/* ==========================================================================
   The Legend Show — dark, high-contrast portfolio.
   A dense scrolling page with a fixed card rail as its section nav.
   Default CSS renders everything fully visible and the rail legible —
   animations.js only adds motion on top, so no-JS and reduced-motion
   visitors get the complete, navigable page.
   ========================================================================== */

:root {
    /* ground — near-black, not navy. Contrast is the whole point. */
    --bg:        #08080A;
    --surf-1:    #0F0F14;
    --surf-2:    #16161D;
    --line:      rgba(255, 255, 255, 0.09);
    --line-2:    rgba(255, 255, 255, 0.18);
    /* ink */
    --text:      #F4F4F6;
    --text-2:    #9A9AA6;
    --text-3:    #6A6A76;
    /* accents */
    --gold:      #FBBF24;
    --gold-deep: #B4830B;
    --crimson:   #F43F5E;
    --crimson-deep: #9F1239;
    --back-red:  #C31432;   /* bicycle back panel */
    --card-face: #FAF7F0;
    /* The gold card's stock — the Joker, the odd card in the hand.
       Tuned AWAY from the obvious #C9982F/#A97C12 kind of "gold": those sit
       at low saturation with green in them and read as mud, which is exactly
       what the first pass looked like. Metal is bright, orange-biased amber
       with hard specular banding, so these stay close to the site's own
       --gold (#FBBF24) and the depth comes from the gradient, not from
       darkening the base. */
    --card-gold:   #FBD35E;
    --card-gold-2: #E8A80F;
    --gold-ink:    #4A3202;   /* engraving on foil: 4.5:1 on the lightest band */
    --back-line:   var(--card-face);   /* the card back's filigree; see below */
    --ink:       #14141A;
    --ink-soft:  #55555F;
    --crimson-ink: #B91C1C; /* red that passes 4.5:1 on the light card face */
    /* type */
    --font-display: 'Abril Fatface', Georgia, serif;
    --font-hud: 'Chakra Petch', 'Courier New', monospace;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* rhythm */
    --wrap: 1180px;
    /* The side gutter, reserved either side of the content at >=1280px. ONE
       value for both modes on purpose — the rail lives in it in the show and
       the index lives in it in plain, and the moment the two reserve different
       widths the whole page shifts and reflows on every pull. */
    --rail-w: clamp(212px, 16vw, 288px);
    --rail-card: clamp(126px, 11.5vw, 178px);
    --gut: clamp(1.25rem, 4vw, 3rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    touch-action: manipulation;
    -webkit-font-smoothing: antialiased;
}

/* Film grain — kills gradient banding, adds texture.
   It deliberately does NOT use mix-blend-mode. A full-viewport blended layer
   sitting on top of everything has to re-blend the whole screen every frame
   that anything under it moves — and under it are 30 falling cards, the dust
   and the whole scrolling page, so it turned every scroll into a full-viewport
   composite and made the show version stutter. Plain alpha composites once. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.035;
}

/* The UA rule for [hidden] is display:none at the lowest specificity, so any
   component rule that sets `display` silently defeats it. Card faces stay
   hidden via the attribute until they are turned over, so make it
   authoritative or they leak through before the flip. */
[hidden] { display: none !important; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--gold); color: var(--bg); }

.skip-link {
    position: fixed;
    top: -100px; left: 12px;
    z-index: 1200;
    padding: 12px 18px;
    background: var(--gold);
    color: var(--bg);
    font-family: var(--font-hud);
    font-weight: 700;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding-inline: var(--gut);
}

.suit-icon { width: 1em; height: 1em; fill: currentColor; flex: none; }
.suit-icon.crimson { color: var(--crimson); }

/* ================= scroll progress ================= */

#progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--crimson), var(--gold));
    transform: scaleX(0);
    transform-origin: left;
    z-index: 1100;
    pointer-events: none;
}

/* ================= dust ================= */

#dust {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.4;
}
#dust::before, #dust::after {
    content: '';
    position: absolute;
    inset: -20% 0;
    background-repeat: repeat;
    background-image:
        radial-gradient(1.6px 1.6px at 12% 18%, rgba(251, 191, 36, 0.5), transparent),
        radial-gradient(1.2px 1.2px at 68% 42%, rgba(255, 255, 255, 0.4), transparent),
        radial-gradient(1.8px 1.8px at 34% 71%, rgba(251, 191, 36, 0.34), transparent),
        radial-gradient(1.1px 1.1px at 87% 12%, rgba(255, 255, 255, 0.45), transparent),
        radial-gradient(1.5px 1.5px at 52% 88%, rgba(251, 191, 36, 0.3), transparent);
    background-size: 340px 340px;
    animation: dust-a 34s linear infinite;
}
#dust::after { background-size: 520px 520px; opacity: 0.6; animation: dust-b 58s linear infinite; }
@keyframes dust-a { from { transform: translate3d(0,0,0); } to { transform: translate3d(-60px,-340px,0); } }
@keyframes dust-b { from { transform: translate3d(0,0,0); } to { transform: translate3d(90px,-520px,0); } }

/* ================= nav ================= */

#nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.85rem var(--gut);
    background: rgba(8, 8, 10, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, background 0.3s;
}
#nav.stuck { border-bottom-color: var(--line); }

.nav-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--text);
}
.nav-mark .suit-icon { font-size: 0.72em; }

.nav-links {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}
.nav-links a {
    position: relative;
    font-family: var(--font-hud);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-2);
    text-decoration: none;
    padding: 0.75em 0.9em;
    transition: color 0.22s;
}
.nav-links a::after {
    content: '';
    position: absolute;
    left: 0.9em; right: 0.9em; bottom: 0.5em;
    height: 1px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }
.nav-links a:hover::after, .nav-links a:focus-visible::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-links a.active { color: var(--gold); }

