/* ============================================================
   WHEREAT — Design System
   Direction artistique : Éditorial sombre raffiné
   - Noir d'encre, un seul accent terreux, typo serif/sans
   - Zéro dégradé, zéro ombre colorée, zéro glassmorphism
   - Surfaces plates différenciées par la valeur + filets fins
   ============================================================ */

/* ---- Fonts : Fraunces (titrage éditorial) + Inter (texte) ---- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;0,9..144,900;1,9..144,400;1,9..144,500&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ---- Couleurs : encre ---- */
  --ink-900: #0b0b0c;   /* fond global, noir chaud neutre */
  --ink-850: #1c1b1a;   /* fond Fond clair? non — voir light vars plus bas */
  --surface-1: #131312; /* carte / surface élevée niveau 1 */
  --surface-2: #1a1a18; /* surface niveau 2 (champs, états hover) */
  --surface-3: #232320; /* surface niveau 3 (chips, pressé) */

  /* ---- Texte ---- */
  --text:        #ece8e1;  /* texte principal, blanc chaud (pas de bleu) */
  --text-strong: #fbf9f5;  /* titres */
  --text-muted:  #a39d92;  /* texte secondaire, gris chaud */
  --text-faint:  #6c675e;  /* labels, méta, désactivé */

  /* ---- Accent unique : rouge brique mat ---- */
  --accent:        #c4422f;
  --accent-hover:  #d24c38;
  --accent-press:  #a8351f;
  --accent-soft:   rgba(196,66,47,0.10);  /* fond très discret */
  --accent-line:   rgba(196,66,47,0.34);  /* bordure discrète */
  --accent-ink:    #e8a99c;               /* texte accent sur fond sombre */

  /* ---- Sémantique (sobres, désaturés) ---- */
  --positive:      #7faf7a;  /* vert sauge, mat */
  --positive-soft: rgba(127,175,122,0.10);
  --positive-line: rgba(127,175,122,0.30);
  --warning:       #c9a24a;  /* ambre mat */
  --warning-soft:  rgba(201,162,74,0.10);
  --warning-line:  rgba(201,162,74,0.30);
  --danger:        #c66;     /* rouge terne, distinct de l'accent */
  --danger-soft:   rgba(204,102,102,0.10);
  --danger-line:   rgba(204,102,102,0.30);

  /* ---- Filets / bordures (jamais d'ombre colorée) ---- */
  --hairline:    rgba(255,255,255,0.07);  /* filet standard */
  --hairline-2:  rgba(255,255,255,0.12);  /* filet appuyé / hover */
  --hairline-3:  rgba(255,255,255,0.18);  /* filet fort */

  /* ---- Ombres : neutres, douces, jamais teintées ---- */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 8px 28px rgba(0,0,0,0.45);
  --shadow-3: 0 24px 64px rgba(0,0,0,0.55);

  /* ---- Typo ---- */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;

  /* ---- Rayons : sobres, pas de pilules partout ---- */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* ---- Rythme / mesure ---- */
  --measure: 720px;       /* largeur de lecture confortable */
  --measure-wide: 1080px;
  --gutter: 20px;
  --nav-h: 60px;

  /* ---- Transitions ---- */
  --t-fast: 120ms cubic-bezier(.2,.6,.2,1);
  --t-med:  200ms cubic-bezier(.2,.6,.2,1);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================================
   Alias de compatibilité (ancien styles.css)
   Permet aux pages non encore migrées de profiter de la nouvelle
   DA sans réécrire chaque variable. À retirer une fois tout migré.
   ============================================================ */
:root {
  --bg: var(--ink-900);
  --card: var(--surface-1);
  --surface: var(--surface-1);
  --surface2: var(--surface-2);
  --text-on-dark: var(--text);
  --card-text: var(--text);
  --muted: var(--text-muted);
  --muted2: var(--text-faint);
  --border: var(--hairline);
  --border2: var(--hairline-2);
  --accent-600: var(--accent-hover);
  --accent-100: var(--accent-soft);
  --accent-light: var(--accent-soft);
  --accent-border: var(--accent-line);
  --accent-warm: var(--warning);
  --green: var(--positive);
  --green-bg: var(--positive-soft);
  --green-border: var(--positive-line);
  --gold: var(--warning);
  --gold-bg: var(--warning-soft);
  --gold-border: var(--warning-line);
  --success: var(--positive);
  --success-600: var(--positive);
  --info: var(--accent-ink);
  --radius: var(--r-md);
  --max-width: var(--measure-wide);
  --max: var(--measure-wide);
  --focus: var(--accent-soft);
  --display: var(--font-display);
  --nav-height: var(--nav-h);
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  font-family: var(--font-body);
  background: var(--ink-900);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  padding-top: var(--nav-h);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--accent); color: #fff; }

