/* ==========================================================================
   Alex Wright — 16-bit broadcast portfolio
   ========================================================================== */

:root {
  /* Brand (from logo) */
  --blue: #0033ff;
  --gold: #ffc83d;
  --red: #ff3b3b;
  --green: #3ddc84;

  /* Type */
  --font-hud: "Press Start 2P", ui-monospace, monospace;
  --font-display: "Pixelify Sans", "Press Start 2P", system-ui, sans-serif;
  --font-num: "Jersey 10", "Pixelify Sans", system-ui, sans-serif; /* pixel font with clear digits */
  --font-body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Pixel unit + spacing (4px grid) */
  --px: 4px;
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px; --s7: 96px;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --steps: steps(4, end);

  --z-scan: 900; --z-nav: 100; --z-dialog: 1000;
}

/* ---------- Dark theme (default) ---------- */
:root,
:root[data-theme="dark"] {
  --bg: #070a1f;
  --bg-alt: #0c1132;
  --surface: #121a4a;
  --surface-2: #1a2462;
  --ink: #eef1ff;
  --ink-muted: #aeb6e0;
  --line: #0b0f2e;          /* pixel outline */
  --accent: #5c80ff;        /* blue tuned for text on dark (AA) */
  --accent-strong: var(--blue);
  --on-accent: #ffffff;
  --shadow: #02030c;
  --sky-1: #0a0f33;
  --sky-2: #16207a;
  --sky-3: #2b2fa8;
  --hill-1: #101a5c;
  --hill-2: #0a1240;
  --scan-opacity: .07;
  color-scheme: dark;
}

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  --bg: #f4f1e6;            /* cartridge-manual cream */
  --bg-alt: #e8e3d0;
  --surface: #ffffff;
  --surface-2: #f7f5ee;
  --ink: #0b1030;
  --ink-muted: #3d4470;
  --line: #0b1030;
  --accent: #0033ff;
  --accent-strong: #0033ff;
  --on-accent: #ffffff;
  --shadow: #0b1030;
  --sky-1: #7fb2ff;
  --sky-2: #a9cbff;
  --sky-3: #d6e6ff;
  --hill-1: #5ab55e;
  --hill-2: #2f8a4a;
  --gold: #b37a00;          /* darker gold for AA on cream */
  --scan-opacity: 0;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container { width: min(1180px, 100% - 32px); margin-inline: auto; }

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

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 2000;
  background: var(--gold); color: #000; padding: 12px 16px;
  font-family: var(--font-hud); font-size: .7rem; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* CRT scanlines (dark only) */
/* Looping particle background (drawn by js/background.js) */
.bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; display: block; }

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: var(--z-scan);
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,1) 2px 4px);
  opacity: var(--scan-opacity);
}

/* ---------- Pixel frame utility ----------
   Notched corners + hard drop shadow, like a SNES menu window. */
.pixel-frame,
.btn, .level, .stage, .client, .hud__stat, .xp-total, .filter, .gallery, .continue {
  --frame: var(--line);
  --drop: var(--shadow);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--frame),
    0 var(--px) 0 0 var(--frame),
    calc(var(--px) * -1) 0 0 0 var(--frame),
    var(--px) 0 0 0 var(--frame),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--px) var(--drop);
}

/* Digits inside pixel headings use the clearer number font */
.num { font-family: var(--font-num); font-weight: 400; font-size: 1.18em; line-height: 1; letter-spacing: .02em; }

/* ---------- HUD label ---------- */
.hud-label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-hud); font-size: .625rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
}
.tally {
  width: 10px; height: 10px; background: var(--red); flex: none;
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: .25; } }

