/* ============================================================
   BASE : polices, reset, typographie, utilitaires
   ============================================================ */

/* --- Polices servies depuis le serveur de Raccordia.
   Aucun appel a Google au chargement de la page : l'adresse IP du visiteur
   ne part chez personne, ce qui evite d'avoir a le declarer dans la
   politique de confidentialite. Les deux fichiers sont des polices
   variables : un seul fichier couvre toutes les graisses. --- */

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../assets/fonts/dmsans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../assets/fonts/dmsans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* --- Reset --- */

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

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  /* Compense la hauteur de l'en-tete collant quand on arrive par une ancre :
     sans cela le titre vise se retrouve cache dessous. */
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--corps);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--encre);
  background: var(--mineral);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

/* --- Typographie ---
   La hierarchie est portee par la taille et l'espace, pas par les effets.
   clamp() evite d'avoir a redeclarer chaque taille dans quatre media queries. */

h1,
h2,
h3,
h4 {
  font-family: var(--titres);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.875rem);
}

h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);
  line-height: 1.25;
}

h4 {
  font-size: 1.0625rem;
  line-height: 1.35;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
}

strong {
  font-weight: 700;
}

/* --- Conteneur --- */

.conteneur {
  width: 100%;
  max-width: var(--largeur-max);
  margin-inline: auto;
  padding-inline: var(--e3);
}

@media (min-width: 720px) {
  .conteneur {
    padding-inline: var(--e5);
  }
}

/* --- Sections --- */

.section {
  padding-block: clamp(var(--e6), 8vw, var(--e8));
  position: relative;
}

.section-serree {
  padding-block: clamp(var(--e5), 6vw, var(--e7));
}

.section-claire {
  background: var(--mineral);
}

.section-sombre {
  background: var(--encre);
  color: var(--mineral);
}

.section-sombre h1,
.section-sombre h2,
.section-sombre h3,
.section-sombre h4 {
  color: var(--mineral);
}

/* --- Textes courants --- */

.surtitre {
  font-family: var(--titres);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ardoise);
  margin-bottom: var(--e2);
}

.section-sombre .surtitre,
.hero .surtitre,
.bandeau-final .surtitre {
  color: var(--elan);
}

.intro {
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  color: var(--encre-voile);
  max-width: var(--largeur-texte);
  margin-top: var(--e3);
}

/* Tous les fonds encre du site, pas seulement « .section-sombre » : le
   bandeau final et le hero portent leur propre classe, et sans eux le
   paragraphe s'affichait en bleu encre sur bleu encre, donc invisible. */
.section-sombre .intro,
.bandeau-final .intro,
.hero .intro {
  color: var(--mineral-voile);
}

.texte-fort {
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.4375rem);
  line-height: 1.5;
  font-family: var(--titres);
  font-weight: 600;
  letter-spacing: -0.015em;
  max-width: 34ch;
}

/* --- Accents ---
   Le vert elan ne sert jamais de couleur de texte sur fond clair : sur
   fond clair il devient un surlignage, sur fond encre il peut colorer. */

.accent-clair {
  color: var(--elan);
}

.surligne {
  background: linear-gradient(
    to top,
    var(--elan) 0,
    var(--elan) 0.32em,
    transparent 0.32em
  );
  padding-inline: 0.06em;
}

/* --- Accessibilite --- */

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

:focus-visible {
  outline: 3px solid var(--corail);
  outline-offset: 3px;
  border-radius: 4px;
}

.saut-contenu {
  position: absolute;
  top: var(--e2);
  left: var(--e2);
  z-index: 200;
  padding: var(--e2) var(--e3);
  background: var(--elan);
  color: var(--encre);
  font-weight: 700;
  border-radius: var(--rayon-s);
  transform: translateY(-200%);
  transition: transform var(--vite);
}

.saut-contenu:focus {
  transform: translateY(0);
}

/* --- Apparitions au scroll ---
   L'element est masque en JavaScript seulement : sans JavaScript la classe
   .js n'est jamais posee et tout reste visible. */

.js .reveal,
.js [data-motion] {
  --motion-x: 0px;
  --motion-y: 22px;
  opacity: 0;
  transform: translate3d(
      calc(var(--motion-x) + var(--pointer-shift-x, 0px)),
      calc(var(--motion-y) + var(--pointer-shift-y, 0px)),
      0
    )
    rotate(var(--pointer-tilt, 0deg));
  transition: opacity var(--lent), transform var(--lent);
}

.js [data-motion="align-left"] {
  --motion-x: calc(var(--motion-distance) * -1);
  --motion-y: 0px;
}

.js [data-motion="align-right"] {
  --motion-x: var(--motion-distance);
  --motion-y: 0px;
}

.js [data-motion="progress"] {
  --motion-y: 14px;
}

/* Sur mobile, l'alignement reste vertical : un mouvement lateral ferait
   sortir un bloc de la zone de lecture avant sa revelation. */
@media (max-width: 719px) {
  .js [data-motion="align-left"],
  .js [data-motion="align-right"] {
    --motion-x: 0px;
    --motion-y: 18px;
  }
}

.js .reveal.visible,
.js [data-motion].visible {
  --motion-x: 0px;
  --motion-y: 0px;
  opacity: 1;
}

/* --- Respect du reglage systeme.
   Un visiteur qui a demande moins d'animations n'en recoit aucune. --- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal,
  .js [data-motion] {
    --motion-x: 0px;
    --motion-y: 0px;
    --pointer-shift-x: 0px;
    --pointer-shift-y: 0px;
    --pointer-tilt: 0deg;
    opacity: 1;
    transform: none;
  }
}