.nav-cta {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--bg);
    background: var(--gold);
    padding: 0.85em 1.3em;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    transition: background 0.22s, transform 0.14s;
}
.nav-cta:hover { background: #FFD35C; }
.nav-cta:active { transform: scale(0.97); }

/* Below the rail's breakpoint the text links ARE the section nav, so they
   must survive all the way down to the smallest screen — they used to be
   hidden under 860px, which combined with the rail taking over above 1100px
   left phones with no way to reach a section at all. Let them scroll instead. */
@media (max-width: 1279px) {
    .nav-links {
        min-width: 0;              /* required for a flex child to shrink */
        overflow-x: auto;
        scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
}
@media (max-width: 640px) {
    #nav { gap: 0.6rem; padding-inline: 1rem; }
    .nav-mark { font-size: 1rem; }
    .nav-links a { font-size: 0.62rem; padding: 0.75em 0.5em; letter-spacing: 0.1em; }
    .nav-cta { font-size: 0.62rem; padding: 0.8em 0.9em; letter-spacing: 0.1em; }
}


/* ---- letter-roll hover -------------------------------------------------
   Built by script.js. Each character sits twice in a 1em-tall clipped box;
   hover rolls the pair up so the twin lands in place, staggered per letter. */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.roll { display: inline-flex; }
.roll-i {
    display: block;
    overflow: hidden;
    height: 1em;
    line-height: 1em;
}
.roll-i span {
    display: block;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn:hover .roll-i span,
.btn:focus-visible .roll-i span,
.nav-links a:hover .roll-i span,
.nav-links a:focus-visible .roll-i span { transform: translateY(-100%); }

@media (prefers-reduced-motion: reduce) {
    /* identical glyphs, so snapping is invisible — just don't animate */
    .roll-i span { transition: none; }
}

/* ================= buttons ================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-hud);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--line-2);
    padding: 0.95em 1.5em;
    min-height: 44px;
    clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
    transition: background 0.22s, color 0.22s, border-color 0.22s, transform 0.14s;
}
.btn:hover, .btn:focus-visible { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn-solid { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.btn-solid:hover, .btn-solid:focus-visible { background: #FFD35C; color: var(--bg); border-color: #FFD35C; }
.arrow { display: inline-block; transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
.btn:hover .arrow, .btn:focus-visible .arrow { transform: translate(3px, -3px); }


/* ==========================================================================
   THE CORD + THE TURNOVER
   The cord swaps the site between the show and a plain, professional version.
   It is a real <button> so it works from the keyboard; dragging is layered on.
   The transition is a ribbon spread of cards flourishing across the screen —
   his own move, rather than the obvious stage curtain.
   ========================================================================== */

#cord[hidden] { display: none; }
#cord {
    position: fixed;
    top: 0;
    right: clamp(10px, 3vw, 60px);
    z-index: 1150;
    width: 200px;
    height: 360px;
    padding: 0;
    border: 0;
    background: none;
    /* the button spans the rope's whole swing, most of which is empty — only
       the rope's own hit-path and the tassel take pointer events */
    pointer-events: none;
    cursor: grab;
    touch-action: none;
}
#cord:active { cursor: grabbing; }
@media (max-width: 1279px) { #cord { top: var(--nav-h, 58px); } }

/* the bracket it hangs from. The rope is drawn from this exact point, so the
   two can never separate however far the cord is pulled. */
.cord-mount {
    position: absolute;
    top: 0;
    left: 100px;
    margin-left: -15px;
    width: 30px;
    height: 9px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(180deg, #6B4C06, var(--gold-deep) 55%, #4A3304);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(255, 226, 150, 0.35);
    pointer-events: none;
}

.cord-draw {
    position: absolute;
    inset: 0;
    width: 200px;
    height: 360px;
    overflow: visible;
    pointer-events: none;
}
/* a generous invisible stroke so the thin rope is still easy to grab */
.cord-hit   { fill: none; stroke: transparent; stroke-width: 30; pointer-events: stroke; }
.cord-back  { fill: none; stroke: #3A2703; stroke-width: 7; stroke-linecap: round; }
/* the dashes read as the twist of a braided cord */
.cord-front { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round;
              stroke-dasharray: 2.5 4.5; }

.cord-tassel {
    position: absolute;
    top: 0; left: 0;
    width: 32px;
    margin-left: -16px;
    transform-origin: 50% 0;
    pointer-events: auto;
    will-change: transform;
}
.tassel-cap {
    display: block;
    height: 18px;
    border-radius: 5px 5px 3px 3px;
    background: linear-gradient(180deg, #FFE9A8, var(--gold) 40%, #7A5606);
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.55);
}
.tassel-skirt {
    display: block;
    height: 38px;
    margin-top: 1px;
    background: repeating-linear-gradient(90deg,
        rgba(251, 191, 36, 0.95) 0 1.5px,
        rgba(120, 84, 8, 0.9) 1.5px 3px);
    clip-path: polygon(6% 0, 94% 0, 78% 100%, 22% 100%);
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}
#cord:hover .tassel-cap,
#cord:focus-visible .tassel-cap {
    box-shadow: inset 0 -2px 3px rgba(0,0,0,0.4), 0 0 14px rgba(251,191,36,0.7);
}

#cord::after {
    content: 'pull';
    position: absolute;
    top: 150px;
    right: 100%;
    margin-right: 4px;
    font-family: var(--font-hud);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    transition: letter-spacing 0.3s, color 0.3s;
    pointer-events: none;
}
#cord:hover::after, #cord:focus-visible::after { letter-spacing: 0.36em; color: #FFD97A; }
body.plain #cord::after { color: var(--text-2); text-shadow: none; }
body.plain #cord:hover::after { color: var(--text); }

/* ---- the swap: the deck SLICES the screen open --------------------------
   Animated with the View Transitions API, which snapshots the old and new
   views so they can be tweened; a bare class change repaints in one frame.

   The cut is the card. The packet crosses the entire viewport on every swap,
   and the new state is revealed along the line it travels — so the deck reads
   as slicing the page open with the new dimension rippling out behind it.

   Three layers move against each other rather than one uniform motion:
     · the NEW view is uncovered by a raked blade sweeping along the deck's
       own path, feathered wide so the cut is an edge of light, not a line
     · it arrives sheared, and the shear relaxes out — the ripple
     · the OLD view is pushed aside ahead of the blade, blurring and
       desaturating as it goes
   Everything that aims or times it (`--slice-*`, and the per-region `--w-*`)
   is written by script.js from the flight animations.js publishes, so the cut
   genuinely tracks the cards. The fallbacks here are a plain leftward sweep,
   which is what a no-JS or no-GSAP page gets.

   `--reveal` is a registered custom property; without @property a percentage
   inside mask-image cannot be interpolated and the mask would jump. */
@property --reveal {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 0%;
}
/* half the height of the seam, measured from the middle line the cards travel
   on. Registered for the same reason as --reveal: a raw custom property
   cannot be interpolated inside a gradient stop. */
@property --split {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 0%;
}

::view-transition-image-pair(root) { isolation: auto; }
::view-transition-old(root),
::view-transition-new(root) { mix-blend-mode: normal; animation: none; }

::view-transition-old(root) {
    z-index: 1;
    animation: swap-old var(--slice-dur, 1.05s) var(--slice-ease, ease-out) both;
}
::view-transition-new(root) {
    z-index: 2;
    /* 284deg runs the gradient right→left (the deck arriving), 104deg
       left→right (the deck leaving); the 14° off square is the angle the
       packet is tipped at as it travels, so the cut lies along the cards
       rather than being a ruled line they happen to cross. */
    /* TWO masks, intersected — the cut and the opening.

       `--reveal` is the CUT ITSELF: the middle of the feather, not its front
       edge, with the band hung around it (opaque 9% behind, gone 11% ahead) so
       the line the eye reads sits exactly where the deck is, instead of the
       cards trailing a hard edge that has already run off the screen.

       `--split` is how far the seam has opened above and below the middle
       line the cards travel on. Intersecting the two is what makes the deck
       score a hairline across the page and the new state then spread out of
       it, rather than the whole height arriving at once behind the blade: for
       the first beat only a thin strip is let through, however far the cut has
       travelled. Both layers are needed because a single gradient can only
       have one axis. */
    --reveal: 0%;
    --split: 2%;
    mask-image:
        linear-gradient(var(--slice-dir, 284deg),
            #000 calc(var(--reveal) - 9%),
            rgba(0, 0, 0, 0.5) var(--reveal),
            transparent calc(var(--reveal) + 11%)),
        linear-gradient(to bottom,
            transparent calc(50% - var(--split) - 7%),
            #000 calc(50% - var(--split)),
            #000 calc(50% + var(--split)),
            transparent calc(50% + var(--split) + 7%));
    -webkit-mask-image:
        linear-gradient(var(--slice-dir, 284deg),
            #000 calc(var(--reveal) - 9%),
            rgba(0, 0, 0, 0.5) var(--reveal),
            transparent calc(var(--reveal) + 11%)),
        linear-gradient(to bottom,
            transparent calc(50% - var(--split) - 7%),
            #000 calc(50% - var(--split)),
            #000 calc(50% + var(--split)),
            transparent calc(50% + var(--split) + 7%));
    /* the two layers INTERSECT rather than stacking. Standard spelling only:
       Chrome aliases `-webkit-mask-composite` onto this same property, so a
       legacy `source-in` alongside it is simply dropped as an invalid value
       and reads back as a duplicate. Safari has supported the standard
       property since well before the View Transitions this rule lives in. */
    mask-composite: intersect;
    /* linear at the element, because the easing is declared PER KEYFRAME
       below — the cut has to be eased exactly like the deck's tween and then
       stop being eased for the mop-up. */
    animation: swap-new var(--slice-dur, 1.05s) linear both;
}

/* The cut crosses on the deck's own easing (`--slice-ease` is the CSS twin of
   the tween carrying the cards) and lands at the far edge at 92% — then the
   last 8% is a linear run-out to 118%, dragging the feather off the screen.
   Without that tail the trailing 11% of the band never resolves and the far
   strip of the page finishes the transition visibly half-uncovered.

   The seam is held at a hairline until 28% — the deck is still drawing it —
   and only then opens to 62% of the height either side. **`aimWave()` inverts
   these three numbers to time every region**, so 28% / 2% / 62% here and
   SPLIT_HOLD / SPLIT_MIN / SPLIT_MAX in script.js are one set of constants
   living in two files; change them together or the page stops turning over
   with the opening.

   The easing is declared PER KEYFRAME rather than on the element, so each of
   the two properties can run on its own curve over its own stretch of the
   timeline: `--reveal` eased across 0→92%, `--split` flat to 28% and eased
   from there, and the linear tails left to the element. */
@keyframes swap-new {
    from {
        --reveal: 0%;
        --split: 2%;
        animation-timing-function: var(--slice-ease, ease-out);
        /* the 1.03 is not decoration: the sheet arrives offset and sheared, and
           without the overhang its trailing edge exposes a bare strip at the
           side of the screen that neither sheet covers */
        transform: translateX(calc(var(--slice-push, -34px) * -1))
                   skewX(var(--slice-skew, 1.4deg)) scale(1.03);
        filter: brightness(1.35);
    }
    /* the seam stays a hairline while the deck is still scoring it */
    28%  { --split: 2%; animation-timing-function: var(--slice-ease, ease-out); }
    55%  { filter: brightness(1.05); }
    92%  { --reveal: 100%; }
    to   {
        --reveal: 118%;
        --split: 62%;
        transform: translateX(0) skewX(0deg) scale(1);
        filter: brightness(1);
    }
}
/* forced APART from the middle line as the seam opens — scaleY, not a sink,
   so the old page reads as being pushed aside by the split rather than fading
   underneath it. The sideways component is the blade's, kept small so the
   dominant motion is up and down. */
@keyframes swap-old {
    from { transform: translateX(0) scaleY(1) skewX(0deg);
           filter: blur(0) saturate(1); }
    to   { transform: translateX(calc(var(--slice-push, -34px) * 0.45)) scaleY(1.09)
                      skewX(calc(var(--slice-skew, 1.4deg) * -1));
           filter: blur(9px) saturate(0.3); }
}

/* ---- leaving for plain: the change spreads from the cord ----------------
   The slice above is the ARRIVAL only. Going the other way the run just slips
   off the near edge — there is no deck crossing the screen to follow, and a
   blade with nothing riding it is a bare wipe pointing at nothing — so the
   change starts at the cord, where the hand actually is. This is the original
   transition, kept intact: a soft radial mask growing from the tassel's own
   position (`--swap-x/--swap-y`, written by `aimCord()` from its real rect)
   while the old view sinks, blurs and desaturates beneath it.

   script.js puts `.vt-cord` on the root before starting the transition, since
   that is when the pseudo-elements are matched. */
:root.vt-cord::view-transition-old(root) {
    animation: bloom-old 1.05s cubic-bezier(0.4, 0, 0.2, 1) both;
}
:root.vt-cord::view-transition-new(root) {
    --reveal: 0%;
    mask-image: radial-gradient(circle at var(--swap-x, 88%) var(--swap-y, 8%),
        #000 var(--reveal),
        rgba(0, 0, 0, 0.55) calc(var(--reveal) + 5%),
        transparent calc(var(--reveal) + 13%));
    -webkit-mask-image: radial-gradient(circle at var(--swap-x, 88%) var(--swap-y, 8%),
        #000 var(--reveal),
        rgba(0, 0, 0, 0.55) calc(var(--reveal) + 5%),
        transparent calc(var(--reveal) + 13%));
    /* MUST be reset. The slice above intersects two mask layers; with the
       single layer here, `intersect` composites against an empty destination
       and masks the new view out completely — a blank screen for the whole
       transition. */
    mask-composite: add;
    animation: bloom-new 1.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes bloom-new {
    from { --reveal: 0%;   transform: scale(1.05) rotate(0.8deg);  filter: brightness(1.3); }
    55%  {                                                          filter: brightness(1.06); }
    to   { --reveal: 155%; transform: scale(1)    rotate(0deg);    filter: brightness(1); }
}
/* counter-rotates the other way, so the two sheets shear against each other */
@keyframes bloom-old {
    from { transform: scale(1)    translateY(0)    rotate(0deg);     filter: blur(0) saturate(1); }
    to   { transform: scale(0.93) translateY(18px) rotate(-1.1deg);  filter: blur(8px) saturate(0.35); }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(root),
    ::view-transition-old(root),
    ::view-transition-new(root) { animation: none !important; }
}


/* ---- layering: each region gets its own snapshot ------------------------
   By default the whole page is ONE snapshot, so however good the root
   animation is it can only ever move as a single sheet. Naming regions gives
   each its own group, which the browser animates independently — so the
   change cascades through the page instead of arriving all at once.

   The rail and the plain-mode index used to SHARE a name, so that the browser
   would treat them as one element and morph one into the other. They no
   longer do. `#rail.dealt` is a full-height 100vh column and `#index` is a
   small centred list, so the "morph" was the live card wheel being squashed
   into a text panel's box and back — read as the rail shrinking on the way
   in and on the way out. Each has its own name and its own box now, and the
   rail's entrance and exit are the cards themselves (see below). */
.hero-inner { view-transition-name: vt-hero; }
/* The name is the anchor the change happens around — it holds its position
   and only its colour resolves, so the page reads as the same site changing
   rather than being replaced. (Borrowed from francoisrisoud.com, where a
   persistent blob survives while everything rebuilds around it.) */
.title { view-transition-name: vt-name; }
::view-transition-group(vt-name) {
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
::view-transition-old(vt-name) { animation: anchor-out 0.45s ease both; }
::view-transition-new(vt-name) { animation: anchor-in 0.55s 0.22s ease both; }
@keyframes anchor-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes anchor-in  { from { opacity: 0; } to { opacity: 1; } }
#rail    { view-transition-name: vt-side; }
#index   { view-transition-name: vt-index; }
#work    { view-transition-name: vt-s1; }
#track   { view-transition-name: vt-s2; }
#stack   { view-transition-name: vt-s3; }
#papers  { view-transition-name: vt-s6; }
#magic   { view-transition-name: vt-s7; }
#other   { view-transition-name: vt-s5; }
#contact { view-transition-name: vt-s4; }
footer   { view-transition-name: vt-foot; }
/* The cord is deliberately NOT named. Giving it its own group and pinning it
   with `animation: none` on both snapshots left the old and new cords stacked
   and fully opaque for the whole transition — two ropes at once, at different
   swing angles. Unnamed, it just travels with the root like everything else. */

/* ---- the wave -----------------------------------------------------------
   Naming the regions above is what lets them move independently, but it also
   takes them OUT of the root snapshot — so the radial mask that grows from
   the cord no longer touches any of them. The result was a transition that
   claimed to spread from the pull and in fact ran a fixed 0.20/0.27/0.34/0.41
   cascade in DOM order, whichever end of the page you were standing at.

   Each delay is now a variable, and script.js writes it at pull time from the
   region's real distance to the cord, measured the same way the mask measures
   its own radius. Scroll to the footer and pull, and the change starts at the
   footer. The stagger is a wavefront, not a queue.

   The fallbacks are the old fixed cascade, so this degrades to the previous
   behaviour if the JS never runs. */
/* The rail is the one region that animates itself: the deck fans out along
   the arc as it arrives and collects back into a packet before it goes, both
   in animations.js. So its snapshots only have to get out of the way — the
   generic layer treatment scaled and blurred the cards on top of their own
   motion, which is what made the fan arrive small and soft. The arriving
   rail is left completely alone; it is armed empty inside the transition
   callback, so there is nothing to see until the cards deal. */
::view-transition-old(vt-side) { animation: side-out 0.3s var(--w-side, 0s) ease both; }
::view-transition-new(vt-side) { animation: none; }
@keyframes side-out { from { opacity: 1; } to { opacity: 0; } }
/* Leaving, the rail is kept rendered so its NEW snapshot can gather the run
   off live (see `.rail-out`). The old snapshot is then a second, frozen copy
   of the same column sitting on top of it — the "two ropes on screen" bug in
   another costume — so it is dropped outright rather than faded. */
:root.vt-cord::view-transition-old(vt-side) { animation: none; opacity: 0; }

/* The plain-mode index has no motion of its own, so it keeps the shared
   layer treatment, timed off the same side wave. */
::view-transition-old(vt-index) { animation: layer-out 0.4s  var(--w-side, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(vt-index) { animation: layer-in  0.6s  var(--w-side, 0.30s) cubic-bezier(0.16, 1, 0.3, 1) both; }

::view-transition-old(vt-hero) { animation: layer-out 0.34s var(--w-hero, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(vt-hero) { animation: layer-in  0.62s var(--w-hero, 0.12s) cubic-bezier(0.16, 1, 0.3, 1) both; }

::view-transition-old(vt-s1)   { animation: layer-out 0.34s var(--w-s1, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-s2)   { animation: layer-out 0.34s var(--w-s2, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-s3)   { animation: layer-out 0.34s var(--w-s3, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-s4)   { animation: layer-out 0.34s var(--w-s4, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-s5)   { animation: layer-out 0.34s var(--w-s5, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-s6)   { animation: layer-out 0.34s var(--w-s6, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-s7)   { animation: layer-out 0.34s var(--w-s7, 0s) cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-old(vt-foot) { animation: layer-out 0.34s var(--w-foot, 0s) cubic-bezier(0.4, 0, 1, 1) both; }

::view-transition-new(vt-s1)   { animation: layer-in  0.62s var(--w-s1, 0.20s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-s2)   { animation: layer-in  0.62s var(--w-s2, 0.27s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-s3)   { animation: layer-in  0.62s var(--w-s3, 0.34s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-s4)   { animation: layer-in  0.62s var(--w-s4, 0.41s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-s5)   { animation: layer-in  0.62s var(--w-s5, 0.44s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-s6)   { animation: layer-in  0.62s var(--w-s6, 0.44s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-s7)   { animation: layer-in  0.62s var(--w-s7, 0.46s) cubic-bezier(0.16, 1, 0.3, 1) both; }
::view-transition-new(vt-foot) { animation: layer-in  0.62s var(--w-foot, 0.48s) cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Each region also moves along its OWN axis: outward from the cord as it
   arrives, back toward the cord as it leaves. script.js writes the unit
   vector per region; without it every region falls back to straight up and
   down, which is where this started. A shared @keyframes can read them
   because the custom properties resolve per pseudo-element. */
::view-transition-old(vt-hero), ::view-transition-new(vt-hero) { --wdx: var(--w-hero-x, 0px); --wdy: var(--w-hero-y, 26px); }
::view-transition-old(vt-index), ::view-transition-new(vt-index) { --wdx: var(--w-side-x, 0px); --wdy: var(--w-side-y, 26px); }
::view-transition-old(vt-s1),   ::view-transition-new(vt-s1)   { --wdx: var(--w-s1-x, 0px);   --wdy: var(--w-s1-y, 26px); }
::view-transition-old(vt-s2),   ::view-transition-new(vt-s2)   { --wdx: var(--w-s2-x, 0px);   --wdy: var(--w-s2-y, 26px); }
::view-transition-old(vt-s3),   ::view-transition-new(vt-s3)   { --wdx: var(--w-s3-x, 0px);   --wdy: var(--w-s3-y, 26px); }
::view-transition-old(vt-s4),   ::view-transition-new(vt-s4)   { --wdx: var(--w-s4-x, 0px);   --wdy: var(--w-s4-y, 26px); }
::view-transition-old(vt-s5),   ::view-transition-new(vt-s5)   { --wdx: var(--w-s5-x, 0px);   --wdy: var(--w-s5-y, 26px); }
::view-transition-old(vt-s6),   ::view-transition-new(vt-s6)   { --wdx: var(--w-s6-x, 0px);   --wdy: var(--w-s6-y, 26px); }
::view-transition-old(vt-s7),   ::view-transition-new(vt-s7)   { --wdx: var(--w-s7-x, 0px);   --wdy: var(--w-s7-y, 26px); }
::view-transition-old(vt-foot), ::view-transition-new(vt-foot) { --wdx: var(--w-foot-x, 0px); --wdy: var(--w-foot-y, 26px); }

@keyframes layer-out {
    from { opacity: 1; transform: translate(0, 0) scale(1); filter: blur(0); }
    to   { opacity: 0;
           transform: translate(calc(var(--wdx, 0px) * -0.55), calc(var(--wdy, 26px) * -0.55)) scale(0.98);
           filter: blur(4px); }
}
@keyframes layer-in {
    from { opacity: 0;
           transform: translate(var(--wdx, 0px), var(--wdy, 26px)) scale(0.985);
           filter: blur(6px); }
    to   { opacity: 1; transform: translate(0, 0) scale(1); filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) { animation: none !important; }
}

/* ================= hero ================= */

.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    /* Equal top and bottom padding. `justify-content: center` centres the
       content BOX, not the content in the viewport — with padding only on top,
       the block landed padding-top/2 (~72px) below the true centre, which read
       as the hero sitting low. The top value still clears the fixed top bar
       below 1280px, so only the bottom half is new. */
    padding: clamp(6rem, 14vh, 9rem) var(--gut);
    isolation: isolate;
}

/* the follow-spot: deliberately faint, it should read as air not as a shape */
.beam {
    position: absolute;
    top: -12%; left: 50%;
    width: 78vmax; height: 118%;
    z-index: -1;
    pointer-events: none;
    clip-path: polygon(46% 0, 54% 0, 88% 100%, 12% 100%);
    background: linear-gradient(180deg,
        rgba(251, 191, 36, 0.06) 0%,
        rgba(251, 191, 36, 0.025) 40%,
        rgba(251, 191, 36, 0.008) 74%,
        transparent 100%);
    filter: blur(26px);
    /* clip-path applies AFTER filter, so blur can't soften the cone's edges —
       this mask runs after clip-path and feathers them away. */
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 26%, #000 74%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 26%, #000 74%, transparent 100%);
    transform: translateX(-50%);
    transform-origin: 50% 0;
    animation: beam-sway 13s ease-in-out infinite;
}
@keyframes beam-sway {
    0%, 100% { transform: translateX(-50%) rotate(-2.2deg); }
    50%      { transform: translateX(-50%) rotate(2.2deg); }
}

.hero-inner {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.7em;
    font-family: var(--font-hud);
    font-size: clamp(0.66rem, 1.5vw, 0.78rem);
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
}

.title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3.6rem, 14vw, 12rem);
    line-height: 0.88;
    letter-spacing: -0.025em;
    margin: 0.22em 0 0;
    color: var(--text);
}
/* masked line-rise reveal: animations.js wraps the words in these spans */
.title .line {
    display: block;
    overflow: hidden;
    /* Abril's descenders fall well outside the 0.88 line-height box, and this
       block is the reveal mask — too little room here shaves the g and y. */
    padding-bottom: 0.24em;
    margin-bottom: -0.24em;
}
.title .word { display: inline-block; will-change: transform; }

/* The same mask, reused for section headings so the whole page has ONE
   reveal idea instead of a different fade per section. Same descender
   allowance — these are Abril too, at line-height 1.02. */
.ln {
    display: block;
    overflow: hidden;
    padding-bottom: 0.24em;
    margin-bottom: -0.24em;
}
.ln > span { display: block; will-change: transform; }

/* GSAP owns the transform on the magnetic button, so the shared .btn
   transition must not also be tweening it — a CSS transition on a property
   something else writes every frame is a fight neither side wins. The press
   feedback .btn:active gives everyone else is re-done in JS here, because an
   inline transform beats a stylesheet rule no matter how specific. */
.magnetic { transition: background 0.22s, color 0.22s, border-color 0.22s; }

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.8rem;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    font-family: var(--font-hud);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-2);
    border: 1px solid var(--line);
    padding: 0.55em 0.95em;
    border-radius: 100px;
}
.pill .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16);
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.2rem; }

/* ==========================================================================
   THE RAIL — the section nav, and the only place cards do real work.
   Default (below) is a plain legible column of face-up cards with labels:
   that is what no-JS and reduced-motion visitors get, and it navigates.
   animations.js adds `.dealt`, which tucks them into an overlapping stack
   and turns only the current section's card face-up.
   ========================================================================== */

#rail {
    display: none;                     /* wide screens only — see the query below */
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 850;
    width: var(--rail-w);
    padding: 12px 0 12px 20px;
}

/* ---- progress spine: how far through the page you are ------------------ */
.rail-spine {
    position: absolute;
    left: 6px; top: 12px; bottom: 12px;
    width: 2px;
    background: var(--line);
}
.rail-spine i {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    height: 0;                          /* script.js sets this from scroll */
    background: linear-gradient(180deg, var(--crimson), var(--gold));
}
#rail:not(.dealt) .rail-spine { display: none; }

.rail-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: auto;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.rail-card + .rail-card { margin-top: 10px; }

.rc-back, .rc-face {
    display: block;
    /* small undealt so every card plus its label fits a short viewport; the
       dealt stack overlaps and can afford to be much bigger */
    width: 56px;
    aspect-ratio: 5 / 7;
    flex: none;
}
.rc-back svg { display: block; width: 100%; height: 100%; }
.rc-back { display: none; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.65)); }
.rc-face .rcard-face { width: 100%; }

.rail-num {
    display: none;
    font-family: var(--font-hud);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-3);
    transition: color 0.25s;
}

.rail-label {
    font-family: var(--font-hud);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-3);
    white-space: nowrap;
    transition: color 0.25s;
}
.rail-card:hover .rail-label,
.rail-card:focus-visible .rail-label { color: var(--text); }
.rail-card.active .rail-label { color: var(--gold); }
.rail-card:hover, .rail-card:focus-visible { transform: translateX(6px); }

/* ---- dealt: a wheel whose hub is off-screen to the left -----------------
   Cards are pinned to the rail's vertical centre and placed by animations.js
   on a large-radius arc, so the run curves away and off the left edge. The
   wheel turns as you scroll, bringing the current card round to the front. */
#rail.dealt {
    top: 0;
    height: 100vh;
    transform: none;
    padding: 0;
    overflow: hidden;          /* the wheel genuinely runs past the edge */
    /* Full viewport width, so the deck can be carried in from the FAR edge
       and travel right across the page to the column. The cards still live
       in the left-hand strip (they are placed at left: 46px below); the box
       is only wide so the travel is not clipped, which is why everything but
       a card itself is click-through — otherwise this would blanket the page.
       right/width rather than 100vw: a fixed 100vw overshoots by the
       scrollbar's width. */
    right: 0;
    width: auto;
    pointer-events: none;
}
#rail.dealt .rail-card,
#rail.dealt .rail-spine { pointer-events: auto; }
#rail.dealt .rail-card {
    position: absolute;
    top: 50%;
    left: 46px;
    width: var(--rail-card);
    margin-top: 0;
    transition: none;          /* GSAP owns the transform now */
}
#rail.dealt .rc-back,
#rail.dealt .rc-face { width: var(--rail-card); }
#rail.dealt .rc-back { display: block; }
/* The turn is a vertical ROLL, not a flip: one side leaves upward while the
   other arrives from below, both travelling the way the wheel already moves.
   Each side clips its own sheet so the half that has rolled out of frame is
   gone rather than hanging off the card — and because the face sits above the
   back and only covers the part of the window its sheet is in, the two tile
   against each other and you see one continuous reel. */
#rail.dealt .rc-back,
#rail.dealt .rc-face { overflow: hidden; }
#rail.dealt .rc-face {
    position: absolute;
    inset: 0 auto 0 0;
    /* face-down is the dealt default. GSAP's autoAlpha writes inline styles
       that override this the moment a card becomes current, so the only
       thing this guards is a flash of face-up cards before it runs. */
    opacity: 0;
    visibility: hidden;
}
#rail.dealt .rail-num {
    display: block;
    position: absolute;        /* y set by animations.js, riding its card */
    top: 50%;
    left: 20px;
    font-size: 0.64rem;
}
#rail.dealt .rail-num.on { color: var(--gold); }
#rail.dealt .rail-spine { left: 6px; top: 8%; bottom: 8%; }

/* A real heart card: the pips are laid out in the traditional arrangement for
   each rank. The lower half is deliberately NOT printed upside down as a real
   deck would — this heart glyph rotated 180° is indistinguishable from a
   spade, so the convention actively misreads the suit. Scoped to #rail so the
   project art, which shares .rcard-face's surface, is untouched. */
/* Same reason the pips stay upright: a rotated bottom index turns the 6 into
   a 9 and its heart into a spade, so the card contradicts itself. */
#rail .rf-ci.bottom { transform: none; }
#rail .pips {
    position: absolute;
    inset: 13% 20%;
}
#rail .pip {
    position: absolute;
    width: 23%;
    height: 23%;
    fill: var(--crimson-ink);
    transform: translate(-50%, -50%);
}
#rail .pip.big { width: 46%; height: 46%; }

/* ---- the name is PRINTED ON THE CARD, where the pips would be -----------
   It used to be a gold caption hanging under the card, on the page ground.
   The fan overlaps itself, so that caption landed on top of the next card's
   back — small gold type over a busy red engraving, effectively unreadable.
   The face is the one surface in the rail with nothing on it and plenty of
   contrast, so the name goes in the pip field and the corner indices stay.
   The pips themselves come off: a rank of hearts AND a word in the same
   space is a crowded card, and the corners already say which card it is.

   animations.js moves the label inside `.rcard-face` when it deals, so the
   name is part of the face and scales with the turn — left outside it, it
   sat at full width while the card was still edge-on. */
#rail.dealt .pips { display: none; }

#rail.dealt .rcard-face .rail-label {
    position: absolute;
    inset: 22% 12%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* sized off the card, which is itself viewport-clamped */
    font-size: calc(var(--rail-card) * 0.082);
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: 0.14em;
    white-space: normal;          /* PUBLICATIONS needs to be able to wrap */
    color: var(--crimson-ink);    /* the card's own suit colour */
    opacity: 0;
    pointer-events: none;
}
#rail.dealt .rail-card:hover,
#rail.dealt .rail-card:focus-visible { transform: none; }

/* the drawn card should read as lit, not just moved */
#rail.dealt .rail-card.active .rcard-face {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 28px 64px rgba(0, 0, 0, 0.75),
        0 0 38px rgba(251, 191, 36, 0.28);
}

/* ---- the gold card: the Joker ------------------------------------------
   The last card in the rail, and deliberately NOT an 8: the ranked run is
   A-7 and the joker sits outside it, so adding this section renumbered
   nothing. Same face as every other card — corner indices, a centre pip,
   the section name in the pip field — gold stock instead of cream.

   The BACK is the same engraving as the rest of the deck, recoloured.
   `#card-back` is stroked and filled with exactly two custom properties,
   and custom properties inherit through `<use>` into the shadow tree:
     · --back-red  is the panel, flat gold
     · --back-line is the filigree, inverted to dark so it reads on foil
   The outer border rect still uses --card-face, so the gold card keeps the
   same white edge as the rest of the deck.

   A double-backer (engraving on the face too, name on a plate) was tried
   and rejected: it didn't read as a card in the same run.

   **Gotcha:** the panel cannot be an SVG gradient. `--back-red: url(#bb-gold)`
   pointing at a `<linearGradient>` looks like it should work — a paint server
   is a legal `fill` — but a `url()` carried through a custom property does not
   resolve as a paint server in Chromium: the fill comes out empty and the
   card's white border rect showed through, so the "gold" back rendered cream.
   The banding is therefore a CSS layer (`.foil-sheen` below).

   Colour note: the first pass used the obvious #C9982F / #A97C12 sort of gold.
   Those sit at low saturation with green in them and read as mud. Metal is
   bright orange-biased amber, and the depth comes from specular BANDING, not
   from darkening the base. */
.rail-card.gold .rcard-face { background: var(--card-gold); }
.rail-card.gold .rc-back svg {
    --back-red: #E8A80F;
    --back-line: #7A5406;
}
.rail-card.gold .pip { fill: var(--gold-ink); }

/* The foil sheen lives on the BACK only. On the face it fought the name
   the way the double-backer did — a specular band across "MAGIC" is the
   same unreadability. The gold stock is already a different colour from
   the cream run; that is enough. */
.rail-card.gold .rc-back { position: relative; isolation: isolate; }
.rail-card.gold .rc-back::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: overlay;
    background: linear-gradient(148deg,
        rgba(255, 255, 255, 0)    0%,
        rgba(255, 255, 255, 0.55) 15%,
        rgba(255, 255, 255, 0.05) 30%,
        rgba(0, 0, 0, 0.26)       48%,
        rgba(255, 255, 255, 0.60) 62%,
        rgba(255, 255, 255, 0.02) 80%,
        rgba(255, 255, 255, 0.34) 100%);
}

.rail-card.gold .rf-ci.red { color: var(--gold-ink); }
/* the joker has no rank, so its corner index is the star on its own and can be
   a little larger — a bare glyph in a corner otherwise reads as debris */
.rail-card.joker .rf-ci .suit-icon { width: 1.25em; height: 1.25em; }

#rail.dealt .rail-card.gold .rail-label { color: var(--gold-ink); }
/* and the lit rim goes warmer still, since the card under it is already gold */
#rail.dealt .rail-card.gold.active .rcard-face {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.7) inset,
        0 28px 64px rgba(0, 0, 0, 0.75),
        0 0 48px rgba(251, 191, 36, 0.55);
}
#rail.dealt .rail-card.active .rc-back { filter: none; }


@media (min-width: 1280px) {
    #rail { display: block; }
    /* The top bar goes entirely: the rail is the navigation here, and the
       LY mark is duplicated by the rail's Home card. It is kept BELOW this
       breakpoint because the rail is hidden there and removing both would
       leave narrow screens with no navigation at all. */
    #nav { display: none; }
    /* Reserve the rail's width rather than letting it float over the page.
       Without this the rail sits on top of the text from 1100-1280px, where
       the centred 1180px column leaves almost no gutter. Fixed-position
       elements ignore body padding, so #nav is offset separately. */
    /* Symmetric, so the content column lands on the true viewport centre.
       Reserving space only on the rail's side pushed everything right by half
       the rail width, which read as the whole page being off-centre. */
    body { padding-left: var(--rail-w); padding-right: var(--rail-w); }
}

/* ---- cards falling across the whole screen ----------------------------
   The layer sits BEHIND the content and is entirely inert. That is what lets
   it cover the full width: cards pass behind the text rather than over it, so
   they can never hurt legibility or intercept a click meant for a link.
   Three depth tiers (size + blur + opacity) give it real parallax. */
#drift {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.dcard {
    position: absolute;
    top: 0; left: 0;
    aspect-ratio: 5 / 7;
    pointer-events: none;
    will-change: transform;
}
/* One container per depth tier. animations.js drags each by a different
   amount as you scroll, so a hard flick shears the three depths apart. */
