/*
  Base : reset minimal, typographie, focus, utilitaires.
  Aucune couleur en dur : tout passe par tokens.css.
*/

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Pas de rectangle de surlignage du navigateur au toucher : le retour d'appui est dessiné par le site
     (:active sur les boutons, les liens, le menu, les cartes et les choix du formulaire). */
  -webkit-tap-highlight-color: transparent;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  overflow-wrap: break-word;   /* un mot plus long que la ligne se coupe, il ne fait pas défiler la page */
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: var(--step-body);
  line-height: var(--leading-body);
}

@media (min-width: 48em) {
  body {
    font-size: var(--step-lead);
  }
}

main {
  flex: 1 0 auto;
}

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

img {
  height: auto;
}

h1,
h2,
h3,
.h1,
.h2,
.h3 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  text-wrap: balance;
}

h1,
.h1 {
  font-size: var(--step-h1);
  line-height: var(--leading-h1);
}

h2,
.h2 {
  font-size: var(--step-h2);
  line-height: var(--leading-h2);
}

h3,
.h3 {
  font-size: var(--step-h3);
  line-height: var(--leading-h3);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
}

p,
li {
  max-width: var(--measure);
}

strong,
b {
  font-weight: var(--weight-strong);
}

small,
.small {
  font-size: var(--step-small);
  line-height: var(--leading-small);
}

.muted {
  color: var(--text-muted);
}

/* Les liens sont soulignés en permanence, pas seulement au survol */
a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

/* Survol : seulement avec une souris. Au toucher, :hover reste collé après le tap (et au retour sur la page) :
   sans cette garde, le texte d'un bouton prenait la couleur de survol des liens, identique à son fond (1,04:1 en sombre). */
@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--link-hover);
    text-decoration-thickness: 0.14em;
  }
}

/* Retour d'appui des liens (au toucher, c'est lui qui montre que le tap a été pris en compte) */
a:not(.btn):active {
  color: var(--link-hover);
  text-decoration-thickness: 0.14em;
}

/* Focus toujours visible, jamais supprimé */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Prix et nombres avec unité : jamais coupés en fin de ligne */
.nowrap {
  white-space: nowrap;
}

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

/* Icônes de contenu (sprite icons/sprite.svg) : trait de 2 px comme la flèche des liens externes, aucun aplat.
   Toujours décoratives : aria-hidden dans le HTML, le sens est dans un texte (visible, ou masqué à l'écran).
   La couleur suit la couleur du texte (currentColor) ; on la fixe sur le conteneur, jamais en dur ici. */
.icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--action-bg);
  color: var(--action-text);
  font-weight: var(--weight-strong);
  border-radius: var(--radius-s);
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
}

/* Le lien d'évitement est un bouton (fond d'action) : jamais la couleur de survol ou d'appui des liens */
a.skip-link:hover,
a.skip-link:active {
  color: var(--action-text);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 48em) {
  :root {
    --gutter: 2rem;
  }
}

/* Mouvement réduit : plus de transition ni d'animation */
@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;
  }
}
