:root {
    --navy: #091725;
    --navy-deep: #07131e;
    --navy-mid: #10243a;
    --navy-surface: #172f49;
    --gold: #d2aa64;
    --gold-deep: #b78d46;
    --ivory: #faf8f3;
    --stone: #eeeae2;
    --paper: #faf8f3;
    --ink: #17212d;
    --muted: #5c6976;
    --line: rgba(215, 186, 122, 0.35);
    --good: #1d6a48;
    --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
    --sans: "DM Sans", "Segoe UI", sans-serif;
    --shadow: 0 24px 60px rgba(9, 23, 37, 0.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--ivory);
    font-family: var(--sans);
    font-size: 1.05rem;
    line-height: 1.65;
    overflow-x: clip;
}
img, video, iframe { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.03em; line-height: 1.05; }
h1 { font-size: clamp(2.8rem, 6.2vw, 5.75rem); margin: 0 0 0.8rem; }
h2 { font-size: clamp(2rem, 4vw, 3.6rem); margin: 0 0 0.8rem; }
h3 { font-size: clamp(1.35rem, 2vw, 1.8rem); margin: 0 0 0.4rem; }
p { margin: 0 0 1rem; }
.shell { width: min(1180px, calc(100% - 2.4rem)); max-width: 100%; margin: 0 auto; }
.narrow { width: min(760px, calc(100% - 2.4rem)); max-width: 100%; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--gold); color: var(--navy); padding: 0.5rem 0.8rem; z-index: 9; }
.skip:focus { top: 1rem; }

.site-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(9, 23, 37, 0.92);
    color: white;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, background 0.3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: rgba(9, 23, 37, 0.98); }