.dtier { position: absolute; inset: 0; will-change: transform; }
.dcard svg { display: block; width: 100%; height: 100%; }
.dcard.d-far  { width: 86px;  opacity: 0.045; filter: blur(2.6px); }
.dcard.d-mid  { width: 140px; opacity: 0.07;  filter: blur(1.2px); }
.dcard.d-near { width: 205px; opacity: 0.09;  filter: blur(0.4px); }

/* the field is ambient wallpaper, so it can run at any width */

.cue {
    position: absolute;
    bottom: 1.6rem; left: 50%;
    z-index: 4;
    transform: translateX(-50%);
    display: inline-grid;
    place-items: center;
    width: 46px; height: 46px;
    color: var(--gold);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 50%;
    transition: border-color 0.25s, background 0.25s;
    animation: cue-bob 1.9s ease-in-out infinite;
}
.cue svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.cue:hover, .cue:focus-visible { border-color: var(--gold); background: rgba(251, 191, 36, 0.12); }
@keyframes cue-bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(8px); }
}

/* ================= sections ================= */

.sec {
    position: relative;
    z-index: 1;
    padding-block: clamp(5rem, 11vw, 9rem);
    border-top: 1px solid var(--line);
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    font-family: var(--font-hud);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
}
.kicker.sm { font-size: 0.66rem; color: var(--text-2); }

