/* ==========================================================================
   world.css: "world theme" (round 31, branch world-theme)
   The page borrows the footer's pixel world: navy night / cream day.
   Loaded right after styles.css. Delete its <link> to revert completely.
   Only overrides: tokens first, then a few targeted rules.
   ========================================================================== */

/* 1. PALETTE ---------------------------------------------------------------- */
/* Shared keys (dock "+", sound key, card keys, boot keys): navy instead of warm grey */
:root {
  --key-face:     #18223a;
  --key-face-top: #202c48;
  --key-band:     #0c1323;
  --key-outline:  #050914;
  --key-fg:       #a9b4c8;
  --key-fg-hi:    #e8ecf4;
  --screen:       #0a1122;
}

/* Night (sampled from footer-sky-night / footer-scene-night: #0b0c24 → #2b56a6, mountains #2e3f86) */
/* (not plain :root: in light mode :root is the same <html>, and anything set here
   that the day block doesn't repeat would leak into light mode) */
:root:not([data-theme="light"]),
[data-theme="dark"] {
  --bg:            #070b18;
  --bg-deep:       #080d22;                 /* where the page ends up, just above the footer sky */
  --bg-card:       #111a2e;
  --bg-chip:       rgb(14 20 36 / .9);
  --text:          #e8ecf4;
  --text-2:        #a9b4c8;
  --text-3:        #8693ab;
  --border:        rgb(170 200 255 / .08);
  --border-strong: rgb(170 200 255 / .15);
  --hover-fill:    rgb(170 200 255 / .07);
  --bar-bg:        linear-gradient(rgb(170 200 255 / .06), rgb(170 200 255 / .06)), rgb(8 12 24 / .55);
  --dock-bg:       rgb(7 11 24 / .88);
  --dock-border:   rgb(170 200 255 / .14);
  --dock-shadow:   0 10px 30px rgb(2 4 12 / .55);
  --bar-divider:   rgb(170 200 255 / .14);
  --art-rest:      40%;
  --art-rest-liq:  22%;
  --screen-filter: brightness(.9);          /* thumbnails in colour at rest */
  /* cartridges + shelf */
  --cart-face:     #131c32;
  --cart-edge:     rgb(170 200 255 / .11);
  --cart-band:     #0b1222;
  --cart-well:     #070b16;
  --cart-ridge:    rgb(170 200 255 / .16);
  --cart-led:      rgb(170 200 255 / .18);
  --rail-face:     #121b31;
  --rail-band:     #0a1121;
  --rail-edge:     rgb(170 200 255 / .2);
  --rail-shadow:   0 14px 26px -12px rgb(2 4 12 / .8);
  --boot-backdrop: rgb(4 7 16 / .66);
  --insert-tint:   rgb(6 9 18 / .8);
}

/* Day (warm valley morning; footer-sky-day: #ffffff → #5bb4e6, pines #226f4c) */
[data-theme="light"] {
  --bg:            #fbf8f1;
  --bg-deep:       #f1f7fb;                 /* drifts toward the footer's morning sky */
  --bg-card:       #fffdf7;
  --bg-chip:       rgb(255 253 247 / .9);
  --text:          #1c1a17;
  --text-2:        #57524b;
  --text-3:        #6f685f;
  --border:        #ece5d7;
  --border-strong: #e2d9c7;
  --hover-fill:    #f4eee2;
  --shadow-card:   0 1px 2px rgb(60 40 10 / .04), 0 8px 24px -12px rgb(60 40 10 / .1);
  --bar-bg:        rgb(255 252 245 / .8);
  --bar-border:    rgb(60 40 10 / .08);
  --bar-shadow:    0 1px 2px rgb(60 40 10 / .04), 0 6px 20px -6px rgb(60 40 10 / .1);
  --bar-divider:   rgb(60 40 10 / .1);
  --bar-hover-fill: rgb(244 238 226 / .9);
  --dock-bg:       var(--bar-bg);           /* cream glass, like the top bar */
  --dock-border:   var(--bar-border);
  --dock-shadow:   var(--bar-shadow);
  --art-rest:      28%;
  --art-rest-liq:  14%;
  --screen-filter: none;
  --cart-face:     #fffdf7;
  --cart-edge:     #e6dece;
  --cart-band:     #e6dece;
  --cart-well:     #f2ecdf;
  --cart-ridge:    #d8cfbd;
  --cart-led:      #d8cfbd;
  --cart-shadow:   drop-shadow(0 1px 1px rgb(60 40 10 / .05)) drop-shadow(0 8px 10px rgb(60 40 10 / .07));
  --rail-face:     #f3ede1;
  --rail-band:     #e4dccb;
  --rail-edge:     #e2d9c7;
  --rail-side:     #e2d9c7;
  --rail-shadow:   0 12px 22px -12px rgb(60 40 10 / .28);
  --boot-backdrop: rgb(40 30 10 / .22);
  --insert-tint:   rgb(251 248 241 / .84);
}
[data-theme="light"] .card__btn,
[data-theme="light"] .boot__key {
  --key-face:     #f4eee2;
  --key-face-top: #fbf8f1;
  --key-band:     #e4dccb;
  --key-outline:  #d6ccb8;
  --key-fg:       #6f685f;
}

