/* ============================================================================
   support.css — page PUBLIQUE /support (aide, dépannage, contact)
   ----------------------------------------------------------------------------
   S'appuie sur /design-system.css (tokens --ds-*, .ds-scope, .ds-btn,
   .ds-input, .ds-blueprint + .corner, .ds-busy). Gabarit d'en-tête et de pied
   de page repris de public/plans.html ; FAQ reprise de la section #faq de
   public/landing.html (<details>/<summary> natifs).

   Fichier SÉPARÉ plutôt qu'un <style> en ligne : la page n'ajoute rien à la
   dette 'unsafe-inline' documentée dans src/utils/securityHeaders.js (cible :
   script-src puis style-src sans 'unsafe-inline'). Même raison : aucun
   attribut style="…" dans support.html.

   ACCESSIBILITÉ — choix volontaires, mesurés (WCAG 2.2 AA) :
   • texte secondaire à 70 % de --ds-color-text minimum (≈ 5,9:1 sur le fond) :
     les 55–60 % utilisés ailleurs tombent sous 4,5:1 ;
   • bordure des champs à --ds-color-muted (≈ 3,7:1, seuil 3:1 des composants
     d'interface) : le filet --ds-color-divider (≈ 1,4:1) ne délimite pas un
     champ pour un utilisateur malvoyant ;
   • bouton d'envoi sur --ds-accent-700 (≈ 5,8:1) : .ds-btn-primary sur
     --ds-color-accent ne fait que 3,7:1 pour un libellé de 13–14 px ;
   • texte d'erreur en --sp-bad-ink (#b91c1c, ≈ 5,8:1) : --ds-bad (#dc2626)
     donne 4,3:1 sur le fond, sous le seuil pour du texte courant ;
   • champs en 16 px : en dessous, Safari iOS zoome au focus.
   ========================================================================== */

:root {
  /* Rouge d'ENCRE pour les messages d'erreur (texte courant). --ds-bad reste
     la couleur sémantique du verdict ; celle-ci n'existe que pour le contraste. */
  --sp-bad-ink: #b91c1c;
  /* Hauteur réservée à l'en-tête collant : ancres et focus clavier ne doivent
     jamais finir dessous (WCAG 2.4.11). */
  --sp-header-h: 5rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--sp-header-h); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* L'attribut `hidden` doit TOUJOURS gagner : sans ça, `.sp-form { display:grid }`
   l'emporterait sur le display:none du navigateur (formulaire masqué après envoi). */
[hidden] { display: none !important; }

/* Texte réservé aux lecteurs d'écran (motif « visually hidden » standard). */
.sp-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Planche de pictogrammes (<symbol>) : présente dans le DOM, jamais affichée. */
.sp-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ─── Lien d'évitement (premier élément focalisable de la page) ─────────────── */
.sp-skip {
  position: absolute; left: 12px; top: -200px; z-index: 100;
  padding: 10px 14px; font-weight: 600; text-decoration: none;
  background: var(--ds-accent-900); color: var(--ds-color-bg);
}
.ds-scope a.sp-skip, .ds-scope a.sp-skip:hover { color: var(--ds-color-bg); }
.sp-skip:focus { top: 12px; }
/* <main tabindex="-1"> reçoit le focus du lien d'évitement : pas d'anneau
   autour de toute la zone de contenu (ce n'est pas une commande). */
main:focus { outline: none; }

/* ─── En-tête (gabarit /plans) ───────────────────────────────────────────── */
.sp-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--ds-color-bg); border-bottom: 1px solid var(--ds-color-divider);
}
.sp-nav {
  display: flex; align-items: center; gap: clamp(10px, 2vw, 22px);
  max-width: 1200px; margin: 0 auto; padding: 10px clamp(20px, 5vw, 72px);
}
.sp-brand {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto;
  white-space: nowrap; text-decoration: none;
}
.sp-brand svg, .sp-burger svg { display: block; flex: none; }
.sp-wordmark {
  font-family: var(--ds-font-heading); font-weight: 600; font-size: 20px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ds-color-text); line-height: 1;
}
.sp-navlink { font-size: 14px; font-weight: 500; text-decoration: none; }
.sp-navlink:hover { text-decoration: underline; text-underline-offset: 4px; }
/* Page courante : signalée par un soulignement épais, pas par la couleur seule. */
.sp-navlink[aria-current="page"] {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px;
}
.sp-header .ds-btn { text-decoration: none; }

