/* ==========================================================================
   ISMOD · Base
   Reset, typographie, rythme, liens, focus, utilitaires de mise en page,
   thèmes et impression. Toutes les valeurs viennent de tokens.css, chargé
   par sa propre balise <link> AVANT cette feuille (pas d'@import : il
   allongerait la chaîne de rendu).
   ========================================================================== */

/* ==========================================================================
   Rôles dérivés
   Construits uniquement à partir de tokens.css.
   --bouton-fond, --bouton-texte : bouton principal du thème
     (indigo à texte blanc sur clair, blanc à texte noir sur sombre).
   --bouton-survol-fond, --bouton-survol-texte, --bouton-survol-bord :
     survol du bouton principal (indigo de nuit sur clair ; inversion sur
     sombre, jamais un gris qui se lirait « désactivé »).
   --aplat : grand aplat de la signature (noir sur clair, blanc sur noir).
   --focus-contraste : liseré extérieur de l'anneau de focus, de contraste
     opposé à --focus, pour que l'anneau reste lisible sur une photo.
   --police-code : extraits de balisage de la bibliothèque.
   --voile-entete : voile de l'en-tête transparent, limité à sa bande.
     Mesure : le texte des liens se trouve entre 28 et 44 px de haut ; sur
     l'écran LED blanc des photos de défilé, 56 % de noir à cet endroit
     donnent 4,6:1 au blanc des liens. Au-delà, le voile s'éteint avant le
     bas de la bande et ne descend jamais jusqu'aux visages.
   ========================================================================== */
:root,
.theme-clair {
  --bouton-fond: var(--accent-plein);
  --bouton-texte: var(--sur-accent);
  --bouton-survol-fond: var(--indigo-nuit);
  --bouton-survol-texte: var(--blanc);
  --bouton-survol-bord: var(--indigo-nuit);
  --aplat: var(--noir);
  --focus-contraste: var(--blanc);
}
:root {
  --police-code: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --voile-entete: linear-gradient(
    color-mix(in srgb, var(--noir) 60%, transparent),
    color-mix(in srgb, var(--noir) 56%, transparent) 62%,
    color-mix(in srgb, var(--noir) 0%, transparent)
  );
}
.theme-clair {
  --fond: var(--blanc);
  --fond-alt: var(--craie);
  --texte: var(--noir);
  --texte-doux: var(--gris-500);
  --filet: var(--gris-200);
  --accent: var(--indigo);
  --accent-plein: var(--indigo);
  --sur-accent: var(--blanc);
  --focus: var(--noir);
  background-color: var(--fond);
  color: var(--texte);
}
.theme-noir {
  --bouton-fond: var(--accent-plein);
  --bouton-texte: var(--sur-accent);
  --bouton-survol-fond: var(--noir);
  --bouton-survol-texte: var(--blanc);
  --bouton-survol-bord: var(--blanc);
  --aplat: var(--blanc);
  --focus-contraste: var(--noir);
}
/* Surface secondaire du thème courant (craie sur clair, anthracite sur noir). */
.fond-alt {
  background-color: var(--fond-alt);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--hauteur-entete) + var(--e-4));
  hanging-punctuation: first last;
}
html:has(dialog[open]) {
  overflow: hidden;
}
body {
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: var(--t-base);
  font-weight: 400;
  font-stretch: 100%;
  line-height: var(--interligne-texte);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}
img,
video {
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: var(--rayon);
}
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
address {
  font-style: normal;
}
[hidden] {
  display: none !important;
}
abbr[title] {
  text-decoration: none;
}

/* ---------- Typographie ----------
   Titres en Zodiak, texte en Archivo. Graisse de Zodiak selon la taille
   rendue : 300 au-dessus de 88 px, 400 de 40 à 88 px, 500 sous 40 px. */
h1,
h2,
h3,
.titre-monumental,
.titre-1,
.titre-2,
.titre-3 {
  font-family: var(--police-titre);
  font-weight: var(--titre-graisse);
  line-height: var(--interligne-titre);
  text-wrap: balance;
}
h4,
h5,
h6 {
  font-family: var(--police-texte);
  font-size: var(--t-base);
  font-weight: 600;
  line-height: 1.3;
}
.titre-monumental {
  font-size: var(--t-5xl);
  line-height: var(--interligne-serre);
}
h1,
.titre-1 {
  font-size: var(--t-4xl);
  line-height: var(--interligne-serre);
}
h2,
.titre-2 {
  font-size: var(--t-3xl);
}
/* h3 : 28 à 40 px, graisse 500. */
h3,
.titre-3 {
  font-size: var(--t-2xl);
  font-weight: var(--titre-graisse-petit);
}
/* h2 : --t-3xl passe sous 40 px en dessous de 533 px de large. */
@media (max-width: 33.3125em) {
  h2,
  .titre-2 {
    font-weight: var(--titre-graisse-petit);
  }
}
/* Monumental : --t-5xl dépasse 88 px à partir de 855 px de large. */
@media (min-width: 53.4375em) {
  .titre-monumental {
    font-weight: var(--titre-graisse-monumental);
  }
}
:is(h1, h2, h3, .titre-monumental, .titre-1, .titre-2, .titre-3) em {
  font-style: italic;
}
/* text-wrap: pretty coûte cher en mise en page : réservé aux chapeaux. */
.chapeau {
  text-wrap: pretty;
}
/* Mesure du texte courant ; les annotations du modéliste en sont exclues
   (spécificité nulle de :where, les classes gardent la main). */