.sec-head { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }
/* scoped to the section, not to .sec-head — several sections (the trick, the
   magic blurb, contact) lay their heading out without that wrapper */
.sec h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.2rem, 6.4vw, 4.6rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin-top: 0.35em;
}
.sec-sub {
    max-width: 52ch;
    margin-top: 1.1rem;
    font-size: 1.02rem;
    line-height: 1.6;
    color: var(--text-2);
}

/* ==========================================================================
   CARD STOCK — the face used by the rail's cards.
   Cream card on a near-black table: the whole point of the palette.
   ========================================================================== */

.rcard-face {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 7;
    background: var(--card-face);
    border-radius: 8px;
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 24px 60px rgba(0, 0, 0, 0.6);
}

/* corner indices */
.rf-ci {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12em;
    font-family: var(--font-hud);
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1;
    color: var(--ink);
}
.rf-ci .suit-icon { width: 0.8em; height: 0.8em; }
.rf-ci.top { top: 9px; left: 11px; }
.rf-ci.bottom { bottom: 9px; right: 11px; transform: rotate(180deg); }
.rf-ci.red,
.rcard-face[data-suit="red"] .rf-ci { color: var(--crimson-ink); }

/* ================= the hand (projects) ================= */

.hand { list-style: none; display: grid; gap: clamp(3rem, 7vw, 6rem); }