/* 2. PAGE JOURNEY: the background drifts toward the footer's sky ------------- */
body {
  background: linear-gradient(var(--bg) 0, var(--bg) 35%, var(--bg-deep) 100%) var(--bg);
}
/* the footer sky starts in the old page colour: fade it in from --bg-deep so there is no seam */
.footer__scene::before {
  background:
    linear-gradient(var(--bg-deep), transparent 22%),
    var(--sky-strip) repeat-x 0 0 / calc(var(--px) * 4) 100%;
}

/* 3. HERO ------------------------------------------------------------------- */
/* dithered glow: moonlight blue + mint at night, soft sky glow by day (the canvas paints in --accent) */
.hero__water { filter: hue-rotate(38deg) saturate(1.1); }
[data-theme="light"] .hero__water { filter: hue-rotate(22deg) saturate(.9); }

/* skill pills, night: deep saturated tints on navy (were mixed with grey #0d0d0d/#141414 → olive) */
.badge {
  --pill-edge:     color-mix(in srgb, var(--c) 62%, #070b18);
  --pill-face-top: color-mix(in srgb, var(--c) 34%, #111a2e);
  --pill-face:     color-mix(in srgb, var(--c) 26%, #111a2e);
  --pill-band:     color-mix(in srgb, var(--c) 16%, #070b18);
  --pill-ink:      color-mix(in srgb, var(--c) 72%, #ffffff);
}
[data-theme="light"] .badge {
  --pill-edge:     color-mix(in srgb, var(--c) 55%, #fffdf7);
  --pill-face-top: color-mix(in srgb, var(--c) 14%, #fffdf7);
  --pill-face:     color-mix(in srgb, var(--c) 20%, #fffdf7);
  --pill-band:     color-mix(in srgb, var(--c) 32%, #fffdf7);
}

/* a few pixel stars at night, in the side margins (never behind the headline / button) */
.hero { position: relative; }
.hero::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 2px; height: 2px;
  background: transparent;
  pointer-events: none;
  z-index: 0;
  color: rgb(214 232 255 / .55);
  box-shadow:
    6vw 18svh 0 currentColor, 13vw 9svh 0 currentColor, 9vw 41svh 0 currentColor, 17vw 63svh 0 currentColor,
    4vw 76svh 0 currentColor, 21vw 30svh 0 currentColor,
    93vw 14svh 0 currentColor, 86vw 34svh 0 currentColor, 95vw 52svh 0 currentColor, 81vw 11svh 0 currentColor,
    89vw 71svh 0 currentColor, 78vw 58svh 0 currentColor;
  animation: world-twinkle 5s steps(1) infinite;
}
@keyframes world-twinkle { 0% { opacity: .55; } 40% { opacity: 1; } 70%, 100% { opacity: .7; } }
[data-theme="light"] .hero::after { display: none; }

/* 4. PROJECTS --------------------------------------------------------------- */
.shelf__kicker { color: var(--accent-text); }
/* each cartridge shows its colour at rest: LED on, number + ridges tinted, faint ring */
.cart {
  --led: color-mix(in srgb, var(--c) 80%, transparent);
}
.cart__no { color: color-mix(in srgb, var(--c) 70%, var(--text-2)); }
[data-theme="light"] .cart__no { color: color-mix(in oklab, var(--c) 50%, var(--text)); }
.cart__ridges { background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, var(--cart-ridge)) 0 1.1cqi, transparent 1.1cqi 2.7cqi); }
/* 4b. CARTRIDGES PLUGGED INTO A CONSOLE (round 32) ----------------------------
   One neutral border for every cartridge (the colour lives in the LED, number, ridges and glow).
   The shelf becomes the top of a game console: each cartridge sits in its own dark slot, plugged
   13% deep. Hover / focus (or "current" on phones) pulls it out with a small overshoot. */
:root:not([data-theme="light"]),
[data-theme="dark"] {
  --cart-edge:   #03050c;                 /* darker than the page (#070b18): one crisp outline for all */
  --deck-top:    #0c1224;                 /* console top surface */
  --deck-face:   #04070f;                 /* console front */
  --deck-band:   #010204;                 /* bottom depth band */
  --deck-hi:     rgb(170 200 255 / .14);  /* lit top edge */
  --deck-grill:  rgb(170 200 255 / .12);
  --slot:        #000;                    /* the slot opening */
  --rail-shadow: 0 16px 28px -12px rgb(0 0 0 / .9);
}
[data-theme="light"] {
  --cart-edge:   #d6cbb5;                 /* darker cream */
  --deck-top:    #5a5148;                 /* warm espresso console: clearly hardware on the cream page */
  --deck-face:   #3b352f;
  --deck-band:   #2a2622;
  --deck-hi:     rgb(255 240 220 / .16);
  --deck-grill:  rgb(255 240 220 / .14);
  --slot:        #15120f;
  --rail-shadow: 0 14px 24px -12px rgb(40 28 12 / .45);
  --shelf-dim:   .5;                      /* other cartridges while one is hovered (styles.css: .7) */
}
@media (hover: hover) and (pointer: fine) {
  [data-theme="light"] .shelf__track:has(.cart:hover) .cart:not(:hover) { filter: saturate(.35); }
}

@property --lift { syntax: '<length-percentage>'; inherits: true; initial-value: 0px; }

/* same border for all cartridges, at rest and lit (the glow carries the colour) */
.cart,
.cart:hover,
.cart:focus-visible,
.cart.is-current { --ring: var(--cart-edge); }

/* pull-out: the lift is a share of the cartridge's own height, with a small overshoot.
   a.cart is the still hit box; the motion lives on .cart__body, so the hover target never moves away from the cursor. */
.cart { --plug: 8%; transition: opacity 300ms var(--ease), filter 300ms var(--ease); }
.cart__body { transition: translate 520ms linear(0, 0.6 25%, 0.95 40%, 1.08 50%, 1.08 58%, 0.99 72%, 1), transform 600ms cubic-bezier(.2, .8, .2, 1); }
@media (hover: hover) and (pointer: fine) {
  .cart:hover .cart__body { transition: translate 560ms linear(0, -0.1 7%, -0.13 12.5%, 0.55 22%, 0.92 30%, 1.06 37%, 1.02 46%, 0.99 58%, 1), transform 180ms ease-out; }
}
.cart:focus-visible .cart__body { transition: translate 560ms linear(0, -0.1 7%, -0.13 12.5%, 0.55 22%, 0.92 30%, 1.06 37%, 1.02 46%, 0.99 58%, 1), transform 400ms cubic-bezier(.2, .8, .2, 1); }
@media (hover: none) {
  .cart.is-current .cart__body { transition: translate 560ms linear(0, -0.1 7%, -0.13 12.5%, 0.55 22%, 0.92 30%, 1.06 37%, 1.02 46%, 0.99 58%, 1), transform 600ms cubic-bezier(.2, .8, .2, 1); }
}
.cart:active .cart__body { transition-duration: 90ms; }
@media (hover: hover) and (pointer: fine) {
  .cart:hover { --lift: -11%; }
}
.cart:focus-visible { --lift: -11%; }
@media (hover: none) {
  .cart.is-current { --lift: -11%; }          /* fully out on phones too */
}
.cart:active { --lift: -9%; }
/* room above, so a cartridge can come fully out */
.shelf__scroller { padding-top: 56px; }                          /* was 32px */
.shelf.is-scroller .shelf__scroller { padding-top: 120px; }      /* was 96px (margin-top -64px unchanged) */
/* no whole-cartridge glow: the light comes from the slot (below) */
.cart::after { content: none; }

/* the console: replaces the rail */
.shelf__track::after {
  top: 92%;                                          /* = 100% − --plug */
  bottom: -22px;
  height: auto;
  border: 0;
  border-radius: 12px 12px 8px 8px;
  background:
    /* grill, left end */
    repeating-linear-gradient(90deg, var(--deck-grill) 0 3px, transparent 3px 7px) left 22px bottom 11px / 42px 8px no-repeat,
    /* top surface, then the front */
    linear-gradient(var(--deck-top) 0 12px, var(--deck-face) 12px);
  box-shadow:
    inset 0 1px 0 var(--deck-hi),
    inset 0 -6px 0 var(--deck-band),
    var(--rail-shadow);
}
/* one slot opening per cartridge, on the console's top edge */
.shelf__track > li { position: relative; }
.shelf__track > li::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: -5px; right: -5px;
  top: calc(92% - 3px);
  height: 6px;
  border-radius: 4px;
  background: var(--slot);
  box-shadow: inset 0 2px 2px rgb(0 0 0 / .5), 0 1px 0 var(--deck-hi);
  pointer-events: none;
}
/* --- slot status LEDs: green = seated, red = pulled out --- */
:root { --led-off: #3ad07f; --led-on: #ff4a3d; }

.shelf__track > li::before {
  content: ""; position: absolute; z-index: 3; pointer-events: none;
  left: 50%; top: calc(100% + 5px);           /* on the console face, in line with the grill */
  width: 16px; height: 5px; margin-left: -8px; border-radius: 2px;
  background: var(--led-off);
  box-shadow: 0 0 0 2px rgb(0 0 0 / .35),
              0 0 6px color-mix(in srgb, var(--led-off) 55%, transparent);
}
.shelf__track > li:has(.cart:focus-visible)::before { 
  background: var(--led-on);
  box-shadow: 0 0 0 2px rgb(0 0 0 / .35),
              0 0 6px 1px color-mix(in srgb, var(--led-on) 75%, transparent),
              0 0 16px 3px color-mix(in srgb, var(--led-on) 35%, transparent);
  animation: led-out 300ms steps(1) 1;
}
@media (hover: hover) and (pointer: fine) {
  .shelf__track > li:has(.cart:hover)::before {
    background: var(--led-on);
    box-shadow: 0 0 0 2px rgb(0 0 0 / .35),
                0 0 6px 1px color-mix(in srgb, var(--led-on) 75%, transparent),
                0 0 16px 3px color-mix(in srgb, var(--led-on) 35%, transparent);
    animation: led-out 300ms steps(1) 1;
  }
}
@media (hover: none) {
  .shelf__track > li:has(.cart.is-current)::before {
    background: var(--led-on);
    box-shadow: 0 0 0 2px rgb(0 0 0 / .35),
                0 0 6px 1px color-mix(in srgb, var(--led-on) 75%, transparent),
                0 0 16px 3px color-mix(in srgb, var(--led-on) 35%, transparent);
    animation: led-out 300ms steps(1) 1;
  }
}
/* 0–75ms still green (the press), then red, one flicker, steady red */
@keyframes led-out {
  0%   { background: var(--led-off); box-shadow: 0 0 0 2px rgb(0 0 0 / .35); }
  25%  { opacity: 1; }
  50%  { opacity: .2; }
  75%  { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .shelf__track > li::before { animation: none !important; }
}
@media (max-width: 47.99rem) {
  .shelf__track > li::after { left: -3px; right: -3px; }   /* 12px gaps on phones: keep the slots apart */
}
@media (prefers-reduced-motion: reduce) {
  .cart { transition: opacity 300ms; }                     /* no slide; the lit state still shows */
  .cart__body { transition: none; }
}

/* ---- 3D depth (round 40) ---- */
/* side + back colours: per cartridge, so they're set on .cart where --c exists */
.cart { --cart-side: color-mix(in srgb, var(--c) 26%, #17213a); --cart-back: color-mix(in srgb, var(--c) 12%, #0b1122); }
[data-theme="light"] .cart { --cart-side: color-mix(in srgb, var(--c) 22%, #e2d8c3); --cart-back: color-mix(in srgb, var(--c) 14%, #cdc1a8); }

.cart__body > .cart__top, .cart__body > .cart__well, .cart__body > .cart__info { transform: translateZ(1px); }   /* sit just above the face, no z-fighting */
.cart__depth { position: absolute; inset: 0; z-index: -1; transform-style: preserve-3d; pointer-events: none; }
.cart__depth svg {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  fill: var(--cart-side); stroke: none;
  transform: translateZ(calc(var(--z) * -1));
}
.cart__depth svg:last-child { fill: var(--cart-back); }

@media (hover: hover) and (pointer: fine) { .cart:hover { --tx: -9deg; } }   /* resting hover pose: top tips toward you */
.cart:focus-visible { --tx: -9deg; --ty: -12deg; }                             /* keyboard focus shows the depth too */
@media (hover: none) { .cart.is-current { --tx: -6deg; --ty: -14deg; } }       /* phones: current cartridge rests at an angle */

/* 5. WHO DIS / FUN LAB ------------------------------------------------------ */
/* icons in colour at rest (animations still start on hover / on screen) */
.card__art { fill: color-mix(in srgb, var(--c) 70%, var(--bg-card)); }
.card__art .liq { fill: color-mix(in srgb, var(--c) 35%, var(--bg-card)); }
/* a hint of each card's colour at rest; full wash on hover */
.card__glow { opacity: .45; }
/* meta labels in the card colour (mixed with text so they keep AA) */
.card__meta { color: color-mix(in oklab, var(--c) 62%, var(--text-2)); }
[data-theme="light"] .card__meta { color: color-mix(in oklab, var(--c) 45%, var(--text)); }
/* card keys lit in the card colour at rest, like the chunky game buttons */
.card__btn::before { opacity: 1; }
.card__btn {
  height: 3.25rem;
  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 18px color-mix(in srgb, var(--c) 16%, transparent);
}
/* day: pastel keys with deep same-hue ink (a full-strength green face read heavy/olive on cream) */
[data-theme="light"] .card__btn {
  color: color-mix(in srgb, var(--c) 45%, #111);
  text-shadow: 0 1px 0 rgb(255 255 255 / .5);
}
[data-theme="light"] .card__btn::before {
  background: linear-gradient(color-mix(in srgb, var(--c) 26%, #fff), color-mix(in srgb, var(--c) 48%, #fff) 58%);
  box-shadow: inset 0 2px 0 rgb(255 255 255 / .7), inset 0 -5px 0 color-mix(in srgb, var(--c) 70%, #fff);
}

/* 6. SELECTION + FOCUS -------------------------------------------------------- */
[data-theme="light"] { --selection: rgb(20 184 166 / .22); }

/* 7. REDUCED MOTION ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero::after { animation: none; }
}

/* 8. FOOTER: privacy link, looks like the HUD text around it ---------------- */
.footer__privacy { color: inherit; text-decoration: none; }
.footer__privacy:hover,
.footer__privacy:focus-visible { text-decoration: underline; text-underline-offset: .3em; }
