/* ==========================================================================
   Bavan — portfolio styles
   --------------------------------------------------------------------------
   1. Design tokens (colours, fonts, type scale, spacing, motion)
      ↳ Tweak the look here. Everything below uses these variables.
   2. Base
   3. Top bar
   4. Hero
   5. Cards
   6. Footer
   7. Dock
   8. Cursor canvas
   9. Simple pages (Works, Who dis, Fun Lab, 404)
   10. Reduced motion
   ========================================================================== */


/* 1. DESIGN TOKENS ======================================================== */
:root {
  /* Colours: the theme colours (dark / light) live in the two theme blocks
     right below. The values here are the SAME in both themes. */
  --hi: #ffffff;                   /* highlight base: used inside color-mix() */
  --shade: #000000;                /* shadow base: used inside color-mix() */
  --paper: #e8e2da;                /* warm off-white on dark surfaces */
  --on-accent: #0d0d0d;            /* text on top of the turquoise */
  --accent-dark: #14b8a6;          /* darker turquoise */

  /* "Say hi" game button */
  --btn-face: #2de1c2;
  --btn-face-top: #5ff2d9;
  --btn-band: #0f9a87;             /* darker base = the 3D depth */
  --btn-ink: #0b2b27;              /* label colour */

  /* "insert cartridge" scene: the game station + cartridge (round 24) */
  --con-top:   #f3efe9;
  --con-face:  var(--paper);       /* #e8e2da */
  --con-shade: #c4bcb1;
  --con-base:  #9c958c;
  --con-dark:  #2a2826;            /* slot, d-pad, vents */
  --con-led:   #5a5650;            /* LED off */
  --con-btn-a: #fe9ac2;
  --con-btn-b: #c7adff;
  --kart-face: #9a948c;
  --kart-hi:   #c9c3bb;
  --kart-shade:#6e6963;

  /* Small dark arcade keys (card buttons, dock "+" and sound key) */
  --key-face: #1f1e1c;
  --key-face-top: #2a2826;
  --key-band: #121110;
  --key-outline: #050505;
  --key-fg: #b5aa9c;               /* icon / label on a key */
  --key-fg-hi: #e8e2da;            /* hovered or open */
  --key-lit-ink: #061210;          /* label on a lit (coloured) card key */

  /* Retro screen on the Works card + footer moon */
  --screen: #0b0d0d;
  --screen-2: #1a1d1d;
  --moon: #eaf3ff;
  --moon-shade: #c4d8f2;
  --moon-crater: #b3c9e8;
  /* Footer day scene: the sun (light theme) */
  --sun: #ffcf4d;
  --sun-shade: #f6a823;
  --sun-hi: #fff3c4;
  --sun-ray: #ffc23d;

  /* Fonts. PP Mondwest is self-hosted (see @font-face at the top of section 2). */
  --font-display: "PP Mondwest", ui-monospace, monospace;
  --font-body:    "Google Sans Flex", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Type scale: phone size → desktop size (grows smoothly in between) */
  --text-hero:   clamp(3rem, 1.66rem + 5.49vw, 6.625rem);  /* 48 → 106 (check 1280: two lines) */
  --text-hero-phone: clamp(2.25rem, 10.5vw, 3rem);       /* 36 → 48, under 48rem */
  --text-h2:     clamp(2.5rem, 1.94rem + 2.29vw, 4rem);    /* 40 → 64 */
  --text-card:   clamp(2rem, 1.81rem + 0.76vw, 2.5rem);    /* 32 → 40 */
  --text-body:   1rem;                                      /* 16 */
  --text-small:  0.875rem;                                 /* 14 */
  --text-meta:   0.8125rem;                                /* 13 */

  --leading-tight: 1;
  --leading-heading: 1.2;
  --leading-body: 1.6;

  /* Spacing (8px rhythm) */
  --space-1: 0.5rem;   /* 8 */
  --space-2: 1rem;     /* 16 */
  --space-3: 1.5rem;   /* 24 */
  --space-4: 2.5rem;   /* 40 */
  --space-5: 4rem;     /* 64 */
  --space-6: 7.5rem;   /* 120 */

  --gutter: max(1rem, 2.78vw);          /* page side margin: 16 → 40 */
  --radius: 0.75rem;                    /* 12px, bars and buttons */
  --radius-card: 1.25rem;               /* 20px, teaser panels */
  --bar-height: 4rem;                   /* 64px top bar */
  --bar-top: 1.5rem;                    /* gap above the top bar */
  --nav-clear: calc(var(--bar-top) + var(--bar-height));   /* real bottom edge of the floating nav */
  --nav-gap: 3rem;                      /* clear space between the nav and the first content (phones) */
  --dock-edge: 1.75rem;                 /* dock distance from the right and bottom edges */

  /* Hero */
  --hero-visual: clamp(15rem, 38vh, 28rem);  /* photo + circle size */

  /* Motion */
  --ease-out: cubic-bezier(.19, 1, .22, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --duration: 600ms;
}

@media (min-width: 48rem) {
  :root { --nav-gap: clamp(3.5rem, 9svh, 6rem); }   /* desktop: 56-96px, scales with window height */
}

@media (max-width: 47.99rem) {
  :root { --bar-height: 3.5rem; --bar-top: 1rem; --dock-edge: 1rem; }
}


/* ---- THEMES ----------------------------------------------------------------
   <html data-theme="dark|light"> picks one (js/main.js + a tiny script in each <head>).
   Dark is the default. The footer follows the theme too (night scene / day scene). */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #0d0d0d;                 /* page */
  --bg-card:       #141414;                 /* cards */
  --bg-chip:       rgb(18 18 18 / .9);      /* small tags over the water */
  --text-strong:   #ffffff;                 /* hero headline */
  --text:          #ece7e0;                 /* titles, primary text */
  --text-2:        #b5aa9c;                 /* body copy, nav links */
  --text-3:        #8c857c;                 /* meta labels, captions */
  --border:        rgb(255 255 255 / .06);  /* hairlines */
  --border-strong: rgb(255 255 255 / .12);
  --hover-fill:    rgb(255 255 255 / .06);  /* hover background on small buttons */
  --shadow-card:   none;
  --accent:        #2de1c2;                 /* water, cursor, icons, focus ring */
  --accent-text:   #2de1c2;                 /* accent-coloured TEXT (passes contrast) */
  --trail:         var(--accent);           /* cursor trail + tap ripple colour */
  --c-work:        #2de1c2;
  --c-about:       #a6f05a;
  --c-lab:         #5cc8f5;
  --c-pink:        #fe9ac2;   /* hero skill pills only */
  --c-purple:      #c7adff;
  --c-orange:      #ffa65f;
  --selection:     rgb(45 225 194 / .3);
  /* top bar + dock glass */
  --bar-bg:        linear-gradient(rgb(255 255 255 / .06), rgb(255 255 255 / .06)), rgb(0 0 0 / .48);
  --bar-border:    var(--border);
  --bar-shadow:    none;
  --bar-blur:      40px;
  --bar-sat:       1;                       /* backdrop saturate (1 = unchanged) */
  --dock-blur:     24px;
  --bar-divider:   var(--border-strong);
  --bar-hover-fill: linear-gradient(var(--hover-fill), var(--hover-fill)), var(--bar-bg);
  --bar-hover-border: var(--border-strong);
  --mark-ring:     transparent;
  --dock-bg:       rgb(13 13 13 / .88);
  --dock-border:   rgb(255 255 255 / .12);
  --dock-shadow:   0 10px 30px rgb(0 0 0 / .5);
  /* card details */
  --card-glow-a:   8%;                      /* colour wash on hover, start / end */
  --card-glow-b:   26%;
  --art-rest:      26%;                     /* resting icon colour (mix of text into card) */
  --art-rest-liq:  13%;
  --screen-filter: grayscale(1) brightness(.7);
  /* footer scene */
  --scene:         url("/assets/images/footer-scene-night.png");   /* mountains, trees, grass */
  --sky-strip:     url("/assets/images/footer-sky-night.png");     /* banded sky */
  --haze:          none;
  --cloud-1:       url("/assets/images/footer-cloud-1-night.png");
  --cloud-2:       url("/assets/images/footer-cloud-2-night.png");
  --cloud-3:       url("/assets/images/footer-cloud-3-night.png");
  --halo:          #3f7cc4;                 /* moon halo rings */
  --firefly:       #36c3e6;
  --spark-core:    #ffffff;                 /* night-only sparkle stars */
  --spark-arm:     #c8e6fc;
  --ufo-body:      #0b1030;
  --ufo-dome:      transparent;
  --ground:        #06162d;                 /* the soil strip under the grass */
  --ground-edge:   #0b3a50;
  --ground-ink:    #cfe3f5;
  /* primary game button: ring, hover halo and drop shadow (dark values = what it always had) */
  --btn-ring:         color-mix(in srgb, var(--btn-face) 35%, transparent);
  --btn-ring-hover:   color-mix(in srgb, var(--btn-face) 50%, transparent);
  --btn-ring-active:  color-mix(in srgb, var(--btn-face) 30%, transparent);
  --btn-halo:         color-mix(in srgb, var(--btn-face) 14%, transparent);
  --btn-drop:         color-mix(in srgb, var(--shade) 50%, transparent);
  --btn-drop-hover:   color-mix(in srgb, var(--shade) 50%, transparent);
  --btn-drop-active:  color-mix(in srgb, var(--shade) 40%, transparent);
  /* cartridge shelf (round 23) */
  --cart-face:    #191919;
  --cart-edge:    rgb(255 255 255 / .09);
  --cart-band:    #101010;                  /* 6px bottom depth band */
  --cart-well:    #0b0b0b;                  /* recess around the label */
  --cart-ridge:   rgb(255 255 255 / .12);
  --cart-led:     rgb(255 255 255 / .14);   /* LED off */
  --cart-shadow:  drop-shadow(0 0 0 transparent);
  --cart-glow:    34%;                      /* lit glow strength (mixed with the project colour) */
  --rail-face:    #121212;
  --rail-edge:    rgb(255 255 255 / .12);
  --rail-side:    transparent;
  --shelf-dim:    .55;                      /* other cartridges while one is hovered */
  --boot-shadow:  0 40px 120px -20px rgb(0 0 0 / .7);
  --boot-backdrop: rgb(0 0 0 / .6);
  --boot-close-bg:     rgb(13 13 13 / .82);
  --boot-close-border: rgb(255 255 255 / .16);
  --boot-close-fg:     var(--text);
  --boot-close-shadow: 0 2px 10px rgb(0 0 0 / .35);
  --in-spark:      #ffffff;
  --insert-tint:   rgb(8 8 8 / .78);                         /* dark, blurred page behind */
  --insert-shadow: drop-shadow(0 14px 28px rgb(0 0 0 / .55));
}

[data-theme="light"] {
  color-scheme: light;
  --bg:            #ffffff;
  --bg-card:       #fafafa;
  --bg-chip:       rgb(255 255 255 / .9);
  --text-strong:   #09090b;
  --text:          #18181b;
  --text-2:        #52525b;
  --text-3:        #71717a;
  --border:        #ececef;
  --border-strong: #e4e4e7;
  --hover-fill:    #f4f4f5;
  --shadow-card:   0 1px 2px rgb(0 0 0 / .04), 0 8px 24px -12px rgb(0 0 0 / .08);
  --accent:        #14b8a6;
  --accent-text:   #0f766e;
  --trail:         #a78bfa;                 /* violet-400: visible on white, lighter than #8b5cf6 */
  --c-work:        #14b8a6;
  --c-about:       #65a30d;
  --c-lab:         #0ea5e9;
  --c-pink:        #df6c9d;
  --c-purple:      #a481e9;
  --c-orange:      #dc7d20;
  --selection:     rgb(20 184 166 / .2);
  --bar-bg:        rgb(255 255 255 / .78);   /* clean white glass */
  --bar-border:    rgb(0 0 0 / .07);         /* a real, crisp 1px edge */
  --bar-shadow:    0 1px 2px rgb(0 0 0 / .04), 0 6px 20px -6px rgb(0 0 0 / .08);
  --bar-blur:      20px;
  --bar-sat:       1.6;
  --dock-blur:     20px;
  --dock-bg:       var(--bar-bg);            /* the dock matches the top bar */
  --dock-border:   var(--bar-border);
  --dock-shadow:   var(--bar-shadow);
  --bar-divider:   rgb(0 0 0 / .08);
  --bar-hover-fill: rgb(244 244 245 / .9);
  --bar-hover-border: rgb(0 0 0 / .1);
  --mark-ring:     rgb(0 0 0 / .06);
  --card-glow-a:   6%;
  --card-glow-b:   18%;
  --art-rest:      14%;
  --art-rest-liq:  7%;
  --screen-filter: grayscale(1) opacity(.85);
  /* footer scene: daytime */
  --moon:          #ffcf4d;                 /* the halo behind the scene turns warm */
  --scene:         url("/assets/images/footer-scene-day.png");
  --sky-strip:     url("/assets/images/footer-sky-day.png");
  --haze:          url("/assets/images/footer-haze-day.png");
  --cloud-1:       url("/assets/images/footer-cloud-1-day.png");
  --cloud-2:       url("/assets/images/footer-cloud-2-day.png");
  --cloud-3:       url("/assets/images/footer-cloud-3-day.png");
  --ufo-body:      #27272a;
  --ufo-dome:      #71717a;
  --ground:        #2f7d48;
  --ground-edge:   #5cc873;
  --ground-ink:    #ffffff;
  /* primary game button on white: clear teal ring, teal-tinted shadow */
  --btn-ring:         #14b8a6;
  --btn-ring-hover:   #14b8a6;
  --btn-ring-active:  #14b8a6;
  --btn-halo:         rgb(20 184 166 / .16);
  --btn-drop:         rgb(15 118 110 / .22);
  --btn-drop-hover:   rgb(15 118 110 / .26);
  --btn-drop-active:  rgb(15 118 110 / .2);
  /* cartridge shelf (round 23) */
  --cart-face:    #fafafa;
  --cart-edge:    #e4e4e7;
  --cart-band:    #e4e4e7;
  --cart-well:    #ececef;
  --cart-ridge:   #d4d4d8;
  --cart-led:     #d4d4d8;
  --cart-shadow:  drop-shadow(0 1px 1px rgb(0 0 0 / .04)) drop-shadow(0 8px 10px rgb(0 0 0 / .05));
  --cart-glow:    30%;
  --rail-face:    #f4f4f5;
  --rail-edge:    #e4e4e7;
  --rail-side:    #e4e4e7;
  --shelf-dim:    .7;
  --boot-shadow:  0 1px 2px rgb(0 0 0 / .04), 0 24px 64px -16px rgb(0 0 0 / .18);
  --boot-backdrop: rgb(9 9 11 / .28);
  --boot-close-bg:     var(--bar-bg);
  --boot-close-border: var(--bar-border);
  --boot-close-fg:     var(--text-3);
  --boot-close-shadow: var(--bar-shadow);
  --in-spark:      #f6a823;                                  /* warm sparkle that still shows on white */
  --insert-tint:   rgb(255 255 255 / .82);                   /* white, blurred page behind */
  --insert-shadow: drop-shadow(0 14px 28px rgb(15 23 42 / .16));
}

