:root {
    --bg: #f4efe6;
    --bg-soft: #fbf7f0;
    --surface: rgba(255, 251, 245, 0.94);
    --ink: #1f1c18;
    --muted: #6d6255;
    --line: rgba(61, 49, 35, 0.14);
    --card: rgba(255, 252, 247, 0.92);
    --brand: #9f3f24;
    --brand-dark: #6f2510;
    --brand-soft: #f2d7c9;
    --accent: #21493d;
    --shadow: 0 24px 60px rgba(52, 35, 20, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
}

body.page-home {
    background:
        radial-gradient(circle at top left, rgba(159, 63, 36, 0.18), transparent 26%),
        radial-gradient(circle at right 15%, rgba(33, 73, 61, 0.14), transparent 24%),
        linear-gradient(180deg, #f8f3eb 0%, #f1eadf 48%, #ede2d2 100%);
}

body.page-home::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.32;
    background-image:
        linear-gradient(rgba(117, 88, 51, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(117, 88, 51, 0.05) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(circle at center, black 48%, transparent 100%);
}

body.page-template,
body.page-longtail,
body.page-info {
    background:
        radial-gradient(circle at top left, rgba(159, 63, 36, 0.16), transparent 28%),
        linear-gradient(180deg, #f8f3eb 0%, #efe6d8 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 700;
    line-height: 1.05;
}

p {
    margin: 0;
}

.page {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 28px 0 72px;
}

.page.page-narrow,
body.page-template .page,
body.page-longtail .page,
body.page-info .page {
    width: min(1100px, calc(100vw - 32px));
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

body.page-home .nav {
    margin-bottom: 30px;
}

body.page-template .nav,
body.page-longtail .nav,
body.page-info .nav {
    padding: 18px 24px;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

body.page-home .brand {
    font-size: 1.1rem;
}

.brand-badge,
.badge {
    display: grid;
    place-items: center;
    color: #fff9f4;
    background: linear-gradient(145deg, var(--brand), var(--brand-dark));
}

.brand-badge {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.badge {
    width: 42px;
    height: 42px;
    border-radius: 14px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
}

.nav-links a,
.chip,
.button {
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.52);
}

.nav-links a,
.chip {
    border-radius: 999px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover,
button:hover {
    transform: translateY(-1px);
}

.button.primary,
button.primary {
    color: #fff9f4;
    background: linear-gradient(145deg, var(--brand), var(--brand-dark));
    border-color: transparent;
    padding: 14px 20px;
    box-shadow: 0 18px 34px rgba(111, 37, 16, 0.24);
}

.button.secondary,
button.secondary {
    background: linear-gradient(145deg, #eff6f2, #dcebe3);
    color: #17362d;
    border-color: rgba(33, 73, 61, 0.16);
    padding: 14px 20px;
}

.hero,
.section,
.surface,
.hero-card,
.footer-links {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

body.page-home .hero-card,
body.page-home .surface,
body.page-home .footer-links {
    background: var(--card);
    backdrop-filter: blur(18px);
}

body.page-template .hero,
body.page-template .section,
body.page-longtail .hero,
body.page-longtail .section,
body.page-info .hero,
body.page-info .section {
    background: var(--surface);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--brand-dark);
    margin-bottom: 18px;
}

body.page-home .eyebrow {
    padding: 10px 14px;
    background: var(--brand-soft);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

body.page-template .eyebrow,
body.page-longtail .eyebrow,
body.page-info .eyebrow {
    background: rgba(159, 63, 36, 0.1);
}

body.page-home h1 {
    font-size: clamp(2.7rem, 7vw, 5rem);
    letter-spacing: -0.05em;
    max-width: 11ch;
}

body.page-template h1,
body.page-longtail h1,
body.page-info h1 {
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    letter-spacing: -0.05em;
    max-width: 12ch;
}

.hero-copy,
.lead,
.section p,
.footer,
.footer-note {
    color: var(--muted);
    line-height: 1.72;
}

.hero-actions,
.section-actions,
.stats,
.tone-switcher,
.preview-actions,
.export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

button,
select,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

body.page-home .hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 26px;
    align-items: stretch;
    margin-bottom: 28px;
}

body.page-home .hero-card {
    padding: 38px;
    position: relative;
    overflow: hidden;
}

body.page-home .hero-card::after {
    content: "";
    position: absolute;
    inset: auto -50px -70px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(159, 63, 36, 0.18), transparent 66%);
}

body.page-home .hero-copy {
    max-width: 60ch;
    font-size: 1.08rem;
    margin: 18px 0 26px;
}

.stats {
    margin-top: 22px;
}

.stat {
    min-width: 150px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 248, 240, 0.86);
    border: 1px solid rgba(109, 98, 85, 0.12);
}

.stat strong {
    display: block;
    font-size: 1.4rem;
}

.hero-panel {
    padding: 24px;
    display: grid;
    gap: 16px;
}

.mini-letter {
    padding: 22px;
    border-radius: 20px;
    background: linear-gradient(180deg, #fffdfa, #f9f1e7);
    border: 1px solid rgba(111, 37, 16, 0.12);
}

.mini-letter .line {
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(159, 63, 36, 0.15), rgba(33, 73, 61, 0.1));
    margin-bottom: 12px;
}

.mini-letter .line.short {
    width: 42%;
}

.mini-letter .line.medium {
    width: 68%;
}

.mini-letter .line.long {
    width: 100%;
}

.checklist {
    display: grid;
    gap: 12px;
    padding: 0;
    margin: 0;
    list-style: none;
    color: var(--muted);
}

.checklist li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.checklist li::before {
    content: "\2713";
    color: var(--accent);
    font-weight: 700;
}

.workflow {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1.05fr);
    gap: 26px;
    align-items: start;
}

.surface {
    padding: 28px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 20px;
}

.section-head p,
.helper,
.field small,
.template-card p,
.preview-note,
.export-note {
    color: var(--muted);
}

.templates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.template-card {
    position: relative;
    text-align: left;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(248, 241, 233, 0.92));
}

.template-card.active {
    border-color: rgba(159, 63, 36, 0.36);
    box-shadow: inset 0 0 0 1px rgba(159, 63, 36, 0.18);
    background: linear-gradient(180deg, rgba(255, 244, 236, 0.98), rgba(249, 232, 220, 0.95));
}

.template-card span {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(159, 63, 36, 0.09);
    color: var(--brand-dark);
    font-size: 0.84rem;
    margin-bottom: 10px;
}

.template-card h3 {
    margin-bottom: 6px;
    font-size: 1.18rem;
}

.template-link {
    display: inline-flex;
    margin-top: 10px;
    color: var(--brand-dark);
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.form-grid,
.section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-size: 0.95rem;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid rgba(61, 49, 35, 0.15);
    border-radius: 16px;
    background: rgba(255, 252, 247, 0.94);
    padding: 14px 15px;
    color: var(--ink);
    outline: none;
}

textarea {
    min-height: 128px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(159, 63, 36, 0.44);
    box-shadow: 0 0 0 4px rgba(159, 63, 36, 0.08);
}

.preview-shell {
    position: sticky;
    top: 22px;
}

.preview-card {
    padding: 22px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 254, 251, 0.98), rgba(249, 242, 232, 0.98));
    border: 1px solid var(--line);
}

.tone-switcher {
    margin: 18px 0 14px;
}

.tone-switcher button {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 248, 241, 0.96);
    border: 1px solid var(--line);
    color: var(--muted);
}

.tone-switcher button.active {
    background: linear-gradient(145deg, var(--accent), #17362d);
    border-color: transparent;
    color: #f7f7f2;
}

.letter-paper {
    min-height: 540px;
    padding: 28px;
    background: #fffdfa;
    border-radius: 20px;
    border: 1px solid rgba(61, 49, 35, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    line-height: 1.72;
    outline: none;
}

.letter-paper:empty::before {
    content: "Preview surat akan muncul di sini selepas anda klik 'Jana Surat'.";
    color: #988777;
}

.letter-layout {
    display: grid;
    gap: 18px;
}

.letter-top {
    display: grid;
    gap: 14px;
}

.letter-block {
    white-space: pre-line;
}

.letter-divider {
    border: 0;
    border-top: 1px solid rgba(61, 49, 35, 0.28);
    margin: 0;
}

.letter-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.letter-date {
    min-width: 170px;
    text-align: right;
    white-space: nowrap;
}

.letter-body {
    white-space: pre-line;
}

.letter-body p {
    margin: 0 0 14px;
}

.letter-body p:last-child,
.sample p:last-child,
.info-list li:last-child,
.footer-group a:last-child {
    margin-bottom: 0;
}

.letter-numbered {
    margin: 0 0 18px;
    padding-left: 18px;
}

.letter-numbered li {
    margin-bottom: 14px;
    padding-left: 8px;
    text-align: justify;
}

.letter-numbered li:last-child {
    margin-bottom: 0;
}

.preview-note,
.export-note {
    font-size: 0.93rem;
    line-height: 1.55;
}

.export-actions {
    margin-top: 18px;
}

.faq-section {
    margin-top: 28px;
}

.faq-list {
    display: grid;
    gap: 14px;
}

.faq-item,
.card,
.sample,
.related-link {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(248, 241, 233, 0.92));
}

.faq-item {
    padding: 20px 22px;
}

.faq-item h3 {
    margin-bottom: 8px;
    font-size: 1.08rem;
}

.faq-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.footer-links {
    margin-top: 26px;
    padding: 28px;
}

.footer-grid,
.related-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.footer-group h3 {
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.footer-group a {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
}

.success {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(33, 73, 61, 0.1);
    color: var(--accent);
    display: none;
}

.success.show {
    display: block;
}

body.page-template .hero,
body.page-longtail .hero,
body.page-info .hero {
    padding: 34px;
    margin-bottom: 24px;
}

body.page-template .section,
body.page-longtail .section,
body.page-info .section {
    padding: 28px;
    margin-bottom: 20px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 0 0 18px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 251, 245, 0.78);
    color: var(--muted);
    box-shadow: var(--shadow);
}

.breadcrumbs a {
    color: var(--brand-dark);
}

.breadcrumbs .separator {
    opacity: 0.56;
}

.card {
    padding: 20px;
}

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.keyword-list span {
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(33, 73, 61, 0.08);
    color: var(--accent);
    border: 1px solid rgba(33, 73, 61, 0.12);
}

.info-list {
    margin: 16px 0 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.72;
}

.info-list li {
    margin-bottom: 10px;
}

.related-link {
    display: block;
    padding: 18px;
}

.related-link strong {
    display: block;
    margin-bottom: 6px;
}

.related-link span {
    color: var(--muted);
    line-height: 1.6;
}

.sample {
    padding: 20px;
}

.sample h3 {
    margin-bottom: 12px;
}

.sample p {
    margin: 0 0 12px;
}

.footer {
    margin-top: 22px;
    text-align: center;
    font-size: 0.95rem;
}

@media (max-width: 980px) {
    body.page-home .hero,
    .workflow {
        grid-template-columns: 1fr;
    }

    .preview-shell {
        position: static;
    }
}

@media (max-width: 760px) {
    .page,
    .page.page-narrow,
    body.page-template .page,
    body.page-longtail .page,
    body.page-info .page {
        width: min(100vw - 18px, 100%);
        padding-top: 14px;
    }

    .nav {
        flex-direction: column;
        align-items: stretch;
    }

    .section-grid,
    .related-list,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    body.page-template .hero,
    body.page-template .section,
    body.page-longtail .hero,
    body.page-longtail .section,
    body.page-info .hero,
    body.page-info .section {
        padding: 22px;
    }
}

@media (max-width: 720px) {
    .nav-links {
        flex-wrap: wrap;
    }

    body.page-home .hero-card,
    body.page-home .surface,
    body.page-home .hero-panel {
        padding: 22px;
    }

    .templates,
    .form-grid {
        grid-template-columns: 1fr;
    }

    body.page-home h1 {
        font-size: clamp(2.2rem, 12vw, 3.6rem);
    }
}
