/* ==========================================================================
   Socle : page plein écran pour la scène 3D, boutons, badges, champs.
   Couleurs et typographie : uniquement les jetons de tokens.css.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }
[hidden] { display: none !important; }

body {
  background: var(--c-dark-bg);
  color: var(--text);
  font: 400 var(--fs-body)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--link-strong); }
button { font: inherit; color: inherit; }
kbd {
  font: 700 0.72rem/1 var(--font-mono);
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid currentColor;
  opacity: .75;
}

.mono { font-family: var(--font-mono); letter-spacing: .04em; font-size: var(--fs-caption); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: initial; } }

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

.skip-link {
  position: fixed; left: var(--s-4); top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill); text-decoration: none; transition: top var(--dur-2) var(--ease-out);
}
.skip-link:focus { top: var(--s-4); }

/* Scène ------------------------------------------------------------------- */
.stage { position: fixed; inset: 0; }
.stage__canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }

/* Boutons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: var(--touch); padding: 0 var(--s-5);
  border-radius: 3px; border: 1px solid transparent;
  font: 600 0.9375rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1), transform var(--dur-1) var(--ease-out);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(.97); }
/* bouton principal : bordeaux, filet doré intérieur comme une plaque émaillée */
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3px rgba(201, 162, 75, .55); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn--primary:disabled { opacity: .45; cursor: progress; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--gold); }

.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur-1), transform var(--dur-1);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: var(--gold); }

/* Badges d'état (repris des statuts En rayon / À commander / Indisponible) */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-2); width: fit-content;
  padding: 4px var(--s-3); border-radius: var(--r-pill);
  font: 600 var(--fs-caption)/1.4 var(--font-body);
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--ok { background: var(--badge-ok-bg); color: var(--badge-ok-fg); }
.badge--warn { background: var(--badge-warn-bg); color: var(--badge-warn-fg); }
.badge--err { background: var(--badge-err-bg); color: var(--badge-err-fg); }

/* Champs ------------------------------------------------------------------ */
.field { display: grid; gap: var(--s-1); border: 0; padding: 0; margin: 0; }
.field label, .field legend { font: 600 var(--fs-caption)/1.4 var(--font-body); color: var(--text-muted); padding: 0; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-el);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s-3);
  min-height: var(--touch); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.field.is-invalid input, .field.is-invalid textarea { border-color: var(--err); }
.field__error { color: var(--err); font-size: var(--fs-caption); min-height: 0; }
.field__error:empty { display: none; }

.field--chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.field--chips legend { width: 100%; margin-bottom: var(--s-2); }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: var(--s-2) var(--s-3); border-radius: var(--r-pill);
  border: 1px solid var(--border); font-size: 0.875rem; transition: background var(--dur-1), color var(--dur-1);
}
.chip input:checked + span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: var(--s-2); font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Version texte ------------------------------------------------------------ */
.texte {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}
.texte:target, .no-webgl .texte {
  position: fixed; inset: 0; width: auto; height: auto; clip: auto; overflow: auto; z-index: 60;
  background: var(--bg); padding: clamp(24px, 6vw, 72px); display: grid; gap: var(--s-7);
  align-content: start; max-width: none;
}
.texte > * { max-width: var(--content); margin-inline: auto; width: 100%; }
.texte h2 { font-size: var(--fs-display); }
.texte h3 { font-size: var(--fs-title); margin-bottom: var(--s-3); color: var(--accent); }
.texte h4 { font-size: var(--fs-subtitle); margin-top: var(--s-4); }
.texte header { display: grid; gap: var(--s-4); }
.no-webgl .start { display: none; }
.noscript { position: fixed; bottom: 0; left: 0; right: 0; padding: var(--s-4); background: var(--surface); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* Champ piège anti-spam : hors écran, ni visible ni atteignable au clavier */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