/* Card buttons: a soft, "not yet active" grey key at rest in light mode
   (scoped to .card__btn so the dark dock keys stay as they are) */
[data-theme="light"] .card__btn {
  --key-face:     #f4f4f5;
  --key-face-top: #fafafa;
  --key-band:     #e4e4e7;               /* the 5px bottom "depth" band */
  --key-outline:  #d4d4d8;
  --key-fg:       #71717a;
  --key-lit-ink:  #0b2b27;               /* dark ink on the lit coloured key */
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .9),
    inset 0 -5px 0 var(--band),
    0 0 0 1px rgb(0 0 0 / .02);
}

[data-theme="light"] .boot__key {
  --key-face:     #f4f4f5;
  --key-face-top: #fafafa;
  --key-band:     #e4e4e7;
  --key-outline:  #d4d4d8;
  --key-fg:       #71717a;
  --key-fg-hi:    #18181b;
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .9),
    inset 0 -5px 0 var(--band),
    0 0 0 1px rgb(0 0 0 / .02);
}


/* 2. BASE ================================================================= */
/* PP Mondwest, self-hosted (Regular 400, Bold 700 for buttons) */
@font-face { font-family: "PP Mondwest"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/assets/fonts/PPMondwest-Regular.woff2") format("woff2"); }
@font-face { font-family: "PP Mondwest"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("/assets/fonts/PPMondwest-Bold.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[data-theme="light"] body { -webkit-font-smoothing: auto; }   /* dark text on white looks thin when antialiased */

h1, h2, h3, p { margin: 0; }
::selection { background: var(--selection); }
img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: var(--space-1) var(--space-2);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-2); }

/* Glass button: 12px corners, see-through fill */
.button {
  display: inline-flex;
  align-items: center;
  height: 3.5rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(var(--hover-fill), var(--border-strong));
  font-size: var(--text-small);
  font-weight: 500;
  transition: background-color 200ms, border-color 200ms;
}
.button:hover {
  background-color: var(--hover-fill);
  border-color: var(--text);
}


/* 3. TOP BAR =============================================================
   Glass pill: avatar · small divider · links. */
/* .topnav = the fixed, centred pair: the pill + the round theme button (siblings, never nested:
   a nested backdrop-filter would lose its blur). */
.topnav {
  position: fixed;
  top: var(--bar-top);
  left: 50%;
  translate: -50% 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: .5rem;
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
}
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);                     /* 32px around the divider */
  min-width: 0;
  height: var(--bar-height);
  padding: 0 var(--space-4) 0 .875rem;      /* left = space above/below the avatar (14px) */
  border: 1px solid var(--bar-border);
  border-radius: 100px;
  background: var(--bar-bg);
  box-shadow: var(--bar-shadow);
  -webkit-backdrop-filter: blur(var(--bar-blur)) saturate(var(--bar-sat));
          backdrop-filter: blur(var(--bar-blur)) saturate(var(--bar-sat));
  font-size: 1rem;
}
.topbar__home { display: flex; align-items: center; flex: none; }
.topbar__mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--mark-ring);
  object-fit: cover;
}
.topbar__divider {
  flex: none;
  width: 1px;
  height: 1rem;
  background: var(--bar-divider);
}
.topbar__links {
  display: flex;
  gap: var(--space-4);
  color: var(--text-2);
}
.topbar__links a {
  --c: var(--c-work);
  position: relative;
  display: inline-block;
  white-space: nowrap;
  transition: color 200ms;
}
.topbar__links a[href$="about.html"] { --c: var(--c-about); }
.topbar__links a[href$="lab.html"]   { --c: var(--c-lab); }
.topbar__links a:hover,
.topbar__links a[aria-current="page"] { color: var(--text); }
[data-theme="light"] .topbar__links a[aria-current="page"] { font-weight: 500; }

/* Theme switch: round glass button next to the pill, as tall as the pill.
   Shows the icon of the theme you will switch TO (sun while dark, moon while light). */
.theme-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--bar-height);
  height: var(--bar-height);
  padding: 0;
  border: 1px solid var(--bar-border);
  border-radius: 50%;
  background: var(--bar-bg);
  box-shadow: var(--bar-shadow);
  -webkit-backdrop-filter: blur(var(--bar-blur)) saturate(var(--bar-sat));
          backdrop-filter: blur(var(--bar-blur)) saturate(var(--bar-sat));
  color: var(--text-2);                    /* same grey as the nav links */
  -webkit-tap-highlight-color: transparent;
  transition: color 160ms cubic-bezier(.25, .46, .45, .94),
              background 160ms cubic-bezier(.25, .46, .45, .94),
              border-color 160ms cubic-bezier(.25, .46, .45, .94),
              scale 120ms;
}
.theme-btn:hover {
  color: var(--text);                      /* same as the nav links on hover */
  border-color: var(--bar-hover-border);
  background: var(--bar-hover-fill);
}
.theme-btn:active { scale: .97; }
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* thin smooth 16px icons (fixed px); colour comes only from the button's `color` */
.theme-btn__icon { width: 16px; height: 16px; }
.theme-btn .icon-moon { display: none; }
[data-theme="light"] .theme-btn .icon-sun  { display: none; }
[data-theme="light"] .theme-btn .icon-moon { display: inline; }

/* Colour change when switching themes (only after first paint, never with reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
    transition: background-color 200ms, color 200ms, border-color 200ms, box-shadow 200ms, fill 200ms, stroke 200ms !important;
  }
  html.theme-switching .hero__avatar { transition: opacity 200ms !important; }   /* portrait crossfade */
}

/* Nav hover: pixel rocket lift-off (word rumbles + rises, exhaust flame below, sparkles around) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .topbar__links a::before,
  .topbar__links a::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 2px;
    height: 2px;
    margin-left: -1px;
    opacity: 0;
    pointer-events: none;
  }

  /* Exhaust flame under the word: hot bone core, section-colour sparks */
  .topbar__links a::before {
    top: calc(100% + 1px);
    background: var(--text);
    box-shadow:
      -2px 0 var(--text), 2px 0 var(--text),
      0 2px var(--text), -2px 2px var(--c), 2px 2px var(--c),
      -4px 4px var(--c), 0 4px var(--c), 3px 4px var(--c),
      -1px 6px var(--c), 4px 7px var(--c),
      -3px 9px var(--c), 2px 10px var(--c),
      0 13px var(--c);
  }

  /* Sparkles: two pixel plus-stars + three single pixels around the word */
  .topbar__links a::after {
    top: 50%;
    margin-top: -1px;
    background: transparent;
    box-shadow:
      -30px -10px var(--c), -32px -10px var(--c), -28px -10px var(--c), -30px -12px var(--c), -30px -8px var(--c),
      30px -6px var(--c), 28px -6px var(--c), 32px -6px var(--c), 30px -8px var(--c), 30px -4px var(--c),
      22px -14px var(--c), -20px 8px var(--c), 36px 6px var(--c);
  }

  .topbar__links a:hover,
  .topbar__links a:focus-visible {
    animation: nav-liftoff 640ms steps(1, end) forwards;
  }
  .topbar__links a:hover::before,
  .topbar__links a:focus-visible::before {
    animation: nav-thrust 360ms steps(4) 140ms infinite;
  }
  .topbar__links a:hover::after,
  .topbar__links a:focus-visible::after {
    animation: nav-twinkle 900ms steps(3) 200ms infinite;
  }
}

@keyframes nav-liftoff {
  0%       { translate: 0 0; }
  12%      { translate: -1px 0; }
  24%      { translate: 1px 0; }
  36%      { translate: -1px 0; }
  48%      { translate: 0 -1px; }
  64%      { translate: 0 -2px; }
  80%,100% { translate: 0 -3px; }
}
@keyframes nav-thrust {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(6px); }
}
@keyframes nav-twinkle {
  0%   { opacity: 0; }
  33%  { opacity: 1; }
  66%  { opacity: .5; }
  100% { opacity: 0; }
}

@media (max-width: 47.99rem) {
  .topbar { gap: 1.125rem; padding: 0 1.25rem 0 .75rem; font-size: .9375rem; }
  .topbar__links { gap: 1.125rem; }
  .topbar__mark { width: 2rem; height: 2rem; }
}
/* Smallest phones: pill and button get a touch tighter so the pair still fits */
@media (max-width: 22rem) {
  .topnav { gap: .375rem; }
  .topbar { gap: .875rem; padding: 0 .875rem 0 .625rem; font-size: .875rem; }
  .topbar__links { gap: .875rem; }
  .topbar__mark { width: 1.75rem; height: 1.75rem; }
}


/* 3b. MOBILE MENU (below 48rem) =============================================
   js/main.js (block 9) adds .has-menu to .topnav and builds the menu button, the "theme" row and the backdrop.
   Collapsed: a small pill (avatar · divider · menu button) with the theme button beside it.
   Open (.is-menu-open): the pill itself grows into a panel with the links listed below.
   Without JS nothing here applies and the normal pill stays. */
.menu-btn, .topbar__more, .menu-backdrop { display: none; }
.menu__icon { display: none; }                 /* link icons show only in the mobile menu */
.menu-theme .icon-moon { display: none; }
[data-theme="light"] .menu-theme .icon-sun  { display: none; }
[data-theme="light"] .menu-theme .icon-moon { display: inline; }

@media (max-width: 47.99rem) {
  .topnav.has-menu {
    --mark: 2rem;
    --pill-w: calc(.75rem + var(--mark) + 1.125rem * 2 + 1px + 2.5rem + .5rem);   /* padding + avatar + gaps + divider + 40px button */
    --panel-w: min(calc(100vw - 2 * var(--gutter)), 22rem);
    --panel-h: calc(var(--bar-height) + 4px + 156px + 8px + 1px + 48px + 8px);    /* top row + 3 links + hairline + theme row */
    z-index: 40;
    width: var(--pill-w);
    /* centre the pair (pill + theme button) while collapsed; centre the panel alone when open */
    translate: calc(-50% - (var(--bar-height) + .5rem) / 2) 0;
    transition: width 220ms var(--ease-out), translate 220ms var(--ease-out);
  }
  .topnav.has-menu.is-menu-open {
    width: var(--panel-w);
    translate: -50% 0;
    transition-duration: 300ms;
  }

  .topnav.has-menu .topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: var(--bar-height) auto auto;
    align-content: start;
    gap: 0;
    width: 100%;
    height: var(--bar-height);
    padding: 0 .5rem 0 .75rem;
    overflow: hidden;
    border-radius: calc(var(--bar-height) / 2);
    transition: height 220ms var(--ease-out), border-radius 220ms var(--ease-out);
  }
  .topnav.has-menu.is-menu-open .topbar {
    height: var(--panel-h);
    border-radius: 1.5rem;
    transition-duration: 300ms;
  }
  .topnav.has-menu .topbar__home { grid-area: 1 / 1; }
  .topnav.has-menu .topbar__mark { width: var(--mark); height: var(--mark); }
  .topnav.has-menu .topbar__divider {
    grid-area: 1 / 2; justify-self: start; align-self: center;
    margin-left: 1.125rem;
    transition: opacity 120ms;
  }
  .topnav.has-menu.is-menu-open .topbar__divider { opacity: 0; }

  /* menu button: 40px round hit area, thin 16px two-line icon that turns into an X */
  .topnav.has-menu .menu-btn {
    grid-area: 1 / 3; align-self: center; justify-self: end;
    display: grid; place-items: center;
    width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--text-2);
    -webkit-tap-highlight-color: transparent;
    transition: color 160ms, background 160ms;
  }
  .topnav.has-menu .menu-btn:hover,
  .topnav.has-menu .menu-btn:active { color: var(--text); }
  .topnav.has-menu .menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .menu-btn svg { width: 16px; height: 16px; }
  .menu-btn line {
    stroke: currentColor; stroke-width: 1.5; stroke-linecap: round;
    transform-box: fill-box; transform-origin: center;
    transition: transform 200ms var(--ease-out);
  }
  .is-menu-open .menu-btn__a { transform: translateY(2.75px) rotate(45deg); }
  .is-menu-open .menu-btn__b { transform: translateY(-2.75px) rotate(-45deg); }

  /* the theme button hangs beside the pill, and fades out while the panel is open */
  .topnav.has-menu .theme-btn {
    position: absolute; top: 0; left: calc(100% + .5rem);
    transition: opacity 160ms, visibility 0s, color 160ms, background 160ms, border-color 160ms, scale 120ms;
  }
  .topnav.has-menu.is-menu-open .theme-btn {
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 120ms, visibility 0s 120ms;
  }

  /* links, one per row */
  .topnav.has-menu nav {
    grid-area: 2 / 1 / 3 / 4;
    margin: 0 -.5rem 0 -.75rem;               /* reach the panel edges, so icons can line up with the avatar */
    padding: 4px 4px 0;
    visibility: hidden;
    transition: visibility 0s 220ms;
  }
  .topnav.has-menu.is-menu-open nav,
  .topnav.has-menu.is-menu-open .topbar__more { visibility: visible; transition-delay: 0s; }
  .topnav.has-menu .topbar__links { display: block; }
  .topnav.has-menu .topbar__links li,
  .topnav.has-menu .topbar__more {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 100ms, transform 100ms, visibility 0s 220ms;
  }
  .topnav.has-menu.is-menu-open .topbar__links li,
  .topnav.has-menu.is-menu-open .topbar__more {
    opacity: 1;
    transform: none;
    transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
    transition-delay: calc(80ms + var(--i, 3) * 40ms);
  }
  .topnav.has-menu .topbar__links a {
    display: flex; align-items: center; gap: .75rem;
    height: 52px; padding: 0 1rem 0 8px;      /* 4px nav inset + 8px = 12px: the icon lines up with the avatar */
    border-radius: .875rem;
    font-size: 1.0625rem;
    color: var(--text-2);
    -webkit-tap-highlight-color: transparent;
    transition: color 160ms cubic-bezier(.25, .46, .45, .94), background 160ms cubic-bezier(.25, .46, .45, .94);
  }
  /* no desktop rocket flame / sparkles in the menu */
  .topnav.has-menu .topbar__links a::before,
  .topnav.has-menu .topbar__links a::after { display: none; }
  .menu__icon { display: block; flex: none; width: 16px; height: 16px; }
  .topnav.has-menu .topbar__links a:hover,
  .topnav.has-menu .topbar__links a:focus-visible { animation: none; }
  .topnav.has-menu .topbar__links a:active,
  .topnav.has-menu .topbar__links a[aria-current="page"] { background: var(--hover-fill); }
  .topnav.has-menu .topbar__links a[aria-current="page"] { color: var(--text); font-weight: 500; }
  .topnav.has-menu .topbar__links a:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
  @media (hover: hover) {
    .topnav.has-menu .topbar__links a:hover { background: var(--hover-fill); color: var(--text); }
  }

  /* hairline + quiet "theme" row */
  .topnav.has-menu .topbar__more { grid-area: 3 / 1 / 4 / 4; display: block; margin: 0 -.5rem 0 -.75rem; padding: 8px 4px 8px; visibility: hidden; }
  .topbar__sep { display: block; height: 1px; margin: 0 8px 0 12px; background: var(--bar-divider); }
  .menu-theme {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; height: 48px; padding: 0 12px 0 8px;
    border: 0; border-radius: .875rem; background: transparent;
    font: inherit; font-size: .875rem; color: var(--text-3);
    -webkit-tap-highlight-color: transparent;
  }
  .menu-theme:active { background: var(--hover-fill); }
  .menu-theme:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
  .menu-theme svg { width: 16px; height: 16px; }

  /* backdrop behind the panel; tap to close */
  .menu-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 35;
    background: rgb(0 0 0 / .35);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    opacity: 0; visibility: hidden;
    transition: opacity 150ms, visibility 0s 150ms;
  }
  [data-theme="light"] .menu-backdrop { background: rgb(255 255 255 / .45); }
  .menu-backdrop.is-on { opacity: 1; visibility: visible; transition: opacity 200ms, visibility 0s; }
}
html.menu-lock { overflow: hidden; }

