
:root {
    --ink: #17212b;
    --ink-soft: #34414c;
    --paper: #f6f1e8;
    --surface: #fffdf9;
    --surface-soft: #eee8dd;
    --line: #ddd5c8;
    --terracotta: #b65c42;
    --terracotta-dark: #8d3f2c;
    --sage: #667b69;
    --sage-soft: #e5ece3;
    --gold: #b8914c;
    --navy: #162433;
    --white: #ffffff;
    --shadow: 0 18px 45px rgba(24, 31, 36, .09);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --serif: Georgia, "Times New Roman", serif;
    --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 88% 7%, rgba(184, 145, 76, .10), transparent 20rem),
        linear-gradient(180deg, #f9f5ee 0%, var(--paper) 100%);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.55;
}

a {
    color: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid rgba(221, 213, 200, .78);
    background: rgba(249, 245, 238, .93);
    backdrop-filter: blur(18px);
}

.header-inner {
    width: min(1180px, calc(100% - 36px));
    min-height: 78px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 34px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--navy);
    color: var(--white);
    font-family: var(--serif);
    font-weight: 700;
    letter-spacing: .02em;
}

.brand-copy strong {
    display: block;
    font-family: var(--serif);
    font-size: 1.05rem;
    letter-spacing: .01em;
}

.brand-copy span {
    display: block;
    color: var(--ink-soft);
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.main-nav a {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: .88rem;
    font-weight: 750;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 5px 18px rgba(24, 31, 36, .06);
}

.progress-chip {
    min-width: 145px;
    text-align: right;
}

.progress-chip strong {
    display: block;
    font-family: var(--serif);
    font-size: 1rem;
}

.progress-chip span {
    color: var(--ink-soft);
    font-size: .78rem;
}

.page-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 46px 0 70px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--terracotta-dark);
    font-size: .76rem;
    font-weight: 850;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
}

h1,
h2,
h3 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -.025em;
}

h1 {
    margin: 16px 0 18px;
    font-size: clamp(2.7rem, 6vw, 5.5rem);
    line-height: .99;
}

h2 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.08;
}

h3 {
    font-size: 1.22rem;
}

.lead {
    max-width: 690px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 1.08rem;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 800;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

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

.button.primary {
    background: var(--terracotta);
    color: var(--white);
    box-shadow: 0 12px 24px rgba(182, 92, 66, .22);
}

.button.primary:hover {
    background: var(--terracotta-dark);
}

.button.secondary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

.button.text {
    min-height: auto;
    padding: 0;
    border-radius: 0;
    color: var(--terracotta-dark);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 36px;
    align-items: end;
    padding: 44px 0 58px;
}

.hero h1 {
    font-size: clamp(1.65rem, 3vw, 2.8rem);
    line-height: 1.08;
}

.hero-card,
.panel {
    border: 1px solid rgba(221, 213, 200, .9);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 249, .92);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 26px;
}

.hero-card .stage-label {
    color: var(--terracotta-dark);
    font-size: .78rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hero-card h2 {
    margin-top: 10px;
}

.hero-card p {
    margin: 12px 0 0;
    color: var(--ink-soft);
}

.progress-track {
    width: 100%;
    height: 8px;
    margin: 22px 0 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-soft);
}

.progress-track span {
    display: block;
    width: 15.6%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--terracotta), var(--gold));
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    color: var(--ink-soft);
    font-size: .78rem;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.stat {
    padding: 24px;
    text-align: center;
}

.stat + .stat {
    border-left: 1px solid var(--line);
}

.stat strong {
    display: block;
    font-family: var(--serif);
    font-size: 2rem;
}

.stat span {
    color: var(--ink-soft);
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.section {
    padding: 62px 0 0;
}

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

.section-heading p {
    max-width: 560px;
    margin: 0;
    color: var(--ink-soft);
}

.journey-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.phase-card {
    min-height: 230px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.phase-card.current {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
    box-shadow: 0 20px 42px rgba(22, 36, 51, .18);
}

.phase-number {
    color: var(--terracotta);
    font-family: var(--serif);
    font-size: 2rem;
}

.phase-card.current .phase-number {
    color: #e7c785;
}

.phase-card p {
    color: var(--ink-soft);
}

.phase-card.current p {
    color: #d9e0e6;
}

.phase-meta {
    margin-top: 28px;
    color: var(--ink-soft);
    font-size: .78rem;
}

.phase-card.current .phase-meta {
    color: #d9e0e6;
}

/* Stage page */
.stage-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 30px;
    align-items: end;
    padding: 36px 0 32px;
}

.stage-hero h1 {
    font-size: clamp(2.6rem, 5vw, 4.6rem);
}

.stage-roadmap-section {
    padding-top: 31px;
}

.stage-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.meta-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 750;
}

