/* ==========================================================================
   What Happens When You Press <enter>
   A talk turned into one long scroll. Purple full-viewport "stages" carry
   the deck's statements, quotes and characters; parchment "chapters" carry
   the story between them. Structure shared with love.avi.nyc, palette and
   type from the deck's Google Slides theme.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Deck theme */
    --purple: #2b003b;
    --purple-2: #3f0057;
    --purple-3: #55107a;
    --purple-rule: rgba(255, 255, 255, 0.14);
    --gold: #ffd745;
    --gold-2: #ffdc5c;
    --gold-dim: #d4b239;
    --red: #ff2e4d;
    --red-2: #ff4560;
    --teal: #0097a7;
    --teal-dark: #007a88;

    /* Light surface */
    --paper: #fbf7ef;
    --panel: #f3ecdd;
    --ink: #2a1436;
    --text: #3b2a44;
    --text-soft: #574a5e;
    --muted: #7a6d80;
    --rule: #e8dfcf;
    --border: #d9cdb8;

    /* Dark surface */
    --on-dark: #fbf7ef;
    --on-dark-soft: #dccfe3;
    --on-dark-muted: #b39fbf;

    /* Type */
    --font-display: 'Lakki Reddy', 'Bricolage Grotesque', Georgia, serif;
    --font-body: 'Roboto Condensed', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'IBM Plex Mono', Menlo, monospace;

    /* Layout */
    --container: 1160px;
    --gutter: 40px;
    --nav-height: 64px;

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 16px); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: 19px;
    line-height: 1.55;
    color: var(--text);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-dark); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--red); }
ul, ol { list-style: none; }
strong { font-weight: 700; color: var(--ink); }
em { font-style: italic; }
::selection { background: var(--gold); color: var(--purple); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: 0;
    color: var(--ink);
}

kbd {
    font-family: var(--font-mono);
    font-size: 0.8em;
    padding: 2px 8px 3px;
    border-radius: 6px;
    border: 1px solid var(--border);
    border-bottom-width: 3px;
    background: #fff;
    color: var(--ink);
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
.kicker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.kicker--ink { color: var(--ink); }
.kicker--gold { color: var(--gold); }
.kicker--on-dark { color: var(--on-dark-muted); }

.lead { font-size: 24px; line-height: 1.45; color: var(--text); }
.measure { max-width: 640px; }
.note { font-size: 16px; color: var(--muted); }
.note strong { color: var(--text-soft); }
.mono { font-family: var(--font-mono); }
.accent { color: var(--red); }

.caption {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--muted);
    line-height: 1.5;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 22px;
    border-radius: 22px;
    background: var(--gold);
    color: var(--purple);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.btn:hover { background: var(--gold-2); color: var(--purple); transform: translateY(-1px); }

/* Screenshots open in the lightbox; plates are art and stay put. */
.shot {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: zoom-in;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.shot:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(42, 20, 54, 0.14); }
.shot--on-dark { border-color: var(--purple-rule); background: transparent; }

.plate { width: 100%; }
.plate--framed { border: 1px solid var(--border); }
.plate--round { border-radius: 6px; }

/* Layout primitives */
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack--tight { gap: 12px; }
.stack--loose { gap: 32px; }
.captioned { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.row > * { min-width: 0; }

.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 48px;
    align-items: start;
}
.split > *, .stack > * { min-width: 0; }
.split--center { align-items: center; }
.split--wide-right { grid-template-columns: 1fr 1.5fr; }
.split--wide-left { grid-template-columns: 1.5fr 1fr; }
.split--ruled {
    padding: 40px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.grid-2x2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.pull-quote {
    font-family: var(--font-body);
    font-size: 30px;
    line-height: 1.2;
    font-weight: 300;
    color: var(--ink);
    text-wrap: pretty;
}
.pull-quote--sm { font-size: 24px; }
.pull-quote strong { font-weight: 700; }

.bullets { display: flex; flex-direction: column; gap: 10px; padding-left: 0; }
.bullets li { position: relative; padding-left: 22px; }
.bullets li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.62em;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--red);
}
.bullets--gold li::before { background: var(--gold); }
.numbered { counter-reset: n; display: flex; flex-direction: column; gap: 12px; }
.numbered li { counter-increment: n; position: relative; padding-left: 40px; }
.numbered li::before {
    content: counter(n) '.';
    position: absolute;
    left: 0; top: 0.15em;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--red);
}

