/* ============================================================
   BASE.CSS — Variables, reset, typographie
   ------------------------------------------------------------
   Ce fichier définit :
   - Les variables CSS (couleurs, espacements, rayons, ombres)
   - Le reset de base (marges, box-sizing, etc.)
   - Le style de base du body
   - Le mode sombre (via la classe .dark sur <body>)
   - Les classes utilitaires très générales

   Il doit être chargé EN PREMIER dans chaque page HTML.
   ============================================================ */

/* ------------------------------------------------------------
   1. VARIABLES — MODE CLAIR (par défaut)
   ------------------------------------------------------------ */
:root {
  /* Couleurs de fond */
  --bg: #ffffff;
  --bg-soft: #faf8f3;
  --surface: #ffffff;
  --surface-2: #f5f1e8;

  /* Couleurs de texte */
  --text: #0f172a;
  --text-soft: #52525b;
  --text-faint: #a1a1aa;

  /* Couleurs dorées (thème principal) */
  --gold: #c9a227;
  --gold-dark: #a07f1a;
  --gold-soft: #f5ecd1;
  --gold-glow: rgba(201, 162, 39, .25);

  /* Couleurs d'accent */
  --accent: #d97706;
  --accent-soft: #fef3c7;

  /* Couleurs de danger (erreurs) */
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-dark: #b91c1c;

  /* Couleurs d'information */
  --info: #0891b2;
  --info-soft: #cffafe;

  /* Bordures */
  --border: #ebe4d3;
  --border-strong: #d9cfb3;

  /* Dimensions globales */
  --nav-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --max-width: 680px;
  --padding-x: 1.25rem;

  /* Rayons de bordure */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Ombres */
  --shadow-sm: 0 1px 3px rgba(120, 90, 20, .06), 0 1px 2px rgba(120, 90, 20, .04);
  --shadow: 0 4px 16px rgba(120, 90, 20, .08), 0 2px 6px rgba(120, 90, 20, .04);
  --shadow-lg: 0 20px 40px rgba(120, 90, 20, .12), 0 8px 16px rgba(120, 90, 20, .06);
  --shadow-gold: 0 8px 24px rgba(201, 162, 39, .35);
}

/* ------------------------------------------------------------
   2. VARIABLES — MODE SOMBRE
   ------------------------------------------------------------
   Activé en ajoutant la classe "dark" sur <body>.
   Chaque variable est redéfinie pour s'adapter au fond sombre.
   ------------------------------------------------------------ */
body.dark {
  --bg: #0a0908;
  --bg-soft: #141210;
  --surface: #1a1815;
  --surface-2: #24211c;

  --text: #f5f0e6;
  --text-soft: #a8a194;
  --text-faint: #6b665c;

  --gold: #e0b84a;
  --gold-dark: #c9a227;
  --gold-soft: #2e2718;
  --gold-glow: rgba(224, 184, 74, .35);

  --accent: #fbbf24;
  --accent-soft: #422006;

  --danger: #f87171;
  --danger-soft: #450a0a;
  --danger-dark: #dc2626;

  --info: #67e8f9;
  --info-soft: #164e63;

  --border: #2a2620;
  --border-strong: #3a352c;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow: 0 4px 16px rgba(0, 0, 0, .5);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, .6);
  --shadow-gold: 0 8px 24px rgba(224, 184, 74, .4);
}

/* ------------------------------------------------------------
   3. RESET
   ------------------------------------------------------------
   Annule les marges/paddings par défaut des navigateurs
   et adopte un box-sizing plus intuitif.
   ------------------------------------------------------------ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

/* ------------------------------------------------------------
   4. BODY & TYPOGRAPHIE
   ------------------------------------------------------------ */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background .35s, color .35s;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Les champs de saisie restent sélectionnables */
input, textarea {
  user-select: text;
  -webkit-user-select: text;
  font-family: inherit;
}

/* ------------------------------------------------------------
   5. FOCUS VISIBLE (accessibilité)
   ------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------------------------------------
   6. ICÔNES MATERIAL SYMBOLS
   ------------------------------------------------------------ */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
  font-size: 1.25em;
}

/* ------------------------------------------------------------
   7. CLASSES UTILITAIRES TRÈS GÉNÉRALES
   ------------------------------------------------------------ */

/* Masquer complètement un élément */
.cache { display: none !important; }

/* Centrer du texte */
.centre { text-align: center; }

/* Texte adouci */
.texte-soft { color: var(--text-soft); }

/* ------------------------------------------------------------
   8. SCROLLBAR PERSONNALISÉE (WebKit seulement)
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

/* ------------------------------------------------------------
   9. PRÉFÉRENCE "MOUVEMENT RÉDUIT"
   ------------------------------------------------------------
   Si l'utilisateur a activé "réduire les animations" dans
   son système, on désactive toutes les animations.
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ------------------------------------------------------------
   10. RESPONSIVE — Marges latérales sur grand écran
   ------------------------------------------------------------
   Sur mobile : padding normal.
   Sur tablette/PC : on élargit la largeur max et les marges.
   ------------------------------------------------------------ */
@media (min-width: 900px) {
  :root {
    --max-width: 780px;
    --padding-x: 1.75rem;
  }
}

@media (min-width: 1200px) {
  :root {
    --max-width: 860px;
    --padding-x: 2rem;
  }
}

@media (min-width: 1500px) {
  :root {
    --max-width: 920px;
    --padding-x: 2.25rem;
  }
}

@media (max-width: 480px) {
  :root {
    --padding-x: 1rem;
  }
}