p:where(:not(.cote, .piece, .cran)) {
  max-width: var(--mesure);
}
strong,
b {
  font-weight: 600;
}
/* Pas d'italique d'Archivo (police non chargée) : dans le texte courant,
   l'emphase passe par la graisse. Les titres en Zodiak gardent l'italique. */
em,
i,
cite,
dfn {
  font-style: normal;
}
:where(p, li, dd, td, th, figcaption, blockquote) em {
  font-weight: 500;
}
/* Code et noms de variables : chasse fixe, sans ligature, pour que « -- »
   reste deux traits d'union et ne se lise jamais comme un tiret long. */
code,
kbd,
samp,
pre {
  font-family: var(--police-code);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  letter-spacing: 0.08em; /* jour visible entre deux traits d'union */
}
small {
  font-size: var(--t-xs);
}

/* Chapeau, texte secondaire, mention */
.chapeau {
  font-size: var(--t-lg);
  line-height: 1.5;
  max-width: 44ch;
}
.texte-doux {
  color: var(--texte-doux);
}
.mention {
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--texte-doux);
}
.chiffres {
  font-variant-numeric: tabular-nums;
}

/* Libellé de données (Durée, Âge, Frais…) : bas de casse, Archivo, gris.
   Jamais au-dessus d'un titre. */
.libelle {
  font-family: var(--police-texte);
  font-size: var(--t-sm);
  font-weight: 400;
  line-height: 1.4;
  color: var(--texte-doux);
  max-width: none;
}

/* ---------- Rythme vertical ---------- */
.flux > * + * {
  margin-block-start: var(--flux-espace, 1em);
}
.flux-serre {
  --flux-espace: var(--e-3);
}
.flux-large {
  --flux-espace: var(--e-6);
}
.section {
  padding-block: var(--section);
}
.section--serree {
  padding-block: calc(var(--section) / 2);
}

/* ---------- Liens ---------- */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: var(--filet-fin);
  text-underline-offset: 0.22em;
  text-decoration-color: currentColor;
  transition: text-decoration-color var(--duree-rapide) var(--ease-couture);
}
a:hover {
  text-decoration-color: var(--accent);
  text-decoration-thickness: var(--filet-fort);
}
/* Numéros insécables dans le texte courant seulement ; ailleurs (boutons,
   listes d'actions) le retour à la ligne reste permis (1.4.12, 1.4.10). */
a[href^="tel:"] {
  font-variant-numeric: tabular-nums;
}
/* Insécable à partir de 30 em seulement : en dessous, et sous l'espacement
   de texte WCAG (1.4.12), le numéro peut passer à la ligne. */
@media (min-width: 30em) {
  :where(p, li, dd, address) > a[href^="tel:"]:not([class]) {
    white-space: nowrap;
  }
}

/* ---------- Focus visible ----------
   Anneau double : 2 px en --focus (noir sur clair, blanc sur sombre),
   décalé de 3 px, cerné d'un liseré de contraste opposé. L'anneau reste
   lisible sur une photographie claire comme sombre (1.4.11). */
:focus {
  outline: none;
}
:focus-visible {
  outline: var(--filet-fort) solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 calc(3px + var(--filet-fort) + 2px) var(--focus-contraste);
}
@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid CanvasText;
  }
}

/* ---------- Sélection ---------- */
::selection {
  background-color: var(--noir);
  color: var(--blanc);
}
.theme-noir ::selection,
.theme-noir::selection {
  background-color: var(--blanc);
  color: var(--noir);
}

/* ---------- Lien d'évitement ---------- */
.lien-evitement {
  position: fixed;
  top: var(--e-3);
  left: var(--e-3);
  z-index: calc(var(--z-modale) + 1);
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: var(--e-2) var(--e-5);
  background-color: var(--blanc);
  color: var(--noir);
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(calc(-100% - var(--e-6)));
  transition: transform var(--duree-rapide) var(--ease-couture);
  outline: var(--filet-fort) solid var(--noir);
  outline-offset: 0;
}
.lien-evitement:focus-visible {
  --focus: var(--noir);
  --focus-contraste: var(--blanc);
  transform: none;
}