/* Burger mobile (même motif que /plans : <details> natif, fermeture au clic
   extérieur et à Échap ajoutée par support.js). */
.sp-burger { display: none; position: relative; }
.sp-burger > summary {
  list-style: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; cursor: pointer;
  border: 1px solid var(--ds-color-divider); background: var(--ds-color-bg); color: var(--ds-color-text);
}
.sp-burger > summary::-webkit-details-marker { display: none; }
.sp-burger[open] > summary { background: color-mix(in srgb, var(--ds-color-accent) 10%, transparent); }
.sp-burger-menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; z-index: 80;
  display: flex; flex-direction: column; background: var(--ds-color-bg);
  border: 1px solid var(--ds-color-divider); box-shadow: var(--ds-shadow-md);
}
.sp-burger-menu a {
  display: block; padding: 12px 16px; font-size: 14px; text-decoration: none;
  color: var(--ds-color-text);
  border-bottom: 1px solid color-mix(in srgb, var(--ds-color-text) 7%, transparent);
}
.ds-scope .sp-burger-menu a { color: var(--ds-color-text); }
.sp-burger-menu a:last-child { border-bottom: 0; }
.sp-burger-menu a:hover { background: color-mix(in srgb, var(--ds-color-accent) 8%, transparent); }
.sp-burger-menu a:focus-visible { outline-offset: -2px; }
.sp-burger-menu a[aria-current="page"] { font-weight: 600; }

/* ─── Titre de page ──────────────────────────────────────────────────────── */
.sp-hero {
  max-width: 1200px; margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) clamp(20px, 5vw, 72px) clamp(24px, 4vw, 40px);
}
.sp-hero h1 {
  font-size: clamp(38px, 5vw, 64px); line-height: 1.04; letter-spacing: 0.01em;
  margin: 0 0 0 -0.052em;
}
.sp-hero .sp-lede {
  font-size: 17px; line-height: 26px; max-width: 60ch; margin: 16px 0 0;
  color: color-mix(in srgb, var(--ds-color-text) 82%, transparent);
}

/* ─── Mise en page : sommaire + contenu ──────────────────────────────────── */
.sp-layout {
  max-width: 1200px; margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 72px) clamp(48px, 6vw, 88px);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px;
}
.sp-content { min-width: 0; max-width: 780px; }

/* Sommaire (cadre blueprint). Pas d'overflow sur ce bloc : les croix de calage
   sont dessinées HORS de la boîte (cf. .ds-blueprint). */
.sp-toc { padding: 18px 20px 16px; align-self: start; }
.sp-toc .sp-toc-title {
  margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ds-accent-700);
}
.sp-toc ol, .sp-toc ul { list-style: none; margin: 0; padding: 0; }
.sp-toc > ol > li + li { border-top: 1px solid color-mix(in srgb, var(--ds-color-text) 8%, transparent); }
.sp-toc a {
  display: flex; align-items: baseline; gap: 10px; min-height: 40px; padding: 9px 0;
  font-size: 14px; font-weight: 500; line-height: 1.35; text-decoration: none;
  color: var(--ds-color-text);
}
.ds-scope .sp-toc a { color: var(--ds-color-text); }
.ds-scope .sp-toc a:hover { color: var(--ds-accent-700); text-decoration: underline; text-underline-offset: 3px; }
.sp-toc-num {
  flex: none; min-width: 1.7em; font-family: var(--ds-font-heading); font-weight: 600; font-size: 13px;
  font-feature-settings: 'tnum'; color: color-mix(in srgb, var(--ds-color-text) 70%, transparent);
}
.sp-toc .sp-toc-sub { margin: -6px 0 8px; padding-left: calc(1.7em + 10px); }
.sp-toc-sub a { min-height: 32px; padding: 5px 0; font-size: 13px; font-weight: 400; }
.ds-scope .sp-toc-sub a { color: color-mix(in srgb, var(--ds-color-text) 80%, transparent); }
.sp-toc .sp-legend {
  display: flex; align-items: center; gap: 6px; margin: 12px 0 0;
  padding-top: 12px; border-top: 1px solid var(--ds-color-divider);
  font-size: 12.5px; line-height: 1.4; color: color-mix(in srgb, var(--ds-color-text) 72%, transparent);
}