/* reduced motion: no growing or rising, only a quick fade */
@media (max-width: 47.99rem) and (prefers-reduced-motion: reduce) {
  .topnav.has-menu, .topnav.has-menu .topbar, .topnav.has-menu .topbar__divider, .menu-btn line { transition: none !important; }
  .topnav.has-menu .topbar__links li, .topnav.has-menu .topbar__more { transform: none !important; transition: opacity 120ms !important; transition-delay: 0s !important; }
  .menu-backdrop { transition-duration: 120ms !important; }
}

/* 4. HERO ================================================================= */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100svh;
  padding: calc(var(--nav-clear) + var(--nav-gap)) var(--gutter) var(--space-5);
  text-align: center;
  isolation: isolate;
  overflow-x: clip; /* the glow is wider than a phone screen */
}

/* Photo block: a pixel-art portrait, shown uncropped, over the pixel water. */
.hero__visual {
  position: relative;
  width: min(100%, calc(var(--hero-visual) * 1.13));
  aspect-ratio: 800 / 716;
  margin-bottom: var(--space-4);
}

/* Pixel-art water behind the photo, centred on the circle (js/main.js) */
.hero__water {
  position: absolute; left: 50%; top: 45%; z-index: -1;
  width: 210%; aspect-ratio: 1; translate: -50% -50%;
  pointer-events: none;
  image-rendering: pixelated;
}
@media (max-width: 47.99rem) {
  .hero__water { width: 175%; opacity: .75; }   /* calmer on phones */
}

.hero__avatar {
  position: relative;
  width: 100%;
  height: auto;
  image-rendering: pixelated; /* keeps the pixels sharp when scaled */
  animation: settle 1200ms 200ms var(--ease-out) backwards;   /* 'backwards' (not 'both') so the theme fade below still works afterwards */
}
/* Two portraits stacked in the same box: the one for the current theme shows, the other fades out */
.hero__avatar--light { position: absolute; inset: 0; }
[data-theme="dark"] .hero__avatar--light,
[data-theme="light"] .hero__avatar--dark { opacity: 0; }
.theme-ready .hero__avatar--light,
.theme-ready .hero__avatar--dark { transition: opacity 200ms; }

/* Hero intro: small arcade name-plate under the portrait */
.hero__intro {
  --cut: 3px;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: var(--space-3);
  padding: 10px 16px;
  font-family: var(--font-display); text-transform: none;
  font-size: .9375rem;
  line-height: 1.3;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--text);
  background: var(--bg-chip);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  clip-path: polygon(0 var(--cut), var(--cut) var(--cut), var(--cut) 0, calc(100% - var(--cut)) 0, calc(100% - var(--cut)) var(--cut), 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, var(--cut) calc(100% - var(--cut)), 0 calc(100% - var(--cut)));
  animation: settle 1000ms 350ms var(--ease-out) both;
}
.hero__dot {
  flex: none;
  width: 6px;
  height: 6px;
  background: var(--accent);
  animation: intro-dot 2.4s steps(1) infinite;
}
@keyframes intro-dot { 0% { opacity: 1; } 85% { opacity: .25; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero__dot { animation: none; } }

/* Phones: roomier plate, slightly tighter type so it stays on one row;
   dot lines up with the first text line if it ever wraps */
@media (max-width: 47.99rem) {
  .hero__intro {
    align-items: flex-start;
    max-width: 100%;
    padding: 10px 16px;
    white-space: normal;
    text-align: left;
  }
  .hero__dot { margin-top: calc((1.3em - 6px) / 2); }
}
@media (min-width: 64rem) { .hero__intro { font-size: 1rem; } }

.hero__title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display); text-transform: none;
  color: var(--text-strong);
  font-size: var(--text-hero-phone); /* phones: each line fits on one row */
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
  animation: settle 1000ms 450ms var(--ease-out) both;
}

.hero__line { display: block; }

@media (min-width: 48rem) {
  .hero__title { font-size: var(--text-hero); }
}

/* "Say hi": chunky game-style button (glossy face, 3D base, press effect) */
.game-btn {
  --face: var(--btn-face);
  --face-top: var(--btn-face-top);
  --band: var(--btn-band);        /* darker turquoise base = the 3D depth */
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 9.5rem; height: 3.75rem; padding: 0 1.75rem 6px;
  font-family: var(--font-display); text-transform: none; font-weight: 700;
  font-size: 1.375rem; letter-spacing: .01em;
  color: var(--btn-ink); text-shadow: 0 1px 0 color-mix(in srgb, var(--hi) 35%, transparent);
  text-decoration: none; user-select: none;
  background: linear-gradient(var(--face-top), var(--face) 55%);
  border: 3px solid transparent; border-radius: 14px;   /* see-through rim: the page shows between the face and the thin ring */
  background-clip: padding-box;
  box-shadow:
    inset 0 3px 0 color-mix(in srgb, var(--hi) 50%, transparent),
    inset 0 -8px 0 var(--band),
    0 0 0 1px var(--btn-ring),
    0 10px 22px var(--btn-drop);
  transition: translate 120ms cubic-bezier(.3, 1.6, .5, 1), box-shadow 120ms, filter 120ms, padding 120ms;
  -webkit-tap-highlight-color: transparent;
  animation: settle 1000ms 550ms var(--ease-out) both;
}

/* "say hi!" is lowercase: the display font's arcade shapes read nicely */
.game-btn--hi { letter-spacing: .01em; }

/* Hover only on devices with a real mouse (prevents "sticky" hover on phones) */
@media (hover: hover) {
  .game-btn:hover {
    translate: 0 -2px;
    filter: brightness(1.08);
    box-shadow:
      inset 0 3px 0 color-mix(in srgb, var(--hi) 60%, transparent),
      inset 0 -8px 0 var(--band),
      0 0 0 1px var(--btn-ring-hover),
      0 0 0 6px var(--btn-halo),
      0 14px 26px var(--btn-drop-hover);
  }
}

/* Pressed: works for mouse click and finger tap */
.game-btn:active {
  translate: 0 4px;
  padding-bottom: 2px;
  filter: brightness(.96);
  transition-duration: 60ms;
  box-shadow:
    inset 0 3px 0 color-mix(in srgb, var(--hi) 35%, transparent),
    inset 0 -3px 0 var(--band),
    0 0 0 1px var(--btn-ring-active),
    0 3px 8px var(--btn-drop-active);
}

.game-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

@media (prefers-reduced-motion: reduce) {
  .game-btn { transition: none; }
}

@keyframes settle {
  from { transform: translateY(1.5rem); opacity: 0; }
}

/* Desktop: fit the hero to the window height so "Say hi" is always above the
   fold on laptops. These come last so they win over the rules above. */
@media (min-width: 48rem) {
  .hero {
    padding-top: calc(var(--nav-clear) + var(--nav-gap));
    padding-bottom: clamp(1.5rem, 4svh, 4rem);
  }
  .hero__title {
    /* full size on tall screens, shrinks a little on short laptop windows */
    font-size: min(var(--text-hero), 11.5svh);
    margin: 0 0 clamp(.75rem, 2.5svh, 1.5rem);
  }
  .hero__visual {
    /* the portrait takes whatever height is left, so the button always fits */
    height: clamp(11rem, 62.5svh - 15.5rem, 30rem);
    width: auto;
    margin-bottom: clamp(1rem, 2.5svh, 2rem);
  }
}


/* 4b. SKILL PILLS =========================================================
   Pixel "arcade" pills drifting around the hero (js/badges.js builds them, wide screens only; the skills
   live at the top of that file). The outer .badge is moved by the physics and is the deeper-coloured outline;
   .badge__face is the lighter face inside it. Both share one stepped, pixel-cut capsule shape. Colours are
   muted on purpose so "say hi!" stays the only fully saturated thing in the hero. */
