/* ============================================================================
   BASE — Editorial Arena
   Canvas clair (crème chaud) + contrastes ink / paper / seam pour les duels.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,700;9..144,900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* ─── Palette éditoriale */
  --ink: #15110E;
  --paper: #FFFFFF;
  --paper-warm: #EFEAE1;
  --paper-dim: #E8E3DA;
  --seam: #E4002B;

  /* ─── Canvas (fond pages — clair, aéré) */
  --canvas: #F7F4EF;
  --canvas-warm: #F3EFE8;
  --canvas-line: #E5DFD6;

  --bg-0: var(--canvas);
  --bg-1: var(--canvas-warm);
  --bg-2: #EDE8E0;

  /* ─── Surfaces & bordures */
  --surface: rgba(21, 17, 14, 0.03);
  --surface-2: rgba(21, 17, 14, 0.06);
  --border: rgba(21, 17, 14, 0.10);
  --border-strong: rgba(21, 17, 14, 0.18);

  /* ─── Texte (fond clair par défaut) */
  --text: #15110E;
  --text-dim: rgba(21, 17, 14, 0.58);
  --text-faint: rgba(21, 17, 14, 0.38);

  /* ─── Alias sur surfaces paper (duels, cartes) */
  --text-ink: #15110E;
  --text-ink-dim: rgba(21, 17, 14, 0.62);
  --text-ink-faint: rgba(21, 17, 14, 0.40);

  /* ─── Accents */
  --accent: #E4002B;
  --accent-hover: #FF1A42;
  --accent-soft: rgba(228, 0, 43, 0.08);
  --accent-secondary: #C45A1A;
  --accent-secondary-soft: rgba(196, 90, 26, 0.08);
  --accent-positive: #1A6B52;
  --accent-negative: #E4002B;

  /* ─── Géométrie & ombres (légères sur fond clair) */
  --radius: 4px;
  --radius-sm: 3px;
  --radius-xs: 2px;
  --shadow-sm: 0 1px 3px rgba(21, 17, 14, 0.06), 0 1px 2px rgba(21, 17, 14, 0.04);
  --shadow-md: 0 4px 18px rgba(21, 17, 14, 0.08), 0 2px 6px rgba(21, 17, 14, 0.04);
  --shadow-lift: 0 14px 44px rgba(21, 17, 14, 0.10), 0 4px 14px rgba(21, 17, 14, 0.05);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --shadow-seam: 0 4px 20px rgba(228, 0, 43, 0.22);

  /* ─── Typographie */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --vh: 1vh;

  /* ─── Navigation shell (slots bandeaux) */
  --nav-btn-size: 36px;
  --nav-icon-size: 18px;
  --nav-slot-sep: rgba(21, 17, 14, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
}

/* Portail admin — hors shell no-scroll du parcours jeu (voir doc/INSTRUCTIONS-IA.md §3.2.1) */
html.admin-html,
body.admin-body {
  position: relative;
  inset: auto;
  width: 100%;
  min-height: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: auto;
}

#app {
  position: relative;
  height: calc(var(--vh, 1vh) * 100);
  width: 100%;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

/* ─── Fond : crème lumineux, halo doux, sans masse sombre */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 85% 55% at 50% -8%, rgba(255, 255, 255, 0.95), transparent 62%),
    radial-gradient(ellipse 45% 38% at 100% 88%, rgba(228, 0, 43, 0.04), transparent 52%),
    radial-gradient(ellipse 40% 35% at 0% 75%, rgba(196, 90, 26, 0.04), transparent 48%),
    linear-gradient(180deg, #FBF9F6 0%, #F7F4EF 48%, #F3EFE8 100%);
}

.bg-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.35;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Classes typographiques partagées */
.display {
  font-family: var(--font-display);
  font-weight: 900;
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.03em;
  color: var(--text);
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--seam);
}

/* ─── Coque d'écran (shell applicatif : une vue = un viewport, pas de scroll document) */
.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  gap: 0;
  align-items: stretch;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.screen { animation: screenIn 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

:focus-visible {
  outline: 2px solid var(--seam);
  outline-offset: 3px;
}

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

/* ─── Grain global : texture papier fine */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.018;
  background-color: #15110E;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22 -10'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

/* ─── Séparateur carte (partagé duel + panels) */
.card-sep {
  align-self: stretch;
  width: 100%;
  max-width: 40ch;
  height: 0;
  margin: 0;
  border: none;
  border-top: 1px solid currentColor;
  opacity: 0.28;
}
