/* PICKLEHOOD.
   A neon room with one real object in it, and everything breathing on the beat.

   The whole page reads two custom properties written once a frame by js/main.js:
     --beat  1 at each beat, decaying to 0 before the next
     --bar   the same, once every four beats
   so nothing here needs a clock of its own and nothing drifts away from the music.

   The set is a photographed television with a hole in it, not a border drawn round a
   video. Its geometry is measured off the asset and lives in the --tv-* numbers below. */

@font-face {
  font-family: "Bagel Fat One";
  src: url("/assets/fonts/BagelFatOne-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Anton";
  src: url("/assets/fonts/Anton-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/Archivo-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --ink: #08030f;
  --paper: #fff6ff;

  /* the six tubes. his own acid lime is one of them, it is where the brand lives */
  --n-pink: #ff2d95;
  --n-orange: #ff7a18;
  --n-lime: #d9f13c;
  --n-green: #2bff88;
  --n-cyan: #22d9ff;
  --n-violet: #a44bff;
  --n-magenta: #ff35d6;

  --rainbow: var(--n-pink), var(--n-orange), var(--n-lime), var(--n-green),
             var(--n-cyan), var(--n-violet), var(--n-pink);

  --beat: 0;
  --bar: 0;
  --heat: 0;

  /* measured off assets/img/tv-shell.webp: the shell is 1512x1040 and its screen hole
     runs x 114..1394, y 100..737. every one of these is that hole as a percentage. */
  --tv-ar: 1512 / 1040;
  --tv-x: 7.5397%;
  --tv-y: 9.6154%;
  --tv-w: 84.7222%;
  --tv-h: 61.3462%;

  --font-display: "Bagel Fat One", "Archivo", system-ui, sans-serif;
  --font-meme: "Anton", "Archivo Black", "Arial Black", system-ui, sans-serif;
  --font-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-synthesis: none;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:where(a, button, [tabindex]):focus-visible {
  outline: 3px solid var(--n-lime);
  outline-offset: 4px;
  border-radius: 8px;
}

/* ---------------------------------------------------------------- the world */

.world, .vignette, .haze {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.world {
  object-fit: cover;
  filter: blur(10px) saturate(1.5) brightness(calc(0.88 + var(--beat) * 0.16));
  transform: scale(1.09);
  z-index: 0;
}

.haze { z-index: 1; mix-blend-mode: screen; opacity: 0.9; }

.vignette {
  z-index: 2;
  background:
    radial-gradient(128% 90% at 50% 46%, transparent 40%, rgba(8, 3, 15, 0.4) 76%, rgba(8, 3, 15, 0.74) 100%),
    linear-gradient(180deg, rgba(8, 3, 15, 0.4), transparent 24%, transparent 72%, rgba(8, 3, 15, 0.58));
}

/* ---------------------------------------------------------------- the stage */

.stage {
  position: relative;
  z-index: 3;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  justify-items: center;
  align-content: center;
  gap: clamp(8px, 1.5vh, 18px);
  padding: clamp(10px, 2vh, 24px) clamp(12px, 3vw, 34px) max(clamp(10px, 2vh, 24px), env(safe-area-inset-bottom));
}

/* --------------------------------------------------------- the hanging sign */

.sign { text-align: center; line-height: 1; }

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(36px, 6.9vw, 86px);
  line-height: 0.94;
  position: relative;
  isolation: isolate;
}

.wordmark span {
  background: linear-gradient(96deg, var(--rainbow));
  background-size: 340% 100%;
  animation: tube-run 5.2s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 calc(6px + var(--beat) * 12px) rgba(255, 45, 149, 0.95))
    drop-shadow(0 0 calc(18px + var(--beat) * 30px) rgba(164, 75, 255, 0.7))
    drop-shadow(0 0 calc(40px + var(--beat) * 46px) rgba(34, 217, 255, 0.45));
  display: inline-block;
  transform: scale(calc(1 + var(--bar) * 0.024));
  transform-origin: 50% 60%;
}

.wordmark::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: #2b0b3d;
  -webkit-text-stroke: 8px #2b0b3d;
  paint-order: stroke fill;
}

.ticker {
  margin: clamp(2px, 0.6vh, 8px) 0 0;
  font-weight: 800;
  font-stretch: 118%;
  font-size: clamp(13px, 1.5vw, 19px);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--n-lime);
  paint-order: stroke fill;
  -webkit-text-stroke: 4px #1c0730;
  text-shadow: 0 0 calc(8px + var(--beat) * 14px) rgba(217, 241, 60, 0.9);
}