/* ---------- Pixel icons (rendered by JS into SVG) ---------- */
.px-icon { display: inline-block; width: 20px; height: 20px; line-height: 0; }
.px-icon svg { width: 100%; height: 100%; shape-rendering: crispEdges; }
.px-icon--lg { width: 32px; height: 32px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 14px 22px;
  font-family: var(--font-hud); font-size: .6875rem; line-height: 1.4; text-transform: uppercase;
  text-decoration: none; border: 0; cursor: pointer;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background-color .15s;
  touch-action: manipulation;
}
.btn--primary { background: var(--accent-strong); color: var(--on-accent); }
.btn--primary:hover { background: #2a55ff; }
.btn--ghost { background: var(--surface); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); }
.btn:active { transform: translate(4px, 4px); --drop: transparent; }
.btn--sm { min-height: 44px; padding: 10px 14px; font-size: .625rem; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: var(--px) solid var(--line);
}
:root[data-theme="dark"] .nav { border-bottom-color: var(--surface-2); }
.nav__inner { display: flex; align-items: center; gap: var(--s3); min-height: 72px; }
.nav__brand { display: flex; align-items: center; gap: 14px; flex: none; min-height: 44px; text-decoration: none; }
.logo { height: 40px; width: auto; }
.nav__name {
  font-family: var(--font-hud); font-size: clamp(.8125rem, 1.1vw, 1rem); line-height: 1; text-transform: uppercase;
  color: var(--ink); white-space: nowrap;
}
.nav__brand:hover .nav__name { color: var(--accent); }
.nav nav { margin-left: auto; }
.nav__links { display: flex; gap: 4px; align-items: center; }
.nav__links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  font-family: var(--font-hud); font-size: .625rem; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.nav__links a:hover { color: var(--accent); }
.nav__links a.is-active { color: var(--accent); }
.nav__links a.is-active::before { content: "▶"; margin-right: 6px; font-size: .5rem; }
.nav__cta { background: var(--accent-strong); color: #fff !important; }
.nav__cta:hover { background: #2a55ff; }

.theme-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: var(--surface); color: var(--gold); border: 0; cursor: pointer;
  box-shadow: 0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line);
}
:root[data-theme="dark"] .theme-toggle { box-shadow: 0 -4px 0 0 var(--surface-2), 0 4px 0 0 var(--surface-2), -4px 0 0 0 var(--surface-2), 4px 0 0 0 var(--surface-2); }
.theme-toggle [data-icon="moon"] { display: none; }
:root[data-theme="light"] .theme-toggle [data-icon="sun"] { display: none; }
:root[data-theme="light"] .theme-toggle [data-icon="moon"] { display: inline-block; color: var(--ink); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: var(--s6) 0 var(--s7); overflow: hidden; isolation: isolate; }
.sky {
  position: absolute; inset: 0; z-index: -1; opacity: .88;
  /* banded 16-bit sky */
  background: linear-gradient(to bottom, var(--sky-1) 0 45%, var(--sky-2) 45% 100%);
}
.sky::before { /* checker dither between the two sky bands */
  content: ""; position: absolute; left: 0; right: 0; top: calc(45% - 8px); height: 16px;
  background-image: conic-gradient(var(--sky-2) 25%, transparent 0 50%, var(--sky-2) 0 75%, transparent 0);
  background-size: 8px 8px;
}
.sky::after { /* stepped pixel hills behind the HUD */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 200px;
  background:
    linear-gradient(to bottom, transparent 0 55%, var(--hill-2) 55%),
    var(--hill-1);
  clip-path: polygon(0 40%, 6% 40%, 6% 30%, 12% 30%, 12% 20%, 20% 20%, 20% 32%, 28% 32%, 28% 44%, 36% 44%, 36% 26%, 42% 26%, 42% 14%, 50% 14%, 50% 26%, 58% 26%, 58% 38%, 66% 38%, 66% 22%, 74% 22%, 74% 10%, 82% 10%, 82% 24%, 90% 24%, 90% 36%, 100% 36%, 100% 100%, 0 100%);
}
:root[data-theme="dark"] .hero::before { /* pixel stars */
  content: ""; position: absolute; z-index: -1; top: 0; left: 0; width: 4px; height: 4px; background: transparent;
  box-shadow:
    5vw 40px #fff, 14vw 120px #9fb3ff, 23vw 60px #fff, 31vw 180px #fff, 44vw 30px #9fb3ff,
    52vw 140px #fff, 61vw 70px #fff, 70vw 200px #9fb3ff, 78vw 40px #fff, 88vw 110px #fff,
    95vw 170px #9fb3ff, 9vw 230px #fff, 38vw 90px #fff, 66vw 20px #fff, 83vw 250px #fff;
  animation: twinkle 3s steps(2) infinite;
}
@keyframes twinkle { 50% { opacity: .55; } }
:root[data-theme="light"] .hero::before { /* pixel clouds */
  content: ""; position: absolute; z-index: -1; top: 60px; left: 8%; width: 16px; height: 16px; background: transparent;
  box-shadow:
    16px 0 #fff, 32px 0 #fff, 48px 0 #fff, 0 16px #fff, 16px 16px #fff, 32px 16px #fff, 48px 16px #fff, 64px 16px #fff,
    60vw 40px #fff, calc(60vw + 16px) 40px #fff, calc(60vw + 32px) 40px #fff, calc(60vw - 16px) 56px #fff, 60vw 56px #fff, calc(60vw + 16px) 56px #fff, calc(60vw + 32px) 56px #fff, calc(60vw + 48px) 56px #fff;
}

