/* ==========================================================================
   Adour Confort : design tokens
   Source de vérité unique. Aucune valeur de couleur, taille ou durée
   ne doit être écrite en dur ailleurs que dans ce fichier.
   Documentation : DESIGN.md et styleguide.html
   ========================================================================== */

@font-face {
  font-family: "Quicksand";
  src: url("../fonts/quicksand-latin-var.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/nunito-sans-latin-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* Fallbacks métriquement proches pour limiter le CLS au chargement des polices */
@font-face {
  font-family: "Quicksand Fallback";
  src: local("Arial Rounded MT Bold"), local("Arial");
  size-adjust: 96%;
  ascent-override: 100%;
}

@font-face {
  font-family: "Nunito Sans Fallback";
  src: local("Arial");
  size-adjust: 101%;
  ascent-override: 101%;
}

:root {
  /* ---- Couleurs : primitives de marque (brief) ---- */
  --navy: #183858;        /* texte, fonds sombres */
  --teal: #58B8A8;        /* primaire marque. Jamais de texte blanc dessus */
  --teal-dark: #309880;   /* teal sur clair : grands titres (>= 24px) et icônes uniquement (3.5:1) */
  --ink: #0E2233;         /* fond très sombre */
  --paper: #F3F6F8;       /* fond clair */
  --white: #FFFFFF;
  --amber: #FFB547;       /* accent rare : 5% de la surface max */
  --turquoise-vif: #1FE0BC; /* optionnel, désactivé par défaut (voir --accent-hover) */

  /* ---- Couleurs : dérivées pour l'accessibilité ---- */
  --teal-ink: #277A68;    /* texte teal de petite taille sur clair : 5.2:1 blanc, 4.8:1 paper */
  --teal-tint: #E6F4F1;   /* surface teintée claire */
  --slate: #4A5F72;       /* texte secondaire sur clair : 6.6:1 blanc, 6.1:1 paper */
  --mist: #C5D3DF;        /* texte secondaire sur sombre : 7.9:1 navy, 10.6:1 ink */
  --line: #D7E0E7;        /* séparateurs décoratifs */
  --line-strong: #7A8FA1; /* bordures de champs : 3.35:1 (contraste non textuel) */
  --error: #B42318;       /* 6.6:1 blanc */

  /* ---- Couleurs : rôles sémantiques (contexte clair par défaut) ---- */
  --bg: var(--paper);
  --surface: var(--white);
  --surface-tint: var(--teal-tint);
  --text: var(--navy);
  --text-muted: var(--slate);
  --text-accent: var(--teal-ink);
  --heading: var(--navy);
  --accent: var(--teal);
  --on-accent: var(--navy);
  --accent-hover: #4AA898; /* passer à var(--turquoise-vif) si l'accent vif est validé */
  --focus: var(--teal-ink);
  --deco: var(--teal);     /* couleur des motifs (sourire, topo) */

  /* ---- Typographie ---- */
  --font-display: "Quicksand", "Quicksand Fallback", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito Sans", "Nunito Sans Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Échelle fluide 360px -> 1280px */
  --fs-xs: 0.8125rem;                                   /* 13px : mentions légales */
  --fs-sm: 0.9375rem;                                   /* 15px */
  --fs-base: 1rem;                                      /* 16px, corps de texte */
  --fs-lead: 1rem;                                      /* 16px, chapôs de section */
  --fs-hero: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);  /* 17 -> 19, sous-titre du hero */
  --fs-h4: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);  /* 19 -> 22 */
  --fs-h3: clamp(1.375rem, 1.2rem + 0.8vw, 1.875rem);   /* 22 -> 30 */
  --fs-h2: clamp(1.875rem, 1.4rem + 2.1vw, 3rem);       /* 30 -> 48 */
  --fs-h1: clamp(2.375rem, 1.6rem + 3.5vw, 4.25rem);    /* 38 -> 68 */
  --fs-figure: clamp(2.25rem, 1.6rem + 2.9vw, 3.75rem); /* chiffres clés */

  --lh-tight: 1.1;
  --lh-snug: 1.25;
  --lh-body: 1.6;
  --tracking-eyebrow: 0.14em;
  --tracking-title: -0.01em;
  --measure: 62ch;

  /* ---- Espacement (base 4px) ---- */
  --space-1: 0.25rem;  /* 4 */
  --space-2: 0.5rem;   /* 8 */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.5rem;   /* 24 */
  --space-6: 2rem;     /* 32 */
  --space-7: 3rem;     /* 48 */
  --space-8: 4rem;     /* 64 */
  --space-9: 6rem;     /* 96 */
  --space-10: 8rem;    /* 128 */

  --gutter: max(1rem, 4vw);                          /* 16px mini (brief) */
  --section-y: clamp(4rem, 2.8rem + 6vw, 8rem);      /* 64 -> 128 */
  --container: 76rem;                                /* 1216px */
  --container-narrow: 48rem;

  /* ---- Formes : règle documentée ----
     Interactif (boutons, pilules, chips) = pilule.
     Cartes, panneaux, images = 20px. Champs = 14px. */
  --radius-pill: 999px;
  --radius-card: 20px;
  --radius-field: 14px;
  --radius-sm: 8px;

  /* ---- Élévation : ombres teintées navy, jamais noires ---- */
  --shadow-sm: 0 1px 2px rgb(24 56 88 / 0.06), 0 2px 8px rgb(24 56 88 / 0.05);
  --shadow-md: 0 2px 4px rgb(24 56 88 / 0.05), 0 12px 32px rgb(24 56 88 / 0.09);
  --shadow-lg: 0 4px 8px rgb(24 56 88 / 0.06), 0 24px 60px rgb(24 56 88 / 0.14);

  /* ---- Mouvement : 150 à 250ms (brief) ---- */
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 250ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ---- Motifs ---- */
  --deco-opacity: 0.14;     /* filigrane derrière du texte : <= 0.18 (brief) */
  --deco-opacity-dark: 0.12;

  /* ---- Couches (z-index) ---- */
  --z-base: 0;
  --z-deco: 0;
  --z-content: 1;
  --z-header: 50;
  --z-skip: 100;
}

/* Contexte sombre : appliquer .theme-dark à une section navy/ink.
   Les composants lisent les rôles, ils s'adaptent sans variante. */
.theme-dark {
  --bg: var(--navy);
  --surface: rgb(255 255 255 / 0.06);
  --surface-tint: rgb(88 184 168 / 0.12);
  --text: var(--white);
  --text-muted: var(--mist);
  --text-accent: var(--teal);
  --heading: var(--white);
  --on-accent: var(--ink);
  --focus: var(--teal);
  --deco: var(--white);
  --line: rgb(255 255 255 / 0.14);
  --line-strong: rgb(255 255 255 / 0.5);
}

.theme-ink {
  --bg: var(--ink);
}

/* Fond teal : texte navy uniquement, logo mono navy */
.theme-teal {
  --bg: var(--teal);
  --text: var(--navy);
  --text-muted: var(--navy);
  --text-accent: var(--navy);
  --heading: var(--navy);
  --accent: var(--navy);
  --on-accent: var(--white);
  --accent-hover: var(--ink);
  --focus: var(--navy);
  --deco: var(--white);
}
