/* =====================================================================================
   Homepage hero "Just one more game." (A · 90s bedroom at night, chosen 23 Oct 2026)
   Markup: the .hb section in index.html. Motion: home-hero-bedroom.js. Every class is hb-*.
   -------------------------------------------------------------------------------------
   Two layouts, one scene:
   - Tall (phones, tablets upright, square windows): the tall room photo, words at the top,
     the gold button at the bottom, the console on the glowing duvet between them.
   - Wide (768px+ and at least 5:4 landscape): the widened room fills the screen, words and
     button on the left, the console sits on the duvet's glow on the right.
   Layout model (all in CSS, no JS measuring, no layout shift):
   - The hero is a size container. --u = 1% of its width, --v = 1% of its height.
   - It slides 52px up under the sticky glass menu bar (site-nav.css --bar-h) and fills the
     rest of the first screen below the delivery strip (28px, 46px under 360px wide).
   - Everything in the scene is placed in console widths (--cw) from the pivot P = (--px, --base):
     the bottom-centre of the console, which leans -6deg about it. The console (a straight-on render,
     771 x 1246) is 1.1203 cw wide and 1.8105 cw tall. Rotated outline from P (cw units):
     TL(-.746,-1.742) TR(.368,-1.859) BR(.557,-.059) BL(-.557,.059). Screen centre S = (-.154,-1.354).
   - html.hb-notice (set in <head> while the cookie notice is waiting for an answer): on the
     tall layout the button sits above the notice and the scene shrinks to fit.
   Motion states (only when <html> has .hb-motion, i.e. not reduced motion):
     .is-live   console image loaded: console rises in, PRESS START blinks
     .is-on     screen switches on to the FireRed title
     .is-burst  flash + characters and particles burst out, then idle-float
     .is-switch restarted on every game change (roll band + light flicker)
     .is-paused freezes every animation (pause button, off screen, tab hidden)
   Without .hb-motion the default styles below ARE the final still composition.
   ===================================================================================== */

.hb {
  --hb-bg: #0c0d10; --hb-end: #131519; --hb-ink: #f3f3f0; --hb-muted: #adb0b6;   /* --hb-end: the page colour below the hero */
  --hb-gold: #ffd25a; --hb-gold-hover: #ffda72; --hb-on-gold: #272619; --hb-lilac: #b9a2e8;
  --hb-display: 'Space Grotesk', Arial, sans-serif; --hb-text: 'Barlow', Arial, sans-serif;
  --hb-ease-out: cubic-bezier(.16, 1, .3, 1);
  container: hb / size;
  display: block; position: relative; isolation: isolate; overflow: hidden; overflow: clip;
  margin-top: -52px; padding: 0;   /* style.css still pads and flexes the old .s1 meadow hero */
  --strip: 28px;
  height: calc(100vh - var(--strip)); height: calc(100svh - var(--strip));
  min-height: 520px; max-height: 1000px;
  background: var(--hb-bg); color: var(--hb-ink); color-scheme: dark;
  font: 400 16px/1.5 var(--hb-text); -webkit-font-smoothing: antialiased;
  --u: 1cqw; --v: 1cqh;
  --notice: 0px;
  /* headline size; head-b = visual bottom of the headline block */
  --fs: max(44px, min(calc(14.4 * var(--u)), calc(6.8 * var(--v)), 66px));   /* the px floor lets it grow with browser zoom */
  --head-b: calc(92px + 1.92 * var(--fs));
  --cta-h: 104px;                                   /* button 54 + gap 10 + trust line 20 + bottom 20 */
  --cw: min(calc(48.5 * var(--u)), calc(22.5 * var(--v)), calc((100 * var(--v) - var(--cta-h) - var(--head-b) - 60px) / 1.859), 250px);
  --ch: calc(1.8105 * var(--cw));                   /* console height; its width is 1.1203 cw (image 771 x 1246) */
  --base: max(calc(65 * var(--v)), calc(var(--head-b) + 12px + 1.859 * var(--cw)));
  --px: calc(50 * var(--u) + .08 * var(--cw));      /* nudged right: the -6deg lean shifts the top left */
  --sx: -.154; --sy: -1.354;                        /* screen centre from P, in cw */
}
@media (max-width: 359px) { .hb { --strip: 46px; } }   /* the strip wraps onto two lines */
@supports not (width: 1cqw) { .hb { --u: 1vw; --v: clamp(5.2px, calc(1vh - var(--strip) / 100), 10px); } }
/* Cookie notice still waiting (phones: a 80px card 12px off the bottom; 445px+: a 114px card). */
html.hb-notice .hb { --notice: 92px; --cta-h: calc(66px + var(--notice)); }   /* button 54 + 12 clear of the notice */
@media (min-width: 445px) { html.hb-notice .hb { --notice: 126px; } }

.hb img, .hb video, .hb svg { display: block; }
.hb-sprites { position: absolute; width: 0; height: 0; overflow: hidden; }
.hb-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hb :where(a, button):focus-visible { outline: 2px solid var(--hb-ink); outline-offset: 3px; }