/* Mobile / tablette : sommaire compact en 2 colonnes, sans les raccourcis de
   dépannage (ils sont visibles dès l'ouverture de la section 05). */
@media (max-width: 960px) {
  .sp-toc > ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .sp-toc > ol > li + li { border-top: 0; }
  .sp-toc > ol > li { border-bottom: 1px solid color-mix(in srgb, var(--ds-color-text) 8%, transparent); }
  .sp-toc a { min-height: 44px; }
  .sp-toc-sub { display: none; }
}
@media (max-width: 420px) {
  .sp-toc > ol { grid-template-columns: minmax(0, 1fr); }
}
/* Grand écran : sommaire en colonne, collant si la hauteur d'écran le permet
   (un bloc collant plus haut que la fenêtre rendrait sa fin inatteignable). */
@media (min-width: 961px) {
  .sp-layout { grid-template-columns: 240px minmax(0, 1fr); gap: clamp(40px, 5vw, 80px); }
}
@media (min-width: 961px) and (min-height: 640px) {
  .sp-toc { position: sticky; top: calc(var(--sp-header-h) - 4px); }
}

/* ─── Sections thématiques ───────────────────────────────────────────────── */
.sp-section + .sp-section { margin-top: clamp(44px, 5vw, 64px); }
.sp-section h2 {
  display: flex; align-items: baseline; gap: 12px;
  font-size: clamp(24px, 2.6vw, 30px); line-height: 1.1; margin: 0;
  padding-bottom: 12px; border-bottom: 1px solid var(--ds-color-divider);
}
.sp-num {
  flex: none; font-size: 15px; letter-spacing: 0.04em; font-feature-settings: 'tnum';
  color: var(--ds-accent-700);
}
.sp-section .sp-section-intro {
  margin: 14px 0 4px; font-size: 15px; line-height: 24px;
  color: color-mix(in srgb, var(--ds-color-text) 78%, transparent);
}

/* ─── Questions (<details>/<summary> natifs : clavier, lecteurs d'écran) ──── */
.sp-q { position: relative; border-bottom: 1px solid var(--ds-color-divider); }
.sp-q > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; padding: 14px 0;
  font-size: 16px; font-weight: 500; line-height: 1.35; color: var(--ds-color-text);
}
.sp-q > summary::-webkit-details-marker { display: none; }
/* Indicateur +/− DESSINÉ (dégradés), pas un caractère : un « + » en `content`
   serait lu par les lecteurs d'écran à la fin de chaque question. L'état
   ouvert/fermé est déjà annoncé nativement par <details>. */
.sp-q > summary::after {
  content: ""; flex: none; width: 14px; height: 14px; color: var(--ds-accent-700);
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}
.sp-q[open] > summary::after {
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
}
.sp-q > summary:hover { color: var(--ds-accent-700); }
/* Question visée par une ancre (lien depuis l'extension ou Mon compte) :
   filet d'accent dans la marge, sans décaler le texte. */
.sp-q:target::before {
  content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px;
  background: var(--ds-color-accent);
}
.sp-q:target > summary { color: var(--ds-accent-700); }