/* Scrollbar discrète */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 3px solid var(--ink-900); }

/* ============================================================
   Typographie éditoriale
   ============================================================ */

/* Titres en serif Fraunces — caractère, optical sizing, italique disponible */
.display, h1.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  color: var(--text-strong);
  letter-spacing: -0.015em;
  line-height: 1.08;
}

h1, h2, h3 { font-family: var(--font-display); color: var(--text-strong); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.9rem); font-weight: 600; }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.18rem; }

/* L'italique de Fraunces est superbe — réservé aux accents éditoriaux */
.editorial-em { font-family: var(--font-display); font-style: italic; font-weight: 500; }

/* Overline : petit label en capitales espacées, code print */
.overline {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.overline.accent { color: var(--accent-ink); }

/* Filet d'accent court — signature visuelle */
.rule-accent { width: 44px; height: 2px; background: var(--accent); border: none; }
.rule { width: 100%; height: 1px; background: var(--hairline); border: none; }

.lead { font-size: 1.08rem; color: var(--text-muted); line-height: 1.6; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }

/* ============================================================
   Layout
   ============================================================ */
.wa-container { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); width: 100%; }
.wa-container--wide { max-width: var(--measure-wide); }
.wa-section { padding: 56px 0; }
.stack > * + * { margin-top: var(--stack-gap, 16px); }

/* ============================================================
   Navbar
   ============================================================ */
.wa-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  background: var(--ink-900);
  border-bottom: 1px solid var(--hairline);
}
.wa-nav__inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.wa-brand { display: inline-flex; align-items: center; gap: 9px; }
.wa-brand img { height: 26px; width: auto; }
.wa-brand__word {
  font-family: var(--font-display);
  font-weight: 600; font-size: 1.18rem; letter-spacing: -0.01em;
  color: var(--text-strong);
}
.wa-nav__links { display: flex; align-items: center; gap: 4px; list-style: none; }

/* ============================================================
   Boutons — plats, bordures nettes, pas d'ombre colorée
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body);
  font-weight: 600; font-size: 0.92rem;
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  white-space: nowrap; line-height: 1; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn i { font-size: 1.05em; }
.btn:active { transform: translateY(1px); }

/* Primaire : accent plein, pas d'ombre teintée */
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:active { background: var(--accent-press); }

/* Secondaire : contour fin sur fond sombre */
.btn--ghost { background: transparent; color: var(--text); border-color: var(--hairline-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--hairline-3); }

/* Tertiaire : texte seul */
.btn--quiet { background: transparent; color: var(--text-muted); padding-left: 10px; padding-right: 10px; }
.btn--quiet:hover { color: var(--text-strong); background: var(--surface-2); }

/* Outline accent : pour CTA secondaires liés à l'accent */
.btn--outline { background: transparent; color: var(--accent-ink); border-color: var(--accent-line); }
.btn--outline:hover { background: var(--accent-soft); border-color: var(--accent); }