/* ---------- Accessibilité ---------- */
.visuellement-masque:not(:focus):not(:active) {
  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;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---------- Icônes (sprite Tabler, trait 1,5) ---------- */
.icone {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.icone--sm {
  width: 1.25rem;
  height: 1.25rem;
}
.icone--lg {
  width: 2rem;
  height: 2rem;
}

/* ---------- Mise en page ---------- */
.conteneur {
  width: 100%;
  max-width: var(--conteneur);
  margin-inline: auto;
  padding-inline: var(--marge);
}
.conteneur--texte {
  max-width: calc(var(--conteneur-texte) + 2 * var(--marge));
}

/* Grille de 12 colonnes. Sur mobile, chaque enfant occupe toute la largeur
   par défaut ; .col-N, .col-m-N (48em) et .col-l-N (64em) répartissent. */
.grille {
  display: grid;
  grid-template-columns: repeat(var(--colonnes), minmax(0, 1fr));
  column-gap: var(--gouttiere);
  row-gap: var(--e-6);
}
.grille > * {
  grid-column: 1 / -1;
  min-width: 0;
}
.grille--alignee-bas {
  align-items: end;
}
.grille--alignee-centre {
  align-items: center;
}
.grille > .col-3 { grid-column: auto / span 3; }
.grille > .col-4 { grid-column: auto / span 4; }
.grille > .col-6 { grid-column: auto / span 6; }
.grille > .col-8 { grid-column: auto / span 8; }
.grille > .col-9 { grid-column: auto / span 9; }

@media (min-width: 48em) {
  .grille > .col-m-3 { grid-column: auto / span 3; }
  .grille > .col-m-4 { grid-column: auto / span 4; }
  .grille > .col-m-5 { grid-column: auto / span 5; }
  .grille > .col-m-6 { grid-column: auto / span 6; }
  .grille > .col-m-7 { grid-column: auto / span 7; }
  .grille > .col-m-8 { grid-column: auto / span 8; }
  .grille > .col-m-12 { grid-column: auto / span 12; }
}
@media (min-width: 64em) {
  .grille > .col-l-2 { grid-column: auto / span 2; }
  .grille > .col-l-3 { grid-column: auto / span 3; }
  .grille > .col-l-4 { grid-column: auto / span 4; }
  .grille > .col-l-5 { grid-column: auto / span 5; }
  .grille > .col-l-6 { grid-column: auto / span 6; }
  .grille > .col-l-7 { grid-column: auto / span 7; }
  .grille > .col-l-8 { grid-column: auto / span 8; }
  .grille > .col-l-9 { grid-column: auto / span 9; }
  .grille > .col-l-10 { grid-column: auto / span 10; }
  .grille > .col-l-12 { grid-column: auto / span 12; }
  .grille > .deb-l-1 { grid-column-start: 1; }
  .grille > .deb-l-2 { grid-column-start: 2; }
  .grille > .deb-l-3 { grid-column-start: 3; }
  .grille > .deb-l-4 { grid-column-start: 4; }
  .grille > .deb-l-5 { grid-column-start: 5; }
  .grille > .deb-l-6 { grid-column-start: 6; }
  .grille > .deb-l-7 { grid-column-start: 7; }
  .grille > .deb-l-8 { grid-column-start: 8; }
  .grille > .deb-l-9 { grid-column-start: 9; }
}

/* Calque de contrôle de la grille (outil de mise au point). */
.calque-grille {
  position: fixed;
  inset: 0;
  z-index: var(--z-modale);
  pointer-events: none;
}
.calque-grille .conteneur,
.calque-grille .grille {
  height: 100%;
}
.calque-grille .grille > span {
  grid-column: span 1;
  border-inline: var(--filet-fin) solid var(--gris-500);
  opacity: 0.7;
}

/* Pile de boutons */
.groupe-boutons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--e-3) var(--e-4);
}

/* ---------- Impression ---------- */
@media print {
  .theme-noir,
  .theme-clair {
    --fond: var(--blanc);
    --fond-alt: var(--blanc);
    --texte: var(--noir);
    --texte-doux: var(--gris-700);
    --filet: var(--gris-200);
    --accent: var(--noir);
    background: none;
    color: var(--noir);
  }
  body {
    font-size: 11pt;
    line-height: 1.45;
  }
  .entete,
  .menu-mobile,
  .visionneuse,
  .lien-evitement,
  .video__lecture,
  .video__pause,
  .calque-grille,
  .groupe-boutons {
    display: none !important;
  }
  .section {
    padding-block: 1.5rem;
  }
  img {
    break-inside: avoid;
    max-height: 9cm;
    width: auto;
  }
  h1,
  h2,
  h3 {
    break-after: avoid;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
  }
  [data-revele] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}