.sp-answer {
  padding: 0 0 22px; max-width: 70ch;
  font-size: 15px; line-height: 24px; color: color-mix(in srgb, var(--ds-color-text) 82%, transparent);
}
.sp-answer p, .sp-intro p { margin: 0 0 10px; }
.sp-answer > :last-child { margin-bottom: 0; }
.sp-answer ul, .sp-answer ol, .sp-intro ul { margin: 0 0 10px; padding-left: 22px; }
.sp-answer li, .sp-intro li { margin: 3px 0; }
.sp-answer strong, .sp-intro strong { color: var(--ds-color-text); font-weight: 600; }
/* « 1er » : l'exposant ne doit pas creuser l'interligne de sa ligne. */
.sp-answer sup { line-height: 0; }
.sp-symptom { color: var(--ds-color-text); }

/* Liens de contenu : soulignés (jamais distingués par la couleur seule). */
.sp-content a:not(.ds-btn) { text-decoration: underline; text-underline-offset: 3px; }
.sp-content a:not(.ds-btn):hover { text-decoration-thickness: 2px; }

/* Pictogramme « connexion requise » (cadenas) accolé aux liens concernés.
   Le texte « (connexion requise) » est porté par un .sp-sr dans le lien. */
.sp-lock {
  display: inline-block; width: 0.8em; height: 0.8em; margin-left: 0.3em;
  vertical-align: -0.05em; fill: currentColor;
}
.sp-legend .sp-lock { margin-left: 0; flex: none; }

/* Libellés tels qu'affichés par l'extension (« RIEN TROUVÉ », « QUOTA »…).
   Écrits en casse normale dans le HTML (lecture correcte par les lecteurs
   d'écran), mis en capitales ici comme dans l'extension. */
.sp-label {
  display: inline-block; padding: 0 6px; white-space: nowrap;
  font-size: 12px; font-weight: 700; line-height: 1.6; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ds-color-text); background: var(--ds-color-surface);
  border: 1px solid color-mix(in srgb, var(--ds-color-text) 45%, transparent);
}
.sp-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em;
  padding: 1px 5px; overflow-wrap: anywhere;
  background: var(--ds-color-surface); border: 1px solid var(--ds-color-divider);
}

/* ─── Nous écrire ────────────────────────────────────────────────────────── */
.sp-intro { margin-top: 16px; font-size: 15px; line-height: 24px; max-width: 70ch;
  color: color-mix(in srgb, var(--ds-color-text) 82%, transparent); }
.sp-caution {
  padding: 10px 14px; color: var(--ds-color-text);
  background: var(--ds-color-surface); border-left: 3px solid var(--ds-accent-700);
}

.sp-formbox { margin-top: 24px; padding: clamp(18px, 3vw, 28px); }
.sp-formbox .sp-noscript { margin: 0 0 16px; font-size: 15px; }

.sp-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 640px) {
  .sp-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-field-full, .sp-actions, .sp-msg { grid-column: 1 / -1; }
}
/* Sans JavaScript, l'envoi ne peut pas aboutir (l'API attend du JSON) : le
   formulaire disparaît et le <noscript> donne l'adresse e-mail à la place. */
@media (scripting: none) { .sp-form { display: none; } }