/* -------------------------------------------------------------- THE SET */

.tvwrap {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* the object. bounded by height as well as width, or on a laptop it eats the room and
   there is no world left to look at. */
.tv {
  position: relative;
  width: min(100%, 860px, calc(58vh * var(--tv-ar)));
  aspect-ratio: var(--tv-ar);
  container-type: inline-size;
  filter:
    drop-shadow(0 22px 34px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 calc(20px + var(--beat) * 34px) rgba(255, 53, 214, calc(0.28 + var(--heat) * 0.42)))
    drop-shadow(0 0 calc(70px + var(--beat) * 70px) rgba(34, 217, 255, calc(0.16 + var(--heat) * 0.3)));
}

/* the shell is the photograph. it sits ON TOP of the picture, which is what makes the
   hole read as a hole rather than as a border. */
.tv-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

/* the glass is the hole, to the pixel */
.glass {
  position: absolute;
  left: var(--tv-x);
  top: var(--tv-y);
  width: var(--tv-w);
  height: var(--tv-h);
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 1.6cqw;
  overflow: hidden;
  background: #07030d;
  cursor: pointer;
  touch-action: manipulation;
  isolation: isolate;
}

.slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slot-vid { opacity: 0; }
.glass.is-video .slot-img { opacity: 0; }
.glass.is-video .slot-vid { opacity: 1; }

/* the cut IS the beat, so there is no fade */
.glass.cut .slot { animation: cut-in 170ms steps(3, end); }

@keyframes cut-in {
  0% { filter: invert(1) saturate(3) hue-rotate(90deg); transform: scale(1.05); }
  100% { filter: none; transform: scale(1); }
}

/* the score is a television on-screen display, so it lives on the glass, not on a strip
   bolted under it */
.osd {
  position: absolute;
  left: 0; right: 0; top: 0;
  display: flex;
  align-items: center;
  gap: 1.6cqw;
  padding: 1.6cqw 2.4cqw;
  background: linear-gradient(180deg, rgba(6, 2, 14, 0.72), transparent);
  font-family: var(--font-ui);
  pointer-events: none;
}

.osd-k {
  font-size: clamp(7px, 1.25cqw, 13px);
  font-weight: 800;
  letter-spacing: 0.2em;
  color: rgba(255, 246, 255, 0.55);
}

.osd-v {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: clamp(11px, 2.1cqw, 24px);
  line-height: 1;
  color: var(--n-lime);
  text-shadow: 0 0 calc(5px + var(--beat) * 10px) rgba(217, 241, 60, 0.9);
}

/* the readout stays on the LEFT half of the glass: his legs hang down over the right
   side of the screen and would sit on top of anything put there */
.osd-v#combo { min-width: 3.4ch; }
.osd-right { margin-left: 0.6cqw; }
.osd-dots { margin-left: 1.4cqw; }
.osd::after { content: ""; flex: 1 1 22%; }
#combo.hot { color: var(--n-magenta); text-shadow: 0 0 14px rgba(255, 53, 214, 0.95); }

.osd-dots { display: flex; gap: 0.9cqw; }

.osd-dots i {
  width: clamp(5px, 1cqw, 11px);
  height: clamp(5px, 1cqw, 11px);
  border-radius: 50%;
  background: rgba(255, 246, 255, 0.16);
  transition: background 60ms linear, box-shadow 60ms linear;
}

.osd-dots i.on { background: var(--n-cyan); box-shadow: 0 0 10px var(--n-cyan); }
.osd-dots i.win { background: var(--n-lime); box-shadow: 0 0 14px var(--n-lime); }

/* MEME TYPE. White, all caps, heavy black outline, sat on the picture. That treatment is
   the joke's own handwriting; the neon display face would make it look like an advert. */
.meme-cap {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 4.5%;
  font-family: var(--font-meme);
  font-weight: 400;
  font-size: clamp(15px, 5.6cqw, 46px);
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  color: #fff;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.13em #000;
  text-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.85);
  transform: scale(var(--cap-pop, 1));
  transition: transform 90ms cubic-bezier(0.2, 1.7, 0.4, 1);
  pointer-events: none;
}

.scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0 1px, transparent 1px 3px),
    radial-gradient(124% 84% at 50% 50%, transparent 58%, rgba(10, 0, 25, 0.5));
  mix-blend-mode: multiply;
  opacity: 0.65;
}