/* Code / HTTP strings */
.code {
    font-family: var(--font-mono);
    font-size: 15px;
    line-height: 1.6;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px 24px;
    color: var(--ink);
    overflow-x: auto;
    tab-size: 2;
}
.code--dark { background: var(--purple); border-color: var(--purple-2); color: var(--on-dark); }
.code--big { font-size: clamp(16px, 2vw, 22px); }
.tok-verb { color: var(--red); font-weight: 500; }
.tok-proto { color: var(--teal-dark); }
.tok-host { color: var(--ink); font-weight: 500; }
.tok-path { color: #a3571a; }
.tok-cmt { color: var(--muted); }
.code--dark .tok-host { color: var(--gold); }
.code--dark .tok-proto { color: #7fdcea; }
.code--dark .tok-path { color: var(--gold-2); }

/* Verb table */
.verbs { width: 100%; border-collapse: collapse; font-size: 17px; }
.verbs th, .verbs td { text-align: left; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.verbs th { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.08em; color: var(--red); width: 130px; font-weight: 500; }
.verbs tr:last-child th, .verbs tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* Two-column mapping (anatomy of a request) */
.mapping { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; font-size: 18px; }
.mapping__col { display: flex; flex-direction: column; }
.mapping__row { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.mapping__row:last-child { border-bottom: none; }
.mapping__n { font-family: var(--font-mono); font-size: 13px; color: var(--red); }
.mapping__k { font-family: var(--font-mono); font-size: 14px; color: var(--teal-dark); min-width: 88px; }

/* Emoji timelines */
.timeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px 24px;
}
.timeline__item { display: flex; flex-direction: column; gap: 10px; }
.timeline__item .shot { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.timeline__label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--ink);
}
.timeline__emoji { font-size: 26px; line-height: 1; }
.timeline__year { color: var(--muted); }
.year-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--ink);
}
.year-badge .timeline__emoji { font-size: 32px; }

/* Logo row */
.logos { display: flex; flex-wrap: wrap; gap: 28px 40px; align-items: center; }
.logos img { height: 44px; width: auto; }

/* Portrait strip */
.strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 900px; }
.strip img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: 4px; filter: grayscale(0.2); }

/* Inline SVG diagrams */
.diagram { width: 100%; height: auto; display: block; overflow: visible; }
.diagram text { font-family: var(--font-mono); font-size: 13px; fill: currentColor; }
.diagram .t-sm { font-size: 11px; }
.diagram .t-lg { font-size: 16px; font-family: var(--font-body); font-weight: 700; }
.diagram .line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.diagram .line--dash { stroke-dasharray: 6 6; }
.diagram .line--accent { stroke: var(--red); }
.diagram .line--gold { stroke: var(--gold); }
.diagram .box { fill: #fff; stroke: currentColor; stroke-width: 2; }
.diagram .box--soft { fill: var(--panel); }
.diagram .box--accent { fill: var(--red); stroke: var(--red); }
.diagram .box--gold { fill: var(--gold); stroke: var(--gold); }
.diagram .on-accent { fill: #fff; }
.diagram .on-gold { fill: var(--purple); }
.diagram .muted { fill: var(--muted); }
.diagram .draw { stroke-dasharray: 600; stroke-dashoffset: 600; transition: stroke-dashoffset 1.2s ease 0.2s; }
.visible .diagram .draw { stroke-dashoffset: 0; }
.stage .diagram .box { fill: var(--purple-2); stroke: var(--on-dark); }
.stage .diagram .box--soft { fill: var(--purple-2); }

/* --------------------------------------------------------------------------
   Navigation
   Light-on-purple over the hero; flips to dark-on-paper once scrolled past.
   -------------------------------------------------------------------------- */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--nav-height);
    background: var(--purple);
    color: var(--on-dark);
    border-bottom: 1px solid var(--purple-rule);
    transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}
.nav--light {
    background: rgba(251, 247, 239, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--ink);
    border-bottom-color: var(--rule);
}