/* ---------- 1 · room ---------- */
.hb-bg, .hb-bg__img, .hb-bg__vid { position: absolute; inset: 0; width: 100%; height: 100%; }
.hb-bg { z-index: 0; pointer-events: none; }
.hb .hb-bg__img, .hb-bg__vid { max-width: none; object-fit: cover; object-position: 50% 50%; }
.hb-bg__vid { opacity: 0; transition: opacity .9s ease; }
.hb-bg__vid.is-playing { opacity: 1; }

/* ---------- 2 · light ---------- */
.hb-glow { position: absolute; pointer-events: none; }
/* Bloom of the screen on the wall and pillow behind the console. Tint layers follow the game on screen. */
.hb-halo { z-index: 1; left: calc(var(--px) + (var(--sx) - 1.25) * var(--cw)); top: calc(var(--base) + (var(--sy) - 1) * var(--cw)); width: calc(2.5 * var(--cw)); height: calc(2 * var(--cw)); }
.hb-halo__in, .hb-halo__in > i { position: absolute; inset: 0; }
.hb-halo__in > i { border-radius: 50%; }
.hb-halo__base { background: radial-gradient(closest-side, rgba(204, 186, 255, .36), rgba(185, 162, 232, .15) 50%, rgba(185, 162, 232, 0)); }
.hb-halo__t { opacity: 0; transition: opacity .7s ease; }
.hb-halo__t--warm { background: radial-gradient(closest-side, rgba(255, 146, 76, .26), rgba(255, 146, 76, 0) 72%); }
.hb-halo__t--green { background: radial-gradient(closest-side, rgba(170, 240, 182, .2), rgba(170, 240, 182, 0) 72%); }
.hb-halo__t--blue { background: radial-gradient(closest-side, rgba(96, 150, 255, .3), rgba(96, 150, 255, 0) 72%); }
.hb[data-tint="warm"] .hb-halo__t--warm, .hb[data-tint="green"] .hb-halo__t--green, .hb[data-tint="blue"] .hb-halo__t--blue { opacity: 1; }

/* Edges of the room and the dark bands behind the words and the button (text contrast). */
.hb-vignette {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(to bottom, var(--hb-bg) 0, rgba(12, 13, 16, .85) calc(var(--head-b) * .55), rgba(12, 13, 16, 0) calc(var(--head-b) + 70px)),
    linear-gradient(to top, var(--hb-end) 0, rgba(12, 13, 16, .9) calc(var(--cta-h) * .7), rgba(12, 13, 16, 0) calc(var(--cta-h) + 90px)),
    radial-gradient(130% 75% at 50% 58%, rgba(12, 13, 16, 0) 58%, rgba(12, 13, 16, .5) 100%);
}

/* Screen light pooling on the duvet in front of the console (lines up with the glow baked into the photo). */
.hb-pool { z-index: 3; left: calc(var(--px) - 1.41 * var(--cw)); top: calc(var(--base) - .32 * var(--cw)); width: calc(2.7 * var(--cw)); height: calc(.75 * var(--cw)); mix-blend-mode: screen; }
.hb-pool__in { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(closest-side, rgba(228, 216, 255, .5), rgba(185, 162, 232, .22) 48%, rgba(185, 162, 232, 0)); }
/* Contact shadow along the tilted base: a tight dark core plus a soft wide falloff. */
.hb-contact { z-index: 3; left: calc(var(--px) - .8 * var(--cw)); top: calc(var(--base) - .16 * var(--cw)); width: calc(1.6 * var(--cw)); height: calc(.3 * var(--cw)); transform: rotate(-6deg);
  background: radial-gradient(34% 30% at 50% 50%, rgba(4, 3, 10, .9), rgba(4, 3, 10, 0)), radial-gradient(closest-side, rgba(4, 3, 10, .45), rgba(4, 3, 10, 0)); }

/* Burst light: a bloom behind the console and two rings in front of it, centred on the screen. */
.hb-burst { position: absolute; left: calc(var(--px) + var(--sx) * var(--cw)); top: calc(var(--base) + var(--sy) * var(--cw)); width: 0; height: 0; pointer-events: none; }
.hb-burst__glow { position: absolute; z-index: 4; width: calc(2.6 * var(--cw)); height: calc(2.6 * var(--cw)); left: calc(-1.3 * var(--cw)); top: calc(-1.3 * var(--cw)); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .85), rgba(218, 204, 255, .5) 22%, rgba(185, 162, 232, .18) 52%, rgba(185, 162, 232, 0)); mix-blend-mode: screen; opacity: 0; }
.hb-burst__ring { position: absolute; z-index: 6; width: calc(.9 * var(--cw)); height: calc(.9 * var(--cw)); left: calc(-.45 * var(--cw)); top: calc(-.45 * var(--cw)); border-radius: 50%;
  border: 2px solid rgba(234, 225, 255, .95); box-shadow: 0 0 16px rgba(185, 162, 232, .85), inset 0 0 14px rgba(185, 162, 232, .6); opacity: 0; }