.hitflash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(112deg, var(--rainbow));
  background-size: 200% 100%;
  mix-blend-mode: screen;
}

.hitflash.go { animation: flash 250ms ease-out; }
.hitflash.bad { animation: flash-bad 250ms ease-out; }

@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes flash-bad { 0% { opacity: 0.75; background: #ff1436; } 100% { opacity: 0; background: #ff1436; } }

/* he sits ON the television, on its top right corner, legs over the front. that is the
   whole reason he is here: not standing next to the interface, sitting on it. */
.mascot {
  position: absolute;
  z-index: 3;
  left: 90%;
  top: 0;
  height: 46%;
  width: auto;
  /* his seat is at 56% down the file and 64.6% across it, both measured off the asset */
  transform: translate(-64.6%, -56%) rotate(calc(var(--beat) * -1.6deg));
  transform-origin: 64.6% 56%;
  pointer-events: none;
  filter:
    drop-shadow(0 10px 16px rgba(0, 0, 0, 0.6))
    drop-shadow(0 0 calc(12px + var(--beat) * 20px) rgba(255, 53, 214, 0.5));
  animation: sit-bob 2.4495s cubic-bezier(0.3, 0, 0.2, 1) infinite;
}

@keyframes sit-bob {
  0%, 100% { translate: 0 0; }
  12% { translate: 0 -9px; }
  50% { translate: 0 1px; }
  62% { translate: 0 -5px; }
}

.hint {
  margin: clamp(6px, 1vh, 12px) 0 0;
  text-align: center;
  font-size: clamp(11px, 1.15vw, 14px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 246, 255, 0.66);
  text-shadow: 0 0 10px rgba(164, 75, 255, 0.6);
  opacity: calc(0.45 + var(--beat) * 0.55);
}

.hint.done { opacity: 0; transition: opacity 500ms; }

/* --------------------------------------------------- the arcade buttons */

.pads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(10px, 1.8vw, 26px);
}

/* a real arcade button: a domed cap in a ring, that travels down onto its own seat */
.pad {
  --c: var(--n-lime);
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: none;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  color: var(--paper);
}

.pad[data-glow="cyan"] { --c: var(--n-cyan); }
.pad[data-glow="magenta"] { --c: var(--n-magenta); }
.pad[data-glow="violet"] { --c: var(--n-violet); }

.pad-dome {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(52px, 6.4vw, 76px);
  height: clamp(52px, 6.4vw, 76px);
  border-radius: 50%;
  /* the seat the cap sits in */
  background:
    radial-gradient(circle at 50% 118%, rgba(255, 255, 255, 0.16), transparent 60%),
    conic-gradient(from 210deg, #4a3b58, #2a1d3b 25%, #6b5a7c 52%, #2a1d3b 78%, #4a3b58);
  box-shadow:
    0 6px 0 #180a2a,
    0 10px 18px rgba(0, 0, 0, 0.6),
    0 0 calc(14px + var(--beat) * 22px) color-mix(in oklab, var(--c) 60%, transparent),
    0 0 calc(44px + var(--beat) * 40px) color-mix(in oklab, var(--c) 30%, transparent);
  transition: transform 80ms cubic-bezier(0.2, 1.7, 0.4, 1), box-shadow 80ms;
}

/* the cap itself */
.pad-dome::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, color-mix(in oklab, var(--c) 60%, white 55%), transparent 52%),
    radial-gradient(circle at 50% 120%, color-mix(in oklab, var(--c) 70%, black 30%), transparent 62%),
    var(--c);
  box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.35), inset 0 3px 6px rgba(255, 255, 255, 0.45);
}