.proj {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
}
/* alternate the side the card sits on so the page has a rhythm */
.proj:nth-child(even) .proj-shot { order: 2; }
/* A project with no live site to capture runs as one copy column rather than
   sitting next to an empty frame — a blank panel reads as a broken image. */

/* The project art is a screenshot of the live site — the cards that used to
   sit here carried no information about the work. Landscape frame, image
   anchored to the top so the site's header is what shows. */
/* The art is an <a> to the same place the Visit button goes, so the obvious
   click target works. It is aria-hidden + tabindex="-1" in the markup: the
   button already carries that link, and a second one only adds a duplicate
   tab stop and a duplicate announcement. Needs display:block — an anchor is
   inline by default, which collapses the aspect-ratio frame. */
.proj-shot {
    display: block;
    position: relative;      /* containing block for the pointer glow */
    aspect-ratio: 16 / 10;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surf-1);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.45s ease, box-shadow 0.45s ease;
}
.proj-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}
.proj:hover .proj-shot {
    transform: translateY(-8px);
    border-color: var(--line-2);
    box-shadow: 0 34px 66px rgba(0, 0, 0, 0.7);
}

.proj-tags-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1.1rem;
}
.badge {
    font-family: var(--font-hud);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-2);
    border: 1px solid var(--line-2);
    padding: 0.45em 0.8em;
}
.badge-live { color: var(--gold); border-color: rgba(251, 191, 36, 0.4); }
.when {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--text-3);
}

