/* Socle : polices, reset léger, typographie, plans de l'affiche, conteneurs,
   sections, utilitaires. */

/* Polices de l'app (dsm/fonts, licence OFL), sous-ensemble latin servi depuis
   le site : la page n'appelle aucun tiers. Régénérées par tools/gen-assets.sh. */
@font-face {
  font-family: 'Jost';
  src: url('../assets/fonts/jost-800-latin.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Jost';
  src: url('../assets/fonts/jost-900-latin.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sofia Sans Condensed';
  src: url('../assets/fonts/sofia-sans-condensed-800-latin.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sofia Sans';
  src: url('../assets/fonts/sofia-sans-600-latin.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sofia Sans';
  src: url('../assets/fonts/sofia-sans-700-latin.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Brygada 1918';
  src: url('../assets/fonts/brygada-400-italic-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Brygada 1918';
  src: url('../assets/fonts/brygada-500-italic-latin.woff2') format('woff2');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* L'affiche : Jost en capitales, comme les titres de l'app. */
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-poster);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}

h2 {
  font-size: clamp(2.1rem, 5.4vw, 3.4rem);
}

h3 {
  font-weight: 800;
  font-size: 1.375rem;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

p,
ul,
ol {
  margin: 0;
}

p {
  text-wrap: pretty;
}

strong {
  font-weight: 700;
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
}

/* ---------- Les trois plans de l'affiche (MountainBackdrop) ---------- */

/* Le ciel : en-têtes, affiches. La nuit, il s'étoile. */
.plane-sky {
  color: var(--on-sky);
  background: var(--stars) 0 0 / 420px repeat, var(--sky);
}

/* La face : le terrain du jeu, sous ses courbes de niveau. Les courbes sont un
   masque : leur couleur suit le thème sans repeindre. */
.plane-face {
  position: relative;
  isolation: isolate;
  color: var(--text-primary);
  background: var(--face);
}

.plane-face::before,
.plane-face::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  -webkit-mask: url('../assets/contours-minor.svg') 0 0 / 1200px 1200px repeat;
  mask: url('../assets/contours-minor.svg') 0 0 / 1200px 1200px repeat;
  background: var(--contour);
}

.plane-face::after {
  -webkit-mask-image: url('../assets/contours-index.svg');
  mask-image: url('../assets/contours-index.svg');
  background: var(--contour-index);
}

/* Le sol : la zone d'action. */
.plane-ground {
  color: var(--on-ground);
  background: var(--ground);
}

/* Arêtes dentelées (tools/gen-art.py) : étirées en largeur, pas en hauteur. */
.edge {
  display: block;
  width: 100%;
  pointer-events: none;
}

/* ---------- Voix de texte ---------- */

/* Étiquette espacée : « COMMENT ON JOUE », « TOUR 5/12 ». */
.label {
  font-family: var(--font-poster);
  font-weight: 800;
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* La carte : Brygada italique, pour les définitions et le chambrage. */
.map {
  font-family: var(--font-map);
  font-style: italic;
  font-weight: 500;
}

/* ---------- Conteneurs & sections ---------- */

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

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--section-y);
}

.section-head {
  max-width: 700px;
  margin: 0 auto clamp(2.5rem, 6vw, 3.5rem);
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

.section-head .label {
  color: var(--text-secondary);
}

/* Convention : les règles génériques d'un composant ne ciblent que les
   paragraphes sans classe, pour ne jamais écraser une variante nommée. */
.section-head p:not([class]) {
  font-size: 1.15rem;
  color: var(--text-secondary);
  text-wrap: balance;
}

.section-foot {
  max-width: 640px;
  margin: clamp(2.5rem, 6vw, 3.5rem) auto 0;
  text-align: center;
  font-family: var(--font-map);
  font-style: italic;
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.3;
  text-wrap: balance;
}

/* ---------- Accessibilité ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--plate);
  color: var(--on-plate);
}

.skip-link:focus {
  left: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Pas de `display: none` : les clipPath des insignes ne se rendraient plus. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Révélation au défilement (seulement si le JS tourne) ---------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--duration-reveal) ease,
    transform var(--duration-reveal) var(--ease-decelerate);
}

html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

  html.js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
