/* ============================================================================
   BOUGE — base.css
   Remise à zéro, rôles typographiques, coquille et utilitaires.
   Aucune valeur en dur : tout vient de tokens.css.
   Ordre de chargement obligatoire :
     tokens.css → base.css → composants.css → mouvement.css
   ============================================================================ */

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

html {
  font-family: var(--police);
  /* Texte de base : 17 px, comme la maquette de référence de l'écran d'exercice
     (`apercu/index.html`, `apercu/README.md` § règles de simplicité). Toute l'échelle de
     tokens.css est exprimée en `rem` : c'est cette seule ligne qui la pose, et les tailles
     gardent entre elles les rapports dessinés. Les espacements sont en px, ils ne bougent pas. */
  font-size: 17px;
  line-height: var(--ligne-4);
  background: var(--fond);
  color: var(--texte);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font-size: var(--taille-4);
  font-weight: var(--graisse-4);
  font-variation-settings: "opsz" var(--opsz-4);
  overscroll-behavior-y: contain;
}

/* Pendant une séance, la page ne défile pas : l'exercice tient dans l'écran. */
html[data-seance="en-cours"] body {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

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

:focus {
  outline: none;
}

/* Le contour de focus doit rester visible sur le jaune GO comme sur le sable :
   deux anneaux, encre puis fond, l'un des deux tranche toujours. */
:focus-visible {
  outline: 3px solid var(--texte);
  outline-offset: 2px;
  border-radius: var(--rayon-s);
  box-shadow: 0 0 0 6px var(--fond);
}

::selection {
  background: var(--accent);
  color: var(--sur-accent);
}

/* ---------- Rôles typographiques ---------- */

.t1,
.t2,
.t3,
.t4,
.t5 {
  font-variation-settings: "opsz" var(--opsz-4);
}

.t1 {
  font-size: var(--taille-1);
  font-weight: var(--graisse-1);
  line-height: var(--ligne-1);
  letter-spacing: var(--lettre-1);
  font-variation-settings: "opsz" var(--opsz-1);
  font-variant-numeric: var(--chiffres);
}

.t2 {
  font-size: var(--taille-2);
  font-weight: var(--graisse-2);
  line-height: var(--ligne-2);
  letter-spacing: var(--lettre-2);
  font-variation-settings: "opsz" var(--opsz-2);
}

.t3 {
  font-size: var(--taille-3);
  font-weight: var(--graisse-3);
  line-height: var(--ligne-3);
  letter-spacing: var(--lettre-3);
  font-variation-settings: "opsz" var(--opsz-3);
}

.t4 {
  font-size: var(--taille-4);
  font-weight: var(--graisse-4);
  line-height: var(--ligne-4);
}

.t5 {
  font-size: var(--taille-5);
  font-weight: var(--graisse-5);
  line-height: var(--ligne-5);
  letter-spacing: var(--lettre-5);
  font-variation-settings: "opsz" var(--opsz-5);
}

.doux {
  color: var(--texte-doux);
}

/* Chiffres : toujours tabulaires, sinon le chronomètre tremble à chaque seconde. */
.nombre,
.chrono__valeur,
.compte__chiffre,
input[inputmode="numeric"],
input[inputmode="decimal"] {
  font-variant-numeric: var(--chiffres);
}

/* Une unité collée à un chiffre reste plus petite et secondaire. */
.unite {
  font-size: var(--taille-5);
  font-weight: var(--graisse-5);
  color: var(--texte-doux);
}

/* ---------- Coquille ---------- */

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app__principal {
  flex: 1;
  width: 100%;
  padding: 0 var(--marge-ecran)
    calc(var(--hauteur-nav) + env(safe-area-inset-bottom, 0px) + var(--espace-32));
  padding-top: env(safe-area-inset-top, 0px);
}

.ecran {
  width: 100%;
  margin: 0 auto;
  padding-top: var(--espace-24);
}

.ecran__titre {
  font-size: var(--taille-2);
  font-weight: var(--graisse-2);
  line-height: var(--ligne-2);
  letter-spacing: var(--lettre-2);
  font-variation-settings: "opsz" var(--opsz-2);
  margin-bottom: var(--espace-4);
}

.ecran__intro {
  color: var(--texte-doux);
  font-size: var(--taille-4);
  margin-bottom: var(--espace-24);
}

@media (min-width: 640px) {
  .ecran {
    max-width: var(--largeur-colonne);
  }
}

/* Bureau : la barre de navigation passe en colonne à gauche. */
@media (min-width: 1024px) {
  .app {
    flex-direction: row;
  }

  .app__principal {
    padding-left: calc(88px + var(--marge-ecran));
    padding-bottom: var(--espace-48);
  }

  .ecran {
    max-width: var(--largeur-max);
  }
}

/* ---------- Sections ---------- */

.section {
  margin-top: var(--espace-32);
}

.section__entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--espace-12);
  min-height: var(--cible-tactile);
}

.section__titre {
  font-size: var(--taille-3);
  font-weight: var(--graisse-3);
  line-height: var(--ligne-3);
  letter-spacing: var(--lettre-3);
  font-variation-settings: "opsz" var(--opsz-3);
}

/* ---------- Utilitaires ---------- */

.pour-lecteur-decran {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icone {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icone--s {
  width: 18px;
  height: 18px;
}

.icone--l {
  width: 32px;
  height: 32px;
  stroke-width: 2.25;
}

.pile > * + * {
  margin-top: var(--espace-16);
}

.rangee {
  display: flex;
  align-items: center;
  gap: var(--espace-12);
}

.pousse {
  flex: 1;
  min-width: 0;
}

.separateur {
  height: 1px;
  background: var(--bordure);
  border: 0;
  margin: 0;
}

/* `hidden` doit l'emporter sur n'importe quel display de classe. */
[hidden] {
  display: none !important;
}
