/* =============================================================
   Kavalkan — Feuille de style unique
   Vanilla CSS, 0 dépendance. Tokens en :root (point de vérité).
   Organisation : Tokens · Reset · Base · Layout · Composants · Pages · Responsive · A11y
   ============================================================= */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Couleurs */
  --c-bg:       #ffffff;
  --c-surface:  #f5f8fc;   /* fond de section alterné */
  --c-ink:      #0f1e34;   /* texte principal (navy quasi-noir) */
  --c-primary:  #122c4f;   /* brand, header/hero sombre */
  --c-primary-2:#0b1d38;   /* dégradé foncé */
  --c-accent:   #0ea5e9;   /* CTA, liens, accents */
  --c-accent-d: #0284c7;   /* accent survol */
  --c-muted:    #5a6b82;   /* texte secondaire */
  --c-border:   #e2e8f0;
  --c-on-dark:  #eaf2fb;   /* texte sur fond sombre */
  --c-on-dark-muted: #a9bdd6;

  /* Typographie — stack système (0 web font = 0 latence) */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --fs-base: 1.0625rem;    /* 17px */
  --lh: 1.65;

  /* Échelle d'espacement */
  --sp-1: .25rem;  --sp-2: .5rem;  --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;   --sp-7: 3rem;   --sp-8: 4rem;  --sp-9: 6rem;

  /* Divers */
  --radius: 14px;
  --radius-sm: 9px;
  --container: 1120px;
  --shadow-sm: 0 1px 2px rgba(15,30,52,.06), 0 1px 3px rgba(15,30,52,.08);
  --shadow-md: 0 6px 20px rgba(15,30,52,.08), 0 2px 6px rgba(15,30,52,.06);
  --shadow-lg: 0 18px 45px rgba(15,30,52,.14);
}

/* ---------- 2. Reset léger ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-accent-d); text-decoration: underline; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
:target { scroll-margin-top: 90px; }

/* ---------- 3. Base ---------- */
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.2; color: var(--c-primary); font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p { color: var(--c-ink); }
p + p { margin-top: var(--sp-4); }
strong { color: var(--c-primary); }

/* ---------- 4. Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-5); }
.section { padding-block: var(--sp-9); }
.section--surface { background: var(--c-surface); }
.section--tight { padding-block: var(--sp-7); }
.section-head { max-width: 60ch; margin-bottom: var(--sp-6); }
.section-head .eyebrow { color: var(--c-accent); font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; font-size: .8rem; display: block; margin-bottom: var(--sp-2); }
.lead { font-size: 1.15rem; color: var(--c-muted); }

/* Skip link (a11y) */
.skip-link { position: absolute; left: -999px; top: 0; background: var(--c-primary);
  color: #fff; padding: var(--sp-3) var(--sp-4); border-radius: 0 0 var(--radius-sm) 0; z-index: 100; }
.skip-link:focus { left: 0; color: #fff; }

/* ---------- 5. Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--c-border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 66px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 30px; width: auto; }
.site-nav ul { display: flex; align-items: center; gap: var(--sp-5); }
.site-nav a { color: var(--c-primary); font-weight: 600; }
.site-nav a:hover { color: var(--c-accent); text-decoration: none; }
/* Lien courant : accent — sauf le bouton Contact (.btn), qui garde son texte blanc */
.site-nav a[aria-current="page"]:not(.btn) { color: var(--c-accent); }

/* Bouton burger (masqué en desktop) */
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none;
  border: 0; padding: var(--sp-2); }
.nav-toggle-bar { width: 24px; height: 2px; background: var(--c-primary); border-radius: 2px;
  transition: transform .25s, opacity .25s; }

/* ---------- 6. Boutons ---------- */
.btn { display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--c-accent); color: #fff; font-weight: 700;
  padding: .8rem 1.4rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: background .2s, transform .1s, box-shadow .2s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--c-accent-d); color: #fff; text-decoration: none;
  transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--c-primary); border-color: var(--c-border);
  box-shadow: none; }
