/* Les couleurs du thème sont déclarées pour pouvoir glisser d'un produit à l'autre. */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #0b0b0e; }
@property --bg2 { syntax: '<color>'; inherits: true; initial-value: #16142e; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #6f6ae8; }
@property --accent2 { syntax: '<color>'; inherits: true; initial-value: #a9a5ff; }
@property --ink { syntax: '<color>'; inherits: true; initial-value: #f5f5f7; }

@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist-1.7.2/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

/* Le nom de chaque produit dans SA police d'affichage, réduite aux lettres du nom
   (fonts/noms/LISEZMOI.md). */
@font-face { font-family: 'Nom Scribe'; src: url('/fonts/noms/scribe.woff2') format('woff2'); font-weight: 500; font-display: block; }
@font-face { font-family: 'Nom Planete'; src: url('/fonts/noms/planete.woff2') format('woff2'); font-weight: 800; font-display: block; }
@font-face { font-family: 'Nom Emancia'; src: url('/fonts/noms/emancia.woff2') format('woff2'); font-weight: 700; font-display: block; }
@font-face { font-family: 'Nom Vincoria'; src: url('/fonts/noms/vincoria.woff2') format('woff2'); font-weight: 700; font-display: block; }

/* Le thème suit le produit courant: main.js écrit ces variables. */
:root {
  --bg: #0b0b0e;
  --bg2: #16142e;
  --accent: #6f6ae8;
  --accent2: #a9a5ff;
  --ink: #f5f5f7;
  --ink-soft: color-mix(in oklab, var(--ink) 68%, transparent);
  --ink-faint: color-mix(in oklab, var(--ink) 48%, transparent);
  --theme-ms: 900ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
  transition: --bg var(--theme-ms) var(--ease), --bg2 var(--theme-ms) var(--ease), --accent var(--theme-ms) var(--ease),
    --accent2 var(--theme-ms) var(--ease), --ink var(--theme-ms) var(--ease);
}

* { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--theme-ms) var(--ease), color var(--theme-ms) var(--ease);
}

/* Le champ de couleur occupe toute la page (QD2): un dégradé maillé aux couleurs
   du produit, qui dérive lentement, et un grain fin par-dessus. */
.colorfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}
.colorfield-color {
  position: absolute;
  inset: -18%;
  /* Couleurs propres à la couche, posées par main.js: le passage d'un produit à
     l'autre est un fondu d'opacité entre deux couches, qui ne repeint rien. */
  --fa: #6f6ae8;
  --fa2: #a9a5ff;
  --fb2: #16142e;
  background:
    /* Le coeur du halo reste lumineux et saturé: un orange à moitié transparent
       posé sur du bleu nuit virait au brun. Il se tient derrière le capot: posé
       sous le socle, il éclaircissait le sol et le portable lévitait. */
    radial-gradient(30% 20% at 50% 38%, color-mix(in oklab, color-mix(in oklab, var(--fa) 88%, white) 82%, transparent), transparent 70%),
    radial-gradient(56% 40% at 50% 42%, color-mix(in oklab, var(--fa) 30%, transparent), transparent 76%),
    radial-gradient(34% 34% at 14% 16%, color-mix(in oklab, var(--fa2) 30%, transparent), transparent 72%),
    radial-gradient(40% 36% at 90% 88%, color-mix(in oklab, var(--fa2) 18%, transparent), transparent 72%),
    radial-gradient(60% 50% at 82% 14%, var(--fb2), transparent 74%),
    radial-gradient(70% 60% at 10% 92%, var(--fb2), transparent 74%);
  opacity: 0;
  transition: opacity var(--theme-ms) var(--ease);
}
.colorfield-color.on { opacity: 1; }
.colorfield-grain {
  position: absolute;
  inset: 0;
  background: url('/assets/grain.png') repeat;
  background-size: 128px;
  opacity: 0.07;
  mix-blend-mode: overlay;
}
@media (prefers-reduced-motion: no-preference) {
  .colorfield-color { animation: derive 26s ease-in-out infinite alternate; }
}
@keyframes derive {
  0% { transform: translate3d(-2%, 1%, 0) scale(1); }
  50% { transform: translate3d(2%, -1.5%, 0) scale(1.04); }
  100% { transform: translate3d(-1%, -2%, 0) scale(1.02); }
}

/* Le nom du produit, immense, posé DERRIÈRE les appareils (QD3). main.js le cadre
   sur la scène: --name-top et --name-size. */
.bigname {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--name-top, 18vh);
  z-index: 1;
  display: flex;
  justify-content: center;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.bigname span {
  display: block;
  font-family: var(--name-font, 'Nom Scribe'), serif;
  font-size: var(--name-size, 18vw);
  line-height: 0.86;
  /* La boîte se cale sur les capitales: le haut des lettres tombe au même endroit
     quelle que soit la police du produit. */
  text-box: trim-both cap alphabetic;
  /* background-clip: text ne peint que dans la boîte: sans cette marge intérieure,
     tout ce qui dépasse les capitales (point du i, hampe du b, accent) est coupé net. */
  padding: 0.24em 0.08em 0.06em;
  margin: -0.24em -0.08em -0.06em;
  letter-spacing: var(--name-track, -0.035em);
  white-space: pre;
  text-align: center;
  color: transparent;
  background: linear-gradient(180deg, color-mix(in oklab, var(--ink) 96%, transparent) 18%, color-mix(in oklab, var(--accent2) 55%, transparent) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 700ms var(--ease), transform 900ms var(--ease);
}
.bigname.on span { opacity: 1; transform: none; }
.bigname.leaving span { opacity: 0; transform: translateX(var(--shift, 0)); transition-duration: 240ms; transition-timing-function: ease-in; }
.bigname.entering span { opacity: 0; transform: translateX(var(--shift, 0)); transition: none; }

#scene {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 700ms var(--ease);
}
#scene.ready { opacity: 1; }

.frame {
  position: relative;
  z-index: 3;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: 'top' 'stage' 'foot';
  padding: max(env(safe-area-inset-top), clamp(14px, 3vh, 30px)) max(env(safe-area-inset-right), clamp(16px, 3.4vw, 48px)) max(env(safe-area-inset-bottom), clamp(16px, 3.4vh, 36px)) max(env(safe-area-inset-left), clamp(16px, 3.4vw, 48px));
  pointer-events: none;
}

/* La barre du haut: la marque à gauche; About, la demande et le son à droite (QD4). */
.top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { pointer-events: auto; display: block; border-radius: 8px; touch-action: manipulation; }
.brand img { display: block; height: clamp(24px, 2.2vw, 30px); width: auto; }
.brand:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 4px; }

