/* ==========================================================================
   Cartoine — base
   Reset léger, styles globaux, échelle typo, primitives de layout,
   accessibilité. Ne contient aucun composant (ça, c'est _components.css).
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-8);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-noir);
  color: var(--c-clair);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }

img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* Listes sans puces quand on les utilise pour du layout (role="list") */
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: .35em; }
a:hover { color: var(--c-or); }

::selection { background: var(--c-teal); color: var(--c-clair); }

/* --- Accessibilité ----------------------------------------------------- */
:focus-visible { outline: var(--focus); outline-offset: 3px; }

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

/* L'attribut hidden gagne toujours, même sur un élément en display: flex ou grid (.stack, .tabs__list…) */
[hidden] { display: none !important; }

/* Masqué à l'écran, lu par les lecteurs d'écran */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Lien "Aller au contenu", visible seulement au clavier */
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: var(--z-lightbox);
  padding: var(--space-3) var(--space-4);
  background: var(--c-clair); color: var(--c-noir); font-weight: var(--fw-bold);
}
.skip-link:focus { top: var(--space-4); }

/* --- Échelle typographique ----------------------------------------------
   Les classes décrivent l'apparence, pas la sémantique : un <h1> peut
   prendre .t-label (cas de la home), un <p> peut prendre .t-display.     */
.t-display, .t-h1, .t-h2 {
  font-weight: var(--fw-black);
  line-height: var(--lh-title);
  letter-spacing: var(--ls-title);
  text-transform: uppercase;
  text-wrap: balance;
}
.t-display { font-size: var(--fs-display); letter-spacing: var(--ls-display); }
.t-h1      { font-size: var(--fs-h1); }
.t-h2      { font-size: var(--fs-h2); }

.t-h3, .t-h4 {
  font-weight: var(--fw-extrabold);
  text-transform: uppercase;
  text-wrap: balance;
}
.t-h3 { font-size: var(--fs-h3); line-height: 1.05; }
.t-h4 { font-size: var(--fs-h4); line-height: var(--lh-tight); }

.t-h5 {
  font-size: var(--fs-h5);
  font-weight: var(--fw-bold);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.t-lead {
  max-width: 44rem;
  color: var(--c-texte-2);
  font-size: var(--fs-lead);
  font-weight: var(--fw-medium);
  line-height: var(--lh-lead);
  text-wrap: pretty;
}

.t-body { max-width: var(--measure); color: var(--c-texte-2); text-wrap: pretty; }

.t-label, .t-meta {
  color: var(--c-label);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
}
.t-label { font-size: var(--fs-label); letter-spacing: var(--ls-label); line-height: 1.6; }
.t-meta  { font-size: var(--fs-meta);  letter-spacing: var(--ls-meta); }

.t-small { color: var(--c-muted); font-size: var(--fs-small); line-height: 1.5; }

/* Point final doré : uniquement sur Display, H1, H2 */
.dot { color: var(--c-or); }

/* Lien texte souligné teal */
.link {
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-decoration-color: var(--c-teal);
  text-decoration-thickness: 2px;
  text-underline-offset: .4em;
}
.link:hover { color: var(--c-clair); text-decoration-color: var(--c-or); }

/* Lien d'action en capitales, souligné d'un trait teal (« Voir le projet », « Toutes les réalisations ») */
.link-line {
  align-self: flex-start;
  color: var(--c-clair);
  font-size: .85rem;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-nav);
  text-decoration: underline;
  text-decoration-color: var(--c-teal);
  text-decoration-thickness: 2px;
  text-transform: uppercase;
  text-underline-offset: .4em;
}
.link-line:hover { color: var(--c-clair); text-decoration-color: var(--c-or); }

/* Contenu rédigé dans le BO (Markdown) : mentions légales, textes longs */
.prose { max-width: var(--measure); color: var(--c-texte-2); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { margin-top: var(--space-7); color: var(--c-clair); font-size: var(--fs-h4); font-weight: var(--fw-extrabold); text-transform: uppercase; }
.prose h3 { margin-top: var(--space-6); color: var(--c-clair); font-size: var(--fs-h5); font-weight: var(--fw-bold); }
.prose a  { color: var(--c-clair); text-decoration-color: var(--c-teal); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li + li { margin-top: var(--space-2); }

/* --- Primitives de layout ---------------------------------------------- */

/* Conteneur centré avec marges latérales fluides */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Section avec l'espace vertical standard */
.section { padding-block: var(--section); }
.section--tight { padding-block: calc(var(--section) / 2); }
.section--navy  { background: var(--c-surface-2); }
.section--line  { border-top: 1px solid var(--c-line); }

/* Empilement vertical : --stack-gap pour régler l'écart */
.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-5)); }

/* Rangée qui passe à la ligne : boutons, tags, filtres */
.cluster {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--cluster-gap, var(--space-4));
}

/* Grille auto : autant de colonnes que possible, --grid-min de large minimum */
.grid-auto {
  display: grid;
  gap: var(--grid-gap, var(--space-5));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 16rem)), 1fr));
}

/* Deux colonnes qui passent en une seule sous ~26rem chacune */
.split {
  display: grid;
  gap: var(--split-gap, clamp(1.5rem, 4vw, 3.5rem));
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  align-items: var(--split-align, center);
}

/* En-tête de section : titre à gauche, lien à droite */
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