.btn--ghost:hover { background: var(--c-surface); color: var(--c-primary); border-color: var(--c-accent); }
.btn--on-dark { background: #fff; color: var(--c-primary); }
.btn--on-dark:hover { background: var(--c-on-dark); color: var(--c-primary); }
.btn-sm { padding: .55rem 1rem; font-size: .95rem; }

/* ---------- 7. Hero ---------- */
.hero {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(14,165,233,.28), transparent 60%),
    linear-gradient(160deg, var(--c-primary) 0%, var(--c-primary-2) 100%);
  color: var(--c-on-dark);
  padding-block: clamp(3.5rem, 9vw, 7rem);
  position: relative; overflow: hidden;
}
.hero h1 { color: #fff; max-width: 16ch; }
.hero p { color: var(--c-on-dark-muted); font-size: 1.2rem; max-width: 54ch; margin-top: var(--sp-5); }
.hero .hero-cta { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-6); }
.hero-badge { display: inline-flex; align-items: center; gap: var(--sp-2);
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  color: var(--c-on-dark); padding: .4rem .9rem; border-radius: 999px; font-size: .9rem;
  font-weight: 600; margin-bottom: var(--sp-5); }
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; }

/* Bandeau CTA sombre (bas de page) */
.cta-band { background: linear-gradient(160deg, var(--c-primary), var(--c-primary-2));
  color: var(--c-on-dark); border-radius: var(--radius); padding: var(--sp-7);
  text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: var(--c-on-dark-muted); max-width: 52ch; margin-inline: auto; margin-top: var(--sp-3); }
.cta-band .btn { margin-top: var(--sp-5); }

/* ---------- 8. Grilles & cartes ---------- */
.grid { display: grid; gap: var(--sp-5); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: var(--sp-6); box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #cfe0f2; }
.card h3 { margin-bottom: var(--sp-3); }
.card p { color: var(--c-muted); }
.card .card-icon { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(14,165,233,.12); color: var(--c-accent); margin-bottom: var(--sp-4); }
.card .card-icon svg { width: 24px; height: 24px; }
.card a.card-link { font-weight: 700; margin-top: var(--sp-4); display: inline-flex; gap: .35rem; }

/* Liste à puces "check" (livrables) */
.check-list { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }
.check-list li { position: relative; padding-left: 1.9rem; color: var(--c-ink); }
.check-list li::before {
  content: ""; position: absolute; left: 0; top: .35em; width: 1.15rem; height: 1.15rem;
  background: rgba(14,165,233,.14); border-radius: 50%;
  /* coche SVG en data-URI (0 requête) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230ea5e9' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: .8rem;
}

/* ---------- 9. Bloc service détaillé ---------- */
.service-block { display: grid; grid-template-columns: 56px 1fr; gap: var(--sp-5);
  padding-block: var(--sp-7); border-top: 1px solid var(--c-border); }
.service-block:first-of-type { border-top: 0; padding-top: var(--sp-5); }
.service-block .s-icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--c-primary), var(--c-accent)); color: #fff; }
.service-block .s-icon svg { width: 28px; height: 28px; }
.service-block h2 { font-size: 1.5rem; margin-bottom: var(--sp-3); }

/* ---------- 10. Zone desservie ---------- */
.area-list { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-5); }
.area-list li { background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: 999px; padding: .5rem 1.1rem; font-weight: 600; color: var(--c-primary);
  box-shadow: var(--shadow-sm); }

/* ---------- 11. Formulaire contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-7); align-items: start; }
.form { display: grid; gap: var(--sp-4); }
.field { display: grid; gap: var(--sp-2); }
.field label { font-weight: 600; color: var(--c-primary); }
.field .req { color: var(--c-accent); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--c-ink); background: var(--c-bg);
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  padding: .7rem .85rem; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(14,165,233,.18);
}
.field textarea { min-height: 150px; resize: vertical; }
.consent { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: .95rem; color: var(--c-muted); }
.consent input { width: auto; margin-top: .25rem; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { padding: var(--sp-4); border-radius: var(--radius-sm); font-weight: 600; display: none; }
.form-status.ok { display: block; background: #e7f7ee; color: #0f7a43; border: 1px solid #b6e6cb; }
.form-status.err { display: block; background: #fdeaea; color: #b42323; border: 1px solid #f3c2c2; }

.contact-aside { background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: var(--sp-6); }
.contact-aside h2, .contact-aside h3 { font-size: 1.2rem; margin-bottom: var(--sp-3); }
.contact-aside dl { display: grid; gap: var(--sp-4); margin-top: var(--sp-4); }
.contact-aside dt { font-weight: 700; color: var(--c-primary); font-size: .9rem; }
.contact-aside dd { color: var(--c-muted); }

/* ---------- 12. Contenu légal / prose ---------- */
.prose { max-width: 72ch; }
.prose h2 { font-size: 1.35rem; margin-top: var(--sp-7); margin-bottom: var(--sp-3); }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--c-ink); }
.prose ul { list-style: disc; padding-left: 1.3rem; display: grid; gap: var(--sp-2); }
.prose .placeholder { background: #fff4d6; border: 1px dashed #e0b84a; color: #7a5b12;
  padding: 0 .35rem; border-radius: 4px; font-weight: 600; }

