/* =====================================================================
   BASE + GRILLE
   Remise a zero breve, puis la grille reelle (mobile d'abord).
   ===================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;

  /* Barre de defilement discrete : la piste disparait, seul un
     curseur fin subsiste. Elle reste fonctionnelle et accessible —
     on ne la supprime pas, on l'integre a la charte. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

@supports not (scrollbar-color: auto) {
  html { scrollbar-width: thin; }
}

/* Curseur fin, sans piste visible. */
::-webkit-scrollbar { width: 8px; height: 8px; }

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-line);
}

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--text-100);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  /* overflow-x: clip (et non hidden) : ne cree PAS de conteneur de
     defilement, donc le defilement reste sur le fil dedie (fluide) et
     les position: sticky continuent de fonctionner. Repli pour les
     vieux navigateurs juste en dessous. */
  overflow-x: hidden;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: var(--lh-tight);
  font-weight: 650;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p { margin: 0 0 var(--sp-3); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-strong); }

img, svg, canvas { max-width: 100%; height: auto; display: block; }

code, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Cibles tactiles : 44px minimum sur mobile (recommandation Apple,
   WCAG 2.2 AAA 2.5.5). On agrandit la zone, pas l'icone. */
button, a.btn, input[type="submit"], input[type="button"] { touch-action: manipulation; }

/* ---------- Grille ---------- */

.container {
  width: 100%;
  max-width: calc(var(--grid-max) + var(--grid-margin) * 2);
  margin-inline: auto;
  padding-inline: var(--grid-margin);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: var(--grid-gutter);
}

/* Etirement sur toute la grille : un bloc "pleine largeur" declare
   explicitement combien de colonnes il occupe. */
.col-full  { grid-column: 1 / -1; }
.col-half  { grid-column: span 2; }
.col-third { grid-column: span 4; }

@media (min-width: 48em) {
  .col-third { grid-column: span 4; }
}

@media (min-width: 62em) {
  .col-half  { grid-column: span 6; }
  .col-third { grid-column: span 4; }
}

/* ---------- Sections : rythme sur la ligne de base ----------
   Hauts resserres (6 rem -> 4 rem, 8 rem -> 5 rem sur grand ecran) :
   le vide entre le header et le debut des pages etait trop grand. */

.section { padding-block: var(--sp-4); }
.section + .section { padding-top: 0; }

@media (min-width: 62em) {
  .section { padding-block: var(--sp-5); }
}

.section-head { margin-bottom: var(--sp-6); }

.section-title {
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-2);
}

.section-kicker {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-2);
}

.section-lede {
  color: var(--text-200);
  max-width: var(--measure);
}

@media (min-width: 62em) {
  .section-title { font-size: var(--fs-3xl); }
}

/* ---------- Utilitaires ---------- */

.muted { color: var(--text-300); }
.secondary { color: var(--text-200); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.stack > * + * { margin-top: var(--sp-3); }
.stack-lg > * + * { margin-top: var(--sp-6); }
.stack-tight > * + * { margin-top: var(--sp-2); }

/* Panneau d'authentification : une seule colonne, lisible au clavier,
   centre verticalement sans dependre d'un 100vh (barres systeme). */
.auth-panel {
  max-width: 26rem;
  margin-inline: auto;
  padding: var(--sp-4);
  background: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}

@media (min-width: 48em) {
  .auth-panel { padding: var(--sp-6); }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--sp-3);
  font-weight: 650;
  color: var(--text-100);
}

.auth-panel .section-title { font-size: var(--fs-xl); }

.auth-foot {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Champ de code a 6 chiffres : lisible, chiffres espaces, gros. */
.auth-code {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  padding-block: var(--sp-3);
}

/* Petit espacement utilitaire (aucune valeur magique ailleurs). */
.mt-2 { margin-top: var(--sp-2); }

/* En-tete d'une barre de niveau : libelle a gauche, pourcentage a droite. */
.meter-head {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: 550;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Piège de formulaire : invisible pour un humain, rempli par un robot.
   PAS `display:none` (un robot le detecte et l'ignore) ni
   `visibility:hidden` : on le sort de l'ecran et du parcours clavier. */
.honeypot-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

/* ---------- Mode mouvement reduit ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Economie de donnees ---------- */
@media (prefers-reduced-data: reduce) {
  * { background-image: none !important; }
}