.badges { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
[data-theme="light"] .badges { filter: drop-shadow(0 2px 3px rgb(0 0 0 / .06)); }   /* on the group: a clip-path would cut it off the pill itself */
.badge {
  /* 3 two-pixel steps per corner (insets 6 / 4 / 2px) */
  --pill-clip: polygon(6px 0, calc(100% - 6px) 0, calc(100% - 6px) 2px, calc(100% - 4px) 2px, calc(100% - 4px) 4px, calc(100% - 2px) 4px, calc(100% - 2px) 6px, 100% 6px,
    100% calc(100% - 6px), calc(100% - 2px) calc(100% - 6px), calc(100% - 2px) calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) calc(100% - 2px), calc(100% - 6px) calc(100% - 2px), calc(100% - 6px) 100%,
    6px 100%, 6px calc(100% - 2px), 4px calc(100% - 2px), 4px calc(100% - 4px), 2px calc(100% - 4px), 2px calc(100% - 6px), 0 calc(100% - 6px),
    0 6px, 2px 6px, 2px 4px, 4px 4px, 4px 2px, 6px 2px);
  --c: var(--c-work);
  /* dark mode colours, all mixed from the pill's own colour */
  --pill-edge:     color-mix(in srgb, var(--c) 45%, #0d0d0d);
  --pill-face-top: color-mix(in srgb, var(--c) 30%, #141414);
  --pill-face:     color-mix(in srgb, var(--c) 24%, #141414);
  --pill-band:     color-mix(in srgb, var(--c) 14%, #0d0d0d);
  --pill-ink:      color-mix(in srgb, var(--c) 75%, #ffffff);
  --pill-text-shadow: none;
  position: absolute; left: 0; top: 0;
  display: block; box-sizing: border-box;
  height: 36px; padding: 0 16px;
  background: var(--pill-edge);
  clip-path: var(--pill-clip);
  opacity: .9;                         /* sits back slightly at rest */
  transition: opacity 200ms;
  pointer-events: none;                /* can't be clicked or dragged; never blocks anything underneath */
  will-change: transform;
  animation: badge-pop 420ms var(--ease-out) calc(1.6s + var(--i, 0) * 60ms) backwards;
}
.badge.is-fleeing { opacity: 1; }
.badge--about { --c: var(--c-about); }
.badge--lab   { --c: var(--c-lab); }
.badge--pink   { --c: var(--c-pink); }
.badge--purple { --c: var(--c-purple); }
.badge--orange { --c: var(--c-orange); }
[data-theme="light"] .badge {
  --pill-edge:     color-mix(in srgb, var(--c) 55%, #ffffff);
  --pill-face-top: color-mix(in srgb, var(--c) 14%, #ffffff);
  --pill-face:     color-mix(in srgb, var(--c) 20%, #ffffff);
  --pill-band:     color-mix(in srgb, var(--c) 32%, #ffffff);
  --pill-ink:      color-mix(in srgb, var(--c) 55%, #000000);
  --pill-text-shadow: 0 1px 0 rgb(255 255 255 / .35);
}
.badge__face {
  position: absolute; inset: 2px;
  clip-path: var(--pill-clip);
  background: linear-gradient(var(--pill-face-top), var(--pill-face) 55%);
  box-shadow: inset 0 -4px 0 var(--pill-band);
}
/* highlight: a short dash and a dot, top-left */
.badge__face::before, .badge__face::after { content: ""; position: absolute; top: 3px; height: 2px; background: rgb(255 255 255 / .75); }
.badge__face::before { left: 7px; width: 8px; }
.badge__face::after  { left: 17px; width: 2px; }
.badge__text {
  position: relative; display: block;
  line-height: 34px;                   /* centred on the face above the bottom band */
  font-family: var(--font-display); text-transform: none;
  font-size: 14px; letter-spacing: .02em; white-space: nowrap;
  color: var(--pill-ink);
  text-shadow: var(--pill-text-shadow);
}
/* Phones and narrow windows ("pocket" mode in js/badges.js): the same pill, smaller. 2 steps per corner (4 / 2px),
   2px outline, 3px bottom band, 5x1 highlight dash + 1x1 dot, 11px text. Short labels are set by the script. */
.badges--pocket .badge {
  --pill-clip: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 2px, calc(100% - 2px) 2px, calc(100% - 2px) 4px, 100% 4px,
    100% calc(100% - 4px), calc(100% - 2px) calc(100% - 4px), calc(100% - 2px) calc(100% - 2px), calc(100% - 4px) calc(100% - 2px), calc(100% - 4px) 100%,
    4px 100%, 4px calc(100% - 2px), 2px calc(100% - 2px), 2px calc(100% - 4px), 0 calc(100% - 4px),
    0 4px, 2px 4px, 2px 2px, 4px 2px);
  height: 24px; padding: 0 9px;
  opacity: .85;
}
.badges--pocket .badge__face { box-shadow: inset 0 -3px 0 var(--pill-band); }
.badges--pocket .badge__face::before, .badges--pocket .badge__face::after { top: 2px; height: 1px; }
.badges--pocket .badge__face::before { left: 5px; width: 5px; }
.badges--pocket .badge__face::after  { left: 12px; width: 1px; }
.badges--pocket .badge__text { line-height: 22px; font-size: 11px; }
@keyframes badge-pop { from { scale: .3; opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .badge { animation: none; transition: none; }
}

/* 5. CARDS ================================================================
   Grey at rest. On hover (desktop) or while on screen (phones) each card
   reveals its own colour: a dark gradient, the pixel wave pattern, a
   coloured animated icon and a "label + arrow" pill. */
.card[hidden] { display: none; }            /* .card { display: flex } would beat the browser's [hidden] rule */
.cards {
  display: grid;
  grid-template-columns: 5fr 7fr;          /* row 2: Fun Lab a bit wider than Who dis */
  gap: var(--space-3);
  width: min(100% - 2 * var(--gutter), 64rem);
  margin: 0 auto var(--space-6);
}
.card--work  { --c: var(--c-work); grid-column: 1 / -1; min-height: 26rem; }   /* full row */
.card--about { --c: var(--c-about); }
.card--lab   { --c: var(--c-lab); }

.card {
  --play: paused;
  --ease: cubic-bezier(.2, .8, .2, 1);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 24rem;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: 40px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  color: var(--text);
  text-decoration: none;
}

/* hidden colour layers: gradient + pixel water (drawn by js/main.js) */
.card__glow,
.card__water {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 500ms var(--ease);
  pointer-events: none;
}
.card__glow {
  background: linear-gradient(64deg,
    color-mix(in srgb, var(--c) var(--card-glow-a), var(--bg-card)) 0%,
    color-mix(in srgb, var(--c) var(--card-glow-b), var(--bg-card)) 100%);
}
.card__water { image-rendering: pixelated; }

/* text */
.card__body { position: relative; display: flex; flex-direction: column; max-width: 26rem; }
.card__meta {
  font-size: .75rem;              /* 12px */
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.card__title {
  font-family: var(--font-display); text-transform: none;
  font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.005em;
  margin-block: .75rem;           /* meta → title → description */
}
.card__text {
  max-width: 24rem;
  font-size: .9375rem;            /* 15px / 24px */
  line-height: 1.6;
  letter-spacing: -0.011em;
  color: var(--text-2);
}

/* pixel icon: grey at rest, coloured + animated on hover */
.card__art {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: auto;
  height: clamp(4rem, 3rem + 3vw, 5.5rem);
  fill: color-mix(in srgb, var(--text) var(--art-rest), var(--bg-card));
  shape-rendering: crispEdges;
  overflow: hidden;
  transition: fill 450ms var(--ease), translate 450ms var(--ease);
}
/* Who dis + Fun Lab: bigger icon in the bottom-right corner */
.card--about .card__art,
.card--lab .card__art { top: auto; bottom: var(--space-4); height: clamp(5.5rem, 4rem + 4vw, 8rem); }
.card__art .liq   { fill: color-mix(in srgb, var(--text) var(--art-rest-liq), var(--bg-card)); transition: fill 450ms var(--ease); }
.card__art .smoke { fill: var(--text); }
/* At rest the icons sit in their default pose; hover/focus (or on screen on phones) starts them from the beginning */
.card:not(:hover, :focus-visible, .is-on-screen) .card__art * { animation: none !important; }

/* Works: retro screen for screenshots, bottom-right, also grey until hover */
.card--work .teaser__screen {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  width: min(36%, 21rem);
  margin: 0;
  filter: var(--screen-filter);
  transition: filter 450ms var(--ease), translate 450ms var(--ease);
}

/* ---- the reveal: hover/focus on desktop, on-screen on phones ---------- */
.card:is(:hover, :focus-visible),
.card.is-on-screen { --play: running; }
.card:is(:hover, :focus-visible) .card__glow,
.card.is-on-screen .card__glow { opacity: 1; }
.card:is(:hover, :focus-visible) .card__art,
.card.is-on-screen .card__art { fill: var(--c); translate: 0 -6px; }
.card:is(:hover, :focus-visible) .card__art .liq,
.card.is-on-screen .card__art .liq { fill: color-mix(in srgb, var(--c) 50%, transparent); }
.card:is(:hover, :focus-visible) .teaser__screen,
.card.is-on-screen .teaser__screen { filter: none; translate: 0 -6px; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* phones: one column, slightly smaller corners */
@media (max-width: 47.99rem) {
  .cards { grid-template-columns: 1fr; gap: var(--space-2); }
  .card { min-height: 22rem; padding: var(--space-3); border-radius: 28px; }
  .card--work { min-height: 0; }
  .card__art { top: var(--space-3); right: var(--space-3); height: 3.5rem; }
  .card--about .card__art,
  .card--lab .card__art { bottom: var(--space-3); height: 5rem; }
  .card--work .card__body { padding-right: 4rem; }          /* keep text clear of the icon */
  .card--work .teaser__screen { position: relative; inset: auto; width: 100%; margin: var(--space-3) 0; }
}
@media (prefers-reduced-motion: reduce) {
  .card__art *, .teaser__shots img { animation: none !important; }
}

/* More breathing room between the hero and the cards */
/* was: clamp(4rem, 1.5rem + 7vw, 9rem); the shelf now takes that gap under the hero */
.cards { margin-top: clamp(4rem, 2rem + 5vw, 7.5rem); }

/* Pixel water: quieter, and kept clear of the icon */
.card:is(:hover, :focus-visible) .card__water,
.card.is-on-screen .card__water { opacity: .32; }
.card--work .card__water {
  -webkit-mask-image: radial-gradient(circle at calc(100% - 4.5rem) 4.5rem, transparent 3.5rem, var(--shade) 7rem);
          mask-image: radial-gradient(circle at calc(100% - 4.5rem) 4.5rem, transparent 3.5rem, var(--shade) 7rem);
}
.card--about .card__water,
.card--lab .card__water {
  -webkit-mask-image: radial-gradient(circle at calc(100% - 5.5rem) calc(100% - 5.5rem), transparent 4.5rem, var(--shade) 8.5rem);
          mask-image: radial-gradient(circle at calc(100% - 5.5rem) calc(100% - 5.5rem), transparent 4.5rem, var(--shade) 8.5rem);
}

/* Card button: small arcade key (same family as the dock "+" key and Say hi).
   Dark at rest; lights up in the card colour (--c) when the card is hovered/focused/on screen. */
.card__btn {
  --face: var(--key-face);
  --face-top: var(--key-face-top);
  --band: var(--key-band);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: .625rem;
  margin-top: auto;
  height: 3rem;
  padding: 0 1rem 5px 1.25rem;
  font-family: var(--font-display); text-transform: none;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: .01em;
  white-space: nowrap;
  color: var(--key-fg);
  background: linear-gradient(var(--face-top), var(--face) 60%);
  border: 2px solid var(--key-outline);
  border-radius: 10px;
  box-shadow:
    inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
    inset 0 -5px 0 var(--band),
    0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent);
  transition:
    color 300ms var(--ease),
    box-shadow 300ms var(--ease),
    translate 120ms cubic-bezier(.3, 1.6, .5, 1),
    filter 120ms,
    padding 120ms;
}

/* Lit face in the card colour, cross-faded with opacity */
.card__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 8px;
  background: linear-gradient(color-mix(in srgb, var(--c) 62%, var(--hi)), var(--c) 58%);
  box-shadow:
    inset 0 2px 0 color-mix(in srgb, var(--hi) 45%, transparent),
    inset 0 -5px 0 color-mix(in srgb, var(--c) 55%, var(--shade));
  opacity: 0;
  transition: opacity 300ms var(--ease);
}

.card__btn svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

.card:is(:hover, :focus-visible) .card__btn,
.card.is-on-screen .card__btn {
  color: color-mix(in srgb, var(--c) 18%, var(--key-lit-ink));
  text-shadow: 0 1px 0 color-mix(in srgb, var(--hi) 30%, transparent);
  box-shadow:
    inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
    inset 0 -5px 0 var(--band),
    0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent),
    0 8px 20px color-mix(in srgb, var(--c) 18%, transparent);
}
.card:is(:hover, :focus-visible) .card__btn::before,
.card.is-on-screen .card__btn::before { opacity: 1; }

/* Chevron dashes forward in pixel steps while the card is hovered/focused */
.card:is(:hover, :focus-visible) .card__btn svg { animation: btn-dash 720ms steps(1) infinite; }

/* Pressed */
.card:active .card__btn { translate: 0 3px; padding-bottom: 2px; }
.card:active .card__btn::before {
  box-shadow:
    inset 0 2px 0 color-mix(in srgb, var(--hi) 35%, transparent),
    inset 0 -2px 0 color-mix(in srgb, var(--c) 55%, var(--shade));
}

/* Same hover as the hero Say hi (.game-btn:hover): lift, brighten, colour halo */
@media (hover: hover) {
  .card .card__btn:hover, .card:focus-visible .card__btn {
    translate: 0 -2px;
    filter: brightness(1.08);
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
      inset 0 -5px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--c) 50%, transparent),
      0 0 0 6px color-mix(in srgb, var(--c) 14%, transparent),
      0 12px 24px color-mix(in srgb, var(--shade) 50%, transparent);
  }
  .card .card__btn:hover::before, .card:focus-visible .card__btn::before {
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 60%, transparent),
      inset 0 -5px 0 color-mix(in srgb, var(--c) 55%, var(--shade));
  }

  /* Pressed beats hover (same as .game-btn:active) */
  .card:active .card__btn {
    translate: 0 3px;
    padding-bottom: 2px;
    filter: brightness(.96);
    transition-duration: 60ms;
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
      inset 0 -2px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent),
      0 3px 8px color-mix(in srgb, var(--shade) 40%, transparent);
  }
  .card:active .card__btn::before {
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 35%, transparent),
      inset 0 -2px 0 color-mix(in srgb, var(--c) 55%, var(--shade));
  }
}

@keyframes btn-dash {
  0%   { translate: 0 0; }
  33%  { translate: 2px 0; }
  66%  { translate: 4px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card__btn svg { animation: none !important; }
}

/* Card icon + screen animations ------------------------------------------ */
/* WORKS: two crossed wrenches give a small "tightening" tilt, then rest */
.art-work .wr { transform-box: view-box; transform-origin: 8px 8px; }
.art-work .wr-a { animation: wr-a 3.6s steps(1, end) infinite; }
.art-work .wr-b { animation: wr-b 3.6s steps(1, end) infinite; }
@keyframes wr-a { 0%, 54% { transform: none; } 55%, 62% { transform: rotate(6deg); } 63%, 68% { transform: none; } 69%, 76% { transform: rotate(6deg); } 77%, 100% { transform: none; } }
@keyframes wr-b { 0%, 54% { transform: none; } 55%, 62% { transform: rotate(-6deg); } 63%, 68% { transform: none; } 69%, 76% { transform: rotate(-6deg); } 77%, 100% { transform: none; } }

/* WHO DIS: calm idle. Blinks, glances left and right, then a wink with a wider smile */
.art-who .eyes-shut, .art-who .wink-r, .art-who .m-grin { opacity: 0; }
.art-who .eyes      { animation: who-look 6s steps(1, end) infinite; }
.art-who .eye-r     { animation: who-eye-r 6s steps(1, end) infinite; }
.art-who .eye-l     { animation: who-eye-l 6s steps(1, end) infinite; }
.art-who .eyes-shut { animation: who-shut 6s steps(1, end) infinite; }
.art-who .wink-r    { animation: who-wink 6s steps(1, end) infinite; }
.art-who .m-smile   { animation: who-smile 6s steps(1, end) infinite; }
.art-who .m-grin    { animation: who-grin 6s steps(1, end) infinite; }
@keyframes who-look  { 0%, 34% { transform: none; } 35%, 47% { transform: translateX(-1px); } 48%, 60% { transform: translateX(1px); } 61%, 100% { transform: none; } }
@keyframes who-eye-l { 0%, 19% { opacity: 1; } 20%, 22% { opacity: 0; } 23%, 100% { opacity: 1; } }
@keyframes who-eye-r { 0%, 19% { opacity: 1; } 20%, 22% { opacity: 0; } 23%, 77% { opacity: 1; } 78%, 89% { opacity: 0; } 90%, 100% { opacity: 1; } }
@keyframes who-shut  { 0%, 19% { opacity: 0; } 20%, 22% { opacity: 1; } 23%, 100% { opacity: 0; } }
@keyframes who-wink  { 0%, 77% { opacity: 0; } 78%, 89% { opacity: 1; } 90%, 100% { opacity: 0; } }
@keyframes who-smile { 0%, 77% { opacity: 1; } 78%, 89% { opacity: 0; } 90%, 100% { opacity: 1; } }
@keyframes who-grin  { 0%, 77% { opacity: 0; } 78%, 89% { opacity: 1; } 90%, 100% { opacity: 0; } }

/* default (static) frames, also used for reduced motion */
.art-lab .lab-tip, .art-lab .drop, .art-lab .puddle, .art-lab .smoke { opacity: 0; }

/* FUN LAB: bubbles, a wobble, tips over, pours drops into a puddle that smokes */
.art-lab .lab-up  { animation: lab-up 5s infinite; }
.art-lab .lab-tip { animation: lab-tip 5s infinite; }
.art-lab .b1 { animation: bub 1s infinite; }
.art-lab .b2 { animation: bub 1s .5s infinite; }
@keyframes bub { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes lab-up { 0%, 25% { opacity: 1; transform: none; } 26% { transform: translateX(1px); } 28% { transform: translateX(-1px); } 30% { transform: translateX(1px); } 32% { transform: none; } 33%, 82% { opacity: 0; transform: none; } 83%, 100% { opacity: 1; } }
@keyframes lab-tip { 0%, 32% { opacity: 0; } 33%, 82% { opacity: 1; } 83%, 100% { opacity: 0; } }
.art-lab .drop { animation: drop 5s infinite; }
.art-lab .d2 { animation-delay: .45s; }
.art-lab .d3 { animation-delay: .9s; }
@keyframes drop {
  0%, 35% { opacity: 0; transform: translateY(0); }
  36% { opacity: 1; transform: translateY(0); }
  38% { transform: translateY(1px); } 40% { transform: translateY(2px); } 42% { transform: translateY(3px); }
  44%, 100% { opacity: 0; transform: translateY(3px); }
}
.art-lab .p1 { animation: p1 5s infinite; }
.art-lab .p2 { animation: p2 5s infinite; }
@keyframes p1 { 0%, 44% { opacity: 0; } 45%, 54% { opacity: 1; } 55%, 100% { opacity: 0; } }
@keyframes p2 { 0%, 54% { opacity: 0; } 55%, 90% { opacity: 1; } 91%, 100% { opacity: 0; } }
.art-lab .smoke { animation: smoke 5s infinite; }
.art-lab .s2 { animation-delay: .5s; }
.art-lab .s3 { animation-delay: 1s; }
@keyframes smoke {
  0%, 54% { opacity: 0; transform: translateY(0); }
  55% { opacity: .75; transform: translateY(0); }
  58% { transform: translateY(-1px); } 61% { opacity: .6; transform: translateY(-2px); }
  64% { transform: translateY(-3px); } 67% { opacity: .4; transform: translateY(-4px); }
  70% { opacity: .2; transform: translateY(-5px); } 73%, 100% { opacity: 0; transform: translateY(-6px); }
}

/* --- screenshot "screen" (works with 0, 1, 2 or 3 images) ---------------- */
.teaser__screen {
  --n: 4px;
  position: relative; z-index: 1;
  display: block;
  width: min(100%, 22rem);
  aspect-ratio: 16 / 10;
  padding-top: 12px;                         /* window bar */
  background:
    radial-gradient(circle, color-mix(in srgb, var(--c) 70%, transparent) 1.5px, transparent 2px) 6px 3px / 7px 6px repeat-x,
    color-mix(in srgb, var(--c) 22%, var(--screen));
  background-size: 7px 6px, auto;
  background-repeat: no-repeat;
  outline: 2px solid color-mix(in srgb, var(--c) 40%, transparent); outline-offset: -2px;
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)));
  transition: translate 160ms steps(2);
}
.teaser__shots { position: absolute; inset: 12px 2px 2px; overflow: hidden; background: var(--screen); }
.teaser__shots::after {                      /* scanlines on the screen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--shade) 18%, transparent) 0 1px, transparent 1px 3px);
}
.teaser__shots img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  opacity: 0;
  animation: shot3 7.5s steps(1, end) infinite; animation-play-state: var(--play);
}
.teaser__shots img:first-child { opacity: 1; }
.teaser__shots img:nth-child(2) { animation-delay: 2.5s; }
.teaser__shots img:nth-child(3) { animation-delay: 5s; }
.teaser__shots img:only-child { animation: none; }
.teaser__shots:has(img:nth-child(2):last-child) img { animation-name: shot2; animation-duration: 5s; }
@keyframes shot3 { 0% { opacity: 1; } 33.33%, 100% { opacity: 0; } }
@keyframes shot2 { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
/* placeholder until screenshots are added: an arcade test pattern */
.teaser__shots:not(:has(img)) {
  display: grid; place-items: center;
  background:
    linear-gradient(90deg, var(--c-work) 0 14.3%, var(--c-about) 0 28.6%, var(--c-lab) 0 42.9%, var(--paper) 0 57.2%, var(--c-work) 0 71.5%, var(--c-about) 0 85.8%, var(--c-lab) 0) top / 100% 62% no-repeat,
    repeating-linear-gradient(90deg, var(--screen-2) 0 8px, var(--screen) 8px 16px) bottom / 100% 38% no-repeat;
  filter: saturate(.45) brightness(.4);
}
.teaser__shots:not(:has(img))::before {
  content: "screens loading"; position: relative; z-index: 1;
  padding: .3em .7em; background: var(--screen); color: var(--paper);
  font-family: var(--font-display); text-transform: none; font-size: .8rem; letter-spacing: .01em;
  filter: saturate(1.8) brightness(1.8);
}


/* 5b. SHELF + BOOT PANEL (round 23) =========================================
   "Selected work": a row of game cartridges (one per project) seated in a rail.
   Hover lifts and colours one; click opens the boot panel (a <dialog>, js/shelf.js).
   Lit states only set custom properties (--ring, --led, --lift ...), so hover, keyboard
   focus and "current on phones" all share the same look. */

.shelf {
  width: min(100% - 2 * var(--gutter), 64rem);   /* same column as .cards */
  margin: clamp(4rem, 1.5rem + 7vw, 9rem) auto 0;
  --bleed: 24px;                                  /* room for the hover glow at the row ends */
}
.shelf__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.shelf__kicker { margin: 0 0 .375rem; font-family: var(--font-display); font-size: .9375rem; line-height: 1.2; letter-spacing: .01em; color: var(--text-3); }
.shelf__title  { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem); line-height: 1.05; letter-spacing: -0.005em; color: var(--text); }

.shelf__scroller {
  container-type: inline-size;
  margin-inline: calc(-1 * var(--bleed));
  padding: 32px var(--bleed) 44px;               /* 32 = lift room, 44 = rail + glow room */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--bleed);
  scrollbar-width: none;
}
.shelf__scroller::-webkit-scrollbar { display: none; }

.shelf__track {
  position: relative; isolation: isolate;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  gap: var(--space-3);                            /* 24px */
  margin: 0; padding: 0; list-style: none;
}
/* the rail: covers the bottom 12px of every cartridge */
.shelf__track::after {
  content: ""; position: absolute; z-index: 2; pointer-events: none;
  left: -16px; right: -16px; bottom: -8px; height: 20px;
  border-radius: 6px;
  background: var(--rail-face);
  border: 1px solid var(--rail-side);
  border-top-color: var(--rail-edge);
}

/* 3 columns while there's room (each >= 250px); below that, the sideways scroller */
@container (max-width: 49.99rem) {
  .shelf__track { display: flex; gap: .75rem; width: max-content; }
  .shelf__track > li { flex: 0 0 min(17.5rem, 76vw); scroll-snap-align: start; }
}
@media (max-width: 47.99rem) {
  .shelf { --bleed: var(--gutter); }
  .shelf__head { margin-bottom: .5rem; }
}

/* desktop grid: the row never scrolls, so it must not clip the glow */
.shelf:not(.is-scroller) .shelf__scroller { overflow: visible; }

/* scroller mode (phones / narrow): it must clip sideways, so give the glow room above
   and run the row to the screen edges */
.shelf.is-scroller { --bleed: var(--gutter); }
.shelf.is-scroller .shelf__scroller { padding-top: 96px; margin-top: -64px; }   /* +64px room, same visual position */

.shelf__dots { display: none; }
.shelf.is-scroller .shelf__dots { display: flex; justify-content: center; gap: 8px; margin-top: -12px; }
.shelf__dots span { width: 6px; height: 6px; background: var(--border-strong); transition: background 200ms; }
.shelf__dots span.is-current { background: var(--c); }

/* ---- the cartridge ---- */
.cart {
  --ring: var(--cart-edge);
  --led: var(--cart-led);
  --led-glow: transparent;
  --label-filter: var(--screen-filter);
  --label-ring: transparent;
  --glow: 0;                                      /* glow layer strength (.cart::after) */
  --sheen: 0;
  --lift: 0px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  position: relative; z-index: 1;
  display: grid; grid-template-rows: auto auto 1fr;   /* the strip's 16cqi height is on .cart__top: cqi on the container itself would measure the outer row, not the cartridge */
  aspect-ratio: 4 / 5;                            /* = the 200×250 silhouette, so it never stretches */
  container-type: inline-size;                    /* inner sizes follow the cartridge width (cqi) */
  color: var(--text); text-decoration: none;
  border-radius: 6.5% / 5.2%; outline: none;
  -webkit-tap-highlight-color: transparent;
  perspective: 1100px; --tx: 0deg; --ty: 0deg;
  transition: opacity 300ms var(--ease);
}
.cart__body {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto auto 1fr;
  border-radius: inherit;
  transform-style: preserve-3d;
  translate: 0 var(--lift);
  transform: rotateX(var(--tx)) rotateY(var(--ty));
}
.cart__shell {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; overflow: visible;
  fill: var(--cart-face); stroke: var(--ring);
  filter: var(--cart-shadow);
  transition: stroke 300ms var(--ease);
}
/* Glow: its own layer BEHIND the cartridge (not a drop-shadow on the shell). Free on 3 sides, cut flat at the
   rail's top edge, so the light never spills under the shelf, even while the cartridge is lifted. */
.cart::after {
  content: "";
  position: absolute; z-index: -2;                     /* behind .cart__shell (z -1), inside the cart's own stacking context */
  left: -6%; right: -6%; top: -5%;
  bottom: calc(12px + var(--lift));                    /* = the rail's top edge, even while the cart is lifted */
  border-radius: 12%;
  background: color-mix(in srgb, var(--c) var(--cart-glow), transparent);
  filter: blur(32px);
  clip-path: inset(-140px -140px 0 -140px);            /* free on 3 sides; cut flat at the bottom = on the shelf */
  opacity: var(--glow);
  pointer-events: none;
  transition: opacity 380ms var(--ease);
}
.cart__top {
  height: 16cqi;
  display: flex; align-items: center; gap: 4.3cqi; padding: 0 7.5cqi;
  font-family: var(--font-display); font-size: 6.5cqi; letter-spacing: .02em; color: var(--text-3);
}
.cart__ridges {
  margin-left: auto; margin-right: 10%;          /* clears the cut corner */
  width: 11.8cqi; height: 5.4cqi;
  background: repeating-linear-gradient(90deg, var(--cart-ridge) 0 1.1cqi, transparent 1.1cqi 2.7cqi);
}
.cart__well { position: relative; margin: 0 4.3cqi; padding: 2.15cqi; border-radius: 5.4cqi; background: var(--cart-well); }
.cart__label {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 3.2cqi; filter: var(--label-filter); transition: filter 380ms var(--ease);
}
.cart__well::after {                              /* sheen + thin coloured ring when lit */
  content: ""; position: absolute; inset: 2.15cqi; border-radius: 3.2cqi; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgb(255 255 255 / .2) 50%, transparent 62%) no-repeat;
  background-size: 250% 100%;
  background-position: var(--mx, 50%) 0;
  box-shadow: inset 0 0 0 1px var(--label-ring);
  opacity: var(--sheen);
  transition: opacity 300ms var(--ease);
}
.cart__info { display: flex; flex-direction: column; gap: 1.1cqi; min-width: 0; padding: 6.5cqi 7.5cqi 0; }
.cart__title {
  font-family: var(--font-display); font-weight: 400; text-transform: none; letter-spacing: .01em;   /* PP Mondwest, lowercase */
  font-size: 24px; line-height: 1.3;              /* project name: 24px on every cartridge size */
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart__meta  { font-size: 16px; line-height: 1.33; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- lit ---- */
@media (hover: hover) and (pointer: fine) {
  .cart:hover { --ring: color-mix(in srgb, var(--c) 55%, var(--bg)); --led: var(--c); --led-glow: color-mix(in srgb, var(--c) 60%, transparent); --label-filter: none; --label-ring: color-mix(in srgb, var(--c) 40%, transparent); --glow: 1; --sheen: 1; --lift: -18px; }
  .shelf__track:has(.cart:hover) .cart:not(:hover) { opacity: var(--shelf-dim); }
}
.cart:focus-visible { --ring: color-mix(in srgb, var(--c) 55%, var(--bg)); --led: var(--c); --led-glow: color-mix(in srgb, var(--c) 60%, transparent); --label-filter: none; --label-ring: color-mix(in srgb, var(--c) 40%, transparent); --glow: 1; --sheen: 1; --lift: -18px; }
.cart:focus-visible::before { content: ""; position: absolute; inset: -6px; border-radius: calc(6.5cqi + 6px); outline: 2px solid var(--accent); pointer-events: none; }
@media (hover: none) {
  .cart.is-current { --ring: color-mix(in srgb, var(--c) 55%, var(--bg)); --led: var(--c); --led-glow: color-mix(in srgb, var(--c) 60%, transparent); --label-filter: none; --label-ring: color-mix(in srgb, var(--c) 40%, transparent); --glow: 1; --lift: -10px; }
}
.cart:active { --lift: -13px; transition-duration: 90ms; }

@media (prefers-reduced-motion: reduce) {
  .cart__body { transform: none !important; translate: none !important; }
  .cart__well::after { display: none; }
}

/* ---- the boot panel ---- */
.boot {
  width: min(100% - 2 * var(--gutter), 72rem);
  max-width: none; max-height: calc(100svh - 2 * var(--gutter));
  margin: auto; padding: 0; border: 0; background: transparent; overflow: visible;
  color: var(--text);
}
.boot::backdrop { background: var(--boot-backdrop, rgb(0 0 0 / .6)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
html.is-boot-open, html.is-boot-open body { overflow: hidden; }

.boot__panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(17.5rem, 1fr);
  grid-template-areas: "screen info" "bar bar";
  gap: var(--space-2) 2rem;
  max-height: calc(100svh - 2 * var(--gutter)); overflow-y: auto;
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  box-shadow: var(--boot-shadow);
}
.boot__screen {
  grid-area: screen; position: relative; align-self: start;
  aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 16px; border: 1px solid var(--border); background: var(--screen);
  touch-action: pan-y;                            /* horizontal swipes reach the JS */
}
.boot__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.boot__pix { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; transition: opacity 120ms linear; pointer-events: none; }
.boot__pix.is-on { opacity: 1; transition: none; }

.boot__info { grid-area: info; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; transition: opacity 120ms ease; }
.boot__info.is-swapping { opacity: 0; }
.boot__top { display: flex; align-items: center; gap: 8px; min-height: 40px; padding-right: 3.5rem; }
.boot__no { font-family: var(--font-display); font-size: .8125rem; letter-spacing: .02em; color: var(--text-3); }
/* LED: centred on the digits (PP Mondwest digits: cap height .64em, ink centre .32em above the baseline) */
.cart__no::before,
.boot__no::before {
  content: "";
  display: inline-block;
  width: .5em; height: .5em;
  margin-right: .6em;
  vertical-align: .07em;                 /* bottom .07em above the baseline -> centre at .32em */
}
.cart__no::before { background: var(--led); box-shadow: 0 0 6px var(--led-glow); transition: background 250ms, box-shadow 250ms; }
.boot__no::before { background: var(--c);   box-shadow: 0 0 6px color-mix(in srgb, var(--c) 60%, transparent); }
.boot__type { margin-left: 4px; padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: .75rem; font-weight: 500; line-height: 1rem; color: var(--text-2); }
.boot__title { margin: var(--space-2) 0 .75rem; font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem); line-height: 1.05; letter-spacing: -0.005em; color: var(--text); }
.boot__summary { margin: 0; max-width: 30rem; font-size: .9375rem; line-height: 1.6; letter-spacing: -0.011em; color: var(--text-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.boot__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: var(--space-2) var(--space-3); width: 100%; margin: var(--space-3) 0; }
.boot__facts > div:has([data-fact="outcome"]) { grid-column: 1 / -1; }   /* the outcome is a sentence: full row */
.boot__facts dt { font-size: .75rem; font-weight: 500; line-height: 1rem; color: var(--text-3); }
.boot__facts dd { margin: 2px 0 0; font-size: .875rem; line-height: 1.25rem; color: var(--text); }
.boot__play { margin-top: auto; animation: none; }   /* only the hero's button keeps the entrance animation */

.boot__close {
  position: absolute; top: var(--space-3); right: var(--space-3);
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border-strong); background: transparent; color: var(--text-3);
  cursor: pointer; transition: background 200ms, color 200ms, border-color 200ms;
}
.boot__close svg { width: 16px; height: 16px; }
.boot__close:hover { background: var(--hover-fill); color: var(--text); }
.boot__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.boot__bar { grid-area: bar; display: flex; align-items: center; gap: 8px; padding-top: var(--space-2); border-top: 1px solid var(--border); }
.boot__count { margin-left: 12px; font-family: var(--font-display); font-size: .9375rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.boot__hint { margin-left: auto; font-size: .75rem; color: var(--text-3); }
@media (hover: none), (max-width: 47.99rem) { .boot__hint { display: none; } }

/* small arcade keys: same family as .card__btn / dock keys */
.boot__key {
  --face: var(--key-face); --face-top: var(--key-face-top); --band: var(--key-band);
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0 0 5px;
  border: 2px solid var(--key-outline); border-radius: 10px;
  background: linear-gradient(var(--face-top), var(--face) 60%);
  color: var(--key-fg); cursor: pointer;
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent), inset 0 -5px 0 var(--band), 0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent);
  transition: translate 120ms cubic-bezier(.3, 1.6, .5, 1), color 200ms, filter 120ms, padding 120ms;
}
.boot__key svg { width: 14px; height: 14px; fill: currentColor; shape-rendering: crispEdges; }
.boot__key[data-dir="-1"] svg { scale: -1 1; }
@media (hover: hover) { .boot__key:hover { translate: 0 -2px; color: var(--key-fg-hi); filter: brightness(1.08); } }
.boot__key:active { translate: 0 3px; padding-bottom: 2px; transition-duration: 60ms; box-shadow: inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent), inset 0 -2px 0 var(--band); }
.boot__key:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* text rises in, one line after another (also captured in the view-transition "new" frame) */
.boot.is-booting .boot__info > * { animation: boot-rise 420ms var(--ease-out) both; animation-delay: calc(240ms + var(--i, 0) * 60ms); }
@keyframes boot-rise { from { opacity: 0; translate: 0 8px; } }

/* browsers without View Transitions: simple open */
.boot[open]:not(.is-vt) .boot__panel { animation: boot-in 320ms var(--ease-out); }
@keyframes boot-in { from { opacity: 0; scale: .96; } }

/* the label → screen morph (only during our own transitions) */
html.boot-vt::view-transition-group(boot-screen) { animation-duration: 420ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
html.boot-vt::view-transition-image-pair(boot-screen) { overflow: hidden; border-radius: 12px; }
html.boot-vt::view-transition-old(boot-screen),
html.boot-vt::view-transition-new(boot-screen) { width: 100%; height: 100%; object-fit: cover; animation-duration: 420ms; }
html.boot-vt::view-transition-old(root),
html.boot-vt::view-transition-new(root) { animation-duration: 260ms; }

/* phones: full-screen sheet, keys stick to the bottom */
@media (max-width: 47.99rem) {
  .boot { width: 100%; height: 100%; max-height: none; margin: 0; }
  .boot__panel { display: flex; flex-direction: column; height: 100%; max-height: none; gap: 0; padding: var(--space-2) var(--space-2) 0; border: 0; border-radius: 0; box-shadow: none; overscroll-behavior: contain; }
  .boot__screen { flex: none; border-radius: 14px; }
  .boot__info { padding: var(--space-3) 0; }
  .boot__top { padding-right: 0; }
  .boot__summary { -webkit-line-clamp: unset; }
  .boot__close {
    position: fixed; top: calc(var(--space-2) + 10px + env(safe-area-inset-top)); right: calc(var(--space-2) + 10px);
    background: var(--boot-close-bg); border-color: var(--boot-close-border); color: var(--boot-close-fg);
    box-shadow: var(--boot-close-shadow);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .boot__bar { z-index: 2; position: sticky; bottom: 0; margin: auto calc(-1 * var(--space-2)) 0; padding: 12px var(--space-2) calc(12px + env(safe-area-inset-bottom)); background: var(--bg-card); }

  /* bottom bar: < >  03 / 03 ................ [play case study] */
  .boot__bar { gap: 8px; }
  .boot__key { width: 48px; height: 48px; }                     /* was 44: same height as the button, easier to tap */
  .boot__key svg { width: 16px; height: 16px; }
  .boot__count { margin-left: 12px; }

  /* compact game button, docked right (js/shelf.js moves it here on phones) */
  .boot__bar .boot__play {
    margin: 0 0 0 auto;
    min-width: 0; height: 48px;
    padding: 0 20px 5px;
    font-size: 1.125rem;                                         /* 18px (was 22) */
    border-radius: 12px;
    white-space: nowrap;
    box-shadow:
      inset 0 3px 0 color-mix(in srgb, var(--hi) 50%, transparent),
      inset 0 -6px 0 var(--band),                                /* was -8: depth scaled to the smaller key */
      0 0 0 1px var(--btn-ring),
      0 6px 14px var(--btn-drop);                                /* was 0 10px 22px: stays inside the bar */
  }
  .boot__bar .boot__play:active {
    translate: 0 3px; padding-bottom: 2px;
    box-shadow:
      inset 0 3px 0 color-mix(in srgb, var(--hi) 35%, transparent),
      inset 0 -3px 0 var(--band),
      0 0 0 1px var(--btn-ring-active),
      0 2px 6px var(--btn-drop-active);
  }
  .boot__bar .boot__play:focus-visible { outline-offset: 3px; }
}
@media (max-width: 22.49rem) { .boot__count { display: none; } }   /* < 360px: room for the button */

@media (prefers-reduced-motion: reduce) {
  .boot.is-booting .boot__info > * { animation: none; }
  .boot[open]:not(.is-vt) .boot__panel { animation: boot-fade 150ms linear; }
  .boot__info { transition: none; }
}
@keyframes boot-fade { from { opacity: 0; } }


/* 5c. INSERT TRANSITION (round 24) ==========================================
   "play case study": the page blurs, a cream game station and a cartridge in the project colour
   appear, the cartridge drops in, the station clicks, LED + screen light up, 3 blocks load, then
   the case study opens (js/shelf.js section 7 navigates at 1250ms). No scenery. */
/* pixel colours (classes are in the SVG) */
.in-spark { fill: var(--in-spark); } .in-ink { fill: var(--ufo-body); }
.in-ctop { fill: var(--con-top); } .in-chi { fill: var(--hi); } .in-cface { fill: var(--con-face); } .in-cshade { fill: var(--con-shade); }
.in-cbase { fill: var(--con-base); } .in-cdark { fill: var(--con-dark); } .in-screen { fill: var(--screen); }
.in-btna { fill: var(--con-btn-a); } .in-btnb { fill: var(--con-btn-b); } .in-led { fill: var(--con-led); }
.in-kface { fill: var(--kart-face); } .in-khi { fill: var(--kart-hi); } .in-kshade { fill: var(--kart-shade); }
.in-label, .in-glow { fill: var(--c); } .in-labelhi, .in-glowhi, .in-seg, .in-flash { fill: var(--hi); }

/* the overlay: full screen, everything behind it blurred */
.insert { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; outline: none; }
.insert[open] { display: grid; place-items: center; }           /* only when open: keep the UA display:none when closed */
.insert::backdrop { background: var(--insert-tint, rgb(8 8 8 / .78)); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.insert__box { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.insert__art { display: block; width: 288px; height: 264px; overflow: visible; filter: var(--insert-shadow); }   /* 6x pixels */
@media (max-width: 47.99rem) { .insert__art { width: 192px; height: 176px; } }                                     /* 4x pixels */
.insert__caption { margin: 0; font-family: var(--font-display); font-size: .9375rem; letter-spacing: .01em; color: var(--text); }
.insert__dots { display: inline-block; clip-path: inset(0 100% 0 0); }

/* hidden parts until their moment */
.insert__lit, .insert__seg, .insert__spark, .insert__spark .a1, .insert__spark .a2, .in-flash { opacity: 0; }

/* ---- timeline (ms from opening): only while .is-playing ---- */
.insert.is-playing::backdrop        { animation: insert-fade 180ms ease-out both; }
.insert.is-playing .insert__art     { animation: insert-pop 240ms steps(4, end) both; }
.insert.is-playing .insert__caption { animation: insert-fade 200ms 200ms ease-out both; }
.insert.is-playing .insert__dots    { animation: insert-dots 600ms 200ms steps(3, jump-none) infinite; }
.insert.is-playing .insert__cart    { animation: insert-cart 595ms 150ms both; }    /* 150 -> 745 */
.insert.is-playing .insert__unit    { animation: insert-squash 120ms 745ms; }        /* the "click" */
.insert.is-playing .in-led          { animation: insert-led 1ms 760ms both; }
.insert.is-playing .in-flash        { animation: insert-blink 60ms 780ms; }
.insert.is-playing .insert__lit     { animation: insert-show 1ms 840ms both; }
.insert.is-playing .insert__seg.s1  { animation: insert-show 1ms 860ms both; }
.insert.is-playing .insert__seg.s2  { animation: insert-show 1ms 940ms both; }
.insert.is-playing .insert__seg.s3  { animation: insert-show 1ms 1020ms both; }
.insert.is-playing .insert__spark.k1 { animation: insert-blink 360ms 800ms; }
.insert.is-playing .insert__spark.k2 { animation: insert-blink 360ms 860ms; }
.insert.is-playing .insert__spark.k3 { animation: insert-blink 360ms 920ms; }
.insert.is-playing .k1 .a1 { animation: insert-blink 216ms 872ms; }  .insert.is-playing .k1 .a2 { animation: insert-blink 72ms 944ms; }
.insert.is-playing .k2 .a1 { animation: insert-blink 216ms 932ms; }  .insert.is-playing .k2 .a2 { animation: insert-blink 72ms 1004ms; }
.insert.is-playing .k3 .a1 { animation: insert-blink 216ms 992ms; }  .insert.is-playing .k3 .a2 { animation: insert-blink 72ms 1064ms; }

@keyframes insert-fade   { from { opacity: 0; } }
@keyframes insert-pop    { from { opacity: 0; scale: .9; } }
@keyframes insert-dots   { from { clip-path: inset(0 66.67% 0 0); } to { clip-path: inset(0 0 0 0); } }   /* 1 -> 2 -> 3 dots */
/* falls 13 art-px in 13 one-pixel steps, hovers above the slot, then slides 7 px in, 1 px per step */
@keyframes insert-cart {
  0%     { translate: 0 -20px; animation-timing-function: steps(13, end); }
  47.06% { translate: 0 -7px;  animation-timing-function: steps(1, end); }
  64.71% { translate: 0 -7px;  animation-timing-function: steps(7, end); }
  100%   { translate: 0 0; }
}
@keyframes insert-squash { 0%, 100% { translate: 0 1px; } }
@keyframes insert-led    { to { fill: var(--c); } }
@keyframes insert-show   { to { opacity: 1; } }
@keyframes insert-blink  { 0%, 100% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .insert.is-playing *, .insert.is-playing::backdrop { animation: none !important; }
  .insert .insert__lit, .insert .insert__seg { opacity: 1; }     /* show the finished frame */
  .insert .in-led { fill: var(--c); }
  .insert .insert__dots { clip-path: none; }
}


/* 6. FOOTER: arcade "Continue?" screen ======================================= */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  --hud-h: 3rem;                           /* height of the ground strip */
  padding: var(--space-6) var(--gutter) 0;
  text-align: center;
}

.footer__kicker {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-family: var(--font-display); text-transform: none;
  font-size: 1rem;
  letter-spacing: .01em;
  color: var(--accent-text);
}

.footer__title {
  font-family: var(--font-display); text-transform: none;
  font-size: var(--text-h2);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
}

.footer__text {
  max-width: 30rem;
  color: var(--text-2);
  text-wrap: pretty;
}

.footer .game-btn { margin-top: var(--space-2); }
/* the quiet "or find me on" text sits low, where the sky is bluest: lighter at night, darker by day, so it stays 4.5:1+ */
.footer { --text-3: #d6d0c7; }
[data-theme="light"] .footer { --text-3: #3f3f46; }

.footer__alt {
  color: var(--text-3);
  font-size: var(--text-small);
}
.footer__alt a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: .3em;
  transition: color 200ms;
}
.footer__alt a:hover { color: var(--accent-text); }

/* ground strip: the floor of the level, under the trees */
.footer__hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  align-self: stretch;
  margin: calc(var(--space-6) + var(--space-3)) calc(var(--gutter) * -1) 0;
  height: var(--hud-h);
  border-top: 1px solid var(--ground-edge);
  background: var(--ground);
  font-family: var(--font-display); text-transform: none;
  font-size: .875rem;
  letter-spacing: .01em;
  color: var(--ground-ink);
}
@media (max-width: 47.99rem) {
  .footer { --hud-h: 2.75rem; }
}
/* Narrow phones, and small tablets where the wide dock is near: two centred lines, so the text stays clear of the dock */
@media (max-width: 21.5rem), (min-width: 48rem) and (max-width: 50rem) {
  .footer { --hud-h: 3.25rem; }
  .footer__hud { flex-direction: column; gap: 0; line-height: 1.25; }
  .footer__dot { display: none; }
}


/* Footer background: moonlit pixel forest (behind the content) */
.footer { position: relative; isolation: isolate; overflow: hidden; }
/* Bigger, brighter moon; a little UFO crosses it every so often */
.footer__scene {
  --moon-size: clamp(4.5rem, 3rem + 5vw, 8rem);
  --moon-top: clamp(2.5rem, 9%, 5rem);
  --moon-right: max(1.25rem, 11%);
  position: absolute;
  inset: 0 0 var(--hud-h);                  /* ends where the ground strip starts */
  z-index: -1;
  pointer-events: none;
}
/* Scene layers, back to front: banded sky, clouds, stars, scenery, fireflies/butterflies, moon/sun, UFO.
   Every art pixel is drawn --px CSS px wide (3 on desktop, 2 on phones). */
.footer__scene { --px: 3px; }
@media (max-width: 47.99rem) { .footer__scene { --px: 2px; } }
.footer__scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sky-strip) repeat-x 0 0 / calc(var(--px) * 4) 100%;   /* top band = page colour: no seam */
  image-rendering: pixelated;
}
/* Mountains, trees and grass sit right on the ground strip. Past 1920px the image is
   mirrored left and right, so the edges meet with no seam. */
.footer__land {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(640 * var(--px));
  height: calc(150 * var(--px));                /* v2 art is 640×150 */
  margin-left: calc(320 * var(--px) * -1);
  background: var(--scene) 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.footer__land::before,
.footer__land::after {
  content: "";
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  background: inherit;
  image-rendering: pixelated;
  transform: scaleX(-1);
}
.footer__land::before { right: 100%; }
.footer__land::after  { left: 100%; }
/* clouds drift left to right in three lanes (3px steps), behind the scenery */
.footer__cloud {
  position: absolute;
  left: 0;
  image-rendering: pixelated;
  background-size: 100% 100%;
  animation: cloud-drift 90s steps(866) infinite;
}
.footer__cloud.c1 { top: 12%; width: calc(84 * var(--px)); height: calc(30 * var(--px)); background-image: var(--cloud-1); --rest: 14%;  animation-duration: 90s;  animation-delay: -30s; }
.footer__cloud.c2 { top: 24%; width: calc(62 * var(--px)); height: calc(23 * var(--px)); background-image: var(--cloud-2); --rest: 62%;  animation-duration: 120s; animation-delay: -85s; }
.footer__cloud.c3 { top: 40%; width: calc(44 * var(--px)); height: calc(17 * var(--px)); background-image: var(--cloud-3); --rest: 36%;  animation-duration: 150s; animation-delay: -20s; }
@keyframes cloud-drift { from { translate: -300px 0; } to { translate: 2300px 0; } }
/* clouds: one layer, so it can be masked as a whole */
.footer__clouds { position: absolute; inset: 0; }
@media (min-width: 48rem) {
  /* keep the text column clear: clouds step out (100 → 66 → 33 → 0%) within ±19rem of the centre */
  .footer__clouds {
    --m1: color-mix(in srgb, var(--shade) 66%, transparent);
    --m2: color-mix(in srgb, var(--shade) 33%, transparent);
    -webkit-mask-image: linear-gradient(90deg,
      var(--shade) calc(50% - 23rem), var(--m1) calc(50% - 23rem) calc(50% - 21rem),
      var(--m2) calc(50% - 21rem) calc(50% - 19rem), transparent calc(50% - 19rem) calc(50% + 19rem),
      var(--m2) calc(50% + 19rem) calc(50% + 21rem), var(--m1) calc(50% + 21rem) calc(50% + 23rem),
      var(--shade) calc(50% + 23rem));
            mask-image: linear-gradient(90deg,
      var(--shade) calc(50% - 23rem), var(--m1) calc(50% - 23rem) calc(50% - 21rem),
      var(--m2) calc(50% - 21rem) calc(50% - 19rem), transparent calc(50% - 19rem) calc(50% + 19rem),
      var(--m2) calc(50% + 19rem) calc(50% + 21rem), var(--m1) calc(50% + 21rem) calc(50% + 23rem),
      var(--shade) calc(50% + 23rem));
  }
}
@media (max-width: 47.99rem) {
  /* phones: the text spans the width, so clouds drift above "continue?" (kicker starts at 120px) */
  .footer__cloud.c1 { top: .5rem; }
  .footer__cloud.c3 { top: 2.5rem; }
  .footer__cloud.c2 { top: 4.5rem; }
}

/* light only: dithered white haze behind the text column */
.footer__haze { display: none; }
[data-theme="light"] .footer__haze {
  display: block;
  position: absolute;
  left: calc(50% - 130 * var(--px));
  top: calc(46% - 60 * var(--px));
  width: calc(260 * var(--px));
  height: calc(120 * var(--px));
  background: var(--haze) 0 0 / 100% 100% no-repeat;
  image-rendering: pixelated;
}

/* light footer: make the key stand out from the sky (white rim + dark teal ring) */
[data-theme="light"] .footer .game-btn {
  border-color: var(--bg);                          /* the 3px see-through rim becomes white */
  --btn-ring: var(--accent-text);
  --btn-ring-hover: var(--accent-text);
  --btn-ring-active: var(--accent-text);
}
/* bigger four-point sparkle stars (night only), upper part of the footer */
.spark {
  --arm: calc(var(--px) * -1);
  position: absolute;
  width: var(--px);
  height: var(--px);
  background: var(--spark-core);
  box-shadow:
    var(--px) 0 0 var(--spark-arm), var(--arm) 0 0 var(--spark-arm),
    0 var(--px) 0 var(--spark-arm), 0 var(--arm) 0 var(--spark-arm);
  animation: spark 4s steps(1) infinite;
}
.spark.s1 { left: 6%;  top: 14%; animation-duration: 4s;   animation-delay: -1s; }
.spark.s2 { left: 17%; top: 28%; animation-duration: 5.5s; animation-delay: -3s; }
.spark.s3 { left: 28%; top: 7%;  animation-duration: 3.2s; animation-delay: -2s; }
.spark.s4 { left: 68%; top: 12%; animation-duration: 6s;   animation-delay: -4s; }
.spark.s5 { left: 76%; top: 31%; animation-duration: 4.6s; animation-delay: -.5s; }
@keyframes spark { 0% { opacity: .35; } 55% { opacity: 1; } 80%, 100% { opacity: .35; } }
[data-theme="light"] .spark { display: none; }
.footer__moon,
.footer__sun,
.footer__ufo {
  position: absolute;
  top: var(--moon-top);
  right: var(--moon-right);
  width: var(--moon-size);
  height: auto;
  shape-rendering: crispEdges;
}
.footer__moon {
  fill: var(--moon);
  overflow: visible;                         /* the halo rings reach past the 32x32 box */
}
.footer__ufo { z-index: 1; }
/* moon at night, sun by day (switched by CSS, so it is right before JS runs) */
.footer__sun { display: none; fill: var(--sun); overflow: visible; filter: drop-shadow(0 0 10px rgb(255 196 61 / .35)); }   /* tight soft glow, no rings */
[data-theme="light"] .footer__moon { display: none; }
[data-theme="light"] .footer__sun  { display: block; }
.footer__sun .sun-shade { fill: var(--sun-shade); }
.footer__sun .sun-hi    { fill: var(--sun-hi); }
.footer__sun .ray       { fill: var(--sun-ray); }
.footer__sun .ray-a     { animation: sun-rays 2.4s steps(1) infinite; }
.footer__sun .ray-b     { opacity: 0; animation: sun-rays-b 2.4s steps(1) infinite; }
@keyframes sun-rays   { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes sun-rays-b { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }
/* moon: stepped pixel halo (two rings, 2 art px each) */
.footer__moon .halo-a { fill: var(--halo); fill-opacity: .35; }
.footer__moon .halo-b { fill: var(--halo); fill-opacity: .18; }
.footer__moon .moon-shade { fill: var(--moon-shade); }
.footer__moon .crater     { fill: var(--moon-crater); }
.footer__ufo .ufo        { animation: ufo-fly 8s infinite; }
.footer__ufo .ufo__bob   { animation: ufo-bob .8s steps(1) infinite; }
.footer__ufo .ufo__body  { fill: var(--ufo-body); }
.footer__ufo .ufo__dome  { fill: var(--ufo-dome); }
.footer__ufo .ufo__light { fill: var(--accent); }
.footer__ufo .ufo__light.b { animation: es-blink .4s steps(1) infinite; }
.footer__ufo .ufo__light.a { animation: es-blink .4s steps(1) -.2s infinite; }
/* flight first, so it starts the moment the footer scrolls into view */
@keyframes ufo-fly {
  0%      { transform: translate(-14px, 13px); opacity: 1; animation-timing-function: steps(46, end); }
  50%     { transform: translate(32px, 9px); opacity: 1; animation-timing-function: steps(1); }
  51%, 100% { transform: translate(32px, 9px); opacity: 0; }
}
@keyframes ufo-bob { 0% { translate: 0 0; } 50%, 100% { translate: 0 -1px; } }
@media (prefers-reduced-motion: reduce) {
  .footer__ufo .ufo { opacity: 0; }
}
.footer__sky { position: absolute; inset: 0; width: 100%; height: 100%; shape-rendering: crispEdges; }
/* Day: clouds and butterflies replace the stars and fireflies */
.footer__sky .bf-wrap { display: none; }
[data-theme="light"] .footer__sky .star,
[data-theme="light"] .footer__sky .fly { display: none; }
[data-theme="light"] .footer__sky .bf-wrap { display: inline; }
.bf { animation: flutter 12s infinite; }
.bf.t0 { --dx: 60px;  --dy: -10px; animation-duration: 12s; animation-delay: -3s; }
.bf.t1 { --dx: -50px; --dy: 8px;   animation-duration: 14s; animation-delay: -8s; }
.bf.t2 { --dx: 45px;  --dy: -6px;  animation-duration: 10s; animation-delay: -5s; }
.bf.t0 .bf__wings { fill: var(--c-work); }
.bf.t1 .bf__wings { fill: var(--c-about); }
.bf.t2 .bf__wings { fill: var(--c-lab); }
.bf__body { fill: #27272a; }
.bf__bob { animation: bf-bob .9s steps(1) infinite; }
.bf__open { animation: bf-open .5s steps(1) infinite; }
.bf__shut { opacity: 0; animation: bf-shut .5s steps(1) infinite; }
@keyframes bf-bob  { 0% { translate: 0 0; } 50%, 100% { translate: 0 -1px; } }
@keyframes bf-open { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes bf-shut { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes flutter {
  0%, 100% { transform: translate(0, 0);                                                 animation-timing-function: steps(80); }
  25%      { transform: translate(calc(var(--dx) * .5), calc(var(--dy) * -1));           animation-timing-function: steps(80); }
  50%      { transform: translate(var(--dx), var(--dy));                                 animation-timing-function: steps(80); }
  75%      { transform: translate(calc(var(--dx) * .4), calc(var(--dy) * .5 + 6px));     animation-timing-function: steps(80); }
}
.footer__sky .star { fill: var(--text); opacity: .3; }
.footer__sky .star.t1 { animation: twinkle 3.6s steps(1) infinite; }
.footer__sky .star.t2 { animation: twinkle 5s steps(1) -2s infinite; }
.footer__sky .fly { fill: var(--firefly); opacity: 0; animation: firefly 4.2s steps(1) infinite; }
.footer__sky .fly.t1 { animation-delay: -1.4s; }
.footer__sky .fly.t2 { animation-delay: -2.8s; }
.footer:not(.is-on-screen) .footer__scene * { animation-play-state: paused; }
@keyframes twinkle { 0% { opacity: .3; } 70% { opacity: .75; } 85%, 100% { opacity: .3; } }
@keyframes firefly { 0% { opacity: 0; } 15% { opacity: .9; } 30% { opacity: .4; } 40%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .footer__scene *, .footer__scene .spark { animation: none !important; }
  .footer__cloud { left: var(--rest); }     /* clouds rest in fixed spots */
  .footer__sky .fly { opacity: .6; }
}


/* 7. DOCK ================================================================
   Little contact bar, bottom-right corner, always visible. On phones it
   folds behind a "+" button (js/main.js toggles .is-open). */
.dock {
  position: fixed;
  left: auto;
  right: var(--dock-edge);
  bottom: var(--dock-edge);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--dock-border);
  border-radius: .75rem;
  background: var(--dock-bg);
  -webkit-backdrop-filter: blur(var(--dock-blur)) saturate(var(--bar-sat));
  backdrop-filter: blur(var(--dock-blur)) saturate(var(--bar-sat));
  box-shadow: var(--dock-shadow);
  transition: translate 500ms var(--ease-out), opacity 500ms;
}

.dock__menu-inner { display: flex; gap: .25rem; align-items: center; }
.dock__toggle { display: none; }

@media (max-width: 47.99rem) {
  .dock { gap: 0; }

  /* Small gray arcade key: raised 3D look, presses down like .game-btn */
  .dock__toggle {
    --face: var(--key-face);
    --face-top: var(--key-face-top);
    --band: var(--key-band);          /* darker base = 3D depth */
    display: grid; place-items: center;
    width: 2.75rem; height: 2.75rem;
    padding: 0 0 4px;
    color: var(--key-fg);
    background: linear-gradient(var(--face-top), var(--face) 60%);
    border: 2px solid var(--key-outline);
    border-radius: 10px;
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
      inset 0 -5px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent);
    -webkit-tap-highlight-color: transparent;
    transition: translate 120ms cubic-bezier(.3, 1.6, .5, 1), box-shadow 120ms, padding 120ms, color 120ms;
  }

  /* Press: squashes down like an arcade button */
  .dock__toggle:active {
    translate: 0 3px;
    padding-bottom: 1px;
    transition-duration: 60ms;
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 5%, transparent),
      inset 0 -2px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent);
  }

  /* Open: stays slightly pressed in, icon brightens */
  .dock.is-open .dock__toggle {
    translate: 0 2px;
    padding-bottom: 2px;
    color: var(--key-fg-hi);
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 5%, transparent),
      inset 0 -3px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 14%, transparent);
  }

  .dock__toggle svg { width: 1.125rem; height: 1.125rem; transition: rotate 160ms steps(3); }
  .dock.is-open .dock__toggle svg { rotate: 45deg; }   /* + turns into × */

  .dock__menu {
    display: grid; grid-template-columns: 0fr;
    opacity: 0; visibility: hidden;
    transition: grid-template-columns 220ms var(--ease-out), opacity 160ms, visibility 0s 220ms;
  }
  .dock__menu-inner { overflow: hidden; min-width: 0; }
  .dock.is-open .dock__menu {
    grid-template-columns: 1fr; opacity: 1; visibility: visible;
    transition: grid-template-columns 220ms var(--ease-out), opacity 160ms;
  }
  .dock.is-open .dock__menu-inner { padding-right: .25rem; }
}

/* Hover only for devices with a real mouse */
@media (max-width: 47.99rem) and (hover: hover) {
  .dock__toggle:hover { translate: 0 -1px; color: var(--key-fg-hi); }
}

@media (prefers-reduced-motion: reduce) {
  .dock__menu, .dock__toggle, .dock__toggle svg { transition: none; }
}

/* Light mode, phones: while the dock is folded only the "+" keycap shows (no white frame).
   The frame (background, border, shadow, blur) grows in as the dock opens and fades out after it closes.
   The 0.25rem padding stays in both states, so the key never moves. */
@media (max-width: 47.99rem) {
  [data-theme="light"] .dock {
    transition: translate 500ms var(--ease-out), opacity 500ms,
                background-color 220ms, border-color 220ms, box-shadow 220ms,
                -webkit-backdrop-filter 0s, backdrop-filter 0s;          /* opening: no delay */
  }
  [data-theme="light"] .dock:not(.is-open) {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    /* closing: wait for the menu to fold (160ms), then fade the frame; blur switches off at the very end */
    transition-delay: 0s, 0s, 160ms, 160ms, 160ms, 380ms, 380ms;
  }
  [data-theme="light"] .dock:not(.is-open) .dock__toggle {
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
      inset 0 -5px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent),
      0 6px 16px rgb(0 0 0 / .12);                                       /* soft lift off the page */
  }
  [data-theme="light"] .dock:not(.is-open) .dock__toggle:active {
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 5%, transparent),
      inset 0 -2px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent),
      0 3px 8px rgb(0 0 0 / .12);
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-theme="light"] .dock, [data-theme="light"] .dock:not(.is-open) { transition: none; }
}