/* ---------- 3 · console ---------- */
.hb-tilt-in { position: absolute; z-index: 5; left: calc(var(--px) - .5602 * var(--cw)); top: calc(var(--base) - var(--ch)); width: calc(1.1203 * var(--cw)); }
.hb-tilt { position: relative; transform: rotate(-6deg); transform-origin: 50% 100%; }
.hb .hb-console { width: 100%; max-width: none; height: auto; }
/* Room lighting on the shell, limited to the console's own silhouette: screen light around the screen,
   cool window light on the right edge, darker towards the base. */
.hb-console-fx {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url('/final/art/hero-bedroom/r36s-purple-front.webp') 0 0 / 100% 100% no-repeat;
  mask: url('/final/art/hero-bedroom/r36s-purple-front.webp') 0 0 / 100% 100% no-repeat;
  background:
    radial-gradient(62% 36% at 49% 24.7%, rgba(214, 198, 255, .36), rgba(185, 162, 232, 0)),
    linear-gradient(to left, rgba(110, 140, 255, .22), rgba(110, 140, 255, 0) 22%),
    linear-gradient(to bottom, rgba(10, 8, 26, 0) 42%, rgba(10, 8, 26, .46) 100%),
    rgba(10, 8, 26, .1);
}
/* The lit area of the console's screen, measured on r36s-purple-front.webp (771 x 1246): x 64-691, y 67-549,
   a straight 627 x 482 rectangle inside the black glass. */