/* the shine across the top of the cap */
.pad-dome::after {
  content: "";
  position: absolute;
  left: 22%;
  top: 13%;
  width: 46%;
  height: 26%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.pad-mark {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #16002c;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.5));
}

.pad-label {
  font-weight: 900;
  font-stretch: 116%;
  font-size: clamp(10px, 1.05vw, 13px);
  letter-spacing: 0.12em;
  text-align: center;
  white-space: nowrap;
  color: var(--paper);
  text-shadow: 0 0 10px color-mix(in oklab, var(--c) 75%, transparent), 0 2px 4px rgba(0, 0, 0, 0.7);
}

.pad-label b { color: var(--c); font-weight: 900; }

.pad:hover .pad-dome { transform: translateY(-2px); }
.pad:active .pad-dome, .pad.press .pad-dome {
  transform: translateY(6px);
  box-shadow: 0 0 0 #180a2a, 0 3px 8px rgba(0, 0, 0, 0.6),
              0 0 calc(20px + var(--beat) * 20px) color-mix(in oklab, var(--c) 80%, transparent);
}

/* a destination that does not exist yet is an UNLIT cap: same object, switched off */
.pad[aria-disabled="true"] { cursor: not-allowed; }
.pad[aria-disabled="true"] .pad-dome::before {
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.22), transparent 52%), #241534;
}
.pad[aria-disabled="true"] .pad-dome {
  box-shadow: 0 6px 0 #180a2a, 0 10px 18px rgba(0, 0, 0, 0.6),
              0 0 calc(8px + var(--beat) * 8px) color-mix(in oklab, var(--c) 22%, transparent);
}
.pad[aria-disabled="true"] .pad-mark { color: color-mix(in oklab, var(--c) 60%, #fff6ff); }
.pad[aria-disabled="true"] .pad-label { color: rgba(255, 246, 255, 0.7); }
.pad[aria-disabled="true"]:hover .pad-dome { transform: none; }

/* ------------------------------------------------------- the contract plate */

.plate {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  flex-wrap: wrap;
  justify-content: center;
  max-width: min(100%, 760px);
  padding: clamp(7px, 1vh, 11px) clamp(12px, 1.6vw, 18px);
  border-radius: 10px;
  background: linear-gradient(180deg, #3b3140, #221a2a);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -2px 6px rgba(0, 0, 0, 0.5),
    0 4px 0 #140a1f,
    0 10px 20px rgba(0, 0, 0, 0.5);
}

.plate-k {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.24em;
  color: var(--n-lime);
  flex: none;
  text-shadow: 0 0 8px rgba(217, 241, 60, 0.5);
}

.plate-ca {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, monospace;
  font-size: clamp(10px, 1.15vw, 14px);
  color: var(--paper);
  overflow-wrap: anywhere;
  user-select: all;
  min-width: 0;
}

.plate-ca.empty { color: rgba(255, 246, 255, 0.55); font-style: italic; user-select: auto; }

.plate-copy {
  flex: none;
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--n-lime);
  color: #14002b;
  font: inherit;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  min-height: 32px;
  box-shadow: 0 3px 0 #7f8f14;
}

.plate-copy:hover { background: #eaff5a; }
.plate-copy:active { transform: translateY(3px); box-shadow: 0 0 0 #7f8f14; }
.plate-copy.ok { background: var(--n-green); box-shadow: 0 3px 0 #139a52; }
.plate-copy.bad { background: #ff5d6e; color: #fff; box-shadow: 0 3px 0 #92202c; }
.plate-copy[disabled] { background: #5b4a6d; color: rgba(255, 246, 255, 0.7); cursor: not-allowed; box-shadow: 0 3px 0 #2d2338; }

/* ---------------------------------------------------------------- the gate */

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(96% 78% at 50% 46%, rgba(30, 4, 58, 0.34), rgba(6, 2, 12, 0.84) 78%),
    linear-gradient(180deg, rgba(6, 2, 12, 0.5), rgba(6, 2, 12, 0.74));
  backdrop-filter: blur(16px) saturate(1.15);
  text-align: center;
}

.gate[hidden] { display: none; }
.gate.out { animation: gate-out 420ms ease-in forwards; }

@keyframes gate-out { to { opacity: 0; transform: scale(1.06); visibility: hidden; } }

.gate-inner { display: grid; justify-items: center; gap: 4px; }

.gate-word {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 8vw, 92px);
  line-height: 1;
  position: relative;
}

.gate-word span {
  background: linear-gradient(96deg, var(--rainbow));
  background-size: 340% 100%;
  animation: tube-run 5.2s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 45, 149, 0.8)) drop-shadow(0 0 48px rgba(34, 217, 255, 0.5));
  display: inline-block;
}

.gate-word::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: #2b0b3d;
  -webkit-text-stroke: 8px #2b0b3d;
  paint-order: stroke fill;
}

.gate-sub {
  margin: 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--n-lime);
}

/* he is sitting on the button you are about to press */
.gate-seat {
  --seat-pad: clamp(66px, 13vh, 124px);
  position: relative;
  display: inline-block;
  margin-top: 14px;
  padding-top: var(--seat-pad);
  padding-right: clamp(30px, 6vw, 70px);
}

.gate-mascot {
  position: absolute;
  z-index: 2;
  left: 100%;
  top: var(--seat-pad);
  height: clamp(120px, 24vh, 220px);
  width: auto;
  translate: -52% -56%;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 34px rgba(255, 53, 214, 0.55));
  animation: gate-float 2.4495s cubic-bezier(0.3, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes gate-float {
  0%, 100% { translate: -52% -56%; rotate: 0deg; }
  14% { translate: -52% calc(-56% - 10px); rotate: -2deg; }
  56% { translate: -52% calc(-56% + 2px); rotate: 1deg; }
}

.gate-btn {
  position: relative;
  border: 0;
  padding: 0;
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  animation: gate-pulse 1.2247s cubic-bezier(0.3, 0, 0.2, 1) infinite;
}

.gate-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 20px;
  translate: 0 9px;
  background: #7a1a5a;
  box-shadow: 0 0 40px rgba(255, 45, 149, 0.85), 0 0 100px rgba(164, 75, 255, 0.55);
}

.gate-btn-face {
  display: block;
  padding: 20px 40px;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffe2f4, var(--n-pink) 48%, #d40f74);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.65), inset 0 -4px 0 rgba(0, 0, 0, 0.25);
  color: #29002a;
  font-weight: 900;
  font-stretch: 118%;
  font-size: clamp(15px, 2.2vw, 22px);
  letter-spacing: 0.12em;
}

.gate-btn:active { translate: 0 9px; }
.gate-btn:active::after { translate: 0 0; }

@keyframes gate-pulse {
  0%, 100% { scale: 1; }
  14% { scale: 1.045; }
  40% { scale: 0.995; }
}

.gate-quiet {
  margin-top: clamp(30px, 7vh, 64px);
  border: 0;
  background: none;
  color: rgba(255, 246, 255, 0.55);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 8px 12px;
}

.gate-quiet:hover { color: var(--paper); }

/* ------------------------------------------------------ the title sequence */

.titles {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #05010a;
  overflow: hidden;
}

.titles[hidden] { display: none; }
.titles.out { animation: titles-out 560ms cubic-bezier(0.6, 0, 0.3, 1) forwards; }

@keyframes titles-out { to { opacity: 0; visibility: hidden; } }

.shots { position: absolute; inset: 0; }

.shots video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.shots video.live { opacity: 1; }

/* the cut is a hard one, with one frame of inverted flash so the eye reads an edit */
.shots.cut::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: shot-cut 110ms steps(2, end);
  pointer-events: none;
}