.dock__item {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: var(--text-small);
  transition: background-color 200ms, color 200ms;
}
.dock__item:hover {
  background: var(--hover-fill);
  color: var(--text);
}
.dock__item svg {
  width: 1.375rem;
  height: 1.375rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dock__copy {
  padding: 0 1.125rem;
  font-size: .9375rem;
  background: var(--hover-fill);
  color: var(--text);
}
.dock__copy[hidden] { display: none; }


/* ---- Sound key (dock) ---- */
.dock__sound {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: .5rem;
  background: transparent;
  color: var(--text-2);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 200ms, color 200ms;
}
.dock__sound[hidden] { display: none; }
.dock__sound::before {                      /* thin divider before the key (desktop row) */
  content: "";
  position: absolute;
  left: -.125rem;
  top: .75rem;
  bottom: .75rem;
  width: 1px;
  background: var(--border-strong);
}
.dock__sound:hover { background: var(--hover-fill); color: var(--text); }
.dock__sound:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dock__sound svg { width: 1.25rem; height: 1.25rem; fill: currentColor; shape-rendering: crispEdges; }
.dock__sound .snd-on { display: none; }
.dock__sound[aria-pressed="true"],
html[data-sound="on"] .dock__sound { color: var(--accent-text); }
.dock__sound[aria-pressed="true"] .snd-on,
html[data-sound="on"] .dock__sound .snd-on { display: inline; }
.dock__sound[aria-pressed="true"] .snd-off,
html[data-sound="on"] .dock__sound .snd-off { display: none; }
/* "sound just came on": the icon blinks once, in two pixel frames */
@media (prefers-reduced-motion: no-preference) {
  .dock__sound.is-blink svg { animation: snd-flash 320ms steps(1); }
}
@keyframes snd-flash { 0% { opacity: .15; } 50%, 100% { opacity: 1; } }

/* small blinking pixel until the visitor has used the key once */
.dock__sound-dot {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 4px;
  height: 4px;
  background: var(--accent);
  animation: snd-blink 1.6s steps(1) infinite;
}
.dock__sound[data-seen] .dock__sound-dot,
.dock__sound[aria-pressed="true"] .dock__sound-dot { display: none; }
@keyframes snd-blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: .15; } }

