/* ============================================================
   SONAVIE — Design system partagé (base.css)
   Monde visuel : institutionnel élevé, confiance d'abord.
   Voir DESIGN.md. Tokens d'abord ; aucun hex en dur dans les pages.
   ============================================================ */

:root {
  /* ---- Couleur ---- */
  --c-blue:        #0096C7;
  --c-blue-700:    #006D9A;
  --c-blue-900:    #004E70;
  --c-ink:         #00303F;   /* bleu nuit : hero, footer */
  --c-blue-50:     #E9F6FB;
  --c-blue-100:    #D2ECF6;

  --c-red:         #EF0026;   /* charte SONAVIE — TRUMATCH 6-a */
  --c-red-700:     #C2001F;

  /* La charte n'a pas d'or : accent secondaire = bleu de marque (tokens conservés) */
  --c-gold:        #0096C7;
  --c-gold-300:    #6FC8E6;   /* tint clair du bleu, lisible sur fond sombre */

  --c-text:        #383839;   /* charte — noir 92 % */
  --c-text-soft:   #5A5B5C;
  --c-text-faint:  #6A6B6D;   /* assez foncé pour AA sur fond clair */
  --c-border:      #DCDDE0;   /* charte — PANTONE Cool Gray 4 C */
  --c-border-soft: #E9EAEC;
  --c-surface:     #F2F3F4;
  --c-surface-2:   #E9EBEC;
  --c-white:       #FFFFFF;

  /* Alias sémantiques simulateurs — tout ramené à la palette bleu + rouge.
     « vie / gain / positif » = bleu ; « décès / risque » = rouge. */
  --bleu:          var(--c-blue-700);
  --rouge:         var(--c-red-700);
  --vert:          var(--c-blue-700);
  --gris-t:        var(--c-text-faint);
  --or:            var(--c-blue-700);

  /* Texte sur fond sombre (teinté, jamais gris pur) */
  --on-dark:       rgba(255,255,255,0.92);
  --on-dark-soft:  rgba(233,246,251,0.70);
  --on-dark-faint: rgba(233,246,251,0.48);
  --on-dark-line:  rgba(255,255,255,0.14);

  /* ---- Typographie — charte SONAVIE : police humaniste unique (≈ Myriad Pro) ---- */
  --f-sans:  'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Myriad, sans-serif;
  --f-serif: var(--f-sans);  /* plus de serif : titres et texte dans la même famille */

  --fs-display: clamp(2.3rem, 1.4rem + 3.6vw, 3.6rem);
  --fs-h1:      clamp(2rem, 1.3rem + 2.6vw, 3rem);
  --fs-h2:      clamp(1.7rem, 1.25rem + 1.8vw, 2.4rem);
  --fs-h3:      clamp(1.2rem, 1.05rem + 0.6vw, 1.4rem);
  --fs-lead:    clamp(1.05rem, 1rem + 0.3vw, 1.18rem);
  --fs-body:    1rem;
  --fs-sm:      0.875rem;
  --fs-xs:      0.78rem;

  /* ---- Espace & forme ---- */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   20px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(0,48,63,0.06), 0 1px 1px rgba(0,48,63,0.04);
  --sh-2: 0 6px 20px -6px rgba(0,48,63,0.12), 0 2px 6px -2px rgba(0,48,63,0.08);
  --sh-3: 0 20px 48px -16px rgba(0,48,63,0.22), 0 6px 16px -8px rgba(0,48,63,0.12);

  --container: 1200px;
  --gutter: clamp(20px, 5vw, 40px);
  --section-y: clamp(72px, 9vw, 116px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);   /* ease-out exponentiel */
  --t-fast: 160ms var(--ease);
  --t-med:  280ms var(--ease);

  --header-h: 76px;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  font-family: var(--f-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; }
:where(h1,h2,h3,h4) { font-family: var(--f-serif); font-weight: 700; line-height: 1.16; letter-spacing: -0.011em; color: var(--c-blue-900); }
strong { font-weight: 700; }
::selection { background: var(--c-blue); color: #fff; }

/* Surfaces navigateur */
:focus-visible { outline: 2.5px solid var(--c-blue); outline-offset: 2px; border-radius: 3px; }
* { scrollbar-color: var(--c-blue-100) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-blue-100); border-radius: 999px; border: 3px solid var(--c-white); }
::-webkit-scrollbar-thumb:hover { background: #B8DCEA; }

/* Barre de progression de lecture (détail moderne, discret) */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1200;
  transform: scaleX(var(--p, 0)); transform-origin: left; pointer-events: none;
  background: linear-gradient(90deg, var(--c-blue), var(--c-gold));
  will-change: transform;
}

/* Lien d'évitement (a11y) */
.skip-link {
  position: fixed; top: -100%; left: 16px; z-index: 2000;
  background: var(--c-blue-900); color: #fff;
  padding: 12px 18px; border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: 700; font-size: var(--fs-sm);
  transition: top var(--t-fast);
}
.skip-link:focus { top: 0; }

/* ============================================================
   Layout utilitaires
   ============================================================ */
.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--section-y); }