.proj-name {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: -0.02em;
}
.proj-real {
    font-family: var(--font-hud);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-top: 0.5rem;
}
.proj-specs {
    list-style: none;
    display: grid;
    gap: 0.8rem;
    margin: 1.4rem 0;
}
.proj-specs li {
    position: relative;
    padding-left: 1.4em;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-2);
}
.proj-specs li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.62em;
    width: 6px; height: 6px;
    background: var(--crimson);
    transform: rotate(45deg);
}
.proj-specs strong { color: var(--text); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
    font-family: var(--font-hud);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-2);
    border: 1px solid var(--line);
    padding: 0.42em 0.8em;
    white-space: nowrap;
    transition: border-color 0.22s, color 0.22s;
}
.tag:hover { border-color: var(--line-2); color: var(--text); }
.proj-body .btn { margin-top: 1.6rem; }
/* a project with both a live site and a repo carries two buttons on one row */
.proj-links { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.6rem; }
.proj-links .btn { margin-top: 0; }

@media (max-width: 780px) {
    .proj { grid-template-columns: 1fr; }
    .proj:nth-child(even) .proj-shot { order: 0; }
}

/* ================= track record ================= */

.track { list-style: none; display: grid; }

.tr {
    display: grid;
    grid-template-columns: clamp(3.5rem, 8vw, 7rem) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2.5rem);
    padding-block: clamp(1.8rem, 4vw, 2.8rem);
    border-top: 1px solid var(--line);
    transition: background 0.3s;
}
.tr:last-child { border-bottom: 1px solid var(--line); }
.tr:hover { background: var(--surf-1); }

.tr-n {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    line-height: 1;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}
.tr-when {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.5rem;
}
.tr-body h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.3rem, 3vw, 1.9rem);
    line-height: 1.2;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6em;
}
.tr-org {
    font-family: var(--font-hud);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
}
.tr-note, .tr-body ul { margin-top: 0.85rem; }
.tr-note { font-size: 0.98rem; line-height: 1.6; color: var(--text-2); max-width: 68ch; }
.tr-body ul { list-style: none; display: grid; gap: 0.55rem; max-width: 68ch; }
.tr-body ul li {
    position: relative;
    padding-left: 1.3em;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text-2);
}
.tr-body ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.62em;
    width: 5px; height: 5px;
    background: var(--text-3);
    transform: rotate(45deg);
}

/* publications */
.paper-list {
    list-style: none;
    display: grid;
    gap: 1.6rem;
    margin-top: 1.6rem;
}
.paper-list li {
    padding: clamp(1.2rem, 3vw, 1.8rem);
    background: var(--surf-1);
    border: 1px solid var(--line);
}
.cite { font-size: 0.98rem; line-height: 1.6; color: var(--text); }
.cite strong { color: var(--gold); }
.doi {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-top: 0.5rem;
}

/* ================= the stack ================= */

.stack { display: grid; }
.stack-row {
    display: grid;
    grid-template-columns: clamp(7rem, 16vw, 12rem) minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 2rem);
    align-items: start;
    padding-block: 1.4rem;
    border-top: 1px solid var(--line);
}
.stack-row:last-child { border-bottom: 1px solid var(--line); }
.stack dt {
    font-family: var(--font-hud);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--crimson);
    padding-top: 0.35em;
}

@media (max-width: 560px) {
    .stack-row, .tr { grid-template-columns: 1fr; gap: 0.75rem; }
}

/* ================= contact ================= */

