/* ==========================================================================
   ÉCRIN — Design System « Boudoir »
   Direction : premium, discret, sensuel mais sobre.
   Palette : noir profond · bordeaux · rose poudré · doré · blanc cassé.
   Typo : Cormorant Garamond (display, sensuel) + Jost (texte, géométrique).
   Accessibilité (ui-ux-pro-max) : contrastes AA, focus visibles, 44px,
   prefers-reduced-motion respecté.
   ========================================================================== */

/* ---- Design tokens (single source of truth) ---------------------------- */
:root {
  /* Couleurs primitives */
  --c-noir:        #0B0B0D;
  --c-noir-800:    #141216;
  --c-noir-700:    #1E1B20;
  --c-bordeaux:    #6E1423;
  --c-bordeaux-600:#7B1E3B;
  --c-bordeaux-400:#9A3450;
  --c-rose:        #E6C3C3;
  --c-rose-300:    #D9A5A5;
  --c-rose-100:    #F3E3E3;
  --c-or:          #C9A96A;
  --c-or-600:      #B08D4C;
  --c-creme:       #F6F1E9;
  --c-creme-100:   #FBF8F3;
  --c-blanc:       #FFFFFF;

  /* Sémantique — thème SOMBRE (défaut, ambiance boudoir) — charbon chaud, moins « pitch black » */
  --bg:            #151318;
  --bg-elev:       #201C24;
  --bg-elev-2:     #29242E;
  --surface:       #1C1920;
  --text:          #F1E9E4;
  --text-muted:    #B9AEB0;
  --text-subtle:   #8A7F84;
  --primary:       var(--c-bordeaux-400);
  --primary-strong:var(--c-bordeaux);
  --accent:        var(--c-or);
  --accent-strong: var(--c-or-600);
  --border:        rgba(201,169,106,0.18);
  --border-strong: rgba(201,169,106,0.35);
  --success:       #4FA079;
  --warning:       #C9922F;
  --danger:        #C7455B;
  --info:          #6E86C9;
  --scrim:         rgba(9,8,10,0.72);

  /* Typographie */
  --font-display: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --font-text:    "Jost", "Manrope", -apple-system, "Segoe UI", sans-serif;
  --fs-xs: 0.75rem; --fs-sm: 0.875rem; --fs-base: 1rem; --fs-md: 1.125rem;
  --fs-lg: 1.375rem; --fs-xl: 1.875rem; --fs-2xl: 2.5rem; --fs-3xl: 3.5rem;
  --lh-tight: 1.15; --lh-base: 1.6;

  /* Espacements (rythme 4/8) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

  /* Rayons / ombres */
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --r-xl: 22px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
  --shadow-glow: 0 0 0 1px var(--border-strong), 0 12px 40px rgba(110,20,35,0.25);

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 160ms var(--ease);
  --t: 240ms var(--ease);

  /* Layout */
  --container: 1240px;
  --z-header: 100; --z-drawer: 200; --z-modal: 300; --z-toast: 400; --z-agegate: 500;
}

/* Thème CLAIR (piloté par [data-theme="light"] — pages compte, checkout) */
[data-theme="light"] {
  --bg:            var(--c-creme);
  --bg-elev:       var(--c-creme-100);
  --bg-elev-2:     var(--c-blanc);
  --surface:       var(--c-blanc);
  --text:          #23181C;
  --text-muted:    #5C4E52;
  --text-subtle:   #8A7B80;
  --primary:       var(--c-bordeaux);
  --primary-strong:var(--c-bordeaux-600);
  --accent:        var(--c-or-600);
  --border:        rgba(110,20,35,0.14);
  --border-strong: rgba(110,20,35,0.28);
  --scrim:         rgba(35,24,28,0.5);
  --shadow-md: 0 8px 24px rgba(110,20,35,0.10);
  --shadow-lg: 0 24px 60px rgba(110,20,35,0.14);
}