.dock { pointer-events: auto; display: flex; align-items: center; gap: 6px; }
.dock button {
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  font: inherit;
  cursor: pointer;
  border: 0;
  color: var(--ink);
  background: transparent;
  transition: background-color 200ms, transform 160ms var(--ease), color 300ms, box-shadow 300ms;
}
.dock button:active { transform: scale(0.96); }
.dock button:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 2px; }
.dock .dock-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 520;
  color: var(--ink-soft);
}
.dock .dock-main {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 560;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 22%, transparent);
}
@media (hover: hover) {
  .dock .dock-btn:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); }
  .dock .dock-main:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 34%, transparent); }
}
/* Le bouton son prend la couleur du produit quand il joue. */
.dock .sound-btn { width: 40px; height: 40px; padding: 0; border-radius: 999px; display: grid; place-items: center; margin-left: 2px; }
.sound-btn svg { width: 20px; height: 20px; }
.dock .sound-btn[aria-pressed='true'] { color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 50%, transparent); }
.dock .sound-btn[aria-pressed='false'] { color: var(--ink-faint); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 16%, transparent); }
.sound-btn .x { display: none; }
.sound-btn[aria-pressed='false'] .w1, .sound-btn[aria-pressed='false'] .w2 { display: none; }
.sound-btn[aria-pressed='false'] .x { display: inline; }
@media (prefers-reduced-motion: no-preference) {
  .sound-btn[aria-pressed='true'] .w1 { animation: onde 2.4s ease-in-out infinite; }
  .sound-btn[aria-pressed='true'] .w2 { animation: onde 2.4s ease-in-out 0.4s infinite; }
}
@keyframes onde { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.dragging, body.dragging * { cursor: grabbing !important; }
.stage.over { cursor: pointer; }

/* La scène elle-même est un lien: toucher les appareils ouvre le produit. */
.stage {
  grid-area: stage;
  pointer-events: auto;
  min-height: 0;
  border-radius: 28px;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.stage:focus-visible { box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--accent) 70%, white); }