/* ---------- 12b. Tables de données (fiche + comparatif) ---------- */
.table-wrap { overflow-x: auto; margin-top: var(--sp-5);
  border: 1px solid var(--c-border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; min-width: 560px; background: var(--c-bg); }
.data-table th, .data-table td { text-align: left; padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-border); vertical-align: top; }
.data-table thead th { color: var(--c-primary); font-size: .82rem; text-transform: uppercase;
  letter-spacing: .05em; background: var(--c-surface); }
.data-table tbody tr:last-child td, .data-table tbody tr:last-child th { border-bottom: 0; }
/* Fiche clé-valeur : 1re colonne = libellé, pas de scroll (2 colonnes étroites) */
.data-table--kv { min-width: 0; }
.data-table--kv th[scope="row"] { color: var(--c-primary); font-weight: 700; width: 34%; }

/* ---------- 12c. FAQ (questions extractables) ---------- */
.faq { display: grid; gap: var(--sp-5); margin-top: var(--sp-6); max-width: 72ch; }
.faq-item h3 { margin-bottom: var(--sp-2); }
.faq-item p { color: var(--c-muted); }

/* ---------- 12d. Étapes ordonnées ---------- */
.steps { counter-reset: step; display: grid; gap: var(--sp-4); margin-top: var(--sp-5); }
.steps li { counter-increment: step; position: relative; padding-left: 2.4rem; color: var(--c-muted); }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -.1rem;
  width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  background: rgba(14,165,233,.14); color: var(--c-accent); font-weight: 700;
  font-size: .9rem; border-radius: 50%; }

/* ---------- 13. Footer ---------- */
.site-footer { background: var(--c-primary-2); color: var(--c-on-dark-muted);
  padding-block: var(--sp-7) var(--sp-6); margin-top: var(--sp-9); }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--sp-6); justify-content: space-between; }
.footer-brand { max-width: 34ch; }
.footer-brand img { height: 28px; margin-bottom: var(--sp-3); }
.site-footer nav ul { display: grid; gap: var(--sp-2); }
.site-footer a { color: var(--c-on-dark-muted); font-weight: 500; }
.site-footer a:hover { color: #fff; }
.footer-col h4 { color: #fff; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: var(--sp-3); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: var(--sp-6);
  padding-top: var(--sp-4); font-size: .9rem; display: flex; flex-wrap: wrap;
  gap: var(--sp-3); justify-content: space-between; }

/* ---------- 14. 404 ---------- */
.error-page { text-align: center; padding-block: var(--sp-9); }
.error-page .code { font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; color: var(--c-accent);
  line-height: 1; }

/* ---------- 15. Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute; top: 66px; left: 0; right: 0;
    background: var(--c-bg); border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-md);
    max-height: 0; overflow: hidden; transition: max-height .28s ease;
  }
  .site-nav.open { max-height: 360px; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: var(--sp-3) var(--sp-5); }
  .site-nav li { border-bottom: 1px solid var(--c-border); }
  .site-nav li:last-child { border-bottom: 0; padding-top: var(--sp-3); }
  .site-nav a { display: block; padding: var(--sp-3) 0; }
  .site-nav .btn { justify-content: center; }
  /* burger animé quand ouvert */
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1){ transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2){ opacity: 0; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }
}

/* ---------- 16. Accessibilité / préférences ---------- */
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