/* ---- Reset & base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-weight: 340;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Ambiance : halo bordeaux + doré discret */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(110,20,35,0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201,169,106,0.10), transparent 55%);
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: 0.005em; }
h1 { font-size: clamp(2.25rem, 5vw, var(--fs-3xl)); }
h2 { font-size: clamp(1.75rem, 3.5vw, var(--fs-2xl)); }
h3 { font-size: var(--fs-xl); }
p { max-width: 68ch; }
::selection { background: var(--primary); color: #fff; }

/* Focus visible (accessibilité) */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* ---- Utilitaires de mise en page -------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-5); }
.section { padding-block: clamp(var(--sp-7), 8vw, var(--sp-9)); }
.stack > * + * { margin-top: var(--sp-4); }
.eyebrow {
  font-family: var(--font-text); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent);
}
.lead { font-size: var(--fs-md); color: var(--text-muted); }
.grid { display: grid; gap: var(--sp-5); }
.muted { color: var(--text-muted); }

/* ---- Boutons ----------------------------------------------------------- */
.btn {
  --btn-bg: var(--primary); --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-6);
  font-family: var(--font-text); font-size: var(--fs-sm); font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid transparent; border-radius: var(--r-pill);
  cursor: pointer; transition: transform var(--t-fast), box-shadow var(--t), background var(--t), filter var(--t);
  touch-action: manipulation; user-select: none;
}
.btn:hover { filter: brightness(1.06); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn[disabled], .btn.is-loading { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn--gold { --btn-bg: linear-gradient(135deg, var(--c-or), var(--c-or-600)); --btn-fg: #241a08; }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: rgba(201,169,106,0.08); }
.btn--block { width: 100%; }
.btn--sm { min-height: 40px; padding-inline: var(--sp-4); font-size: var(--fs-xs); }
.btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn.is-loading .btn-label { visibility: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Formulaires ------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.field .req { color: var(--primary); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: var(--sp-3) var(--sp-4);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font: inherit; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.textarea { min-height: 120px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,169,106,0.18); outline: none; }
.field .help { font-size: var(--fs-xs); color: var(--text-subtle); }
.field .error { font-size: var(--fs-xs); color: var(--danger); }
.field.has-error .input, .field.has-error .select { border-color: var(--danger); }
.checkbox { display: flex; align-items: flex-start; gap: var(--sp-3); cursor: pointer; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--primary); margin-top: 2px; }

/* ---- Cartes ------------------------------------------------------------ */
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: clip; transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

/* ---- Badges / pills ---------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  border-radius: var(--r-pill); background: rgba(201,169,106,0.14); color: var(--accent);
  border: 1px solid var(--border-strong);
}
.badge--new { background: rgba(79,160,121,0.16); color: var(--success); border-color: rgba(79,160,121,0.4); }
.badge--promo { background: rgba(199,69,91,0.16); color: var(--danger); border-color: rgba(199,69,91,0.4); }
.badge--best { background: rgba(201,169,106,0.18); color: var(--accent); }

/* ---- Toasts ------------------------------------------------------------ */
.toast-region { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: var(--z-toast); display: grid; gap: var(--sp-3); }
.toast {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 260px; max-width: 360px;
  padding: var(--sp-4); background: var(--bg-elev-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); animation: toast-in var(--t);
}
.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Animations d'apparition ------------------------------------------ */
[data-reveal] { opacity: 0; transform: translateY(18px); }
[data-reveal].is-visible { opacity: 1; transform: none; transition: opacity 600ms var(--ease), transform 600ms var(--ease); }

/* ---- Séparateur filet doré -------------------------------------------- */
.rule-gold { height: 1px; border: 0; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }

/* ---- Skip link (a11y) -------------------------------------------------- */
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #241a08; padding: var(--sp-3) var(--sp-4); z-index: var(--z-agegate); border-radius: 0 0 var(--r-md) 0; }
.skip-link:focus { left: 0; }