.nav__container {
    height: 100%;
    padding: 0 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.nav__logo { display: flex; align-items: center; gap: 12px; color: inherit; }
.nav__logo:hover { color: var(--gold); }
.nav--light .nav__logo:hover { color: var(--red); }
.enter-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 22px;
    border-radius: 5px;
    border: 1.5px solid currentColor;
    font-size: 14px;
    line-height: 1;
    color: var(--gold);
    flex-shrink: 0;
}
.nav--light .enter-mark { color: var(--red); }
.nav__links { display: flex; align-items: center; gap: 32px; }
.nav__link { position: relative; color: inherit; opacity: 0.85; }
.nav__link::after {
    content: '';
    position: absolute;
    left: 0; bottom: -6px;
    width: 0; height: 1px;
    background: currentColor;
    transition: width var(--transition-base);
}
.nav__link:hover, .nav__link.active { color: inherit; opacity: 1; }
.nav__link:hover::after, .nav__link.active::after { width: 100%; }
.nav__byline { opacity: 0.7; }

.nav__toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: inherit;
}
.nav__toggle span {
    display: block;
    width: 24px; height: 2px;
    background: currentColor;
    transition: transform var(--transition-fast), opacity var(--transition-fast);
}

@media (max-width: 900px) {
    /* backdrop-filter would make the nav the containing block for the
       fixed menu below, collapsing it to the nav's height. */
    .nav--light { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--paper); }
    .nav__container { padding: 0 24px; }
    .nav__byline { display: none; }
    .nav__toggle { display: flex; }
    .nav__links {
        position: fixed;
        top: var(--nav-height); left: 0; right: 0; bottom: 0;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 28px;
        padding: 40px 24px;
        background: var(--purple);
        color: var(--on-dark);
        transform: translateX(100%);
        transition: transform var(--transition-base);
    }
    .nav--light .nav__links { background: var(--paper); color: var(--ink); }
    .nav__links.open { transform: translateX(0); }
    .nav__link { font-size: 18px; }
    .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
}

