/* ==========================================================================
   base.css — Reset, typographie, conteneurs, grilles, utilitaires
   Chargé après tokens.css. Ne contient aucune valeur brute.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Les ancres ne passent jamais sous le header (§ 11.6) */
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--text-body);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* filet de sécurité (§ 15.3) */
}

body.is-locked {
  overflow: hidden;
}

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

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul,
ol {
  list-style: none;
}

/* --- Titres --------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-strong);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.h1,
h1 {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
}

.h2,
h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
}

.h3,
h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
}

.h4,
h4 {
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-tight);
}

h5 {
  font-size: var(--fs-h5);
  font-weight: var(--fw-semibold);
}

/* --- Rôles typographiques nommés (§ 4.3) ---------------------------------- */
/* Sur-titre dans l'ambre clair du mot « Gironde » de la bannière.
   ATTENTION : --warm-300 sur fond blanc ne donne que 1,5:1, très en dessous
   du minimum AA de 4,5:1. La teinte tient sur la photo sombre de la bannière,
   pas sur les fonds clairs des sections. */
.eyebrow {
  display: inline-block;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-ui);
  text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow);
  color: var(--warm-300);
}

.eyebrow--on-dark {
  color: var(--warm-300);
}

.lead {
  font-size: var(--fs-lead);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--text-body);
}

.text-accent {
  color: var(--accent-500);
}

/* --- Conteneurs (§ 5.2) --------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container-max) + 2 * var(--container-pad));
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--narrow {
  max-width: calc(var(--container-narrow) + 2 * var(--container-pad));
}

/* --- Rythme vertical (§ 5.3) ---------------------------------------------- */
.section {
  padding-block: var(--section-py);
}

.section--tight {
  padding-block: calc(var(--section-py) * 0.66);
}

/* Fonds de section (§ 3.3) */
.section--subtle {
  background-color: var(--bg-subtle);
}

.section--canvas {
  background-color: var(--bg-canvas);
}

.section--dark {
  background-color: var(--bg-dark);
}

/* --- En-tête de section (§ 12) -------------------------------------------- */
.section-head {
  max-width: var(--container-narrow);
  margin-inline: auto;
  margin-bottom: var(--sp-12);
  text-align: center;
}

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

.section-head__text {
  margin-top: var(--sp-4);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--text-muted);
}

/* --- Grilles (§ 5.4) ------------------------------------------------------ */
.grid {
  display: grid;
  gap: var(--gutter);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1023px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

/* --- Accessibilité -------------------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-drawer);
  padding: var(--sp-2) var(--sp-4);
  background-color: var(--accent-600);
  color: var(--white);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-sm);
  transform: translateY(-150%);
  transition: transform var(--dur-base) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

/* --- Focus visible global (§ 14) ------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* --- Mouvement réduit (§ 13) ---------------------------------------------- */
@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;
  }
}
