/* ==========================================================================
   YoupiGames — feuille de style de la page d'accueil
   Principe : une salle noire, chaque jeu est une scène éclairée par sa couleur,
   et chaque jeu se montre dans un iPhone, là où il se joue.
   Les animations ne bougent que `transform` et `opacity`.
   ========================================================================== */

/* ---------- Polices (hébergées sur le site, aucun appel externe) ---------- */
@font-face {
  font-family: "Bricolage";
  src: url("../fonts/bricolage-grotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "DSEG7";
  src: url("../fonts/dseg7-classic-bold.woff2") format("woff2");
  font-display: block;
}

/* ---------- Jetons ---------- */
:root {
  --black: #000;
  --ink: #f5f5f7;
  --dim: #a3a3ab;
  --line: rgba(255, 255, 255, .14);
  --paper: #f5f5f7;
  --paper-ink: #1d1d1f;

  /* Couleurs issues de la pub du studio */
  --yellow: #ffd21f;
  --boxer: #ff4a2b;
  --amber: #ffb84a;
  --towny: #4673ff;
  --gold: #e3b757;
  --violet: #5b36e6;

  --font: "Bricolage", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 52px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--black);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--font);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, figure, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[id] { scroll-margin-top: calc(var(--nav-h) + 12px); }

:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--yellow); color: #000; padding: 10px 16px; border-radius: 10px;
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }
/* Présent pour les lecteurs d'écran, absent à l'œil */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 3vw, 40px);
  transition: background-color .3s ease;
}
/* Le voile n'apparaît que lorsque du contenu passe réellement sous la barre */
.nav.is-scrolled {
  background: rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
/* Au-dessus de la section claire, la barre passe en clair */
.nav.is-light { background: rgba(245, 245, 247, .76); }
.nav.is-light .brand, .nav.is-light .nav-links a:hover, .nav.is-light .nav-links a.is-current, .nav.is-light .lang:hover { color: var(--paper-ink); }
.nav.is-light .nav-links a, .nav.is-light .lang { color: #55555a; }
.nav.is-light .lang:hover { background: rgba(0, 0, 0, .08); }
.nav.is-light .pill { background: var(--paper-ink); color: #fff; }
.nav.is-light :focus-visible { outline-color: #000; }
.brand {
  font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; text-decoration: none; color: var(--ink);
  transition: color .3s ease;
}
.brand span { font-weight: 400; }
.nav-links { display: flex; gap: clamp(18px, 2.6vw, 36px); }
.nav-links a {
  font-size: .9375rem; text-decoration: none; color: var(--dim);
  padding: 8px 0; transition: color .2s ease;
}
.nav-links a:hover, .nav-links a.is-current { color: var(--ink); }
.nav-end { display: flex; align-items: center; gap: 10px; }
.lang {
  min-width: 44px; min-height: 36px; border-radius: 999px;
  font-size: .875rem; font-weight: 600; color: var(--dim);
  transition: color .2s ease, background-color .2s ease;
}
.lang:hover { color: var(--ink); background: rgba(255, 255, 255, .1); }
.pill {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 16px;
  border-radius: 999px; background: var(--ink); color: #000;
  font-size: .875rem; font-weight: 600; text-decoration: none;
  transition: transform .12s ease-out, background-color .2s ease;
}
.pill:hover { background: #fff; }
.pill:active { transform: scale(.96); }

/* ---------- Boutons : le retour visuel part dès l'appui ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 28px; border-radius: 999px;
  font-size: 1.0625rem; font-weight: 600; text-decoration: none;
  transition: transform .12s ease-out, background-color .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--yellow); color: #000; }
.btn--primary:hover { background: #ffe052; }
.btn--ghost { color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32); }
.btn--ghost:hover { background: rgba(255, 255, 255, .09); }

/* ==========================================================================
   Composant « iPhone » : cadre en titane, bord noir, îlot, boutons latéraux.
   Une seule cote, --pw (largeur du téléphone) ; tout le reste en découle.
   À l'intérieur de l'écran, les cotes sont en cqw / cqh (% de l'écran).
   ========================================================================== */
.device {
  position: relative; display: block; flex: none;
  width: var(--pw); aspect-ratio: 1 / 2.079;
  padding: calc(var(--pw) * .012);
  border-radius: calc(var(--pw) * .172);
  background: linear-gradient(118deg, #a29f99 0%, #4a4843 20%, #8f8c86 46%, #2e2d2a 72%, #8d8a84 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .3),
    0 0 0 1px rgba(0, 0, 0, .9),
    0 calc(var(--pw) * .2) calc(var(--pw) * .3) calc(var(--pw) * -.14) rgba(0, 0, 0, .95),
    0 0 calc(var(--pw) * .5) calc(var(--pw) * -.08) var(--glow, transparent);
}
/* Boutons : action et volume à gauche, mise en veille à droite */
.device::before, .device::after {
  content: ""; position: absolute; width: calc(var(--pw) * .011); border-radius: calc(var(--pw) * .006);
}
.device::before {
  left: calc(var(--pw) * -.009); top: 15.5%; height: 27%;
  background: linear-gradient(180deg, #6b6964 0 13%, transparent 13% 30%, #6b6964 30% 62%, transparent 62% 68%, #6b6964 68% 100%);
}
.device::after { right: calc(var(--pw) * -.009); top: 27%; height: 11.5%; background: #6b6964; }

.screen {
  position: relative; display: block; height: 100%; overflow: hidden;
  border: calc(var(--pw) * .026) solid #000;
  border-radius: calc(var(--pw) * .162);
  background: #000;
  container-type: size;
}
/* Îlot */
.screen::after {
  content: ""; position: absolute; z-index: 5; left: 50%; top: 1.25cqh;
  width: 31cqw; height: 9.2cqw; translate: -50% 0;
  border-radius: 999px; background: #000;
}
/* Barre d'état : heure et batterie */
.sb {
  position: absolute; z-index: 4; inset: 0 0 auto 0; height: 6.9cqh; padding: .5cqh 9cqw 0 13cqw;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 4.1cqw; line-height: 1; color: #fff; pointer-events: none;
}
.sb b { font-weight: 650; letter-spacing: -.01em; }
.sb i { width: 6.6cqw; height: 3.2cqw; border-radius: .9cqw; background: currentColor; }
.sb--dark { color: #16161a; }

/* Écran rempli par une capture du jeu */
.scr-shot img { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
.scr-shot--light { background: #f6f4f0; }

/* ==========================================================================
   Accueil
   ========================================================================== */
.hero {
  position: relative; isolation: isolate; overflow: clip;
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--nav-h) + clamp(20px, 4.5svh, 64px)) 16px 0;
  text-align: center;
}
/* Trois flaques de lumière, une par jeu, sous les téléphones */
.hero-glow {
  position: absolute; inset: auto 0 0 0; height: 70%; z-index: -1;
  background:
    radial-gradient(38% 46% at 28% 78%, rgba(70, 115, 255, .30), transparent 70%),
    radial-gradient(40% 50% at 50% 82%, rgba(255, 74, 43, .34), transparent 70%),
    radial-gradient(38% 46% at 72% 78%, rgba(227, 183, 87, .24), transparent 70%);
  opacity: calc(1 - var(--hp, 0) * .7);
}
.hero-title {
  font-size: clamp(3.4rem, 9.4vw, 9rem);
  font-weight: 800; line-height: .94; letter-spacing: -.04em; word-spacing: .1em;
  animation: materialize 1s var(--ease-out) both;
}
.br-s { display: none; }
.hero-sub {
  max-width: 46em; margin-top: clamp(12px, 2svh, 24px);
  font-size: clamp(1.0625rem, 1.5vw, 1.375rem); line-height: 1.4; color: var(--dim);
  text-wrap: balance;
  animation: materialize 1s .12s var(--ease-out) both;
}
.hero-actions {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  margin-top: clamp(16px, 2.6svh, 30px);
  animation: materialize 1s .2s var(--ease-out) both;
}

/* Un seul moment orchestré à l'ouverture : le titre se matérialise, les téléphones montent */
@keyframes materialize {
  from { opacity: 0; transform: translateY(.35em); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(90px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Les trois téléphones, en volume ---------- */
.trio {
  --pw: min(30vw, 21.5svh, 250px);
  padding: clamp(24px, 5svh, 72px) 0 clamp(14px, 2.4svh, 30px);
  perspective: 1500px;
  transform: translateY(calc(var(--hp, 0) * -5svh)) scale(calc(1 + var(--hp, 0) * .05));
}
.trio-inner {
  display: flex; justify-content: center; align-items: flex-end;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.phone {
  display: grid; justify-items: center; gap: clamp(10px, 1.6svh, 16px);
  transform-style: preserve-3d;
  text-decoration: none; color: var(--dim);
  font-size: clamp(.8125rem, 1.2vw, 1rem); font-weight: 500;
  animation: rise 1.1s var(--ease-out) both;
  -webkit-tap-highlight-color: transparent;
}
.phone--c { animation-delay: .25s; z-index: 2; }
.phone--l, .phone--r { animation-delay: .4s; }
.phone-name { transition: color .2s ease; }
.phone:hover .phone-name, .phone:focus-visible .phone-name { color: var(--ink); }
.phone .device { transition: translate .45s var(--ease-out); }
.phone--l .device { transform: translateX(4%) translateZ(-70px) rotateY(30deg); }
.phone--r .device { transform: translateX(-4%) translateZ(-70px) rotateY(-30deg); }
.phone--c .device { transform: translateZ(40px); }
.phone:hover .device, .phone:focus-visible .device { translate: 0 -10px; }
.phone:active .device { translate: 0 -4px; }

/* Écran Towny de l'accueil (dessiné en CSS) */
.scr-towny { background: radial-gradient(120% 70% at 50% 30%, #1b2f78, #0a1236 70%); }
.scr-towny-k {
  position: absolute; left: 0; right: 0; top: 17cqh; text-align: center;
  font-size: 8.5cqw; font-weight: 700; color: #fff; letter-spacing: -.02em;
}
.wheel--mini { position: absolute; left: 50%; top: 47cqh; width: 78cqw; translate: -50% -50%; }
.wheel--mini .wheel-disc { transform: rotate(240deg); }
.scr-towny-cards {
  position: absolute; left: 0; right: 0; bottom: 6cqh;
  display: flex; justify-content: center; gap: 3cqw;
}
.scr-towny-cards b {
  width: 25cqw; aspect-ratio: 5 / 7; border-radius: 3cqw;
  background: linear-gradient(180deg, #f1a34c 0 56%, var(--gold) 56%);
  box-shadow: inset 0 0 0 .6cqw rgba(255, 220, 140, .9);
}
.scr-towny-cards b:nth-child(2) { background: linear-gradient(180deg, #5b78e8 0 56%, var(--gold) 56%); translate: 0 -3cqw; }
.scr-towny-cards b:nth-child(3) { background: linear-gradient(180deg, #d9567a 0 56%, var(--gold) 56%); }

/* ==========================================================================
   Composant « borne » de Boxer Champion : toutes les positions sont en % de l'image
   ========================================================================== */
.cab {
  position: relative; aspect-ratio: 881 / 1785;
  container-type: inline-size;
}
/* Dans un écran d'iPhone : la borne occupe toute la largeur, calée en bas, sous la barre d'état */
.screen .cab--game { position: absolute; display: block; left: 0; bottom: 0; width: 100%; }
.cab-img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Afficheur à sept segments, calé sur l'écran vide de la borne */
.cab-led {
  position: absolute; left: 21.5%; top: 38.6%; width: 51%; height: 11.4%;
  display: grid; place-items: center;
  font-family: "DSEG7", monospace; font-size: 14.5cqw; line-height: 1;
  color: #ff3a24;
}
.cab-led > * { grid-area: 1 / 1; }
.led-ghost { opacity: .13; }
.led-val { text-shadow: 0 0 .22em rgba(255, 50, 25, .85); }
/* Le ballon pend au crochet du fronton et pivote autour de son attache */
.ball {
  position: absolute; left: 47%; top: 15%; width: 33%;
  translate: -50% 0;
  transform-origin: 50% 3%;
  transform: rotate(var(--theta, 0deg));
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}
.ball img { width: 100%; pointer-events: none; user-select: none; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .55)); }
button.ball { cursor: grab; }
button.ball:active { cursor: grabbing; }

/* Les ampoules du fronton s'embrasent à l'impact */
.cab-flash {
  position: absolute; z-index: 1; left: -8%; right: -8%; top: 0; height: 26%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 190, 90, .75), transparent 70%);
  mix-blend-mode: screen; opacity: 0; pointer-events: none;
}
.cab.is-hit .cab-flash { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Onde d'impact, posée à l'endroit exact du contact */
.impact {
  position: absolute; left: var(--ix, 47%); top: var(--iy, 30%);
  width: 34%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, .9), rgba(255, 200, 90, .5) 35%, transparent 68%);
  mix-blend-mode: screen;
}
.cab.is-hit .impact { animation: impact .45s ease-out; }
@keyframes impact {
  0%   { opacity: 1; transform: scale(.35); }
  100% { opacity: 0; transform: scale(1.9); }
}
.cab.is-perfect .led-val { animation: blink .28s steps(2) 6; }
@keyframes blink { 50% { opacity: .15; } }

/* ==========================================================================
   Chapitres de jeu
   ========================================================================== */
.chapter {
  position: relative; isolation: isolate;
  padding: clamp(96px, 16vh, 200px) 0 clamp(88px, 13vh, 170px);
}
.chapter--boxer { --accent: var(--boxer); }
.chapter--towny { --accent: var(--towny); }
.chapter--garage { --accent: var(--gold); padding-top: 0; }

.chapter-intro { max-width: 940px; margin-inline: auto; padding: 0 20px; text-align: center; }
.game-name {
  font-size: clamp(1.25rem, 2vw, 1.75rem); font-weight: 600; letter-spacing: -.015em;
  color: var(--accent);
}
.tagline {
  margin: .06em 0 .22em;
  font-size: clamp(3.6rem, 11vw, 9.5rem);
  font-weight: 800; line-height: .95; letter-spacing: -.04em; word-spacing: .1em;
}
.lede {
  max-width: 34em; margin-inline: auto;
  font-size: clamp(1.125rem, 1.7vw, 1.5rem); line-height: 1.4; color: var(--dim);
  text-wrap: balance;
}

.facts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 4vw, 56px);
  max-width: 1128px; margin: clamp(64px, 10vh, 130px) auto 0; padding: 0 24px;
}
.facts li { border-top: 1px solid var(--line); padding-top: 22px; }
.facts h3 { font-size: 1.3125rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.facts p { margin-top: 8px; color: var(--dim); max-width: 30em; }

/* ---------- Boxer Champion : le ring ---------- */
.chapter--boxer::before {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 22%; height: 60%;
  background: radial-gradient(34% 50% at 50% 50%, rgba(255, 74, 43, .24), transparent 72%);
}
.ring {
  display: grid; align-items: center;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "l cab r";
  gap: clamp(28px, 5vw, 84px);
  max-width: 1240px; margin: clamp(40px, 7vh, 84px) auto 0; padding: 0 24px;
  touch-action: pan-y;
}
.ring-phone { grid-area: cab; --pw: min(calc(84svh * .481), 390px, 80vw); }
.ring-side--l { grid-area: l; text-align: right; }
.ring-side--r { grid-area: r; }

.score-k { font-size: 1rem; color: var(--dim); }
.score-v {
  font-size: clamp(3rem, 6.4vw, 5.75rem); font-weight: 800; line-height: 1; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums; margin-bottom: clamp(16px, 3vh, 32px);
}
.score-v--s { font-size: clamp(1.75rem, 3vw, 2.5rem); margin-bottom: 0; color: var(--amber); }
.hint-title { font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.hint { margin-top: 12px; max-width: 19em; color: var(--dim); }
.hint--note { color: var(--ink); }

/* ---------- Scènes pilotées par le défilement ---------- */
.scrub { position: relative; }
.scrub-stage { position: sticky; top: 0; height: 100svh; overflow: clip; }

/* ---------- Towny : la scène se joue dans l'iPhone ---------- */
.scrub--towny { height: 340svh; margin-top: clamp(8px, 3vh, 40px); }
.scrub--towny .scrub-stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(40% 46% at 50% 52%, rgba(70, 115, 255, .26), transparent 72%);
}
.towny-stage {
  height: 100%; max-width: 1240px; margin-inline: auto;
  padding: calc(var(--nav-h) + 4px) 24px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: clamp(28px, 5vw, 84px);
}
.towny-phone { --pw: min(calc((100svh - var(--nav-h) - 52px) * .481), 390px, 80vw); }
/* Les trois temps de la manche : celui en cours s'allume */
.steps {
  justify-self: end; display: grid; gap: .5em; text-align: right;
  font-size: clamp(1.5rem, 2.7vw, 2.375rem); font-weight: 750; letter-spacing: -.035em; line-height: 1.08;
}
.steps li { opacity: .24; transition: opacity .35s ease; }
.scrub[data-step="1"] .steps li:nth-child(1),
.scrub[data-step="2"] .steps li:nth-child(2),
.scrub[data-step="3"] .steps li:nth-child(3) { opacity: 1; }
.scroll-hint {
  justify-self: start; max-width: 11em; color: var(--dim);
  opacity: calc(1 - var(--a, 0) * 5);
}

/* La roue : construite en CSS, toutes ses cotes sont relatives à sa largeur (cqw) */
.wheel { aspect-ratio: 1; container-type: inline-size; }
.wheel--big {
  position: absolute; left: 50%; top: 51cqh; width: 80cqw;
  translate: -50% -50%;
  transform: translateY(calc(var(--b, 0) * -24.5cqh)) scale(calc(1 - var(--b, 0) * .46));
  will-change: transform;
}
/* Jante dorée */
.wheel::before {
  content: ""; position: absolute; inset: -3.4cqw; border-radius: 50%;
  background: conic-gradient(from 20deg, #f6e2a0, #b98a2e, #f3d68a, #9b6f1e, #f6e2a0, #b98a2e, #f3d68a, #9b6f1e, #f6e2a0);
  box-shadow: 0 6cqw 14cqw -4cqw rgba(0, 0, 0, .75);
}
.wheel-disc {
  position: absolute; inset: 0; border-radius: 50%;
  transform: rotate(var(--rot, 0deg));
  will-change: transform;
  background:
    repeating-conic-gradient(from -15deg, rgba(0, 0, 0, .4) 0 .8deg, transparent .8deg 30deg),
    conic-gradient(from -15deg,
      #e23a2e 0 30deg, #2b4fd6 30deg 60deg, #1e9e6a 60deg 90deg, #7a3fd0 90deg 120deg,
      #e9a01f 120deg 150deg, #149fb5 150deg 180deg, #c8324f 180deg 210deg, #2a3f9e 210deg 240deg,
      #2f9d49 240deg 270deg, #5a34b8 270deg 300deg, #e2622a 300deg 330deg, #1b7fb0 330deg 360deg);
  box-shadow: inset 0 0 0 .6cqw rgba(0, 0, 0, .35), inset 0 0 12cqw rgba(0, 0, 0, .4);
}
/* Un repère par secteur ; le secteur gagnant porte une montagne */
.wheel-disc i {
  position: absolute; left: 50%; top: 50%; width: 7.4cqw; aspect-ratio: 1;
  border-radius: 50%; border: .7cqw solid rgba(255, 255, 255, .88);
  transform: translate(-50%, -50%) rotate(calc(var(--i) * 30deg)) translateY(-35.5cqw);
}
.wheel-disc i:nth-child(5) {
  border: 0; border-radius: 0; width: 9cqw; background: #fff;
  clip-path: polygon(50% 8%, 100% 92%, 0 92%);
}
.wheel-win {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 105deg, rgba(255, 244, 200, .5) 0 30deg, transparent 30deg);
  opacity: var(--b, 0);
}
.wheel-hub {
  position: absolute; left: 50%; top: 50%; width: 27cqw; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7a63, #d42a1c 60%, #8f150c);
  box-shadow: 0 0 0 1.4cqw #f0cf7e, 0 2cqw 5cqw rgba(0, 0, 0, .5);
}
.wheel-pin {
  position: absolute; left: 50%; top: -6.2cqw; width: 8cqw; height: 10cqw; translate: -50% 0;
  background: linear-gradient(180deg, #fff3c4, #d8a53a);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 .6cqw .8cqw rgba(0, 0, 0, .5));
}

.criterion {
  position: absolute; left: 0; right: 0; top: 40cqh; text-align: center;
  opacity: var(--b, 0);
  transform: translateY(calc((1 - var(--b, 0)) * 4cqw));
}
.criterion-k, .criterion-rule { font-size: 3.8cqw; line-height: 1.35; color: #aab3d8; }
.criterion-v { font-size: 10.5cqw; font-weight: 800; letter-spacing: -.04em; line-height: 1.05; }

.duel-wrap { position: absolute; left: 0; right: 0; top: 54.5cqh; display: grid; justify-items: center; gap: 4.4cqw; }
.duel { display: flex; align-items: center; gap: 1.6cqw; perspective: 900px; }
.city {
  --cw: 41cqw;
  position: relative; width: var(--cw); aspect-ratio: 5 / 7.2;
  transform: translateY(calc((1 - var(--in, 0)) * 58cqh));
  will-change: transform;
}
.city--a { --in: var(--ina, 0); --flip: var(--flipa, 0); scale: calc(1 + var(--d, 0) * .05); }
.city--b { --in: var(--inb, 0); --flip: var(--flipb, 0); opacity: calc(1 - var(--d, 0) * .55); }
.city-in {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(calc((1 - var(--flip, 0)) * 180deg));
  will-change: transform;
}
.city-front, .city-back {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: calc(var(--cw) * .09);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.city-front {
  display: grid; grid-template-rows: 1fr auto auto;
  background: #0d1740;
  box-shadow: inset 0 0 0 calc(var(--cw) * .012) #e9c877;
  text-align: center;
}
.city-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 50%, rgba(233, 200, 119, .9) 0 9%, transparent 9.5%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 6px, transparent 6px 12px),
    #101c52;
  box-shadow: inset 0 0 0 calc(var(--cw) * .012) #e9c877, inset 0 0 0 calc(var(--cw) * .04) #101c52, inset 0 0 0 calc(var(--cw) * .046) rgba(233, 200, 119, .5);
}
.city-art { position: relative; overflow: hidden; }
.city-art svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: #141033; }
.city-art--havre { background: linear-gradient(180deg, #2c2a72, #d9567a 55%, #f7a54a 92%); }
.city-art--ny { background: linear-gradient(180deg, #0c1c58, #3f6fe0 62%, #9cc3ff); }
.city figcaption { padding: calc(var(--cw) * .05) 4px calc(var(--cw) * .04); display: grid; }
.city-name { font-size: calc(var(--cw) * .118); font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.city-country { font-size: calc(var(--cw) * .07); color: #aab3d8; }
.city-stat {
  display: grid; padding: calc(var(--cw) * .04) 4px calc(var(--cw) * .05);
  background: linear-gradient(180deg, #f3d98b, #cf9f3f); color: #241800;
}
.city-stat span { font-size: calc(var(--cw) * .064); font-weight: 600; }
.city-stat strong { font-size: calc(var(--cw) * .155); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
/* Halo du vainqueur */
.city--a::after {
  content: ""; position: absolute; inset: -12%; z-index: -1; border-radius: 20%;
  background: radial-gradient(closest-side, rgba(255, 215, 110, .6), transparent);
  opacity: var(--d, 0);
}
.vs {
  flex: none; width: 8.6cqw; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #f6e2a0, #c08f2f); color: #241800;
  font-size: 3cqw; font-weight: 800;
  opacity: var(--inb, 0); scale: calc(.6 + var(--inb, 0) * .4);
}
.duel-verdict {
  font-size: 4.4cqw; font-weight: 650; letter-spacing: -.02em; text-align: center;
  opacity: var(--d, 0); transform: translateY(calc((1 - var(--d, 0)) * 3cqw));
}

/* ---------- The Garage ---------- */
.scrub--garage { height: 260svh; }
.garage-stage { background: #000; }
/* Image entière, fondue dans le noir sur ses quatre bords */
.garage-car {
  position: absolute; left: 50%; top: 0; height: 100%; width: auto; max-width: none;
  aspect-ratio: 1448 / 1086; translate: -50% 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent), linear-gradient(180deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent), linear-gradient(180deg, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
  transform: scale(calc(1.14 - var(--g1, 0) * .14));
  will-change: transform;
}
/* Le voile noir se lève avec le défilement : la lumière monte dans le garage */
.garage-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, #000 0, rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0) 66%, #000 100%),
    rgba(0, 0, 0, calc(.9 - var(--g1, 0) * .9));
}
.garage-copy {
  position: absolute; left: 0; right: 0; top: calc(var(--nav-h) + 4svh); padding: 0 20px; text-align: center;
  opacity: var(--g2, 0); transform: translateY(calc((1 - var(--g2, 0)) * 18px));
}
.garage-copy .tagline { margin-bottom: 0; font-size: clamp(3.2rem, min(11vw, 15svh), 9.5rem); }
.stats {
  position: absolute; left: 0; right: 0; bottom: 6svh;
  display: flex; justify-content: center; gap: clamp(20px, 7vw, 110px);
  padding: 0 16px; text-align: center;
  opacity: var(--g3, 0); transform: translateY(calc((1 - var(--g3, 0)) * 18px));
}
.stats dt {
  font-size: clamp(2.6rem, min(7vw, 11svh), 5.5rem); font-weight: 800; line-height: 1; letter-spacing: -.045em;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.stats dd { margin-top: 6px; font-size: clamp(.875rem, 1.3vw, 1.0625rem); color: var(--ink); max-width: 11em; }

.chapter-intro--after { margin-top: clamp(72px, 12vh, 150px); }

/* Trois écrans du jeu : celui du milieu en avant, les deux autres en retrait.
   Ils montent à leur place à l'arrivée dans l'écran (--gl : 0 → 1). */
.gallery {
  --pw: clamp(200px, 21vw, 290px);
  display: flex; justify-content: center; align-items: flex-start; gap: clamp(20px, 3.6vw, 60px);
  margin-top: clamp(40px, 7vh, 88px); padding: 0 24px;
}
.shot {
  display: grid; justify-items: center; gap: 22px; text-align: center;
  transform: translateY(calc((1 - var(--gl, 1)) * var(--drop, 0px)));
  will-change: transform;
}
.shot--main { --drop: 60px; }
.shot--side { --drop: 150px; margin-top: 64px; }
.shot--side .device { --pw: clamp(180px, 18.5vw, 256px); }
.shot figcaption { display: grid; gap: 4px; max-width: 16em; }
.shot figcaption b { font-size: 1.3125rem; font-weight: 650; letter-spacing: -.02em; }
.shot figcaption span { color: var(--dim); }

/* ==========================================================================
   Le studio (section claire)
   ========================================================================== */
.studio { background: var(--paper); color: var(--paper-ink); padding: clamp(104px, 17vh, 210px) 24px; }
.studio-inner { max-width: 1128px; margin-inline: auto; }
.studio-title { font-size: clamp(1.25rem, 2vw, 1.75rem); font-weight: 600; letter-spacing: -.015em; color: #6e6e73; }
.statement {
  margin-top: .35em; max-width: 17em;
  font-size: clamp(2.1rem, 5.6vw, 4.75rem); font-weight: 750; line-height: 1.05; letter-spacing: -.035em; word-spacing: .06em;
}
/* Les mots s'encrent au fil de la lecture */
.statement .w { opacity: var(--o, 1); transition: opacity .25s linear; }
.principles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 4vw, 56px);
  margin-top: clamp(72px, 11vh, 130px);
}
.principles > div { border-top: 1px solid rgba(0, 0, 0, .16); padding-top: 22px; }
.principles h3 { font-size: 1.3125rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.principles p { margin-top: 8px; color: #55555a; max-width: 30em; }
.studio :focus-visible { outline-color: #000; }

/* ==========================================================================
   Sortie et pied de page
   ========================================================================== */
.release {
  position: relative; isolation: isolate; overflow: clip;
  padding: clamp(120px, 20vh, 240px) 20px clamp(104px, 16vh, 200px);
  text-align: center;
}
.release::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(52% 60% at 50% 100%, rgba(91, 54, 230, .5), transparent 72%);
}
.release-title {
  max-width: 11em; margin: 0 auto .3em;
  font-size: clamp(3rem, 8.4vw, 7.5rem); font-weight: 800; line-height: .96; letter-spacing: -.04em; word-spacing: .08em;
  text-wrap: balance;
}
.release .hero-actions { animation: none; margin-top: clamp(28px, 5vh, 44px); }
.release-mail { margin-top: 22px; color: var(--dim); }
.release-mail a { text-decoration-color: rgba(255, 255, 255, .3); text-underline-offset: 4px; }
.release-mail a:hover { color: var(--ink); }

.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
  padding: 28px clamp(16px, 3vw, 40px) calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: .9375rem; color: var(--dim);
}
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.footer nav a { text-decoration: none; padding: 6px 0; }
.footer nav a:hover { color: var(--ink); }

/* ==========================================================================
   Adaptation aux écrans
   ========================================================================== */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .facts, .principles { grid-template-columns: 1fr; gap: 0; }
  .facts li, .principles > div { padding: 20px 0 24px; }
  .ring {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "cab cab" "l r";
    gap: 28px 20px; justify-items: center; align-items: start;
  }
  .ring-side { justify-self: stretch; }
  .ring-side--l { text-align: left; }
  .hint { max-width: none; }

  /* Towny : le téléphone seul, la consigne en dessous */
  .towny-stage { grid-template-columns: 1fr; justify-items: center; align-content: center; gap: 0; }
  .towny-phone { --pw: min(calc((100svh - var(--nav-h) - 72px) * .481), 80vw); }
  .steps { display: none; }
  .scroll-hint {
    position: absolute; left: 0; right: 0; bottom: 1.6svh; max-width: none;
    text-align: center; font-size: .9375rem;
  }

  /* The Garage : les trois écrans se feuillettent du doigt */
  .gallery {
    --pw: min(64vw, 280px);
    justify-content: flex-start; gap: 6vw;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    padding: 8px calc(50vw - min(32vw, 140px)) 24px;
    scrollbar-width: none;
  }
  .gallery::-webkit-scrollbar { display: none; }
  .shot { flex: none; scroll-snap-align: center; transform: none; }
  .shot--side { margin-top: 0; }
  .shot--side .device { --pw: min(64vw, 280px); }
}
@media (max-width: 560px) {
  .br-s { display: inline; }
  .hero-title { font-size: clamp(3.4rem, 17vw, 5rem); }
  .btn { min-height: 48px; padding: 0 22px; font-size: 1rem; }
  .hero .btn--ghost { display: none; }
  .trio { --pw: min(36vw, 23svh); }
  .phone--l .device { transform: translateX(15%) translateZ(-70px) rotateY(30deg); }
  .phone--r .device { transform: translateX(-15%) translateZ(-70px) rotateY(-30deg); }
  .pill { display: none; }
  .footer { flex-direction: column; align-items: flex-start; }
}
/* Écran en hauteur : l'image du garage est cadrée en largeur pour garder le titre entier */
@media (max-aspect-ratio: 1/1) {
  .garage-car { left: -17%; top: 50%; width: 134%; height: auto; translate: 0 -50%; }
  .stats { bottom: 17svh; }
  .garage-copy { top: 19svh; }
}

/* Sans JavaScript : chaque scène s'affiche dans son état final */
html:not(.js) .scrub {
  --a: 1; --b: 1; --ina: 1; --inb: 1; --flipa: 1; --flipb: 1; --d: 1; --rot: 240deg;
  --g1: 1; --g2: 1; --g3: 1; height: auto;
}

/* ==========================================================================
   Préférences d'accessibilité
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-title, .hero-sub, .hero-actions, .phone { animation: none; }
  .trio { transform: none; }
  .scrub { height: auto !important; }
  .scrub-stage { position: relative; }
  .phone .device, .btn, .pill, .steps li { transition: none; }
  .cab.is-hit .cab-flash, .cab.is-hit .impact, .cab.is-perfect .led-val { animation: none; }
  .statement .w { transition: none; }
  .shot { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .nav.is-scrolled { background: #000; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav.is-light { background: var(--paper); }
}
@media (prefers-contrast: more) {
  :root { --dim: #d6d6dc; --line: rgba(255, 255, 255, .5); }
  .nav.is-scrolled { background: #000; }
  .nav.is-light { background: var(--paper); }
}