/* ---- magic: the performance set ----------------------------------------
   Heading is the word itself, in gold, in the display face — the same idea
   as every other section head, just the one-word label instead of a
   sentence, because the clips underneath do the talking.

   Local clips are play tiles, not players. `.reel-play` is display:none in
   the stylesheet; script.js hangs `.armed` on the figure, which is what
   hides the <video> and shows the tile. No-JS therefore still gets a
   visible player. Instagram is an iframe on their /embed URL. */
.sec-magic h2 {
    color: var(--gold);
    font-size: clamp(3.2rem, 9vw, 6.5rem);
    line-height: 0.92;
    letter-spacing: -0.03em;
    /* Abril's descenders fall ~0.24em outside a 0.92 line box, so the g of
       "Magic" lands on top of the sub-line. Reserve the room here rather
       than on .sec-sub's margin: the padding scales with the clamped font
       size, a rem margin does not. */
    padding-bottom: 0.3em;
}
.sec-magic .sec-head { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.sec-magic .sec-sub { margin-top: 0; }

/* The stage is the box both states share. `.magic-set` alone gives it its
   height — the veil is absolute inside it — so the section measures the
   same in show and plain and the cord-pull has no geometry to interpolate. */
.magic-stage { position: relative; }

/* Hidden on the dark stage, shown in plain. Declared this way round because
   `plain` ships on <body> in the markup: the first paint is the plain view,
   so the veil must be the state that needs no JS to appear. `visibility`
   rather than `display` on both sides — it keeps the grid's box, and it
   takes whichever half is hidden out of the accessibility tree and out of
   the way of clicks without a second mechanism. */
.magic-veil {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 0.75rem;
    visibility: hidden;
    /* Sits at the TOP of the stage, right under the section head — centred in
       a metre of reserved height it read as a stray line floating in the
       middle of nothing. The hairlines are what make the space below it
       deliberate rather than a section that failed to load; the page draws
       every other structure the same way. */
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding-top: clamp(2.5rem, 6vh, 4.5rem);
}
body.plain .magic-veil { visibility: visible; }
body.plain .magic-set  { visibility: hidden; }

.veil-line {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.06;
    letter-spacing: -0.02em;
    color: var(--text);
    /* Abril again: the g and y hang outside the line box */
    padding-bottom: 0.16em;
}
.veil-cue {
    margin: 0.2rem 0 0;
    font-family: var(--font-hud);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--crimson);
}
.veil-cue span { margin-right: 0.5em; letter-spacing: 0; }

.magic-set {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(2rem, 4vw, 3.25rem) clamp(1.25rem, 3vw, 2.5rem);
    align-items: end;
}
@media (min-width: 720px) {
    .magic-set {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.65fr) minmax(0, 1.1fr);
    }
    .mg-wide { grid-column: 1 / -1; }
}
.mg {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.mg-promo   .reel { width: min(100%, 248px); }
.mg-close   .reel { width: min(100%, 176px); }
.mg-classic .reel { width: min(100%, 327px); }
.mg-wide    .reel { width: min(100%, 520px); }
.mg-cap h3 {
    font-family: var(--font-hud);
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
    margin: 0;
}
.mg-cap p {
    margin: 0.4rem 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-2);
}
.mg-cap strong { color: var(--text); font-weight: 600; }

.reel {
    margin: 0;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--line-2);
    background: #000;
    box-shadow:
        0 28px 60px rgba(0, 0, 0, 0.6),
        0 0 34px rgba(251, 191, 36, 0.12);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.5s ease;
}
.mg-promo   .reel { transform: rotate(-2.1deg); }
.mg-close   .reel { transform: rotate(2.6deg); }
.mg-classic .reel { transform: rotate(-1.4deg); }
.mg-wide    .reel { transform: rotate(1.1deg); }
.reel:hover, .reel:focus-within {
    transform: rotate(0deg) translateY(-6px);
    box-shadow:
        0 34px 70px rgba(0, 0, 0, 0.66),
        0 0 46px rgba(251, 191, 36, 0.22);
}
.reel-tall { aspect-ratio: 9 / 16; }
.reel-wide { aspect-ratio: 16 / 9; }
.reel-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* play overlay sits ON the still, not instead of it. Hidden until script.js
   arms the reel — no-JS keeps the <video> with nothing covering it. */
.reel-play { display: none; }
.reel.armed:not(.on) .reel-play {
    display: grid;
    place-items: center;
    gap: 0.55rem;
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
    cursor: pointer;
    color: #fff;
    font-family: var(--font-hud);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.reel.armed.on .reel-play { display: none; }
.reel-play-mark {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent var(--gold);
    margin-left: 4px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}
.reel-play:hover,
.reel-play:focus-visible { color: var(--text); }
.reel-play:focus-visible { outline: 2px solid var(--gold); outline-offset: -6px; }

@media (max-width: 719px) {
    .mg-promo .reel,
    .mg-close .reel,
    .mg-classic .reel { width: min(100%, 260px); }
}

/* ---- contact: one card, laid down horizontally -------------------------
   Cream stock on the dark band, so everything inside has to flip to dark ink
   — including the buttons, which are otherwise styled for a dark surface and
   would be invisible here. */
.contact-card {
    position: relative;
    max-width: 880px;
    margin-inline: auto;
    background: var(--card-face);
    color: var(--ink);
    /* transparent, not absent: plain mode draws this border, and a border that
       only exists in one mode makes the card 2px taller there — which shoves
       the footer down and turns into a slide on every cord pull, since a
       view-transition group interpolates whatever box difference it finds */
    border: 1px solid transparent;
    border-radius: 12px;
    padding: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 9vw, 6rem);
    text-align: center;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 40px 90px rgba(0, 0, 0, 0.7);
    transform: rotate(-1.2deg);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.sec-contact:hover .contact-card { transform: rotate(0deg) translateY(-6px); }

/* corner indices, the way the joker card carried them */
.cc-ci {
    position: absolute;
    font-family: var(--font-hud);
    font-weight: 700;
    font-size: 0.6rem;
    line-height: 1.3;
    letter-spacing: 0.05em;
    text-align: center;
    color: var(--crimson-ink);
}
.cc-ci.top { top: 16px; left: 20px; }
.cc-ci.bottom { bottom: 16px; right: 20px; transform: rotate(180deg); }

.contact-card .kicker { color: var(--crimson-ink); }
.contact-card h2 { color: var(--ink); }
.contact-card .sec-sub { color: var(--ink-soft); margin-inline: auto; }

/* the dark-surface button styles have to invert on card stock */
.contact-card .btn {
    color: var(--ink);
    border-color: rgba(31, 36, 48, 0.35);
}
.contact-card .btn:hover,
.contact-card .btn:focus-visible {
    background: var(--ink);
    color: var(--card-face);
    border-color: var(--ink);
}
.contact-card .btn-solid {
    background: var(--ink);
    color: var(--card-face);
    border-color: var(--ink);
}
.contact-card .btn-solid:hover,
.contact-card .btn-solid:focus-visible {
    background: var(--crimson-ink);
    color: var(--card-face);
    border-color: var(--crimson-ink);
}
.contact-card :focus-visible { outline-color: var(--crimson-ink); }

.contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

@media (max-width: 620px) {
    .contact-card { padding-inline: 1.6rem; transform: none; }
    .cc-ci { display: none; }
}

/* ================= footer ================= */

footer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    padding: 2.4rem var(--gut) 3rem;
    max-width: var(--wrap);
    margin: 0 auto;
    border-top: 1px solid var(--line);
}
footer p {
    font-family: var(--font-hud);
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-3);
}


/* ==========================================================================
   PLAIN MODE — the house lights are on.
   Pulling the cord adds body.plain: a light, conventional portfolio with
   every trace of the card theme removed. Project screenshots stay, since
   those are real work rather than decoration.
   ========================================================================== */

body.plain {
    /* a full palette swap rather than a filter, so contrast stays deliberate */
    --bg:        #F6F5F2;
    --surf-1:    #FFFFFF;
    --surf-2:    #EFEEEA;
    --line:      rgba(20, 20, 26, 0.12);
    --line-2:    rgba(20, 20, 26, 0.28);
    --text:      #14141A;
    --text-2:    #4A4A55;
    --text-3:    #75757F;
    --gold:      #1C1C22;      /* the accent becomes ink; no gold on stage */
    --gold-deep: #35353F;
    --crimson:   #A3122B;
    background: var(--bg);
    color: var(--text);
    /* NO padding override here. The gutter `body` reserves at >=1280px is the
       same in both modes and has to stay that way — the rail lives in it here
       and the index lives in it in plain. Zeroing it (and then handing plain
       its own narrower `--index-w` further down) made every full-width section
       jump sideways and reflow the moment the cord was pulled, which is
       exactly the "identical geometry" rule this file keeps warning about. */
}