.stage-progress {
    min-width: 230px;
    padding: 22px;
    border-radius: var(--radius-md);
    background: var(--navy);
    color: var(--white);
}

.stage-progress strong {
    display: block;
    font-family: var(--serif);
    font-size: 2rem;
}

.stage-progress span {
    color: #d9e0e6;
    font-size: .82rem;
}

.week-stack {
    display: grid;
    gap: 18px;
}

.week-block {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.week-summary {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 22px 24px;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.week-summary:hover {
    background: #fbf8f2;
}

.week-kicker {
    color: var(--terracotta-dark);
    font-size: .75rem;
    font-weight: 850;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.week-summary h2 {
    margin-top: 5px;
    font-size: 1.65rem;
}

.week-summary p {
    margin: 6px 0 0;
    color: var(--ink-soft);
}

.week-state {
    text-align: right;
}

.week-state strong {
    display: block;
    font-family: var(--serif);
    font-size: 1.3rem;
}

.week-state span {
    color: var(--ink-soft);
    font-size: .78rem;
}

.lesson-list {
    display: none;
    border-top: 1px solid var(--line);
}

.week-block.open .lesson-list {
    display: block;
}

.lesson-row {
    display: grid;
    grid-template-columns: 82px 150px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 17px 24px;
}

.lesson-row + .lesson-row {
    border-top: 1px solid #ece5da;
}

.lesson-day {
    font-family: var(--serif);
    font-weight: 700;
}

.lesson-type {
    color: var(--ink-soft);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.lesson-copy strong {
    display: block;
    font-family: var(--serif);
    font-size: 1.03rem;
}

.lesson-copy span {
    color: var(--ink-soft);
    font-size: .88rem;
}

.lesson-open {
    padding: 9px 14px;
    border-radius: 999px;
    background: var(--terracotta);
    color: var(--white);
    font-size: .8rem;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
}

/* Lesson page */
.lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 28px;
}

.lesson-title-block {
    padding: 16px 0 30px;
}

.lesson-title-block h1 {
    max-width: 780px;
    font-size: clamp(2.5rem, 5vw, 4.4rem);
}

.lesson-progress {
    display: flex;
    gap: 6px;
    margin-top: 24px;
}

.lesson-progress span {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: #ded7cb;
}

.lesson-progress span.done {
    background: var(--terracotta);
}

.lesson-section-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.lesson-section {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 20px;
    padding: 24px;
}

.lesson-section + .lesson-section {
    border-top: 1px solid var(--line);
}

.section-number {
    color: var(--terracotta);
    font-family: var(--serif);
    font-size: 1.5rem;
}

.lesson-section h2 {
    font-size: 1.35rem;
}

.lesson-section p {
    margin: 7px 0 0;
    color: var(--ink-soft);
}

.minutes {
    color: var(--ink-soft);
    font-size: .82rem;
    font-weight: 800;
}

.phrase-card {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.phrase-card + .phrase-card {
    margin-top: 16px;
}

.phrase-card .italian {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.65rem;
    line-height: 1.2;
}

.phrase-card .english {
    margin: 8px 0 0;
    color: var(--ink-soft);
}

.pronunciation {
    margin-top: 15px;
    color: var(--sage);
    font-size: .85rem;
    font-weight: 700;
}

.phrase-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.audio-button,
.detail-button {
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
}

.audio-button {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
}

.lesson-sidebar {
    position: sticky;
    top: 104px;
    align-self: start;
    display: grid;
    gap: 16px;
}

.sidebar-card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.sidebar-card h3 {
    margin: 0 0 8px;
}

.sidebar-card p {
    margin: 0;
    color: var(--ink-soft);
    font-size: .9rem;
}

.lesson-footer-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.lesson-footer-nav a {
    font-weight: 800;
    text-decoration: none;
}

.lesson-footer-nav a:last-child {
    text-align: right;
}

.site-footer {
    margin-top: 60px;
    padding: 26px 0 10px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: .78rem;
    text-align: center;
}

.prototype-note {
    margin-top: 28px;
    padding: 16px 18px;
    border: 1px dashed var(--gold);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 249, .76);
    color: var(--ink-soft);
    font-size: .86rem;
}

@media (max-width: 980px) {
    .header-inner {
        grid-template-columns: auto 1fr;
    }

    .progress-chip {
        display: none;
    }

    .hero,
    .lesson-layout {
        grid-template-columns: 1fr;
    }

    .journey-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lesson-sidebar {
        position: static;
    }

    .stage-hero {
        grid-template-columns: 1fr;
    }

    .stage-progress {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .site-header {
        position: static;
    }

    .header-inner {
        min-height: auto;
        padding: 16px 0;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .main-nav {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .page-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 28px;
    }

    .hero {
        padding-top: 18px;
    }

    .stat-strip,
    .journey-grid {
        grid-template-columns: 1fr;
    }

    .stat + .stat {
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .section-heading {
        display: block;
    }

    .section-heading p {
        margin-top: 10px;
    }

    .week-summary {
        grid-template-columns: 1fr;
    }

    .week-state {
        text-align: left;
    }

    .lesson-row {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 18px;
    }

    .lesson-open {
        justify-self: start;
        margin-top: 7px;
    }

    .lesson-section {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .minutes {
        grid-column: 2;
    }

    .lesson-footer-nav {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .lesson-footer-nav a:last-child {
        text-align: left;
    }
}


/* Database-backed premium Lesson integration */
.premium-lesson-page .site-footer {
    width: min(1180px, calc(100% - 36px));
    margin: 60px auto 0;
    padding: 26px 0 10px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: .78rem;
    text-align: center;
}

.premium-lesson-page .site-footer p {
    margin: 3px 0;
}

.phrase-detail {
    position: relative;
}

.phrase-detail summary {
    list-style: none;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
}

.phrase-detail summary::-webkit-details-marker {
    display: none;
}

.phrase-detail[open] {
    flex-basis: 100%;
}

.phrase-detail p {
    margin: 10px 0 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-size: .88rem;
}

.premium-dialogue {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.premium-dialogue-line {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    padding: 20px 24px;
}

.premium-dialogue-line + .premium-dialogue-line {
    border-top: 1px solid var(--line);
}

.premium-speaker {
    color: var(--terracotta-dark);
    font-size: .78rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.premium-dialogue-line strong {
    font-family: var(--serif);
    font-size: 1.1rem;
}

.premium-dialogue-line p {
    margin: 5px 0 0;
    color: var(--ink-soft);
}

.audio-button.compact {
    min-width: 42px;
    padding: 8px 11px;
}

.premium-note-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.premium-note-grid .sidebar-card {
    min-height: 170px;
}

.premium-empty-state {
    max-width: 720px;
}

@media (max-width: 720px) {
    .phrase-actions {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .premium-dialogue-line {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 18px;
    }

    .premium-dialogue-line .audio-button {
        justify-self: start;
    }

    .premium-note-grid {
        grid-template-columns: 1fr;
    }
}


/* V26: Lesson title matches the approved Homepage title size. */
.lesson-title-block h1 {
    font-size: clamp(1.65rem, 3vw, 2.8rem);
    line-height: 1.08;
}


/* V28: prevent long dialogue speaker labels from overlapping the sentence. */
.premium-dialogue-line {
    grid-template-columns: 108px minmax(0, 1fr) auto;
}

.premium-speaker {
    white-space: nowrap;
}

/* Move the speaker label onto its own line on narrower screens. */
@media (max-width: 820px) {
    .premium-dialogue-line {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 14px;
    }

    .premium-dialogue-line .premium-speaker {
        grid-column: 1 / -1;
    }

    .premium-dialogue-line > div {
        grid-column: 1;
        min-width: 0;
    }

    .premium-dialogue-line .audio-button {
        grid-column: 2;
        grid-row: 2;
        align-self: start;
        justify-self: end;
    }
}