/* Phones: key becomes its own small square above the dock */
@media (max-width: 47.99rem) {
  /* Same arcade key as the "+" (.dock__toggle), centred directly above it */
  .dock__sound {
    --face: var(--key-face);
    --face-top: var(--key-face-top);
    --band: var(--key-band);
    position: absolute;
    right: .25rem;                  /* anchored over the "+" key's closed position; does not move when the dock opens */
    left: auto;
    bottom: calc(100% + .5rem);
    width: 2.75rem;
    height: 2.75rem;
    padding: 0 0 4px;
    border: 2px solid var(--key-outline);
    border-radius: 10px;
    color: var(--key-fg);
    background: linear-gradient(var(--face-top), var(--face) 60%);
    backdrop-filter: none;
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
      inset 0 -5px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent),
      0 10px 30px color-mix(in srgb, var(--shade) 50%, transparent);
    transition: translate 120ms cubic-bezier(.3, 1.6, .5, 1), box-shadow 120ms, padding 120ms, color 120ms;
  }
  .dock__sound:hover { background: linear-gradient(var(--face-top), var(--face) 60%); color: var(--key-fg-hi); }
  .dock__sound svg { width: 1.125rem; height: 1.125rem; }
  .dock__sound:active {
    translate: 0 3px;
    padding-bottom: 1px;
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 5%, transparent),
      inset 0 -2px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent);
  }
  .dock__sound[aria-pressed="true"],
  html[data-sound="on"] .dock__sound {
    color: var(--accent);
    box-shadow:
      inset 0 2px 0 color-mix(in srgb, var(--hi) 7%, transparent),
      inset 0 -5px 0 var(--band),
      0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
      0 10px 30px color-mix(in srgb, var(--shade) 50%, transparent);
  }
  .dock__sound-dot { top: .375rem; right: .375rem; }
  .dock__sound::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dock__sound-dot { animation: none; }
  .dock__sound { transition: none; }
}