.sp-field { min-width: 0; }
.sp-field > label {
  display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--ds-color-text);
}
.sp-req { font-weight: 400; color: color-mix(in srgb, var(--ds-color-text) 72%, transparent); }
.sp-form .ds-input {
  min-height: 44px; font-size: 16px; border-color: var(--ds-color-muted);
}
.sp-form .ds-input:hover { border-color: color-mix(in srgb, var(--ds-color-text) 75%, transparent); }
.sp-form .ds-input:focus-visible { border-color: var(--ds-color-accent); }
.sp-form textarea.ds-input { min-height: 180px; line-height: 1.5; }
.sp-form .ds-input[aria-invalid="true"] {
  border-color: var(--sp-bad-ink); box-shadow: inset 0 0 0 1px var(--sp-bad-ink);
}
.sp-field .sp-hint, .sp-count {
  margin: 6px 0 0; font-size: 13px; line-height: 1.4;
  color: color-mix(in srgb, var(--ds-color-text) 72%, transparent);
}
.sp-field-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sp-count { white-space: nowrap; font-feature-settings: 'tnum'; }
.sp-count.is-near { color: var(--sp-bad-ink); font-weight: 600; }
.sp-field .sp-error { margin: 6px 0 0; font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--sp-bad-ink); }
.sp-field .sp-error:empty { display: none; }
/* Code d'affiliation (Lot 2) : champ court, en majuscules, police fixe. */
.sp-form .sp-ref { max-width: 18rem; text-transform: uppercase; letter-spacing: .04em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Pot de miel anti-bot : hors écran, JAMAIS display:none (trop facile à
   détecter). Même motif que /legal et la landing. */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.sp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sp-submit {
  min-height: 44px; min-width: 9.5em; padding: 10px 18px; font-size: 14px;
  background: var(--ds-accent-700); border-color: var(--ds-accent-700); color: var(--ds-color-bg);
}
.sp-submit:hover { background: var(--ds-accent-800); border-color: var(--ds-accent-800); }
.sp-submit[aria-disabled="true"] { cursor: progress; }
.sp-note { font-size: 13px; color: color-mix(in srgb, var(--ds-color-text) 72%, transparent); }

/* Zone de statut (role="status") : TOUJOURS rendue, même vide — une région
   live masquée puis réaffichée n'est pas annoncée de façon fiable. Vide, elle
   ne prend aucune place (ni marge, ni bordure). */
.sp-form .sp-msg { margin: 0; font-size: 14px; line-height: 20px; }
.sp-msg.is-info { color: color-mix(in srgb, var(--ds-color-text) 80%, transparent); }
.sp-msg.is-err {
  padding: 10px 12px; color: var(--sp-bad-ink); background: var(--ds-bad-bg);
  border: 1px solid var(--sp-bad-ink);
}
.sp-msg a { color: inherit; text-decoration: underline; }

/* Confirmation d'envoi (remplace le formulaire, reçoit le focus). */
.sp-done { border-left: 3px solid var(--ds-good); padding: 4px 0 4px 16px; }
.ds-scope .sp-done-title {
  margin: 0 0 8px; font-size: 22px; letter-spacing: 0.03em; color: var(--ds-good);
}
.sp-done-title:focus { outline: none; }
.sp-done-title:focus-visible { outline: 2px solid var(--ds-color-accent); outline-offset: 4px; }
.sp-done p { margin: 0 0 10px; font-size: 15px; line-height: 24px; }
.sp-done .ds-btn { min-height: 44px; margin-top: 6px; }

/* ─── Pied de page (gabarit /plans) ──────────────────────────────────────── */
.sp-footer-wrap { border-top: 1px solid var(--ds-color-divider); }
.sp-footer {
  max-width: 1200px; margin: 0 auto; padding: 32px clamp(20px, 5vw, 72px);
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: baseline; justify-content: space-between;
  font-size: 13px; color: color-mix(in srgb, var(--ds-color-text) 72%, transparent);
}
.sp-footer-links { display: inline-flex; flex-wrap: wrap; gap: 8px 20px; }
.sp-footer-links a { text-decoration: none; }
.sp-footer-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─── Responsive : en-tête ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Les liens texte se replient dans le burger (même seuil que /plans) ; le
     bouton « Se connecter » reste visible. */
  .sp-nav .sp-navlink { display: none; }
  .sp-burger { display: block; }
}

/* ─── Impression : contenu seul (support.js déplie toutes les questions) ── */
@media print {
  .sp-skip, .sp-header, .sp-toc, .sp-formbox, .sp-footer-wrap { display: none !important; }
  .sp-layout { display: block; padding: 0 16px; }
  .sp-hero { padding: 0 16px 16px; }
  .sp-q > summary::after { display: none; }
  .sp-content a:not(.ds-btn) { color: inherit; }
}