/* --------------------------------------------------------------------------
   Hero: the title slide
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--nav-height) + 56px) 48px 48px;
    background: var(--purple) url('/svg/swirl.svg') center / cover no-repeat;
    color: var(--on-dark);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 48px;
    overflow: hidden;
    text-align: center;
}

.hero__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 900px;
    animation: fadeInUp 0.8s ease both;
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(40px, 7vw, 96px);
    line-height: 1.02;
    color: var(--gold);
    text-wrap: balance;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.hero__title .mono { font-family: var(--font-mono); font-weight: 500; font-size: 0.78em; letter-spacing: -0.02em; }

.hero__subtitle {
    max-width: 620px;
    font-size: 24px;
    font-weight: 300;
    line-height: 1.4;
    color: var(--gold-2);
}

.hero__art {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}
.hero__wizard { left: 3vw; bottom: 120px; width: clamp(140px, 17vw, 260px); animation: fadeIn 1.2s ease 0.2s both; }
.hero__fairy { right: 4vw; top: calc(var(--nav-height) + 40px); width: clamp(90px, 11vw, 170px); animation: fadeIn 1.2s ease 0.4s both; }

/* The drawn browser window */
.browser {
    width: 100%;
    max-width: 720px;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
    text-align: left;
}
.browser__bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: #ece7f0;
    border-bottom: 1px solid #d9d1e0;
}
.browser__dots { display: flex; gap: 6px; }
.browser__dots i { width: 11px; height: 11px; border-radius: 50%; background: #c8bfd1; }
.browser__dots i:nth-child(1) { background: var(--red); }
.browser__dots i:nth-child(2) { background: var(--gold); }
.browser__dots i:nth-child(3) { background: #3ecf8e; }
.browser__url {
    flex: 1;
    display: flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border-radius: 17px;
    background: #fff;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--ink);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.browser__proto { color: var(--muted); }
.browser__caret { display: inline-block; width: 2px; height: 18px; margin-left: 2px; background: var(--ink); animation: blink 1s steps(1) infinite; }
.browser.is-loaded .browser__caret { display: none; }
.enter-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border-radius: 7px;
    border: 1px solid #c8bfd1;
    border-bottom-width: 3px;
    background: #fff;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink);
    transition: transform 120ms ease, border-bottom-width 120ms ease, background 120ms ease;
}
.enter-key.is-pressed { transform: translateY(2px); border-bottom-width: 1px; background: var(--gold); }
.browser__body { position: relative; aspect-ratio: 16 / 8.5; background: #fff; overflow: hidden; }
.browser__page { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0; transition: opacity 0.8s ease; }
.browser.is-loaded .browser__page { opacity: 1; }
.browser__spinner {
    position: absolute;
    left: 50%; top: 50%;
    width: 28px; height: 28px;
    margin: -14px 0 0 -14px;
    border-radius: 50%;
    border: 3px solid #e6e0ea;
    border-top-color: var(--purple);
    opacity: 0;
    animation: spin 0.9s linear infinite;
}
.browser.is-loading .browser__spinner { opacity: 1; }
.browser__how {
    position: absolute;
    right: 16px; bottom: 12px;
    padding: 2px 14px 0;
    border-radius: 18px;
    background: var(--gold);
    box-shadow: 0 6px 18px rgba(43, 0, 59, 0.25);
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1.3;
    color: var(--purple);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.5s ease 0.6s, transform 0.5s ease 0.6s;
}
.browser.is-loaded .browser__how { opacity: 1; transform: translateY(0); }

.hero__agenda {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: var(--container);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--purple-rule);
    animation: fadeInUp 0.8s ease 0.2s both;
    text-align: left;
}
.agenda {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 22px 24px 18px 0;
    border-right: 1px solid var(--purple-rule);
    color: inherit;
}
.agenda + .agenda { padding-left: 24px; }
.agenda:last-child { border-right: none; padding-right: 0; }
.agenda:hover { color: inherit; }
.agenda:hover .agenda__title { color: var(--gold); }
.agenda__title {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 20px;
    line-height: 1.2;
    color: var(--on-dark);
    transition: color var(--transition-fast);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes twinkle { 0%, 100% { opacity: 0.35; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.1); } }

/* Sparkles: white four-point stars scattered on stages */
.sparkles { position: absolute; inset: 0; z-index: 1; pointer-events: none; color: #fff; }
.sparkle {
    position: absolute;
    width: 18px; height: 18px;
    background: currentColor;
    -webkit-mask: url('/svg/star.svg') center / contain no-repeat;
    mask: url('/svg/star.svg') center / contain no-repeat;
    animation: twinkle 3.2s ease-in-out infinite;
}
.sparkle--sm { width: 11px; height: 11px; }
.sparkle--lg { width: 26px; height: 26px; }
.sparkle--gold { color: var(--gold); }
.sparkle:nth-child(2n) { animation-delay: 0.8s; }
.sparkle:nth-child(3n) { animation-delay: 1.6s; animation-duration: 4s; }
.sparkle:nth-child(5n) { animation-delay: 2.3s; }

@media (max-width: 900px) {
    .hero { padding: calc(var(--nav-height) + 32px) 24px 32px; gap: 32px; }
    .hero__subtitle { font-size: 20px; }
    .hero__wizard { left: -16px; bottom: 8px; width: 120px; opacity: 0.55; }
    .hero__fairy { right: -6px; top: calc(var(--nav-height) + 4px); width: 64px; opacity: 0.9; }
    .hero__title { padding: 0 8px; }
    .hero__agenda { grid-template-columns: 1fr; }
    .agenda { border-right: none; border-bottom: 1px solid var(--purple-rule); padding: 16px 0; }
    .agenda + .agenda { padding-left: 0; }
    .agenda:last-child { border-bottom: none; }
    .agenda__title { font-size: 18px; }
    .browser__url { font-size: 13px; }
    .enter-key span { display: none; }
}

/* --------------------------------------------------------------------------
   Stages: the slides
   -------------------------------------------------------------------------- */
.stage {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    padding: 96px var(--gutter);
    background: var(--purple) url('/svg/swirl.svg') center / cover no-repeat;
    color: var(--on-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow: hidden;
}
.stage--short { min-height: 70vh; min-height: 70svh; }
.stage--tall { min-height: 100vh; min-height: 100svh; }
.stage--flat { background-image: none; }
.stage--gold { background: var(--gold); color: var(--purple); }
.stage--paper { background: var(--panel); color: var(--ink); }
.stage--image { padding: 0; background-image: none; }

.stage__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    max-width: 980px;
}
.stage__inner--tight { gap: 20px; }
.stage__inner--wide { max-width: var(--container); width: 100%; gap: 64px; }
.stage__inner--left { align-items: flex-start; text-align: left; }
.stage__inner--pad { margin-right: auto; max-width: 720px; padding: 96px 120px; }
.stage__inner--right {
    align-items: flex-end;
    text-align: right;
    margin-left: auto;
    max-width: 760px;
    padding: 96px 120px;
}

.stage__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(36px, 5vw, 68px);
    line-height: 1.08;
    color: var(--gold);
    text-wrap: balance;
}
.stage__title--md { font-size: clamp(32px, 4.2vw, 56px); }
.stage__title--sm { font-size: clamp(28px, 3.6vw, 46px); }
.stage__title--white { color: var(--on-dark); font-family: var(--font-body); font-weight: 700; letter-spacing: -0.01em; }
.stage__title--mono {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: -0.02em;
    font-size: clamp(36px, 6vw, 88px);
    color: var(--gold);
}
.stage--gold .stage__title, .stage--gold .stage__lead { color: var(--purple); }
.stage--paper .stage__title { color: var(--ink); }

.stage__lead {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 26px;
    line-height: 1.4;
    color: var(--on-dark-soft);
    max-width: 640px;
    text-wrap: pretty;
}
.stage__lead strong, .stage__lead em { color: var(--on-dark); }
.stage__lead--gold { color: var(--gold-2); }

.stage__quote {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 36px;
    line-height: 1.3;
    color: var(--on-dark);
    max-width: 900px;
    text-wrap: pretty;
}
.stage__quote--sm { font-size: clamp(20px, 2.1vw, 28px); }
.stage__quote strong { color: var(--gold); font-weight: 700; }
.stage__cite {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--on-dark-muted);
}
.stage--gold .stage__cite { color: var(--purple-3); }

.stage__art { position: relative; z-index: 2; width: clamp(120px, 18vw, 220px); will-change: transform; }
.stage__art--side {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}
.stage__art--key { right: 8vw; top: 50%; width: clamp(140px, 20vw, 300px); transform: translateY(-50%); }
.stage__art--dragon { left: 6vw; top: 50%; width: clamp(160px, 24vw, 340px); transform: translateY(-50%); }
.stage__art--wand { width: clamp(90px, 10vw, 150px); }
.stage__art--hourglass { width: clamp(110px, 12vw, 180px); }

.stage__figure { width: 520px; max-width: 100%; }
.stage__figure--sm { width: 320px; }
.stage__figure img { width: 100%; border-radius: 6px; }
.stage__figure--framed img { border: 1px solid var(--purple-rule); }

.stage__bg {
    position: absolute;
    left: 0;
    top: -12%;
    width: 100%;
    height: 124%;
    object-fit: cover;
    opacity: 0.55;
    will-change: transform;
}
.stage__bg--bright { opacity: 0.85; }
.stage__bg--dim { opacity: 0.4; }

.stage__scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(43, 0, 59, 0.35), rgba(43, 0, 59, 0.8));
}
.stage__scrim--side { background: linear-gradient(90deg, rgba(43, 0, 59, 0.92) 40%, rgba(43, 0, 59, 0.3)); }
.stage__scrim--light { background: linear-gradient(180deg, rgba(43, 0, 59, 0.2), rgba(43, 0, 59, 0.55)); }