/* En-tête de section : le titre porte le sens (pas d'eyebrow décoratif) */
.s-head { max-width: 62ch; }
.s-head--center { margin-inline: auto; text-align: center; }
.s-title { font-size: var(--fs-h2); font-weight: 800; letter-spacing: -0.012em; }
.s-title .accent { color: var(--c-blue); }
.s-lead { margin-top: 18px; font-size: var(--fs-lead); color: var(--c-text-soft); line-height: 1.7; }
.s-rule { width: 54px; height: 3px; border-radius: 2px; background: var(--c-gold); margin-top: 22px; }
.s-head--center .s-rule { margin-inline: auto; }

/* Étiquette fonctionnelle (catégorie réelle, pas un eyebrow) */
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--c-text-soft);
}
.tag::before { content: ""; width: 14px; height: 2px; border-radius: 2px; background: var(--c-red); }

/* ============================================================
   Boutons
   ============================================================ */
.btn {
  --_bg: var(--c-red); --_fg: #fff; --_bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--f-sans); font-weight: 700; font-size: 0.95rem; line-height: 1;
  padding: 14px 24px; border-radius: var(--r-sm);
  background: var(--_bg); color: var(--_fg); border: 1.5px solid var(--_bd);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast),
              transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn svg { transition: transform var(--t-fast); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary:hover { background: var(--c-red-700); box-shadow: 0 10px 24px -8px rgba(232,0,30,0.55); }
.btn--primary:hover svg { transform: translateX(3px); }

.btn--secondary { --_bg: transparent; --_fg: var(--c-blue-900); --_bd: var(--c-border); }
.btn--secondary:hover { --_bg: var(--c-blue-50); --_bd: var(--c-blue); color: var(--c-blue-900); box-shadow: var(--sh-2); }

/* Sur fond sombre */
.btn--ghost-light { --_bg: transparent; --_fg: var(--on-dark); --_bd: var(--on-dark-line); }
.btn--ghost-light:hover { --_bg: rgba(255,255,255,0.10); --_bd: rgba(255,255,255,0.5); color: #fff; }

.btn--sm { padding: 10px 18px; font-size: var(--fs-sm); }

/* ============================================================
   En-tête / Navigation
   ============================================================ */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  background: rgba(255,255,255,0.86);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med), box-shadow var(--t-med), background var(--t-med);
}
.site-header.is-scrolled { border-bottom-color: var(--c-border); box-shadow: var(--sh-1); background: rgba(255,255,255,0.94); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: var(--header-h); }

.brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.brand img, .brand svg { height: 50px; width: auto; display: block; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  position: relative; font-size: 0.9rem; font-weight: 600; color: var(--c-text);
  padding: 9px 13px; border-radius: var(--r-sm); transition: color var(--t-fast), background var(--t-fast);
}
.nav a::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 5px; height: 2px;
  background: var(--c-red); border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-fast);
}
.nav a:hover { color: var(--c-blue-900); background: var(--c-blue-50); }
.nav a[aria-current="true"] { color: var(--c-blue-900); }
.nav a[aria-current="true"]::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 12px; }
.header-divider { width: 1px; height: 22px; background: var(--c-border); }