.hb-screen { position: absolute; left: 8.301%; top: 5.377%; width: 81.323%; height: 38.684%; overflow: hidden; background: #040406; }
.hb-screen > *, .hb-scr-games > * { position: absolute; inset: 0; }
.hb-scr-game { opacity: 0; background: #000; overflow: hidden; transition: opacity .22s linear; }
.hb-scr-game.is-active { opacity: 1; }
/* Each game picture is pre-warped to that outline and then given a real lit-screen look in Higgsfield (glass glare,
   pixel grid, backlight glow): screens/real-*.webp, 882 x 1012. Gameplay fills the screen; the title shows its whole
   frame with black above and below, as on the real handheld. */
.hb .hb-scr-game img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.hb-scr-bloom { background: #fff; opacity: 0; }
.hb-scr-off { opacity: 0; background: radial-gradient(120% 90% at 28% 8%, rgba(185, 162, 232, .12), rgba(0, 0, 0, 0) 60%), #040406; }
.hb .hb-scr-press { position: absolute; left: 15%; width: 70%; top: 60%; height: auto; fill: #f3f3f0; filter: drop-shadow(0 0 2px rgba(205, 184, 255, .9)); }
.hb .hb-scr-logo { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 8%; color: #f3f3f0; font: 700 clamp(9px, calc(var(--cw) * .055), 20px)/1 var(--hb-display, sans-serif); letter-spacing: -.035em; text-shadow: 0 0 10px rgba(196, 163, 255, .4); }
.hb .hb-scr-logo img { width: 26%; height: auto; max-width: none; filter: drop-shadow(0 0 8px rgba(196, 163, 255, .35)); }
.hb .hb-scr-logo::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(to bottom, transparent 38%, rgba(215, 196, 255, .28) 50%, transparent 62%); }
.hb .hb-scr-logo::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35; background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(197, 180, 230, .12) 2px 3px); }
.hb.is-boot-logo .hb-scr-logo { display: flex; }
@media (prefers-reduced-motion: no-preference) {
  .hb-motion .hb.is-boot-logo .hb-scr-logo { animation: hb-logo-boot 2.5s linear both, hb-logo-idle 5.2s linear 2.5s infinite; }
  .hb-motion .hb.is-boot-logo .hb-scr-logo::before { animation: hb-logo-sweep 2.5s cubic-bezier(.23, 1, .32, 1) both; }
  .hb-motion .hb.is-boot-logo .hb-scr-logo::after { animation: hb-tv-noise 2.6s steps(2, end) infinite; }
}
@keyframes hb-logo-boot {
  0% { opacity: 0; transform: translateY(5px) scale(.96); }
  16% { opacity: .38; }
  30% { opacity: .96; transform: translateY(0) scale(1); }
  42% { opacity: .40; }
  55% { opacity: 1; }
  68% { opacity: .64; }
  84%, 100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes hb-logo-idle {
  0%, 33%, 49%, 74%, 88%, 100% { opacity: 1; }
  38% { opacity: .58; }
  78% { opacity: .72; }
  43%, 83% { opacity: .94; }
}
@keyframes hb-logo-sweep { 0% { opacity: 0; transform: translateY(-90%); } 25% { opacity: .8; } 85% { opacity: .35; } 100% { opacity: 0; transform: translateY(90%); } }
@keyframes hb-tv-noise { 0%, 100% { opacity: .22; } 50% { opacity: .48; } }
.hb-scr-roll { inset: 0 0 auto 0; height: 22%; opacity: 0; transform: translateY(-110%);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, .24) 50%, rgba(255, 255, 255, 0)); }
.hb-scr-flash { opacity: 0; }
.hb-scr-flash--w { background: #fff; }
.hb-scr-flash--l { background: radial-gradient(circle at 50% 50%, #f2ebff, #b9a2e8 70%, #8a6fd6); }
.hb-scr-glass {
  background:
    linear-gradient(118deg, rgba(255, 255, 255, .06) 0%, rgba(255, 255, 255, 0) 30%),   /* the pictures carry their own glare and pixel grid */
    radial-gradient(130% 110% at 50% 45%, rgba(0, 0, 0, 0) 66%, rgba(0, 0, 0, .28) 100%);
}

/* ---------- 4 · characters ---------- */
/* .hb-win: full-hero layer (its clip opens from the screen at burst start). .hb-ch: resting spot.
   .hb-ch__float: idle bob. .hb-ch__fx: shadow + lilac rim (static). img: soft fades over hard crop edges. */
.hb-win { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.hb-win--near { z-index: 9; }
.hb-win--crash { display: none; }
@container hb (min-height: 620px) { .hb-win--crash { display: block; } }   /* room above the button on all but the shortest screens */
/* While the cookie notice waits, the lifted button would cover him until the hero is ~783px tall (phones) or ~885px (445px+). */
@media not all and (min-width: 768px) and (min-aspect-ratio: 5/4) {
  @container hb (max-height: 789px) { html.hb-notice .hb-win--crash { display: none; } }
  @media (min-width: 445px) { @container hb (max-height: 889px) { html.hb-notice .hb-win--crash { display: none; } } }
}
.hb-ch { position: absolute; left: calc(var(--px) + var(--x) * var(--cw)); top: calc(var(--base) + var(--y) * var(--cw)); width: calc(var(--w) * var(--cw)); }
.hb-ch__fx { filter: drop-shadow(0 16px 14px rgba(0, 0, 0, .55)); }
.hb-win--far .hb-ch__fx { filter: drop-shadow(0 14px 12px rgba(0, 0, 0, .5)); }
.hb .hb-ch__img { width: 100%; max-width: none; height: auto;
  --mt0: 0%; --mt: 0%; --mb: 0%; --ml0: 0%; --ml: 0%; --mr: 0%;
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--mt0), #000 var(--mt), #000 calc(100% - var(--mb)), transparent 100%), linear-gradient(to right, transparent var(--ml0), #000 var(--ml), #000 calc(100% - var(--mr)), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent var(--mt0), #000 var(--mt), #000 calc(100% - var(--mb)), transparent 100%), linear-gradient(to right, transparent var(--ml0), #000 var(--ml), #000 calc(100% - var(--mr)), transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
  filter: drop-shadow(var(--rim) 0 1px rgba(222, 208, 255, .75)) drop-shadow(0 0 10px rgba(185, 162, 232, .32)); }   /* the filter runs before the mask, so the rim fades with the art */
.hb .hb-win--far .hb-ch__img { filter: brightness(.9) drop-shadow(var(--rim) 0 1px rgba(222, 208, 255, .7)) drop-shadow(0 0 10px rgba(185, 162, 232, .3)); }
.hb .hb-ch__img:not([class*="hb-ch__img--"]) { -webkit-mask-image: none; mask-image: none; }   /* Sonic has no fades: keep his glow past the box */
.hb .hb-ch__img--rq { --mt: 7%; --mb: 10%; --ml: 4%; --mr: 6%; }        /* Rayquaza: soft edges where the box art was cropped */
.hb .hb-ch__img--dk { --mt: 4%; --mb: 16%; --ml: 10%; --mr: 4%; }       /* Donkey Kong + Diddy: cut at the bottom and left */
.hb .hb-ch__img--cl { --mt: 4%; --mb: 14%; --ml: 6%; --mr: 6%; }        /* Cloud: legs cut at the bottom */
.hb .hb-ch__img--cz { --mt0: 3.2%; --mt: 9%; --mb: 18%; --ml: 14%; }   /* Charizard: hides the box-art lettering above the wing */
.hb .hb-ch__img--lk { --mt: 10%; --mb: 16%; --ml: 6%; --mr: 10%; }
.hb .hb-ch__img--cr { --mt: 10%; --mb: 16%; --ml: 10%; --rim: 2px; transform: scaleX(-1); }   /* mirrored: the flip also flips the rim */

/* ---------- particles ---------- */
.hb-pt { position: absolute; z-index: 8; left: calc(var(--px) + var(--x) * var(--cw)); top: calc(var(--base) + var(--y) * var(--cw)); width: 0; height: 0; pointer-events: none; }
.hb-pt__d { position: absolute; left: 0; top: 0; }
.hb-pt svg { transform: translate(-50%, -50%); filter: drop-shadow(0 0 4px rgba(255, 236, 170, .45)); }

/* ---------- 5 · words and the button (one static layer, never animated as a block) ---------- */
.hb-copy { position: absolute; z-index: 12; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 62px 16px 20px; text-align: center; pointer-events: none; }
.hb-copy > * { pointer-events: auto; }
html.hb-notice .hb-copy { padding-bottom: calc(var(--notice) + 12px); }
.hb-head { width: 100%; }
.hb .hb-kicker { max-width: none; margin: 0 0 10px; min-height: 20px; font: 700 17px/20px var(--hb-display); letter-spacing: -.03em; }
.hb-wm__p, .hb-q { color: var(--hb-lilac); }
.hb .hb-h1 { max-width: none; margin: 0; font: 700 var(--fs)/.92 var(--hb-display); letter-spacing: -.05em; color: var(--hb-ink); text-wrap: initial; }
.hb-ln { display: block; clip-path: inset(-.25em -.4em -.3em -.4em); }
.hb-ln__in { display: inline-block; white-space: nowrap; }
.hb-q--open { margin-right: -.06em; }   /* optical kerning: the quote glyphs carry wide side bearings */
.hb-q--close { margin-left: -.02em; }
.hb-cta { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.hb .hb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: min(100%, 340px); min-height: 54px; padding: 0 24px; border-radius: 15px;
  background: var(--hb-gold); color: var(--hb-on-gold); font: 700 17px/1 var(--hb-display); letter-spacing: -.02em; text-decoration: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 14px 34px -14px rgba(255, 210, 90, .55), inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -2px 0 rgba(120, 90, 0, .18);
  transition: transform .15s ease-out, background-color .16s ease; }
.hb .hb-btn svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s var(--hb-ease-out); }
@media (hover: hover) and (pointer: fine) { .hb .hb-btn:hover { background: var(--hb-gold-hover); color: var(--hb-on-gold); } .hb .hb-btn:hover svg { transform: translateX(3px); } }
.hb .hb-btn:active, .hb .hb-toggle:active { transform: scale(.96); }
.hb .hb-trust { margin: 0; font: 500 14.5px/20px var(--hb-text); color: var(--hb-muted); text-wrap: balance; }
/* While the notice waits, it sits where the trust line was (the strip at the top already says the same). */
html.hb-notice .hb-trust { display: none; }

/* Pause / play: round glass button above the button area, its left edge on the button's edge
   (340px button centred, 16px page gutter). Bottom-left: Crash stands bottom-right. */
.hb .hb-toggle { position: absolute; z-index: 13; left: max(16px, calc(50% - 170px)); bottom: calc(var(--cta-h) + 10px); width: 44px; height: 44px; margin: 0; padding: 0; border-radius: 50%;
  display: none; place-items: center; color: var(--hb-ink); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(22, 22, 30, .42);
  -webkit-backdrop-filter: blur(12px) saturate(1.4); backdrop-filter: blur(12px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .15s ease-out; }
.hb .hb-sound { position: absolute; z-index: 13; right: max(16px, calc(50% - 170px)); bottom: calc(var(--cta-h) + 10px); min-height: 44px; padding: 0 14px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(22,22,30,.78); color: var(--hb-ink); font: 600 12px/1 var(--hb-text, sans-serif); cursor: pointer; }
.hb .hb-sound[hidden] { display: none; }
.hb :is(.hb-toggle,.hb-sound):focus-visible { outline: 2px solid #e7dcff; outline-offset: 3px; }
/* Both glyphs share one grid cell and cross-fade. */
.hb-toggle svg { grid-area: 1 / 1; width: 14px; height: 14px; fill: currentColor;
  transition: opacity .3s cubic-bezier(.2, 0, 0, 1), transform .3s cubic-bezier(.2, 0, 0, 1), filter .3s cubic-bezier(.2, 0, 0, 1); }
.hb-toggle .hb-i-play, .hb-toggle[data-state="paused"] .hb-i-pause { opacity: 0; transform: scale(.25); filter: blur(4px); }
.hb-toggle[data-state="paused"] .hb-i-play { opacity: 1; transform: none; filter: none; }
.hb-motion .hb .hb-toggle { display: grid; }
/* A window shorter than the hero's 520px minimum (a laptop at 200% zoom): keep the pause button on the first screen,
   16px above its bottom edge but below the headline. Guarded, because without svh the whole value would be dropped. */
@supports (height: 1svh) {
  .hb .hb-toggle { bottom: max(calc(var(--cta-h) + 10px), min(calc(100 * var(--v) - 100svh + var(--strip) + 16px), calc(100 * var(--v) - var(--head-b) - 52px))); }
}
/* Very short windows: the button starts below the first screen anyway, so lifting it for the notice would only
   push it under the notice card (the lift is measured from the hero's bottom, which is then past the window's). */
@media (max-height: 456px) {
  html.hb-notice .hb { --notice: 0px; --cta-h: 104px; }
  html.hb-notice .hb-copy { padding-bottom: 20px; }
  html.hb-notice .hb-trust { display: block; }
}

/* =====================================================================================
   WIDE: 768px+ wide and at least 5:4 landscape (the same query picks the wide photo in index.html).
   The widened room (2280 x 1344) covers the hero; its duvet glow is at 69.1% / 69% of the photo.
   The photo is placed by hand (cover, anchored 70% across and 55% down), so the console can be put
   exactly on the glow: --hi/--wi are the photo's drawn size, --bx/--by its top-left corner.
   ===================================================================================== */
@media (min-width: 768px) and (min-aspect-ratio: 5/4) {
  .hb {
    --copy-l: max(32px, calc(50 * var(--u) - 600px));          /* the menu bar's own content edge */
    --hi: max(calc(100 * var(--v)), calc(100 * var(--u) / 1.6964));
    --wi: calc(var(--hi) * 1.6964);
    --bx: calc((100 * var(--u) - var(--wi)) * .7);
    --by: min(calc((100 * var(--v) - var(--hi)) * .55), calc(100 * var(--v) - .69 * var(--hi) - .9 * var(--cw)));   /* ultrawide: keep the scene above the bottom edge */
    --cw: min(calc(var(--hi) * .27), calc(25 * var(--v)), 300px);
    --px: calc(var(--bx) + .691 * var(--wi));
    --base: calc(var(--by) + .69 * var(--hi) + .06 * var(--cw));
    --fs: max(52px, min(calc(6 * var(--u)), calc(9.5 * var(--v)), 96px));
  }
  html.hb-notice .hb { --notice: 0px; --cta-h: 104px; }   /* the notice is a card at the bottom right, clear of the words */
  .hb .hb-bg__img { inset: auto; left: var(--bx); top: var(--by); width: var(--wi); height: var(--hi); object-fit: fill; }
  .hb-bg__vid { display: none; }
  .hb-vignette {
    background:
      linear-gradient(to top, var(--hb-end) 0, rgba(19, 21, 25, 0) 130px),   /* first, so the bottom edge meets the next section everywhere */
      linear-gradient(to right, rgba(12, 13, 16, .84) 0, rgba(12, 13, 16, .66) calc(var(--copy-l) + 360px), rgba(12, 13, 16, 0) calc(var(--copy-l) + 700px)),
      linear-gradient(to bottom, rgba(12, 13, 16, .72) 0, rgba(12, 13, 16, 0) 170px);
  }
  /* Centred in the part of the hero that is on screen (it keeps a 520px minimum on short landscape screens). */
  .hb-copy { bottom: auto; height: min(100%, calc(100vh - var(--strip))); height: min(100%, calc(100svh - var(--strip)));
    align-items: flex-start; justify-content: center; justify-content: safe center; gap: 36px; padding: 52px 32px 4% var(--copy-l); text-align: left; }
  html.hb-notice .hb-copy { padding-bottom: 4%; }
  .hb-head { width: auto; }
  .hb .hb-kicker { min-height: 24px; margin-bottom: 14px; font-size: 19px; line-height: 24px; }
  .hb-q--open { margin-left: -.36em; }   /* hanging punctuation: the J lines up with the kicker */
  .hb-cta { width: auto; align-items: flex-start; gap: 12px; }
  .hb .hb-btn { width: auto; min-width: 300px; padding: 0 28px; }
  html.hb-notice .hb-trust { display: block; }
  .hb .hb-toggle { left: var(--copy-l); bottom: 24px; }
  .hb .hb-sound { left: calc(var(--copy-l) + 56px); right: auto; bottom: 24px; }
}
/* Short wide windows (landscape phones, laptops at 200% zoom): the hero runs past the window, so the pause button
   moves to the top right, under the menu bar and clear of the words and Rayquaza. */
@media (min-width: 768px) and (min-aspect-ratio: 5/4) and (max-height: 540px) {
  .hb .hb-toggle { top: 64px; right: max(16px, calc(50% - 600px)); bottom: auto; left: auto; }
}

/* =====================================================================================
   MOTION (only with html.hb-motion)
   ===================================================================================== */
@media (prefers-reduced-motion: no-preference) {
  /* Headline: lines slide up out of their own clip; runs at load, not tied to the console. */
  .hb-motion .hb-kicker { animation: hb-fade-up .8s var(--hb-ease-out) both; }
  .hb-motion .hb-ln__in { animation: hb-line-up .95s var(--hb-ease-out) .08s both; }
  .hb-motion .hb-h1 .hb-ln + .hb-ln .hb-ln__in { animation-delay: .2s; }

  /* Before the console has loaded: console, light and screen layers wait. */
  .hb-motion .hb:not(.is-live) .hb-tilt-in, .hb-motion .hb:not(.is-live) .hb-glow { opacity: 0; }
  .hb-motion .hb.is-live .hb-tilt-in { animation: hb-console-in 1s var(--hb-ease-out) both; }
  .hb-motion .hb.is-live .hb-glow { animation: hb-fade 1.4s ease .2s both; }

  /* Screen off: black glass with a blinking PRESS START. */
  .hb-motion .hb:not(.is-on) .hb-scr-off { opacity: 1; }
  .hb-motion .hb:not(.is-on) .hb-scr-games { opacity: 0; }
  .hb-motion .hb.is-live:not(.is-on) .hb-scr-press { animation: hb-blink .9s steps(1, end) .3s infinite; }
  /* Switch on: dot, then line, then the full picture, with a white bloom fading inside it. */
  .hb-motion .hb.is-on .hb-scr-off { animation: hb-out .16s linear both; }
  .hb-motion .hb.is-on .hb-scr-games { animation: hb-crt-on .52s cubic-bezier(.2, .8, .2, 1) both; }
  .hb-motion .hb.is-on .hb-scr-bloom { animation: hb-bloom .7s ease-out both; }

  /* Game changes: crossfade (transition above) + a rolling bright band + a jolt + light flicker. */
  .hb-motion .hb.is-switch .hb-scr-roll { animation: hb-roll .38s linear; }
  .hb-motion .hb.is-switch .hb-scr-game.is-active { animation: hb-jolt .26s ease-out; }
  .hb-motion .hb.is-switch .hb-halo__in, .hb-motion .hb.is-switch .hb-pool__in { animation: hb-flick .5s ease-out; }

  /* The burst. Hidden until it starts. */
  .hb-motion .hb:not(.is-burst) .hb-win, .hb-motion .hb:not(.is-burst) .hb-pt { visibility: hidden; }
  .hb-motion .hb.is-burst .hb-scr-flash--w { animation: hb-flash-w .42s ease-out both; }
  .hb-motion .hb.is-burst .hb-scr-flash--l { animation: hb-flash-l .9s ease-out both; }
  .hb-motion .hb.is-burst .hb-burst__glow { animation: hb-burst-glow 1.1s cubic-bezier(.2, .7, .3, 1) both; }
  .hb-motion .hb.is-burst .hb-burst__ring { animation: hb-ring .9s cubic-bezier(.15, .75, .3, 1) both; }
  .hb-motion .hb.is-burst .hb-burst__ring--2 { animation-delay: .14s; }
  .hb-motion .hb.is-burst .hb-win { animation: hb-window .22s cubic-bezier(.5, 0, 1, 1) var(--d) backwards; }
  .hb-motion .hb.is-burst .hb-ch { animation: hb-fly .86s cubic-bezier(.2, .9, .25, 1.2) var(--d) both; }
  .hb-motion .hb.is-burst .hb-ch__float { animation: hb-bob var(--fp) cubic-bezier(.45, 0, .55, 1) calc(var(--d) + .86s) infinite alternate; }
  .hb-motion .hb.is-burst .hb-pt { animation: hb-pop .95s cubic-bezier(.15, .9, .3, 1.12) var(--d) both; }
  .hb-motion .hb.is-burst .hb-pt__d { animation: hb-drift var(--dp) ease-in-out calc(var(--d) + .95s) infinite alternate; }

  /* Rotation (home-hero-bedroom.js): a character ducks back into the screen, the next one flies out the same way,
     its window opening from the screen again so it never shows over the console's frame. */
  .hb-motion .hb.is-burst .hb-ch.is-back { animation: hb-back .42s cubic-bezier(.55, 0, .8, .2) both; }
  .hb-motion .hb.is-burst .hb-ch.is-again { animation: hb-fly-again .86s cubic-bezier(.2, .9, .25, 1.2) both; }
  .hb-motion .hb.is-burst .hb-win.is-again { animation: hb-window-again .22s cubic-bezier(.5, 0, 1, 1) backwards; }

  /* Paused by the button, off screen or hidden tab: everything freezes in place. */
  .hb.is-paused, .hb.is-paused * { animation-play-state: paused !important; }

  /* Lite (html.hb-lite: Save-Data on, or 2 GB of memory or less): no video and no character swaps (both in JS),
     no Crash, 4 particles, no clip window, 2 floaters, lighter shadows and no lilac rim. */
  .hb-lite .hb-win--crash, .hb-lite .hb-pt--x { display: none !important; }
  .hb-motion.hb-lite .hb.is-burst .hb-win { animation: none; }
  .hb-motion.hb-lite .hb.is-burst .hb-win--far .hb-ch__float, .hb-motion.hb-lite .hb.is-burst .hb-pt__d { animation: none; }
  .hb-lite .hb-ch__fx, .hb-lite .hb-win--far .hb-ch__fx { filter: drop-shadow(0 12px 12px rgba(0, 0, 0, .45)); }
  .hb-lite .hb .hb-ch__img, .hb-lite .hb .hb-win--far .hb-ch__img { filter: none; }
  .hb-lite .hb-burst__glow, .hb-lite .hb-pool { mix-blend-mode: normal; }
  .hb-lite .hb .hb-toggle { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(24, 24, 32, .82); }
}

/* Safety net: reduced motion always gets the still composition, whatever the classes say. */
@media (prefers-reduced-motion: reduce) {
  .hb *, .hb *::before, .hb *::after { animation: none !important; transition: none !important; }
  .hb-bg__vid, .hb .hb-toggle { display: none !important; }
}

@keyframes hb-fade { from { opacity: 0; } }
@keyframes hb-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes hb-fade-up { from { opacity: 0; transform: translateY(12px); } }
@keyframes hb-line-up { from { transform: translateY(132%); } }
@keyframes hb-console-in { from { opacity: 0; transform: translateY(26px) scale(.965); } }
@keyframes hb-blink { 0% { opacity: 1; } 58% { opacity: 0; } }
@keyframes hb-crt-on {
  0% { transform: scale(.05, .012); }
  32% { transform: scale(1, .012); }
  100% { transform: none; }
}
@keyframes hb-bloom { 0% { opacity: 1; } 35% { opacity: .85; } 100% { opacity: 0; } }
@keyframes hb-roll { from { opacity: 1; transform: translateY(-110%); } to { opacity: 1; transform: translateY(480%); } }
@keyframes hb-jolt { from { transform: scaleY(1.06) translateY(-1.5%); } }
@keyframes hb-flick { 0% { opacity: 1; } 22% { opacity: .6; } 50% { opacity: 1; } 68% { opacity: .84; } 100% { opacity: 1; } }
@keyframes hb-flash-w { 0% { opacity: 0; } 10% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hb-flash-l { 0% { opacity: 0; } 18% { opacity: .9; } 100% { opacity: 0; } }
@keyframes hb-burst-glow { 0% { opacity: 0; transform: scale(.35); } 14% { opacity: .95; } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes hb-ring { 0% { opacity: .95; transform: scale(.15); } 100% { opacity: 0; transform: scale(2.4); } }
/* The window starts as the console screen (clip polygon rotated with the console, in hero pixels)
   and opens past the hero edges, so each character first shows only inside the screen. */
@keyframes hb-window {
  from { clip-path: polygon(calc(var(--px) - .644 * var(--cw)) calc(var(--base) - 1.655 * var(--cw)), calc(var(--px) + .263 * var(--cw)) calc(var(--base) - 1.750 * var(--cw)), calc(var(--px) + .336 * var(--cw)) calc(var(--base) - 1.054 * var(--cw)), calc(var(--px) - .570 * var(--cw)) calc(var(--base) - .959 * var(--cw))); }
  to { clip-path: polygon(-60% -60%, 160% -60%, 160% 160%, -60% 160%); }
}
/* From the screen centre (S), small and turned, to the resting spot with a slight overshoot. */
@keyframes hb-fly {
  from { opacity: 0; transform: translate(var(--fly-x, calc((var(--sx) - var(--x) - var(--w) / 2) * var(--cw))), var(--fly-y, calc((var(--sy) - var(--y) - var(--w) * var(--ar) / 2) * var(--cw)))) rotate(var(--r0)) scale(.3); }
  8% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes hb-back {
  to { opacity: 0; transform: translate(var(--fly-x, calc((var(--sx) - var(--x) - var(--w) / 2) * var(--cw))), var(--fly-y, calc((var(--sy) - var(--y) - var(--w) * var(--ar) / 2) * var(--cw)))) rotate(var(--r0)) scale(.3); }
}
@keyframes hb-window-again {   /* same as hb-window: a new name so it restarts on every turn */
  from { clip-path: polygon(calc(var(--px) - .644 * var(--cw)) calc(var(--base) - 1.655 * var(--cw)), calc(var(--px) + .263 * var(--cw)) calc(var(--base) - 1.750 * var(--cw)), calc(var(--px) + .336 * var(--cw)) calc(var(--base) - 1.054 * var(--cw)), calc(var(--px) - .570 * var(--cw)) calc(var(--base) - .959 * var(--cw))); }
  to { clip-path: polygon(-60% -60%, 160% -60%, 160% 160%, -60% 160%); }
}
@keyframes hb-fly-again {   /* same as hb-fly: a new name so swapping classes restarts it */
  from { opacity: 0; transform: translate(var(--fly-x, calc((var(--sx) - var(--x) - var(--w) / 2) * var(--cw))), var(--fly-y, calc((var(--sy) - var(--y) - var(--w) * var(--ar) / 2) * var(--cw)))) rotate(var(--r0)) scale(.3); }
  8% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes hb-bob { to { transform: translate3d(0, -11px, 0) rotate(var(--br, 0deg)); } }
@keyframes hb-pop {
  from { opacity: 0; transform: translate(calc((var(--sx) - var(--x)) * var(--cw)), calc((var(--sy) - var(--y)) * var(--cw))) rotate(-120deg) scale(.2); }
  12% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
@keyframes hb-drift { to { transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--dr)); opacity: var(--do, .7); } }