@keyframes shot-cut { 0% { opacity: 0.55; } 100% { opacity: 0; } }

/* one line per BAR, up for 2.4 seconds, in the meme's own face. the first build put a
   line every half bar and he could not read them. */
.tline {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 4vw;
  pointer-events: none;
}

.tline b {
  font-family: var(--font-meme);
  font-weight: 400;
  font-size: clamp(38px, 10.5vw, 168px);
  line-height: 0.94;
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  color: #fff;
  paint-order: stroke fill;
  -webkit-text-stroke: 0.085em #000;
  text-shadow: 0 0.045em 0 rgba(0, 0, 0, 0.9), 0 0 0.5em rgba(255, 53, 214, 0.55);
  max-width: 92vw;
  will-change: transform, opacity;
}

/* two letterbox bars, so the opening reads as footage rather than as a web page */
.tbars { position: absolute; inset: 0; pointer-events: none; }

.tbars::before, .tbars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6.5vh;
  background: #05010a;
}

.tbars::before { top: 0; }
.tbars::after { bottom: 0; }

.skip {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  padding: 12px 22px;
  border: 2px solid rgba(255, 246, 255, 0.5);
  border-radius: 999px;
  background: rgba(10, 2, 20, 0.6);
  color: var(--paper);
  font: inherit;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.2em;
  cursor: pointer;
  backdrop-filter: blur(4px);
  min-height: 44px;
}

.skip:hover { border-color: var(--n-lime); color: var(--n-lime); }

/* ----------------------------------------------- the gallery, a wall of sets */

.gallery, .lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--paper);
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
}

.gallery::backdrop, .lightbox::backdrop {
  background: rgba(5, 1, 12, 0.92);
  backdrop-filter: blur(8px);
}

.gallery[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }

.gallery-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: clamp(12px, 2vh, 22px) clamp(16px, 4vw, 44px);
}

.gallery-bar h2 {
  margin: 0 auto 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(20px, 3.4vw, 40px);
  background: linear-gradient(96deg, var(--rainbow));
  background-size: 340% 100%;
  animation: tube-run 5.2s linear infinite;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 45, 149, 0.7));
}