.header-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; position: relative; }
.brand-seal { height: 76px; width: auto; display: block; }
.brand-seal-small { height: 58px; }
.site-nav { display: flex; gap: 1.15rem; align-items: center; }
.site-nav a { color: #f6f1e6; text-decoration: none; font-size: 0.95rem; position: relative; }
.site-nav a[aria-current="page"]::after,
.site-nav a:hover::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.4rem; height: 1px; background: var(--gold); }
.nav-signin { border: 1px solid var(--gold) !important; color: var(--gold) !important; border-radius: 999px; padding: 0.5rem 0.9rem; }
.nav-signin::after { display: none !important; }
.nav-check {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.nav-button { display: none; }
.nav-check:focus-visible + .nav-button { outline: 2px solid var(--gold); outline-offset: 3px; }

.eyebrow { color: var(--gold-deep); letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.74rem; margin-bottom: 0.8rem; }
.lede { font-size: clamp(1.15rem, 2vw, 1.35rem); }
.signature { font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.25; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.4rem; }
.button, button.button {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--gold); color: var(--navy); text-decoration: none;
    border: 1px solid var(--gold); border-radius: 999px;
    padding: 0.85rem 1.25rem; font: 600 0.98rem var(--sans); cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.button:hover, button.button:hover { background: #e3c07e; transform: translateY(-1px); }
.button-ghost { background: transparent; color: #f6f1e6; border-color: rgba(210, 170, 100, 0.7); }
.button-ghost:hover { background: rgba(210, 170, 100, 0.12); color: white; }
.button-line { background: transparent; color: var(--navy); border-color: var(--navy); }
.button-line:hover { background: var(--navy); color: var(--ivory); }
.button-light { background: white; color: var(--navy); border-color: white; }
.text-link, .text-button { background: none; border: 0; padding: 0; color: var(--gold-deep); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }

.stage {
    min-height: calc(100vh - 92px);
    display: grid; align-items: center;
    background:
        radial-gradient(900px 420px at 85% 10%, rgba(210, 170, 100, 0.16), transparent 60%),
        linear-gradient(180deg, var(--navy) 0%, var(--navy-mid) 100%);
    color: #f7f2e8;
    padding: 4.5rem 0 0;
    position: relative;
    overflow: hidden;
}
.stage::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: -1px; height: 72px;
    background: var(--ivory);
    border-radius: 48px 48px 0 0;
}
.stage-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; position: relative; z-index: 1; padding: 2rem 0 6.5rem; }
.stage-grid > *, .about-grid > *, .creator > *, .cinema > *, .driver-rail > *, .signin > *, .split > *, .footer-grid > *, .card-row > *, .journey > *, .steps > *, .phase-grid > *, .portrait-frame { min-width: 0; }
.stage p, .stage .signature { color: #f4ecdf; max-width: 38rem; }
.stage .eyebrow { color: var(--gold); }
.portrait-frame { margin: 0; border-radius: 180px 180px 28px 28px; overflow: hidden; background: var(--navy-surface); box-shadow: var(--shadow); }
.portrait-frame img { width: 100%; height: min(68vh, 720px); object-fit: cover; object-position: center 18%; display: block; }

.band { padding: 5.5rem 0; }
.band-ivory { background: var(--ivory); }
.band-stone { background: var(--stone); }
.band-navy { background: var(--navy); color: #f7f2e8; }
.band-navy .eyebrow, .band-navy .signature { color: var(--gold); }
.gold-panel { background: linear-gradient(180deg, #e7c98a, #d2aa64); color: var(--navy); border-radius: 36px; padding: clamp(1.5rem, 3vw, 3rem); }
.gold-panel .eyebrow { color: var(--navy-mid); }

.about-grid, .split, .creator { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 2.5rem; align-items: center; }
.about-grid img, .creator img { width: 100%; border-radius: 28px; object-fit: cover; max-height: 680px; object-position: center 12%; }
.points { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.5rem; }
.points article { border-top: 1px solid rgba(9, 23, 37, 0.2); padding-top: 0.7rem; }

.journey { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; counter-reset: step; }
.journey article, .steps article {
    background: transparent; border-top: 1px solid var(--line); padding: 1.2rem 0.2rem 0.2rem; min-height: 220px;
}
.journey span, .steps span, .driver-card span {
    display: block; font-family: var(--serif); color: var(--gold-deep); font-size: 2rem; margin-bottom: 0.6rem;
}
.band-stone .journey article { border-color: rgba(9, 23, 37, 0.16); }

.driver-rail { display: grid; grid-template-columns: 0.7fr 1.3fr; gap: 2rem; align-items: start; }
.driver-list { display: grid; }
.driver-card {
    display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.4rem 1rem;
    padding: 1.05rem 0; border-bottom: 1px solid rgba(23, 33, 45, 0.12);
    transition: background 0.2s ease, padding 0.2s ease;
}
.driver-card:hover, .driver-card:focus-within { background: rgba(210, 170, 100, 0.12); padding-left: 0.6rem; }
.driver-card h3, .driver-card p { margin: 0; }
.driver-card p { color: var(--muted); }

.resource-rail { display: grid; gap: 0; }
.resource-rail article {
    display: grid; grid-template-columns: 7rem 1fr; gap: 1.5rem; align-items: start;
    padding: 1.6rem 0; border-top: 1px solid rgba(9, 23, 37, 0.12);
}
.resource-rail strong { font-family: var(--serif); font-size: 1.8rem; font-weight: 500; color: var(--gold-deep); }
.access-note { color: var(--muted); max-width: 68ch; }

.cinema { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 2rem; align-items: center; }
.player, .player-pending, .pdf-frame { width: 100%; background: #0b1622; border-radius: 22px; }
.player { aspect-ratio: 16/9; }
.player-pending { min-height: 280px; color: #f7f2e8; display: grid; place-items: center; padding: 2rem; text-align: center; border: 1px solid var(--line); }
.player-pending p { max-width: 42ch; }
.pdf-frame { height: 70vh; border: 0; background: white; }

.quote { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.25; margin: 1.2rem 0; }
.quote footer { margin-top: 0.8rem; font-family: var(--sans); font-size: 0.95rem; letter-spacing: 0.04em; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0; }
.chip-row span { border: 1px solid rgba(210, 170, 100, 0.55); border-radius: 999px; padding: 0.4rem 0.8rem; color: #f7f2e8; }
.outcomes-list { padding-left: 1.1rem; }
.outcomes-list li { margin: 0.45rem 0; }

.site-footer { background: var(--navy-deep); color: #efe7da; padding: 3rem 0 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.1fr auto 1.3fr; gap: 1.5rem; align-items: start; }
.footer-links { display: grid; gap: 0.45rem; }
.footer-links a { color: #efe7da; text-decoration: none; }
.footer-seal { height: 92px; width: auto; }

.page-hero { background: var(--navy); color: #f7f2e8; padding: 5rem 0 3.5rem; }
.page-hero .eyebrow { color: var(--gold); }
.page-hero .lede, .page-hero p { color: #f4ecdf; }
.page-hero h1, .signin-story h1, .auth-card h1, .page-head h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
}
.page-intro { padding: 4.5rem 0 5rem; }
.section { padding: 4.5rem 0; }
.section-muted { background: var(--stone); }
.pull { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.25; margin: 1.4rem 0; }
.auth-card { margin: 0 auto; background: white; border: 1px solid #e4dccf; border-radius: 24px; padding: 2rem 1.6rem; }

.signin { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: calc(100vh - 220px); }
.signin-story { background: var(--navy); color: #f7f2e8; padding: 3.5rem 8vw; display: grid; align-content: center; }
.signin-story .eyebrow, .signin-story .signature { color: var(--gold); }
.signin-panel { display: grid; align-content: center; padding: 3rem 8vw; background: var(--ivory); }
.stack-form { display: grid; gap: 0.45rem; margin-top: 1rem; }
.stack-form input, .stack-form textarea, .stack-form select {
    width: 100%; padding: 0.8rem 0.85rem; border: 1px solid #ddd4c6; border-radius: 12px;
    background: white; font: inherit; font-size: 16px; color: inherit; min-width: 0;
}
.stack-form input[type="checkbox"] { width: 1.05rem; height: 1.05rem; padding: 0; border-radius: 3px; }
.stack-form input:focus, .stack-form textarea:focus, .stack-form select:focus { outline: 2px solid var(--gold); border-color: transparent; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; max-width: 100%; }
.check input { margin-top: 0.35rem; flex: 0 0 auto; }
.check span { min-width: 0; }
.field-error { color: #8d2f2f; margin: 0; }
.banner { background: #e7f3ec; border: 1px solid #b7d7c6; padding: 0.8rem 1rem; border-radius: 12px; }
.banner-error { background: #f8ecec; border-color: #e0b4b4; }
.hp { position: absolute; left: -9999px; }
.auth-card { width: min(560px, calc(100% - 2rem)); }
.qr svg { width: 200px; height: 200px; background: white; }
.secret { font-family: ui-monospace, monospace; letter-spacing: 0.08em; word-break: break-all; }

.academy-body { background: var(--stone); }
.academy-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.academy-side { background: var(--navy); color: #f7f2e8; padding: 1.2rem 1rem 1.4rem; display: flex; flex-direction: column; gap: 1.2rem; position: sticky; top: 0; height: 100vh; }
.brand-invert { display: flex; gap: 0.7rem; align-items: center; color: white; text-decoration: none; }
.brand-invert strong { display: block; font-family: var(--serif); }
.brand-invert small { color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.68rem; }
.side-nav { display: grid; gap: 0.25rem; }
.side-nav a { color: #f7f2e8; text-decoration: none; padding: 0.55rem 0.7rem; border-radius: 10px; }
.side-nav a[aria-current="page"] { background: rgba(210, 170, 100, 0.16); box-shadow: inset 2px 0 var(--gold); }
.side-user { margin-top: auto; }
.side-user p { margin: 0; }
.academy-main { padding: 2rem 1.4rem 3.5rem; }
.page-head { max-width: 70ch; margin-bottom: 1.4rem; }
.progress-panel, .chapter-card, .reading, fieldset, .card-row article {
    background: white; border: 1px solid #e4dccf; border-radius: 18px; padding: 1.1rem 1.15rem;
}
.progress-panel { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; margin-bottom: 1rem; }
.progress-figure { font-family: var(--serif); font-size: 3.2rem; margin: 0; }
.meter { height: 6px; background: var(--stone); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold-deep); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 0.4rem 0 0.4rem 1.3rem; position: relative; }
.check-list li::before { content: ""; width: 0.55rem; height: 0.55rem; border: 1px solid var(--gold-deep); border-radius: 50%; position: absolute; left: 0; top: 0.7rem; }
.check-list li.done::before { background: var(--good); border-color: var(--good); }
.chapter-list, .card-row { display: grid; gap: 0.8rem; }
.card-row { grid-template-columns: 1.1fr 0.9fr; }
.chapter-card { display: block; color: inherit; text-decoration: none; transition: transform 0.2s ease; }
.chapter-card:hover { transform: translateY(-2px); }
.chapter-card span, .chapter-card small { color: var(--gold-deep); }
.chapter-card h2 { font-size: 1.55rem; }
.search-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; margin-bottom: 1rem; }
.search-form input { padding: 0.7rem 0.8rem; border: 1px solid #ddd4c6; border-radius: 12px; font: inherit; }
.reading { max-width: 75ch; }
.reading p { white-space: pre-wrap; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
fieldset { margin: 0 0 1rem; }
legend { font-family: var(--serif); padding: 0 0.3rem; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid #e4dccf; border-radius: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem; border-bottom: 1px solid #eee6da; vertical-align: top; }
.certificate { width: min(760px, calc(100% - 2rem)); margin: 2rem auto; padding: 2.5rem; background: white; border: 1px solid #e4dccf; }
.fine, .muted { color: var(--muted); }
.plain-list { padding-left: 1.1rem; }
.phase-grid, .split-notes, .flagship, .steps, .resource-grid, .driver-grid { display: grid; gap: 1rem; }
.phase-grid, .steps { grid-template-columns: repeat(3, 1fr); }
.steps { grid-template-columns: repeat(4, 1fr); }
.phase-grid article, .resource-grid article, .steps article { background: transparent; border: 0; border-top: 1px solid rgba(23, 33, 45, 0.14); border-radius: 0; padding: 1.15rem 0.15rem 0.2rem; }
.band-stone .steps article, .band-navy .steps article { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
code { font-family: ui-monospace, monospace; font-size: 0.92em; }

@media (max-width: 1024px) {
    .stage-grid, .about-grid, .split, .creator, .cinema, .driver-rail, .signin, .journey, .steps, .card-row, .footer-grid, .progress-panel { grid-template-columns: 1fr; }
    .phase-grid { grid-template-columns: 1fr; }
    .academy-shell { grid-template-columns: 1fr; }
    .academy-side { position: relative; height: auto; }
    .portrait-frame img { height: 62vh; }
}
@media (max-width: 1100px) {
    .points, .driver-card, .resource-rail article { grid-template-columns: 1fr; }
    .nav-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 0.45rem 0.95rem; background: transparent; font: 600 0.92rem var(--sans); cursor: pointer; }
    .signin-story, .signin-panel { padding: 2.2rem 1.25rem; }
    .actions { flex-direction: column; align-items: stretch; }
    .actions .button { width: 100%; }
    .site-nav, .academy-side .side-nav {
        display: flex;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        transition: max-height 0.35s ease, opacity 0.25s ease;
    }
    .site-nav {
        position: absolute; left: 0; right: 0; top: 100%;
        background: var(--navy-deep);
        flex-direction: column; align-items: flex-start;
        padding: 0 1.2rem; gap: 0.85rem;
    }
    .nav-check:checked ~ .site-nav,
    .academy-side .nav-check:checked ~ .side-nav {
        max-height: 28rem;
        opacity: 1;
        pointer-events: auto;
        padding: 1rem 1.2rem 1.2rem;
    }
    .academy-side .side-nav { display: grid; }
    .stage { min-height: auto; padding-top: 2.5rem; }
    .stage::after { height: 36px; border-radius: 24px 24px 0 0; }
    h1 { font-size: clamp(2.7rem, 12vw, 4rem); }
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .button, .chapter-card, .driver-card, .site-header { transition: none; }
}
@media print {
    .site-header, .site-footer, .button, .academy-side { display: none; }
    .certificate { border: 0; }
}