.nav-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: var(--r-sm); }
.nav-toggle:hover { background: var(--c-blue-50); }
.nav-toggle svg { stroke: var(--c-blue-900); }

/* Menu mobile */
.mobile-nav {
  position: fixed; inset: 0; z-index: 1100; background: var(--c-white);
  display: flex; flex-direction: column; padding: 24px var(--gutter) 40px;
  transform: translateX(100%); transition: transform var(--t-med); visibility: hidden;
}
.mobile-nav.is-open { transform: translateX(0); visibility: visible; }
.mobile-nav__top { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); margin-bottom: 12px; }
.mobile-nav__close { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); }
.mobile-nav__close:hover { background: var(--c-surface); }
.mobile-nav a.m-link {
  font-size: 1.15rem; font-weight: 600; color: var(--c-blue-900);
  padding: 16px 4px; border-bottom: 1px solid var(--c-border-soft);
}
.mobile-nav .btn { margin-top: 24px; }
body.no-scroll { overflow: hidden; }

/* ============================================================
   Pied de page
   ============================================================ */
.site-footer { background: var(--c-ink); color: var(--on-dark-soft); padding-top: clamp(56px, 7vw, 80px); border-top: 1px solid rgba(255,255,255,0.10); }
.footer-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1.1fr; gap: clamp(32px, 5vw, 56px); padding-bottom: 48px; border-bottom: 1px solid var(--on-dark-line); }
.footer-brand img, .footer-brand svg { height: 64px; width: auto; }
.mobile-nav__top .brand img, .mobile-nav__top .brand svg { height: 40px; }
.footer-desc { margin: 20px 0 22px; max-width: 32ch; font-size: var(--fs-sm); line-height: 1.7; color: var(--on-dark-faint); }
.footer-socials { display: flex; gap: 10px; }
.social-btn {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: rgba(255,255,255,0.06); border: 1px solid var(--on-dark-line);
  color: var(--on-dark-soft); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.social-btn:hover { background: var(--c-red); border-color: var(--c-red); color: #fff; transform: translateY(-2px); }
.social-btn svg { width: 18px; height: 18px; }

.footer-col h4 { font-family: var(--f-sans); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-dark-faint); margin-bottom: 18px; }
.footer-col ul { display: flex; flex-direction: column; gap: 12px; }
.footer-col a { font-size: var(--fs-sm); color: var(--on-dark-soft); transition: color var(--t-fast), padding-left var(--t-fast); }
.footer-col a:hover { color: #fff; padding-left: 5px; }
.footer-col address { font-style: normal; font-size: var(--fs-sm); line-height: 1.7; color: var(--on-dark-soft); }

.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 24px; }
.footer-copy { font-size: var(--fs-xs); color: var(--on-dark-faint); }
.footer-legal { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-legal a { font-size: var(--fs-xs); color: var(--on-dark-faint); transition: color var(--t-fast); }
.footer-legal a:hover { color: var(--on-dark); }

/* Liseré signature 3 bandes */
.brand-stripe { height: 6px; background: linear-gradient(110deg, var(--c-blue) 0 33%, var(--c-red) 33% 100%); }

/* ============================================================
   FAB WhatsApp
   ============================================================ */
.wa-fab {
  position: fixed; right: clamp(16px, 3vw, 28px); bottom: clamp(16px, 3vw, 28px); z-index: 900;
  width: 56px; height: 56px; border-radius: 50%; background: #25D366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px -4px rgba(37,211,102,0.5); transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.wa-fab:hover { transform: scale(1.08) translateY(-2px); box-shadow: 0 12px 30px -4px rgba(37,211,102,0.6); }
.wa-fab svg { width: 30px; height: 30px; }

/* ============================================================
   Révélation au scroll (un moment d'entrée par section)
   ============================================================ */
.reveal { opacity: 0; transform: translateY(24px); filter: blur(8px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), filter 0.8s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; filter: none; }
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.reveal.d4 { transition-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Responsive — header
   ============================================================ */
@media (max-width: 1040px) {
  .nav, .header-divider { display: none; }
  .nav-toggle { display: flex; }
  .header-actions .btn--devis-desktop { display: none; }
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