/* Le pied: une ligne sur le produit et son adresse, le sélecteur, les flèches. */
.foot {
  grid-area: foot;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: 'card picker arrows';
  /* Les trois pièces du pied partagent une même ligne de BAS: centrées, une phrase
     de deux lignes déplaçait l'adresse de 15 px d'un produit à l'autre. */
  align-items: end;
  min-height: 72px;
  gap: 16px;
}
.card {
  --body-fs: clamp(15px, 1.05vw, 18px);
  grid-area: card;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 25rem;
  min-height: 72px;
  align-items: flex-end;
  pointer-events: auto;
}
/* Le symbole se centre sur la DERNIÈRE ligne de la phrase et l'adresse: centré sur
   tout le bloc, il montait de 11 px quand la phrase passait sur deux lignes. */
.mark { flex: none; display: block; width: 30px; height: 30px; color: var(--ink); align-self: flex-end; margin-bottom: calc(0.7 * var(--body-fs) - 3px); }
.mark svg, .mark img { display: block; width: 100%; height: 100%; }
.card-text { display: grid; gap: 6px; min-width: 0; }
.name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
.body {
  margin: 0;
  font-size: var(--body-fs);
  line-height: 1.4;
  color: var(--ink);
  text-wrap: balance;
}
.link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 6px;
  touch-action: manipulation;
  transition: color 200ms;
}
.link svg { width: 12px; height: 12px; }
.link:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 3px; }
@media (hover: hover) { .link:hover { color: var(--ink); } }

/* Le texte du produit change en glissant dans le sens du geste. */
.card { transition: opacity 380ms var(--ease), transform 520ms var(--ease); }
.card.leaving { opacity: 0; transform: translateX(var(--shift, 0)); transition-duration: 220ms, 260ms; transition-timing-function: ease-in; }
.card.entering { opacity: 0; transform: translateX(var(--shift, 0)); transition: none; }

/* Le sélecteur nomme les produits; un trait sous le courant glisse de l'un à l'autre. */
.picker {
  grid-area: picker;
  position: relative;
  display: flex;
  gap: clamp(14px, 1.6vw, 26px);
  padding: 8px 0 10px;
  pointer-events: auto;
}
.picker .dot {
  position: relative;
  padding: 6px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0.005em;
  white-space: nowrap;
  color: color-mix(in oklab, var(--ink) 46%, transparent);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  transition: color 400ms var(--ease);
}
.picker .dot::after { content: ''; position: absolute; inset: -8px -6px; }
.picker .dot[aria-current='true'] { color: var(--ink); }
.picker .dot:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 4px; border-radius: 4px; }
@media (hover: hover) { .picker .dot:hover { color: color-mix(in oklab, var(--ink) 80%, transparent); } }
.picker::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: color-mix(in oklab, var(--ink) 12%, transparent);
}
.picker-bar {
  position: absolute;
  left: 0;
  bottom: 2px;
  height: 2px;
  width: var(--bar-w, 40px);
  transform: translateX(var(--bar-x, 0));
  border-radius: 2px;
  background: var(--accent);
  transition: transform 620ms var(--ease), width 620ms var(--ease);
}

.arrows { grid-area: arrows; justify-self: end; display: flex; gap: 8px; pointer-events: auto; }
.arrow {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 18%, transparent);
  cursor: pointer;
  transition: background-color 200ms, transform 160ms var(--ease);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.arrow svg { width: 18px; height: 18px; }
.arrow:active { transform: scale(0.94); }
.arrow:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 3px; }
@media (hover: hover) { .arrow:hover { background: color-mix(in oklab, var(--ink) 9%, transparent); } }
@media (hover: none) { .arrows { display: none; } }

/* Téléphone en portrait: le pied s'empile, le sélecteur en bas. */
@media (max-width: 720px) {
  .foot { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'card' 'picker'; gap: 18px; }
  .card { max-width: none; }
  .picker { justify-self: center; gap: 16px; }
  .brand img { height: 26px; }
}
@media (max-width: 480px) {
  .brand { width: 26px; overflow: hidden; }
  .brand img { height: 26px; max-width: none; }
  .dock .dock-btn { padding: 0 10px; }
  .dock .dock-main { padding: 0 13px; }
}
@media (max-width: 374px) { .picker .dot { font-size: 12px; } .picker { gap: 12px; } }

/* Les feuilles: en bas sur téléphone, au centre sur ordinateur. Fond plein, pas de
   backdrop-filter au-dessus du canvas WebGL. */