.gallery-close, .lb-close, .gallery-replay {
  flex: none;
  padding: 12px 22px;
  border: 2px solid var(--n-magenta);
  border-radius: 999px;
  background: rgba(20, 2, 40, 0.7);
  color: var(--paper);
  font: inherit;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.2em;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 0 20px rgba(255, 53, 214, 0.5);
}

.gallery-replay { border-color: var(--n-lime); color: var(--n-lime); box-shadow: 0 0 20px rgba(217, 241, 60, 0.4); }
.gallery-replay:hover { background: var(--n-lime); color: #14002b; }
.gallery-close:hover, .lb-close:hover { background: var(--n-magenta); color: #14002b; }

.gallery-grid {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--n-violet) transparent;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  align-content: start;
  gap: clamp(10px, 1.4vw, 20px);
  padding: 0 clamp(16px, 4vw, 44px) clamp(24px, 5vh, 54px);
}

.gallery-grid::-webkit-scrollbar { width: 10px; }
.gallery-grid::-webkit-scrollbar-track { background: transparent; }
.gallery-grid::-webkit-scrollbar-button { display: none; }
.gallery-grid::-webkit-scrollbar-thumb { background: var(--n-violet); border-radius: 999px; }

/* every tile is the same television, smaller. twenty of them is a video wall. */
.tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--tv-ar);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  container-type: inline-size;
  transition: transform 140ms cubic-bezier(0.2, 1.6, 0.4, 1), filter 140ms;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6))
          drop-shadow(0 0 14px color-mix(in oklab, var(--tc, var(--n-cyan)) 45%, transparent));
}

.tile:hover, .tile:focus-visible {
  transform: translateY(-5px) rotate(-0.7deg);
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.65))
          drop-shadow(0 0 30px color-mix(in oklab, var(--tc, var(--n-cyan)) 85%, transparent));
}

.tile .glass { cursor: pointer; }
.tile .tv-shell { z-index: 2; }

.tile .badge {
  position: absolute;
  z-index: 3;
  left: 10%;
  top: 3%;
  padding: 0.5cqw 1.6cqw;
  border-radius: 999px;
  background: var(--tc, var(--n-cyan));
  color: #14002b;
  font-size: clamp(8px, 1.5cqw, 12px);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.lightbox[open] { display: grid; place-items: center; padding: clamp(12px, 3vh, 40px); }

.lb-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); z-index: 4; }

.lb-fig { margin: 0; display: grid; justify-items: center; width: 100%; }

.lb-tv {
  width: min(1180px, 100%, calc(84vh * var(--tv-ar)));
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 50px rgba(255, 53, 214, 0.45));
}

.lb-tv .glass { cursor: default; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  background: #08030f;
}

.noscript h2 { font-family: var(--font-display); font-size: 44px; color: var(--n-lime); margin: 0; }
.noscript a { color: var(--n-cyan); }

@keyframes tube-run { to { background-position: 340% 0; } }

/* -------------------------------------------------------------- narrow work */

@media (max-width: 900px) {
  .stage {
    grid-template-rows: auto auto auto auto;
    gap: clamp(12px, 2.2vh, 26px);
  }

  .wordmark { font-size: clamp(32px, 10.5vw, 58px); }
  .wordmark::before { -webkit-text-stroke-width: 6px; }

  .tv { width: min(100%, calc(48vh * var(--tv-ar))); }
  .mascot { height: 44%; left: 88%; }

  .pads { gap: 12px; }
  .pad-dome { width: 54px; height: 54px; }
  .pad-label { font-size: 10px; }
}

@media (max-height: 620px) and (max-width: 900px) {
  body { overflow: auto; }
  .stage { height: auto; min-height: 100%; align-content: start; padding-top: 16px; }
}

@media (max-width: 420px) {
  .pads { gap: 10px; }
  .pad-dome { width: 50px; height: 50px; }
  .plate { border-radius: 12px; }
}

/* ----------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .world { filter: blur(10px) saturate(1.3) brightness(0.88); }
  .haze { display: none; }
  .mascot { animation: none; transform: translate(-64.6%, -56%); }
  .gate-mascot { animation: none; translate: -52% -56%; }
  .wordmark span, .gate-word span, .gallery-bar h2 {
    background: none;
    -webkit-text-fill-color: var(--n-lime);
    color: var(--n-lime);
    filter: drop-shadow(0 0 14px rgba(217, 241, 60, 0.7));
  }
}