.hero__grid {
  display: grid; gap: var(--s5); align-items: center;
  grid-template-columns: 1fr;
}
.hero__copy { display: grid; gap: var(--s3); }
:root[data-theme="light"] .hero__copy .hud-label { color: var(--ink); }
/* Player-select portrait */
.player { display: flex; align-items: center; gap: 20px; }
.player__portrait {
  position: relative; margin: 4px; flex: none; width: clamp(96px, 12vw, 136px); aspect-ratio: 1;
  background: #05071a;
  box-shadow:
    0 -4px 0 0 var(--line), 0 4px 0 0 var(--line), -4px 0 0 0 var(--line), 4px 0 0 0 var(--line),
    8px 8px 0 4px var(--shadow);
}
:root[data-theme="dark"] .player__portrait {
  box-shadow:
    0 -4px 0 0 var(--accent-strong), 0 4px 0 0 var(--accent-strong), -4px 0 0 0 var(--accent-strong), 4px 0 0 0 var(--accent-strong),
    8px 8px 0 4px var(--shadow);
}
.player__portrait img { width: 100%; height: 100%; image-rendering: pixelated; }
.player__tag {
  position: absolute; left: -4px; bottom: -4px; padding: 5px 6px;
  font-family: var(--font-hud); font-size: .5625rem; line-height: 1; background: var(--gold); color: #000;
}
:root[data-theme="light"] .player__tag { background: #ffc83d; }
.player__status { display: grid; gap: 12px; }
.player__stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--font-hud); font-size: .5625rem; line-height: 1.6; color: #e3e8ff; }
.player__stats span:last-child { color: var(--green); letter-spacing: -.1em; }
:root[data-theme="light"] .player__stats { color: var(--ink); }
:root[data-theme="light"] .player__stats span:last-child { color: #1b7a43; }

.hero__title { display: grid; gap: 12px; }
.hero__name {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.75rem, 8vw, 5.5rem); line-height: .95; letter-spacing: .01em;
  color: #fff;
  text-shadow: 4px 4px 0 var(--blue), 8px 8px 0 var(--shadow);
}
:root[data-theme="light"] .hero__name { color: var(--ink); text-shadow: 4px 4px 0 #fff, 8px 8px 0 var(--blue); }
.hero__role {
  font-family: var(--font-hud); font-size: clamp(.7rem, 1.6vw, .95rem); line-height: 1.6;
  color: var(--gold); text-transform: uppercase;
}
:root[data-theme="dark"] .hero__role { color: #ffd766; }
:root[data-theme="light"] .hero__role { color: #001aa3; }
.hero__intro { max-width: 52ch; font-size: 1.125rem; color: #e3e8ff; }
:root[data-theme="light"] .hero__intro { color: var(--ink); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 20px; padding: 4px; }

/* Achievement badges (hero) */
.achievements { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 20px; padding: 4px; }
.achievements[hidden] { display: none; }
.achievement {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #ffc83d; color: #000;
  font-family: var(--font-hud); font-size: .625rem; line-height: 1.5; text-transform: uppercase;
  box-shadow: 0 -4px 0 0 #000, 0 4px 0 0 #000, -4px 0 0 0 #000, 4px 0 0 0 #000, 8px 8px 0 4px var(--shadow);
}
.achievement .px-icon { width: 18px; height: 18px; color: #000; flex: none; }
.achievement--silver { background: #d9deef; font-size: .5625rem; padding: 8px 12px; }
.achievement--silver .px-icon { width: 14px; height: 14px; color: #4a5285; }

/* Retro TV (hero) */
.tv { margin: 28px 4px 0; position: relative; }
.tv__antenna { position: absolute; left: 50%; top: -30px; width: 0; height: 0; }
.tv__antenna::before, .tv__antenna::after { /* rabbit ears */
  content: ""; position: absolute; bottom: 0; width: 4px; height: 44px; background: #7c84b3; transform-origin: bottom center;
  box-shadow: 0 -4px 0 0 #c3c9e6;
}
.tv__antenna::before { transform: rotate(-32deg); left: -14px; }
.tv__antenna::after { transform: rotate(32deg); left: 10px; }
.tv__body {
  position: relative; z-index: 1; padding: 18px 18px 0; background: #2a2f55;
  background-image: linear-gradient(to bottom, #3a4175 0 6px, #2a2f55 6px);
  --frame: #05071a; --drop: var(--shadow);
  box-shadow:
    0 -4px 0 0 var(--frame), 0 4px 0 0 var(--frame), -4px 0 0 0 var(--frame), 4px 0 0 0 var(--frame),
    10px 10px 0 4px var(--drop);
}
.tv__screen {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000;
  /* stepped "rounded" corners, 16-bit style */
  clip-path: polygon(0 12px, 4px 12px, 4px 8px, 8px 8px, 8px 4px, 12px 4px, 12px 0,
    calc(100% - 12px) 0, calc(100% - 12px) 4px, calc(100% - 8px) 4px, calc(100% - 8px) 8px, calc(100% - 4px) 8px, calc(100% - 4px) 12px, 100% 12px,
    100% calc(100% - 12px), calc(100% - 4px) calc(100% - 12px), calc(100% - 4px) calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) calc(100% - 4px), calc(100% - 12px) calc(100% - 4px), calc(100% - 12px) 100%,
    12px 100%, 12px calc(100% - 4px), 8px calc(100% - 4px), 8px calc(100% - 8px), 4px calc(100% - 8px), 4px calc(100% - 12px), 0 calc(100% - 12px));
}
.tv__screen::after { /* glass + scanlines, above everything, never blocks clicks */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 6;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.10), transparent 55%),
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0,0,0,.16) 2px 4px);
}
.tv__player, .tv__screen iframe, .tv__fallback { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.tv__fallback { z-index: 1; background: #000; text-decoration: none; }
.tv__fallback[hidden] { display: none; }
.tv__fallback img { width: 100%; height: 100%; object-fit: cover; }
.tv__fallback span {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 14px;
  background: #ff3b3b; color: #fff; font-family: var(--font-hud); font-size: .625rem; text-transform: uppercase; white-space: nowrap;
}
/* Click shield keeps YouTube's own overlay hidden until the TV is hovered (or tapped on touch screens) */
.tv__shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.tv:hover .tv__shield, .tv.is-interactive .tv__shield, .tv.is-file .tv__shield { pointer-events: none; }
/* Power-on / channel-change static */
.tv__static {
  position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0;
  transition: opacity 1s cubic-bezier(.3, 0, .2, 1); /* dissolve out */
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 2px, transparent 2px 4px),
    repeating-conic-gradient(#d9deef 0 25%, #2a2f55 0 50%) 0 0 / 6px 6px,
    #6b7299;
  animation: tv-static .18s steps(4) infinite;
}
.tv__static.is-on { opacity: 1; transition: none; } /* snap on instantly */
/* CRT warm-up as the picture dissolves in */
.tv.is-warm .tv__screen iframe { animation: tv-warm 1.2s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes tv-warm {
  from { filter: brightness(1.9) saturate(0) contrast(.8) blur(2px); }
  to   { filter: none; }
}
@keyframes tv-static { 25% { background-position: 0 0, 3px 2px, 0 0; } 50% { background-position: 0 2px, -2px 3px, 0 0; } 75% { background-position: 0 1px, 2px -3px, 0 0; } }
/* Off state: picture collapses to a line */
.tv__off { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: #05071a; opacity: 0; }
.tv__off::after {
  content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 4px; margin-top: -2px; background: #fff; opacity: 0;
}
.tv.is-off .tv__off { opacity: 1; }
.tv.is-off .tv__off::after { animation: tv-off .5s steps(5) forwards; }
@keyframes tv-off { 0% { opacity: 1; transform: scaleX(1); } 80% { opacity: 1; transform: scaleX(.05); } 100% { opacity: 0; transform: scaleX(0); } }
/* On-screen display */
.tv__osd {
  position: absolute; top: 14px; right: 18px; z-index: 7; margin: 0; pointer-events: none;
  font-family: var(--font-num); font-size: 1.75rem; line-height: 1; color: #3ddc84; text-shadow: 2px 2px 0 #000;
  opacity: 0; transition: opacity .2s steps(2);
}
.tv__osd.is-on { opacity: 1; }
/* Control panel */
.tv__panel { display: flex; align-items: center; gap: 14px; padding: 14px 2px 16px; }
.tv__grille {
  flex: 1 1 auto; height: 28px; min-width: 40px;
  background: radial-gradient(circle, #05071a 1.5px, transparent 2px) 0 0 / 8px 8px;
}
.tv__brand { font-family: var(--font-hud); font-size: .5rem; color: #c3c9e6; letter-spacing: .1em; white-space: nowrap; }
.tv__buttons { display: flex; gap: 10px; flex: none; }
.tv__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 48px; min-height: 44px; padding: 6px 10px; border: 0; cursor: pointer;
  background: #c3c9e6; color: #05071a; font-family: var(--font-hud); font-size: .5rem; line-height: 1;
  box-shadow: inset -3px -3px 0 #7c84b3, inset 3px 3px 0 #fff, 0 4px 0 #05071a;
  transition: transform .08s steps(1), box-shadow .08s steps(1);
  touch-action: manipulation;
}
.tv__btn:hover { background: #d9deef; }
.tv__btn:active { transform: translateY(3px); box-shadow: inset 3px 3px 0 #7c84b3, inset -3px -3px 0 #fff, 0 1px 0 #05071a; }
.tv__btn .px-icon { width: 14px; height: 14px; }
.tv__btn[aria-pressed="true"][data-tv-volume] { background: #ffc83d; }
.tv__channels { display: flex; gap: 6px; }
.tv__btn--ch { min-width: 52px; }
.tv__btn--ch[aria-pressed="true"] { /* the channel you're watching stays pressed in and lit */
  background: #ffc83d; transform: translateY(3px);
  box-shadow: inset 3px 3px 0 #c98a00, inset -3px -3px 0 #ffe08a, 0 1px 0 #05071a;
}
.tv__led { width: 8px; height: 8px; background: #ff3b3b; box-shadow: 0 0 0 2px #05071a; }
.tv__btn--power[aria-pressed="true"] .tv__led { background: #3ddc84; box-shadow: 0 0 0 2px #05071a, 0 0 8px #3ddc84; }
.tv__feet { display: flex; justify-content: space-between; padding: 0 12%; height: 10px; }
.tv__feet::before, .tv__feet::after { content: ""; width: 40px; height: 10px; background: #05071a; }
.tv__caption {
  margin-top: 10px; font-family: var(--font-hud); font-size: .5625rem; line-height: 1.6;
  text-transform: uppercase; color: #aeb6e0;
}
:root[data-theme="light"] .tv__caption { color: var(--ink-muted); }
@media (prefers-reduced-motion: reduce) { .tv__static { display: none; } }

/* HUD stats */
.hud {
  margin: var(--s6) 0 0; display: grid; gap: 20px;
  grid-template-columns: repeat(2, 1fr);
}
.hud__stat { background: var(--surface); padding: 18px 20px; margin: 4px; display: grid; gap: 8px; }
.hud__stat dt { font-family: var(--font-hud); font-size: .5625rem; text-transform: uppercase; color: var(--ink-muted); line-height: 1.5; }
.hud__stat dd {
  margin: 0; font-family: var(--font-num); font-weight: 400; font-size: clamp(2.5rem, 6vw, 3.75rem); line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.hud__stat--gold { background: var(--accent-strong); }
.hud__stat--gold dt { color: #dfe6ff; }
.hud__stat--gold dd { color: #fff; }
.hud__plus { color: var(--gold); }
:root[data-theme="light"] .hud__plus { color: #ffd766; }

/* ---------- Sections ---------- */
.section { padding: var(--s7) 0; }
.section--alt {
  background: color-mix(in srgb, var(--bg-alt) 82%, transparent);
  border-block: var(--px) solid var(--line);
}
.section__head { display: grid; gap: 14px; margin-bottom: var(--s5); max-width: 720px; }
.section__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.25rem); color: var(--ink);
}
.section__lede { color: var(--ink-muted); font-size: 1.125rem; max-width: 60ch; }

/* ---------- Career levels ---------- */
.levels { display: grid; gap: 20px; }
.level {
  position: relative; background: var(--surface); padding: 20px; margin: 4px;
  display: grid; gap: 16px 20px; align-items: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "id" "info" "xp";
}
.level__id { grid-area: id; align-self: start; display: flex; align-items: center; gap: 10px; }
.level__sprite { width: 56px; height: 56px; flex: none; }
.level__sprite svg { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
/* Looping sprite dance: hop, turn, hop, turn back. 1s divides the 40s background loop evenly. */
.level__sprite svg { animation: sprite-dance 1s steps(1, end) infinite; animation-delay: calc(var(--i, 0) * -0.125s); transform-origin: 50% 100%; }
@keyframes sprite-dance {
  0%   { transform: translateY(0) scaleX(1); }
  25%  { transform: translateY(-12.5%) scaleX(1); }
  50%  { transform: translateY(0) scaleX(-1); }
  75%  { transform: translateY(-12.5%) scaleX(-1); }
}
.level__badge {
  flex: none;
  display: grid; place-items: center; align-content: center; gap: 4px;
  width: 64px; height: 64px; background: var(--bg); color: var(--ink-muted);
  box-shadow: inset 0 0 0 4px var(--accent);
}
.level__badge span { font-family: var(--font-hud); font-size: .5625rem; line-height: 1; }
.level__badge b { font-family: var(--font-num); font-size: 2.25rem; line-height: 1; color: var(--ink); }
.level__info { grid-area: info; display: grid; gap: 6px; min-width: 0; }
.level__title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.625rem; line-height: 1.15; color: var(--ink);
}
.level__meta { font-size: 1rem; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }
.level__blurb { font-size: 1.0625rem; color: var(--ink-muted); max-width: 60ch; }
.level__xp { grid-area: xp; display: grid; gap: 8px; }
.level__days { font-size: .9375rem; color: var(--ink-muted); }
.level__days b {
  font-family: var(--font-num); font-weight: 400; font-size: 2.25rem; line-height: 1;
  color: var(--ink); margin-right: 4px; font-variant-numeric: tabular-nums;
}
.xpbar {
  height: 16px; background: var(--bg); position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--line);
}
:root[data-theme="dark"] .xpbar { box-shadow: inset 0 0 0 2px var(--surface-2); }
.xpbar__fill {
  position: absolute; inset: 2px auto 2px 2px; width: calc((100% - 4px) * var(--pct, 0));
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(0,0,0,.25) 12px 16px),
    linear-gradient(to bottom, #8fa8ff 0 30%, var(--blue) 30%);
  transform-origin: left; transform: scaleX(0);
  transition: transform 1s var(--steps);
}
.level.is-visible .xpbar__fill { transform: scaleX(1); }

/* Current role: highlighted card */
.level--current { --frame: var(--accent-strong); background: var(--surface-2); padding: 28px 24px; }
:root[data-theme="light"] .level--current { background: #e9eeff; }
.level--current .level__badge { background: var(--accent-strong); box-shadow: inset 0 0 0 4px #fff; color: #dfe6ff; }
.level--current .level__badge b { color: #fff; }
.level--current .level__title { font-size: clamp(1.75rem, 3.5vw, 2.25rem); }
.level__award {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-hud); font-size: .625rem; line-height: 1; background: #ffc83d; color: #000;
  padding: 5px 8px; text-transform: uppercase;
}
.level__award .px-icon { width: 14px; height: 14px; }
.level__award--silver { background: #d9deef; }
.level__now {
  font-family: var(--font-hud); font-size: .625rem; line-height: 1; background: #ffc83d; color: #000;
  padding: 6px 8px; text-transform: uppercase;
}

@media (min-width: 900px) {
  .level {
    grid-template-columns: auto minmax(0, 1fr) 260px;
    grid-template-areas: "id info xp";
    padding: 22px 28px;
  }
  .level__id { align-self: center; gap: 14px; }
  .level__badge { width: 72px; height: 72px; }
  .level__sprite { width: 64px; height: 64px; }
  .level__xp { align-self: center; }
  .level--current { padding: 32px 28px; }
}

.xp-total {
  margin: var(--s5) 4px 4px; display: flex; align-items: center; gap: 16px;
  padding: 18px 22px; background: var(--surface); color: var(--gold);
}
.xp-total p { color: var(--ink); font-size: 1.0625rem; }
.xp-total strong { font-family: var(--font-num); font-weight: 400; font-size: 2rem; line-height: 1; color: var(--accent); }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: var(--s5); padding: 4px; }
.filter {
  min-height: 44px; padding: 10px 16px; background: var(--surface); color: var(--ink); border: 0; cursor: pointer;
  font-family: var(--font-hud); font-size: .5625rem; text-transform: uppercase;
}
.filter[aria-pressed="true"] { background: var(--accent-strong); color: #fff; }

/* ---------- Stage cards ---------- */
.stages { display: grid; gap: 32px; grid-template-columns: 1fr; }
.stage { background: var(--surface); margin: 4px; transition: transform .15s var(--ease-out); }
.stage:hover { transform: translate(-2px, -2px); }
.stage__btn {
  display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.stage__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg); }
.stage__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease-out); }
.stage:hover .stage__media img { transform: scale(1.04); }
.stage__badge {
  position: absolute; left: 12px; top: 12px; background: var(--gold); color: #000;
  font-family: var(--font-hud); font-size: .5625rem; padding: 6px 8px;
}
:root[data-theme="light"] .stage__badge { background: #ffc83d; }
.stage__count {
  position: absolute; right: 12px; bottom: 12px; background: rgba(5,7,26,.85); color: #fff;
  font-family: var(--font-hud); font-size: .5rem; padding: 6px 8px; display: inline-flex; gap: 8px; align-items: center;
}
.stage__body { padding: 18px 20px 22px; display: grid; gap: 8px; }
.stage__title { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--ink); }
.stage__meta { font-family: var(--font-hud); font-size: .5625rem; line-height: 1.8; color: var(--accent); text-transform: uppercase; }
.stage__summary { color: var(--ink-muted); }
.stage__cta { font-family: var(--font-hud); font-size: .5625rem; color: var(--ink); text-transform: uppercase; margin-top: 6px; }
.stage__btn:hover .stage__cta, .stage__btn:focus-visible .stage__cta { color: var(--accent); }

/* ---------- Show log ---------- */
.subhead {
  font-family: var(--font-hud); font-size: .75rem; line-height: 1.6; text-transform: uppercase;
  color: var(--ink); margin-bottom: var(--s3);
}
.log { margin-top: var(--s7); }
.log__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.log__head .subhead { margin-bottom: var(--s2); }
.log__summary { font-family: var(--font-hud); font-size: .5625rem; color: var(--ink-muted); text-transform: uppercase; line-height: 1.8; }
.log .filters { margin-bottom: var(--s4); }
.log__list { display: grid; gap: 12px; }
.log__row {
  display: grid; gap: 4px 20px; align-items: center;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "year main days" "year role days";
  padding: 14px 18px; background: var(--surface);
  border-left: var(--px) solid var(--accent-strong);
}
.log__row:nth-child(even) { background: var(--surface-2); }
.log__year { grid-area: year; font-family: var(--font-hud); font-size: .5625rem; color: var(--accent); align-self: start; padding-top: 4px; }
.log__main { grid-area: main; min-width: 0; }
.log__name { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.log__sub { font-size: .9375rem; color: var(--ink-muted); }
.log__role { grid-area: role; font-size: .9375rem; color: var(--ink); }
.log__role::before { content: "▶ "; color: var(--accent); font-size: .7em; }
.log__days { grid-area: days; font-family: var(--font-hud); font-size: .5625rem; color: var(--ink-muted); text-align: right; white-space: nowrap; }
.log__days b { display: block; font-family: var(--font-num); font-weight: 400; font-size: 2.25rem; line-height: 1; color: var(--ink); margin-bottom: 4px; }
@media (min-width: 900px) {
  .log__row { grid-template-columns: 56px minmax(0, 1.4fr) minmax(0, 1fr) 72px; grid-template-areas: "year main role days"; }
  .log__year { align-self: center; padding-top: 0; }
}

/* ---------- Clients ---------- */
.clients { display: grid; gap: 24px; grid-template-columns: repeat(2, 1fr); }
.client {
  margin: 4px; min-height: 120px; display: grid; place-items: center; text-align: center; padding: 20px;
  background: var(--surface); color: var(--ink);
}
.client img {
  display: block; margin: 0 auto; width: 100%; max-width: 160px; height: 56px; object-fit: contain;
  /* one-colour logos so every client sits evenly in the pixel tiles */
  filter: brightness(0) invert(1);
}
:root[data-theme="light"] .client img { filter: brightness(0); }
.client img[src*="gravity-media"] { max-width: 180px; }
.client__name { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.client__sprite { color: var(--accent); margin-bottom: 8px; }

/* ---------- Continue / contact ---------- */
.continue {
  margin: var(--s7) 4px 4px; padding: var(--s6) var(--s4); text-align: center;
  background: #05071a; color: #fff; display: grid; justify-items: center; gap: 18px;
  --frame: var(--accent-strong);
}
.continue__blink { font-family: var(--font-hud); font-size: .75rem; color: #ffd766; text-transform: uppercase; animation: blink 1s steps(1) infinite; }
.continue__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.75rem, 4.5vw, 3rem); }
.continue__text { color: #c6ccef; max-width: 52ch; }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.socials a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px;
  color: #c6ccef; font-family: var(--font-hud); font-size: .5625rem; text-transform: uppercase; text-decoration: none;
}
.socials a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Footer ---------- */
.footer { border-top: var(--px) solid var(--line); padding: var(--s4) 0; background: var(--bg-alt); }
:root[data-theme="dark"] .footer { border-top-color: var(--surface-2); }
.footer__inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.footer p, .footer a { font-family: var(--font-hud); font-size: .5625rem; color: var(--ink-muted); text-transform: uppercase; line-height: 1.8; }
.footer a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- Gallery dialog ---------- */
.gallery {
  width: min(1100px, 100% - 32px); max-height: calc(100dvh - 32px); padding: 16px; border: 0;
  background: #05071a; color: #fff; overflow: auto;
  --frame: var(--accent-strong);
}
.gallery::backdrop { background: rgba(2, 3, 12, .85); }
.gallery[open] { animation: gallery-in .22s var(--steps); }
@keyframes gallery-in { from { opacity: 0; transform: scale(.96); } }
.gallery__head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.gallery__title { font-family: var(--font-display); font-size: 1.5rem; }
.gallery__close {
  margin-left: auto; width: 44px; height: 44px; flex: none; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font-size: 1.1rem; font-family: var(--font-hud);
}
.gallery__stage { position: relative; aspect-ratio: 16 / 9; background: #000; display: grid; place-items: center; overflow: hidden; }
.gallery__stage img, .gallery__stage video, .gallery__stage iframe { width: 100%; height: 100%; object-fit: contain; border: 0; }
.gallery__caption { font-size: .9375rem; color: #c6ccef; margin-top: 10px; min-height: 1.6em; }
.gallery__controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 4px; }
.gallery__controls .btn--ghost { background: #1a2462; color: #fff; --frame: #2b3790; --drop: #000; }
.gallery__count { font-family: var(--font-hud); font-size: .625rem; font-variant-numeric: tabular-nums; }
.gallery__thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.gallery__thumbs button {
  display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; cursor: pointer; background: #000; opacity: .6;
  outline-offset: 2px; transition: opacity .15s;
}
.gallery__thumbs button:hover { opacity: 1; }
.gallery__thumbs button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 3px var(--gold); }
.gallery__thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs .is-video { display: grid; place-items: center; color: #fff; font-family: var(--font-hud); font-size: .5rem; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  /* Client logos: three smaller tiles per row on phones */
  .clients { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .client { min-height: 76px; padding: 10px 8px; }
  .client img { max-width: 88px; height: 32px; }
  .client img[src*="gravity-media"] { max-width: 96px; }
  .nav__links li:not(:last-child) { display: none; }
  .logo { height: 34px; }
  .nav__name { display: none; }
  .tv__brand { display: none; }
  .tv__grille { display: none; }
  .tv__panel { justify-content: center; }
  .tv__buttons { gap: 6px; }
  .tv__btn { min-width: 44px; padding: 6px 8px; }
  .tv__btn--ch { min-width: 48px; }
}
@media (min-width: 768px) {
  .hud { grid-template-columns: repeat(4, 1fr); }
  .stages { grid-template-columns: repeat(2, 1fr); }
  .clients { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .hero__grid { grid-template-columns: 1.05fr 1fr; }
  .stages { grid-template-columns: repeat(3, 1fr); }
  .clients { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .xpbar__fill { transform: none; }
}