/* 8. CURSOR CANVAS ======================================================== */
.cursor-canvas {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;                 /* dark: colours add light */
}
/* light: screen would turn every colour white on white, so multiply (colours darken) */
@media (hover: hover) {
  [data-theme="light"] .cursor-canvas { mix-blend-mode: multiply; }
}


/* 8b. PIXEL CURSORS =======================================================
   Real (native) cursors from assets/cursors/*.png, so they never lag. Mouse only: touch screens are untouched.
   Make or change the pictures with: python3 scripts/make-cursors.py
   Each cursor is written three times: plain url() first, then image-set versions; browsers keep the last they understand.
   Hotspots (CSS px): arrow 1 1, hand 9 1, pressed hand 9 3. */
@media (hover: hover) and (pointer: fine) {
  html {
    cursor: url("/assets/cursors/arrow-dark.png") 1 1, auto;
    cursor: -webkit-image-set(url("/assets/cursors/arrow-dark.png") 1x, url("/assets/cursors/arrow-dark@2x.png") 2x) 1 1, auto;
    cursor: image-set(url("/assets/cursors/arrow-dark.png") 1x, url("/assets/cursors/arrow-dark@2x.png") 2x) 1 1, auto;
  }
  html[data-theme="light"] {
    cursor: url("/assets/cursors/arrow-light.png") 1 1, auto;
    cursor: -webkit-image-set(url("/assets/cursors/arrow-light.png") 1x, url("/assets/cursors/arrow-light@2x.png") 2x) 1 1, auto;
    cursor: image-set(url("/assets/cursors/arrow-light.png") 1x, url("/assets/cursors/arrow-light@2x.png") 2x) 1 1, auto;
  }
  :is(a, button, [role="button"], label[for], summary, select, .card, .game-btn, .card__btn, .dock__item, .dock__toggle, .dock__sound, .theme-btn, .topbar__home) {
    cursor: url("/assets/cursors/hand-dark.png") 9 1, pointer;
    cursor: -webkit-image-set(url("/assets/cursors/hand-dark.png") 1x, url("/assets/cursors/hand-dark@2x.png") 2x) 9 1, pointer;
    cursor: image-set(url("/assets/cursors/hand-dark.png") 1x, url("/assets/cursors/hand-dark@2x.png") 2x) 9 1, pointer;
  }
  html[data-theme="light"] :is(a, button, [role="button"], label[for], summary, select, .card, .game-btn, .card__btn, .dock__item, .dock__toggle, .dock__sound, .theme-btn, .topbar__home) {
    cursor: url("/assets/cursors/hand-light.png") 9 1, pointer;
    cursor: -webkit-image-set(url("/assets/cursors/hand-light.png") 1x, url("/assets/cursors/hand-light@2x.png") 2x) 9 1, pointer;
    cursor: image-set(url("/assets/cursors/hand-light.png") 1x, url("/assets/cursors/hand-light@2x.png") 2x) 9 1, pointer;
  }
  /* mouse button held down on something clickable (class set in js/main.js, block 8) */
  html.is-pressing :is(a, button, [role="button"], label[for], summary, select, .card, .game-btn, .card__btn, .dock__item, .dock__toggle, .dock__sound, .theme-btn, .topbar__home) {
    cursor: url("/assets/cursors/hand-press-dark.png") 9 3, pointer;
    cursor: -webkit-image-set(url("/assets/cursors/hand-press-dark.png") 1x, url("/assets/cursors/hand-press-dark@2x.png") 2x) 9 3, pointer;
    cursor: image-set(url("/assets/cursors/hand-press-dark.png") 1x, url("/assets/cursors/hand-press-dark@2x.png") 2x) 9 3, pointer;
  }
  html[data-theme="light"].is-pressing :is(a, button, [role="button"], label[for], summary, select, .card, .game-btn, .card__btn, .dock__item, .dock__toggle, .dock__sound, .theme-btn, .topbar__home) {
    cursor: url("/assets/cursors/hand-press-light.png") 9 3, pointer;
    cursor: -webkit-image-set(url("/assets/cursors/hand-press-light.png") 1x, url("/assets/cursors/hand-press-light@2x.png") 2x) 9 3, pointer;
    cursor: image-set(url("/assets/cursors/hand-press-light.png") 1x, url("/assets/cursors/hand-press-light@2x.png") 2x) 9 3, pointer;
  }
  html :is(input, textarea, [contenteditable]),
  html[data-theme="light"] :is(input, textarea, [contenteditable]) { cursor: text; }
}