/* Binary progression */
.binary { display: flex; flex-direction: column; gap: 14px; align-items: center; font-family: var(--font-mono); }
.binary__line { font-size: clamp(18px, 2.4vw, 30px); color: var(--on-dark); }
.binary__line--code { color: var(--gold); letter-spacing: 0.06em; font-size: clamp(14px, 2vw, 24px); word-break: break-all; }
.binary__arrow { color: var(--on-dark-muted); font-size: 20px; }
.binary .reveal:nth-child(2) { transition-delay: 0.25s; }
.binary .reveal:nth-child(3) { transition-delay: 0.5s; }
.binary .reveal:nth-child(4) { transition-delay: 0.75s; }
.binary .reveal:nth-child(5) { transition-delay: 1s; }

/* Big statement stage with a side plate (Tesla) */
.stage__pair { display: grid; grid-template-columns: 260px 1fr; gap: 56px; align-items: center; text-align: left; max-width: 1040px; }
.stage__pair .plate { border-radius: 4px; }

@media (max-width: 900px) {
    .stage { padding: 72px 24px; }
    .stage--image { padding: 0; }
    .stage__inner--right, .stage__inner--pad { padding: 72px 24px; margin-left: 0; align-items: flex-start; text-align: left; }
    .stage__scrim--side { background: linear-gradient(180deg, rgba(43, 0, 59, 0.35), rgba(43, 0, 59, 0.92)); }
    .stage__quote { font-size: 26px; }
    .stage__lead { font-size: 21px; }
    .stage__art--side { opacity: 0.35; }
    .stage__art--key { right: -30px; width: 200px; }
    .stage__art--dragon { left: -60px; width: 240px; }
    .stage__pair { grid-template-columns: 1fr; gap: 28px; text-align: center; }
    .stage__pair .plate { width: 180px; margin: 0 auto; }
    .strip { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
}

/* --------------------------------------------------------------------------
   Chapters: the parchment narrative
   -------------------------------------------------------------------------- */
.chapter { padding: 120px var(--gutter); background: var(--paper); }
.chapter--panel { background: var(--panel); }
.chapter--quiet { padding: 96px var(--gutter); }

.chapter__container {
    max-width: var(--container);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 32px;
    border-top: 1px solid var(--ink);
    padding-top: 28px;
}
.chapter__container--open { border-top: none; padding-top: 0; }
.chapter__aside { grid-column: span 3; display: flex; flex-direction: column; gap: 12px; }
.chapter__date { font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--red); }
.chapter__body {
    grid-column: span 9;
    display: flex;
    flex-direction: column;
    gap: 56px;
}
.chapter__header { display: flex; flex-direction: column; gap: 20px; }
.chapter__title {
    font-size: clamp(34px, 4.2vw, 52px);
    line-height: 1.08;
    text-wrap: balance;
    color: var(--ink);
}
.chapter__title--xl { font-size: clamp(40px, 5vw, 60px); }
.chapter__title--sans { font-family: var(--font-body); font-weight: 700; letter-spacing: -0.01em; }
.prose { display: flex; flex-direction: column; gap: 18px; }
.prose p { text-wrap: pretty; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1024px) {
    .chapter__container { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .chapter__aside, .chapter__body { grid-column: auto; }
    .chapter__aside { flex-direction: row; align-items: baseline; gap: 16px; flex-wrap: wrap; }
}

@media (max-width: 768px) {
    body { font-size: 18px; }
    :root { --gutter: 24px; }
    .chapter { padding: 80px var(--gutter); }
    .chapter--quiet { padding: 64px var(--gutter); }
    .chapter__body { gap: 40px; }
    .lead { font-size: 21px; }
    .split, .split--wide-right, .split--wide-left, .mapping { grid-template-columns: 1fr; gap: 28px; }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
    .pull-quote { font-size: 26px; }
    .pull-quote--sm { font-size: 21px; }
    .code { font-size: 14px; padding: 16px; }
    .verbs { font-size: 16px; }
    .verbs th { width: 100px; }
    .logos img { height: 34px; }
}

@media (max-width: 480px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .timeline__emoji { font-size: 22px; }
    .timeline__label { font-size: 12px; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer { border-top: 1px solid var(--rule); padding: 0 48px; background: var(--paper); }
.footer__container {
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.footer__content { display: flex; align-items: center; gap: 24px; }
.footer__logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
}
.footer__logo .enter-mark { color: var(--red); }
.footer__text { font-size: 16px; color: var(--muted); }
.footer__meta { display: flex; align-items: center; gap: 24px; font-size: 16px; }

@media (max-width: 640px) {
    .footer { padding: 0 24px; }
    .footer__container { height: auto; padding: 24px 0; flex-direction: column; align-items: flex-start; gap: 12px; }
    .footer__content { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(43, 0, 59, 0.96);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox.active { opacity: 1; visibility: visible; }

.lightbox__content {
    max-width: 92vw;
    max-height: 86vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox__image {
    max-width: 100%;
    max-height: 86vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    transition: transform 0.3s ease;
}
.lightbox.active .lightbox__image { transform: scale(1); }

.lightbox__close, .lightbox__prev, .lightbox__next {
    position: absolute;
    width: 48px; height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    color: var(--on-dark);
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}
.lightbox__close { top: 20px; right: 20px; font-size: 30px; line-height: 1; }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); font-size: 26px; }
.lightbox__prev { left: 20px; }
.lightbox__next { right: 20px; }
.lightbox__close:hover { background: rgba(255, 255, 255, 0.18); transform: scale(1.06); }
.lightbox__prev:hover, .lightbox__next:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-50%) scale(1.06); }
.lightbox__prev:disabled, .lightbox__next:disabled { opacity: 0.3; cursor: not-allowed; }
.lightbox__prev:disabled:hover, .lightbox__next:disabled:hover { transform: translateY(-50%); background: rgba(255, 255, 255, 0.08); }

.lightbox__caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--on-dark-soft);
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
}