/* everything theatrical goes */
body.plain #rail,
body.plain #drift,
body.plain #dust,
body.plain .beam,
body.plain .cue,
body.plain::before { display: none; }

/* ...except that the rail has to survive its own exit. The run is gathered up
   and carried off DURING the transition, not before it, so that the cards
   leaving and the page changing are one moment rather than two. That needs the
   column still rendered after the class flips, because a live
   `::view-transition-new` snapshot is the only thing on screen that can still
   move — an old snapshot is a static image. script.js hangs `.rail-out` on the
   body for exactly as long as that takes and then drops it.

   Scoped to the rail's own breakpoint: below it the rail is hidden in BOTH
   modes, and an unscoped rule here would flash the whole column over the
   content on a narrow screen every time the cord was pulled. */
@media (min-width: 1280px) {
    body.plain.rail-out #rail { display: block; }
}

/* the top bar comes back at every width and becomes the navigation */
body.plain #nav {
    /* deliberately no `display` here — the >=1280 rule hides the bar in both
       modes, so the show and plain views match. Below that breakpoint the base
       `#nav { display: flex }` brings it back for both. */
    padding-left: var(--gut);
    background: rgba(246, 245, 242, 0.85);
    border-bottom-color: var(--line);
}
body.plain #nav.stuck { border-bottom-color: var(--line); }
body.plain .nav-links { display: flex; }
body.plain .nav-links a { color: var(--text-2); }
body.plain .nav-links a:hover,
body.plain .nav-links a.active { color: var(--text); }
body.plain .nav-links a::after { background: var(--text); }
body.plain .nav-cta {
    background: var(--text);
    color: var(--bg);
}
body.plain .nav-cta:hover { background: var(--crimson); }

/* Suits and pips are the theme, not the content.
   NOT `display: none`, though. `.suit-icon` sits inside `.kicker` / `.eyebrow`,
   which are inline-flex, so removing it from the flow changes what determines
   the flex line's height — every section head came out 1px taller in plain
   mode, and eight of those stacked up meant every section below the fold sat
   several px off between the modes. A view-transition group interpolates
   whatever box difference it finds, so that drift became a visible slide on
   every pull. Kept in the flow at zero width instead (the negative margin eats
   the flex gap), which looks identical and measures identical. */
body.plain .suit-icon { visibility: hidden; width: 0; }
/* and the gap goes with it, or the text keeps the space the suit used to sit
   in. Zeroing the gap rather than pulling the icon back with a negative margin
   because these four carry FOUR different gaps (0.12em to 0.7em) — one magic
   number fits one of them and shunts the other three into their own text. */
body.plain .kicker,
body.plain .eyebrow,
body.plain .nav-mark,
body.plain .rf-ci { gap: 0; }
body.plain .pill .dot { display: none; }
body.plain .kicker,
body.plain .eyebrow { color: var(--crimson); }

/* hero: same words, plain dress */
body.plain .title { color: var(--text); }
/* Magic is metal on the dark stage and plain ink here — the word reads as
   one of the section heads in this mode, not as a coloured exception. It
   still needs naming: --gold is remapped in plain, but not to the ink. */
body.plain .sec-magic h2 { color: var(--text); }
body.plain .pill { border-color: var(--line); color: var(--text-2); }

body.plain .btn { color: var(--text); border-color: var(--line-2); }
body.plain .btn:hover,
body.plain .btn:focus-visible { background: var(--text); color: var(--bg); border-color: var(--text); }
body.plain .btn-solid { background: var(--text); color: var(--bg); border-color: var(--text); }
body.plain .btn-solid:hover,
body.plain .btn-solid:focus-visible { background: var(--crimson); border-color: var(--crimson); color: #fff; }

/* surfaces */
body.plain .tr:hover { background: var(--surf-1); }
body.plain .paper-list li { background: var(--surf-1); border-color: var(--line); }
body.plain .cite strong { color: var(--crimson); }
body.plain .badge-live { color: var(--crimson); border-color: rgba(163, 18, 43, 0.4); }
body.plain .tag { border-color: var(--line); color: var(--text-2); }
body.plain .tag:hover { border-color: var(--line-2); color: var(--text); }
body.plain .proj-specs li::before,
body.plain .tr-body ul li::before { background: var(--crimson); }
body.plain .tr-when { color: var(--crimson); }
body.plain .stack dt { color: var(--crimson); }

/* project art: keep the screenshots, drop the stage lighting */
body.plain .proj-shot {
    border-color: var(--line);
    background: var(--surf-1);
    box-shadow: 0 10px 30px rgba(20, 20, 26, 0.1);
}
body.plain .proj:hover .proj-shot {
    box-shadow: 0 18px 44px rgba(20, 20, 26, 0.16);
    border-color: var(--line-2);
}

/* contact stops being a playing card */
body.plain .contact-card {
    background: var(--surf-1);
    border-color: var(--line);       /* the box itself is declared above */
    box-shadow: 0 14px 40px rgba(20, 20, 26, 0.1);
    transform: none;
}
body.plain .sec-contact:hover .contact-card { transform: translateY(-4px); }
body.plain .cc-ci { display: none; }
body.plain .contact-card .kicker { color: var(--crimson); }
body.plain .contact-card .sec-sub { color: var(--text-2); }
body.plain .contact-card .btn { color: var(--text); border-color: var(--line-2); }
body.plain .contact-card .btn-solid { background: var(--text); color: var(--bg); border-color: var(--text); }


/* ---- plain mode's own side index -------------------------------------
   Built by script.js from the rail's sections. Editorial rather than
   theatrical: numbers, names, a hairline, and a mark on the current one. */
#index { display: none; }
body.plain #index {
    display: none;
    position: fixed;
    left: clamp(24px, 4vw, 56px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 850;
    border-left: 1px solid var(--line);
    padding-left: 18px;
}
.index-item {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.55rem 0;
    text-decoration: none;
    color: var(--text-3);
    font-family: var(--font-hud);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    position: relative;
    transition: color 0.25s, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.index-item .ix-num { font-size: 0.58rem; opacity: 0.7; }
.index-item::before {
    content: '';
    position: absolute;
    left: -19px;
    top: 50%;
    width: 1px;
    height: 0;
    background: var(--text);
    transform: translateY(-50%);
    transition: height 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.index-item:hover { color: var(--text-2); transform: translateX(3px); }
.index-item.active { color: var(--text); }
.index-item.active::before { height: 100%; }

/* The index shows in the gutter the rail already reserved. It does NOT get a
   reservation of its own: `body` reserves `--rail-w` either side at this same
   breakpoint, and a narrower plain-mode value (it was `--index-w`, 250px
   against the rail's 288px) made every full-width section 76px wider and 38px
   further left in plain mode — so the whole page shifted and reflowed on every
   pull. That is the "the two modes must have identical geometry" rule: plain
   overrides may change colour and visibility, never padding, height or
   spacing. The index is simply narrower than the space it sits in. */
@media (min-width: 1280px) {
    body.plain #index { display: block; }
}

body.plain #progress { background: var(--text); }
/* the rope goes to ink in plain mode — a gold cord is stage dressing */
body.plain .cord-back  { stroke: #0E0E12; }
body.plain .cord-front { stroke: #6A6A78; }
body.plain .tassel-cap { background: linear-gradient(180deg, #6A6A78, #2A2A33 45%, #14141A); }
body.plain .tassel-skirt {
    background: repeating-linear-gradient(90deg,
        rgba(90, 90, 102, 0.95) 0 1.5px,
        rgba(30, 30, 38, 0.9) 1.5px 3px);
}
body.plain #cord:hover .tassel-cap,
body.plain #cord:focus-visible .tassel-cap { box-shadow: 0 0 12px rgba(20, 20, 26, 0.45); }

/* the side index IS the navigation in plain mode, so the top bar keeps only
   the mark and the CTA rather than duplicating every section link */

/* ==========================================================================
   REDUCED MOTION — kill every ambient animation. The page above is already
   fully legible without motion, so nothing needs a special static layout.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cue, .beam, #dust::before, #dust::after { animation: none !important; }
    #dust, .beam { display: none; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}