/* Touch screens: no full-screen blend while scrolling (big scroll-performance cost on phones) */
@media (hover: none) {
  .cursor-canvas { mix-blend-mode: normal; }
}


/* 9. SIMPLE PAGES ========================================================= */
.page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-3);
  min-height: 80svh;
  padding: calc(var(--nav-clear) + var(--nav-gap)) var(--gutter) var(--space-5);
}

.page__title {
  font-family: var(--font-display); text-transform: none;
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: var(--leading-tight);
}

.page__text {
  max-width: 32rem;
  color: var(--text-2);
}

/* Long-form text (use <div class="prose"> for case studies and write-ups).
   Headings here are Google Sans Flex, not the pixel font. */
.prose h1, .prose h2, .prose h3 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
.prose h1 { letter-spacing: -0.03em; }
.prose p {
  max-width: 65ch;
  margin-block: 0 1em;
  color: var(--text-2);
}
.prose p a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: .2em;
  transition: text-decoration-color 200ms;
}
.prose p a:hover { text-decoration-color: currentColor; }


/* 9b. EMPTY STATES ========================================================== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 100svh;
  padding: calc(var(--nav-clear) + var(--nav-gap)) var(--gutter) var(--space-5);
  text-align: center;
}
.empty__art {
  width: clamp(8.5rem, 5rem + 12vw, 12rem);
  height: auto;
  margin-bottom: var(--space-3);
  fill: var(--c);
  shape-rendering: crispEdges;
  overflow: hidden;
}
.art-space { width: clamp(15rem, 8rem + 22vw, 22rem); }
.empty__kicker {
  font-family: var(--font-display); text-transform: none;
  font-size: .875rem;
  letter-spacing: .01em;
  color: var(--c);
}
.empty__title {
  font-family: var(--font-display); text-transform: none;
  font-weight: 400;
  font-size: clamp(2rem, 1.3rem + 3vw, 3.5rem);
  line-height: 1.05;
  text-wrap: balance;
}
.empty__text {
  max-width: 28rem;
  color: var(--text-2);
  text-wrap: pretty;
}
.empty .game-btn { margin-top: var(--space-3); }

/* shared sprite bits */
.empty__art .dim  { fill: color-mix(in srgb, var(--c) 35%, transparent); }
.empty__art .gap  { fill: var(--bg); }

/* Works: loading bar fills in 8 steps, flashes, restarts */
.art-build .fill {
  transform-box: fill-box; transform-origin: left;
  animation: es-load 4s infinite;
}
.art-build .cursor { animation: es-blink 1s steps(1) infinite; }
@keyframes es-load {
  0%   { transform: scaleX(0); animation-timing-function: steps(8, end); }
  60%  { transform: scaleX(1); opacity: 1; animation-timing-function: steps(1); }
  70%  { opacity: 0; } 78% { opacity: 1; } 86% { opacity: 0; } 94%, 100% { opacity: 1; transform: scaleX(1); }
}

/* Who dis: select brackets blink, the "?" bobs */
.art-mystery .brackets { animation: es-blink 1.2s steps(1) infinite; }
.art-mystery .q { animation: es-bob 1.6s steps(1) infinite; }

/* Fun Lab: coin spins, drops into the slot, slot lights up */
.art-coin .panel { fill: var(--bg-card); }
.art-coin .coin  { animation: es-drop 3.2s infinite; }
.art-coin .f     { opacity: 0; animation: es-frame .64s steps(1) infinite; }
.art-coin .f1    { opacity: 1; }
.art-coin .f2    { animation-delay: -.48s; }
.art-coin .f3    { animation-delay: -.32s; }
.art-coin .f4    { animation-delay: -.16s; }
.art-coin .glow  { fill: var(--text); opacity: 0; animation: es-glow 3.2s steps(1) infinite; }
.art-coin .arrow { animation: es-blink 1s steps(1) infinite; }
@keyframes es-frame { 0% { opacity: 1; } 25%, 100% { opacity: 0; } }
@keyframes es-drop {
  0%, 50% { transform: translateY(0); animation-timing-function: steps(1); }
  52%     { transform: translateY(-1px); animation-timing-function: steps(13, end); }
  72%     { transform: translateY(12px); animation-timing-function: steps(1); }
  73%, 99% { transform: translateY(12px); opacity: 0; }
  100%    { transform: translateY(0); opacity: 0; }
}
@keyframes es-glow { 0%, 72% { opacity: 0; } 74% { opacity: 1; } 80% { opacity: 0; } 84% { opacity: 1; } 92%, 100% { opacity: 0; } }

/* 404: astronaut drifts around, waving; stars twinkle */
.art-space .suit  { fill: var(--text); }
.art-space .shade { fill: var(--text-2); }
.art-space .visor { fill: var(--accent); }
.art-space .shine { fill: var(--text); }
.art-space .star  { fill: var(--text); animation: es-twinkle 2.4s steps(1) infinite; }
.art-space .star.s1 { animation-delay: -.8s; }
.art-space .star.s2 { animation-delay: -1.6s; }
.art-space .star.big { fill: var(--accent); }
.art-space .planet { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.art-space .ring   { fill: var(--text-2); }
.art-space .astro  { animation: es-drift 14s infinite; }
.art-space .arm-b  { opacity: 0; animation: es-wave .9s steps(1) infinite; }
.art-space .arm-a  { animation: es-wave .9s steps(1) infinite reverse; }
@keyframes es-drift {
  0%   { transform: translate(14px, 8px);  animation-timing-function: steps(8); }
  25%  { transform: translate(22px, 4px);  animation-timing-function: steps(8); }
  50%  { transform: translate(26px, 11px); animation-timing-function: steps(10); }
  75%  { transform: translate(16px, 13px); animation-timing-function: steps(6); }
  100% { transform: translate(14px, 8px); }
}
@keyframes es-wave { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes es-twinkle { 0% { opacity: 1; } 60% { opacity: .25; } 80%, 100% { opacity: 1; } }

@keyframes es-blink { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes es-bob   { 0% { transform: translateY(0); } 50%, 100% { transform: translateY(-1px); } }

@media (prefers-reduced-motion: reduce) {
  .empty__art * { animation: none !important; }
  .art-space .astro { transform: translate(16px, 8px); }
}


/* 10. REDUCED MOTION ======================================================
   If someone asks their device for less motion, everything is instant. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