.sheet {
  border: 0;
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  color: var(--ink);
  background: color-mix(in oklab, var(--bg) 93%, var(--ink) 7%);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 12%, transparent), 0 30px 80px -20px rgb(0 0 0 / 0.8);
  width: min(100vw, 460px);
  max-height: 92dvh;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 24px;
}
.sheet::backdrop { background: rgb(0 0 0 / 0.55); }
.sheet[open] { animation: sheet-in 420ms var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@media (max-width: 560px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 24px 24px 0 0; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
}
.sheet h2 { margin: 0 0 14px; font-size: 22px; font-weight: 620; letter-spacing: -0.02em; }
.sheet p { margin: 0 0 10px; line-height: 1.5; color: var(--ink-soft); font-size: 15px; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border: 0; border-radius: 999px;
  display: grid; place-items: center; color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); cursor: pointer;
  touch-action: manipulation;
}
.sheet-close svg { width: 18px; height: 18px; }
.about-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.about-head h2 { margin: 0; }
.about-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 560;
  background: color-mix(in oklab, var(--ink) 9%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 14%, transparent);
  touch-action: manipulation;
}
.pill svg { width: 14px; height: 14px; }
.field { display: grid; gap: 8px; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-size: 14px; font-weight: 560; color: var(--ink); padding: 0; margin-bottom: 0; }
.field legend { margin-bottom: 8px; }
.field textarea, .field input[type='email'] {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); line-height: 1.45;
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  border: 1px solid color-mix(in oklab, var(--ink) 18%, transparent);
  border-radius: 14px; padding: 12px 14px; resize: vertical;
}
.field input[type='email'] { height: 48px; padding: 0 14px; }
.field textarea:focus-visible, .field input[type='email']:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, white); outline-offset: 1px; }
.field [aria-invalid='true'] { border-color: #ff8a80; }
.sheet .help { font-size: 13px; margin: 0; color: var(--ink-faint); }
.sheet .err { font-size: 13px; margin: 0; color: #ff9d94; }
.choices { display: grid; gap: 8px; }
.field .choice {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; cursor: pointer;
  background: color-mix(in oklab, var(--ink) 5%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ink) 12%, transparent);
  font-size: 15px; font-weight: 450; touch-action: manipulation;
}
.field .choice:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.choice input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.send {
  width: 100%; height: 50px; border: 0; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--bg); background: var(--ink); cursor: pointer; touch-action: manipulation;
}
.send:active { transform: scale(0.98); }
.sheet .done { margin-top: 14px; font-size: 14px; color: var(--ink); }
.sheet .done a { color: var(--accent2); }

/* Téléphone en paysage: le pied tient sur une ligne, sans flèches. */
@media (max-height: 520px) and (min-aspect-ratio: 4/3) {
  .frame { padding-top: max(env(safe-area-inset-top), 10px); padding-bottom: max(env(safe-area-inset-bottom), 10px); }
  .foot { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'card picker'; }
  .card { --body-fs: 14px; }
  .dock .dock-btn, .dock .dock-main, .dock .sound-btn { height: 36px; }
  .dock .sound-btn { width: 36px; }
}

/* Aperçu de lien: rien d'interactif. */
.og .picker, .og .arrows, .og .dock, .og .link { display: none; }

/* Repli sans WebGL: les mêmes captures, posées dans deux cadres plats. */
.flat { display: none; }
.no-webgl #scene { display: none; }
.no-webgl .stage { display: grid; place-items: center; container-type: size; }
.no-webgl .flat {
  display: block;
  position: relative;
  width: min(88cqw, 780px, 86cqh * 1.45);
  aspect-ratio: 1.45;
}
.flat-laptop { position: absolute; left: 0; top: 0; width: 84%; }
.flat-screen {
  display: block;
  padding: 2.2% 2.2% 3%;
  border-radius: 18px 18px 6px 6px;
  background: #0d0e11;
  box-shadow: inset 0 0 0 1px #ffffff1a, 0 30px 60px -30px rgb(0 0 0 / 0.8);
}
.flat-screen img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 4px; }
.flat-base {
  display: block;
  height: 14px;
  margin: 0 -6%;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(#5a5e68, #2a2c32);
}
.flat-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 25%;
  padding: 1.6%;
  border-radius: 22px;
  background: #0d0e11;
  box-shadow: inset 0 0 0 1.5px #5a5e68, 0 30px 60px -24px rgb(0 0 0 / 0.85);
}
.flat-phone img { display: block; width: 100%; aspect-ratio: 390 / 844; object-fit: cover; object-position: top; border-radius: 16px; }

@media (prefers-reduced-motion: reduce) {
  :root { --theme-ms: 0ms; }
  #scene { transition: none; }
  .card, .card.leaving { transition: none; }
  .sheet[open] { animation: none; }
}