.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--danger-solid { background: #b23a3a; color: #fff; }
.btn--danger-solid:hover { background: #c44; }

.btn--sm { padding: 8px 13px; font-size: 0.84rem; border-radius: var(--r-sm); }
.btn--lg { padding: 14px 24px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ============================================================
   Cartes — surface plate, filet fin, hover par la bordure
   ============================================================ */
.card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  transition: border-color var(--t-med), background var(--t-med);
}
.card--hover:hover { border-color: var(--hairline-2); }
.card__body { padding: 20px; }
.card__media { position: relative; overflow: hidden; background: var(--surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   Badges / chips — plats, filet fin
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-body);
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--r-xs);
  border: 1px solid var(--hairline-2);
  color: var(--text-muted);
  background: var(--surface-2);
}
.badge i { font-size: 1em; }
.badge--accent   { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.badge--positive { color: var(--positive);  border-color: var(--positive-line); background: var(--positive-soft); }
.badge--warning  { color: var(--warning);   border-color: var(--warning-line);  background: var(--warning-soft); }
.badge--danger   { color: var(--danger);    border-color: var(--danger-line);   background: var(--danger-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.82rem; font-weight: 500;
  padding: 7px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline-2); background: transparent; color: var(--text-muted);
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.chip:hover { border-color: var(--hairline-3); color: var(--text); }
.chip--active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }

/* ============================================================
   Formulaires
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint);
}
.field__label .req { color: var(--accent-ink); }
.input, .textarea, .select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  color: var(--text-strong);
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 0.94rem;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); background: var(--surface-1);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field__hint { font-size: 0.76rem; color: var(--text-faint); }
.field__count { font-size: 0.74rem; color: var(--text-faint); font-weight: 600; text-align: right; }

/* ============================================================
   Alertes
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px; border-radius: var(--r-md);
  font-size: 0.88rem; font-weight: 500; line-height: 1.5;
  border: 1px solid var(--hairline-2); background: var(--surface-1); color: var(--text);
}
.alert i { font-size: 1.15em; flex-shrink: 0; margin-top: 1px; }
.alert--success { background: var(--positive-soft); border-color: var(--positive-line); color: var(--positive); }
.alert--error   { background: var(--danger-soft);   border-color: var(--danger-line);   color: var(--danger); }
.alert--info    { background: var(--accent-soft);    border-color: var(--accent-line);   color: var(--accent-ink); }

/* ============================================================
   Modale — fond assombri net (léger flou autorisé, jamais coloré)
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 5000;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(5,5,6,0.72);
}
.modal.is-open { display: flex; }
.modal__box {
  background: var(--surface-1);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  width: 100%; max-width: 460px;
  box-shadow: var(--shadow-3);
  animation: modal-in 0.22s cubic-bezier(.2,.7,0,1) both;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 22px 0; }
.modal__title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; color: var(--text-strong); }
.modal__body { padding: 16px 22px; }
.modal__foot { padding: 0 22px 22px; display: flex; justify-content: flex-end; gap: 10px; }
.modal__close {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: 1px solid var(--hairline-2);
  color: var(--text-muted); transition: background var(--t-fast), color var(--t-fast);
}
.modal__close:hover { background: var(--surface-2); color: var(--text-strong); }

/* ============================================================
   États vides
   ============================================================ */
.empty {
  text-align: center; padding: 72px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.empty__icon {
  width: 64px; height: 64px; border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: var(--text-faint);
  border: 1px solid var(--hairline); background: var(--surface-1);
}
.empty h2 { font-size: 1.4rem; }
.empty p { color: var(--text-muted); max-width: 320px; font-size: 0.92rem; }

/* ============================================================
   Footer
   ============================================================ */
.wa-footer { border-top: 1px solid var(--hairline); margin-top: 80px; padding: 48px 0 calc(40px + var(--safe-bottom)); }
.wa-footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.wa-footer__brand-word { font-family: var(--font-display); font-size: 1.3rem; color: var(--text-strong); }
.wa-footer__tag { color: var(--text-faint); font-size: 0.86rem; max-width: 220px; margin-top: 8px; }
.wa-footer h4 { font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 14px; }
.wa-footer a { display: block; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 9px; transition: color var(--t-fast); }
.wa-footer a:hover { color: var(--text-strong); }
.wa-footer__bottom { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--hairline); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--text-faint); font-size: 0.8rem; }
@media (max-width: 760px) { .wa-footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
@media (max-width: 460px) { .wa-footer__grid { grid-template-columns: 1fr; } }

/* ============================================================
   Toasts (alignés DA)
   ============================================================ */
.wa-toast {
  pointer-events: auto;
  display: flex; gap: 11px; align-items: center;
  padding: 12px 14px; border-radius: var(--r-md);
  min-width: 240px; max-width: 380px;
  background: var(--surface-1); border: 1px solid var(--hairline-2);
  color: var(--text); box-shadow: var(--shadow-2);
  transform: translateY(-8px); opacity: 0;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.wa-toast.show { transform: none; opacity: 1; }
.wa-toast__rail { width: 3px; align-self: stretch; border-radius: 99px; background: var(--text-faint); flex-shrink: 0; }
.wa-toast--success .wa-toast__rail { background: var(--positive); }
.wa-toast--error   .wa-toast__rail { background: var(--danger); }
.wa-toast--info    .wa-toast__rail { background: var(--accent); }
.wa-toast__msg { flex: 1; font-size: 0.9rem; font-weight: 500; }
.wa-toast__close { color: var(--text-faint); flex-shrink: 0; }
.wa-toast__close:hover { color: var(--text); }

/* ============================================================
   Utilitaires
   ============================================================ */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
