/* Socle : variables, typographie, scène et charpente de page.
 *
 * Direction « Bivouac » : une nuit de forêt, un feu de camp au bas de l'écran. Un seul
 * thème. Les panneaux sont des vitres sombres posées sur la scène, à angles vifs, avec
 * une arête plus claire en haut. La braise (orange) marque ce qui est choisi, l'action
 * principale et le total des points ; la mousse (vert) ce qui est positif ou rend des
 * points ; la rouille ce qui est négatif ou en erreur.
 *
 * Les composants n'écrivent jamais une couleur en dur : ils prennent ces variables.
 * impression.css les redéfinit toutes pour le papier.
 */

:root {
  color-scheme: dark;

  /* Fonds */
  --c-nuit: #06161b;                          /* fond de page, sous la scène */
  --c-nuit-pleine: #071a1f;                   /* fond opaque : ce qui passe par-dessus du texte */
  --c-bandeau: rgba(4, 13, 16, 0.84);         /* barre du haut */
  --c-barre-haut: rgba(4, 13, 16, 0.68);      /* barre du bas, posée sur le feu de la scène */
  --c-barre-bas: rgba(4, 13, 16, 0.36);
  --c-barre-sombre-haut: rgba(4, 13, 16, 0.86); /* la même, budget dépassé : le feu baisse */
  --c-barre-sombre-bas: rgba(4, 13, 16, 0.7);
  --c-feu-proche: rgba(216, 86, 28, 0.5);     /* lueur peinte dans la barre quand elle est opaque */
  --c-feu-loin: rgba(124, 43, 20, 0.16);
  --c-panneau: rgba(7, 21, 25, 0.66);         /* vitre d'un panneau */
  --c-tete: rgba(3, 12, 15, 0.52);            /* tête d'un panneau, en-tête de tableau */
  --c-creux: rgba(2, 9, 11, 0.6);             /* fond d'un champ, piste d'une jauge */
  --c-relief: rgba(10, 30, 35, 0.82);         /* fond d'un bouton : sombre, même devant le feu */
  --c-relief-leger: rgba(196, 230, 222, 0.07); /* fond d'un petit bouton, dans un panneau */
  --c-survol: rgba(196, 230, 222, 0.11);

  /* Traits */
  --c-arete: rgba(196, 230, 222, 0.3);        /* bord haut d'un panneau */
  --c-bord: rgba(196, 230, 222, 0.13);        /* bord d'un panneau */
  --c-filet: rgba(196, 230, 222, 0.08);       /* séparation de deux lignes */
  --c-bord-controle: rgba(196, 230, 222, 0.48); /* bord d'un champ ou d'un bouton */
  --c-hachure: rgba(196, 230, 222, 0.055);    /* hachures d'un choix indisponible */

  /* Texte */
  --c-cendre: #e6eee8;                        /* texte */
  --c-brume: #a9beb6;                         /* texte secondaire */
  --c-eteint: #9aaaa4;                        /* nom d'un choix indisponible */

  /* Accents */
  --c-braise: #f08a3c;                        /* sélection, action principale, focus */
  --c-braise-vive: #ffbf73;                   /* braise en texte ou en trait fin */
  --c-braise-claire: #ffe2b2;                 /* haut de la flamme, dans un dégradé */
  --c-braise-fond: rgba(240, 138, 60, 0.3);   /* fond d'une ligne choisie */
  --c-braise-fond-leger: rgba(240, 138, 60, 0.1);
  --c-braise-halo: rgba(255, 138, 48, 0.55);  /* lueur autour du total des points */
  --c-sur-braise: #1b0d03;                    /* texte posé sur la braise */
  --c-mousse: #a3cf7c;                        /* trait positif, points rendus, validé */
  --c-mousse-sombre: #5d883c;
  --c-mousse-fond: rgba(163, 207, 124, 0.12);
  --c-rouille: #f09880;                       /* trait négatif, erreur, suppression */
  --c-rouille-sombre: #9c4532;
  --c-rouille-fond: rgba(238, 138, 114, 0.13);
  --c-ombre: rgba(1, 6, 8, 0.6);

  /* Scène : le ciel du crépuscule, la brume, les trois plans de pins, le feu */
  --c-scene-ciel-haut: #040d15;
  --c-scene-ciel: #071d28;
  --c-scene-ciel-bas: #0d363d;
  --c-scene-horizon: #1b5853;
  --c-scene-lueur: #86c9aa;
  --c-scene-lueur-loin: #3f8f80;
  --c-scene-brume: #5aa594;
  --c-scene-etoile: #dff3ee;
  --c-scene-crete-loin: #123a40;
  --c-scene-crete: #0b2a30;
  --c-scene-crete-proche: #05161a;
  --c-scene-foyer: rgba(255, 208, 138, 0.7);
  --c-scene-foyer-bord: rgba(255, 138, 42, 0);
  --c-scene-feu: rgba(255, 162, 76, 0.95);
  --c-scene-feu-proche: rgba(216, 86, 28, 0.6);
  --c-scene-feu-loin: rgba(124, 43, 20, 0.22);
  --c-scene-feu-bord: rgba(124, 43, 20, 0);
  --c-scene-etincelle: #ffcf94;
  /* Portrait vide : le même crépuscule, une silhouette à contre-jour */
  --c-portrait-ciel: #0a2630;
  --c-portrait-horizon: #1c5450;
  --c-portrait-sol: #3a3a2a;

  /* Typographie. Les deux premières polices sont servies par le site (voir @font-face
   * plus bas) ; les suivantes, celles du système, servent le temps du chargement. */
  --police-titre: "Big Shoulders Display", Bahnschrift, "Avenir Next Condensed",
    "Roboto Condensed", "Arial Narrow", sans-serif-condensed, sans-serif;
  --police-texte: "Libre Franklin", "Segoe UI", system-ui, Roboto, "Helvetica Neue",
    sans-serif;
  --t-mini: 0.75rem;
  --t-petit: 0.8125rem;
  --t-dense: 0.875rem;       /* listes et panneaux du créateur */
  --t-corps: 1rem;
  --t-tete: 1.1875rem;       /* tête d'un panneau */
  --t-h3: 1.375rem;
  --t-h2: 1.75rem;
  --t-h1: 2.75rem;
  --t-chiffre: 4.25rem;      /* le total des points */

  /* Espacements */
  --e-1: 0.25rem;
  --e-2: 0.5rem;
  --e-3: 0.75rem;
  --e-4: 1rem;
  --e-5: 1.5rem;
  --e-6: 2rem;
  --e-7: 3rem;
  --e-8: 4.5rem;

  /* Mesures */
  --cible: 2.75rem;            /* hauteur minimale d'un contrôle : 44 px */
  --tete: 1.875rem;            /* hauteur de la tête d'un panneau */
  --largeur-page: 72rem;
  --marge-page: var(--e-5);
  --mesure: 38rem;             /* largeur d'un paragraphe de lecture */
  --champ-court: 9rem;         /* un nombre */
  --champ-moyen: 22rem;        /* un nom, un mot de passe */
}

/* --- Polices ---
 * Big Shoulders Display pour les titres et les nombres, Libre Franklin pour le texte :
 * deux polices libres (SIL OFL 1.1, voir fonts/LISEZMOI.txt), à graisse variable, servies
 * par le site. Chaque fichier ne se charge que si la page contient un de ses caractères.
 * « latin-ext » vient avant « latin » : pour un caractère des deux plages (Œ, œ), c'est
 * la dernière déclarée qui sert, et le français tient tout entier dans « latin ». */

@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/big-shoulders-display-latin-ext.bd231f7e70d6.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;
}

@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/big-shoulders-display-latin.b5152247f4c0.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: "Libre Franklin";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/libre-franklin-latin-ext.50db3ad6b326.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;
}

@font-face {
  font-family: "Libre Franklin";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/libre-franklin-latin.bc34823f42d5.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;
}

/* --- Remise à plat --- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--c-bord-controle) transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--c-nuit);
  color: var(--c-cendre);
  font-family: var(--police-texte);
  font-size: var(--t-corps);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

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

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

/* --- Typographie --- */

h1,
h2,
h3,
legend {
  margin: 0 0 var(--e-3);
  font-family: var(--police-titre);
  font-weight: 700;
  font-stretch: 75%;
  line-height: 1.05;
  letter-spacing: 0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-h1);
  font-weight: 800;
  line-height: 0.95;
}

h2 {
  font-size: var(--t-h2);
}

h3,
legend {
  font-size: var(--t-h3);
}

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

a {
  color: var(--c-braise-vive);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--c-braise-claire);
  text-decoration-thickness: 2px;
}

/* Texte à lire (présentations, descriptions, histoire) : une ligne courte et aérée. */
.texte {
  max-width: var(--mesure);
  line-height: 1.6;
}

/* Un seul contour de focus pour tout le site, jamais retiré. */
:focus-visible {
  outline: 2px solid var(--c-braise-vive);
  outline-offset: 2px;
}

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

/* Planche de pictogrammes : des <symbol> que les pages reprennent avec <use>. */
.planche {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.picto {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
}

/* --- Scène : la crête de pins au crépuscule, le feu de camp au bas de l'écran ---
 * Fixe derrière toutes les pages. Le dessin (commun/_scene.html) ne bouge pas ; la
 * lueur du feu et ses étincelles sont à part, pour ne vaciller que si l'on n'a pas
 * demandé moins d'animations. */

.scene {
  --u: max(100vw / 1280, 100vh / 800);   /* l'échelle du dessin, comme « slice » */
  /* Le feu ne grandit pas sans fin avec l'écran : la barre du bas, elle, garde sa
   * hauteur, et ce qui s'y lit doit rester lisible devant lui. */
  --u-feu: min(var(--u), 1.5px);
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.scene__dessin {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

.scene__ciel-haut { stop-color: var(--c-scene-ciel-haut); }
.scene__ciel { stop-color: var(--c-scene-ciel); }
.scene__ciel-bas { stop-color: var(--c-scene-ciel-bas); }
.scene__horizon { stop-color: var(--c-scene-horizon); }
.scene__lueur { stop-color: var(--c-scene-lueur); }
.scene__lueur-loin { stop-color: var(--c-scene-lueur-loin); }
.scene__brume { stop-color: var(--c-scene-brume); }
.scene__etoiles { fill: var(--c-scene-etoile); }
.scene__crete-loin { fill: var(--c-scene-crete-loin); }
.scene__crete { fill: var(--c-scene-crete); }
.scene__crete-proche { fill: var(--c-scene-crete-proche); }

.scene__feu {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: calc(1080 * var(--u-feu));
  height: calc(215 * var(--u-feu));
  transform: translateX(-50%);
  background:
    radial-gradient(
      ellipse calc(150 * var(--u-feu)) calc(44 * var(--u-feu)) at 50% 100%,
      var(--c-scene-foyer),
      var(--c-scene-foyer-bord)
    ),
    radial-gradient(
      ellipse 50% 100% at 50% 100%,
      var(--c-scene-feu),
      var(--c-scene-feu-proche) 28%,
      var(--c-scene-feu-loin) 62%,
      var(--c-scene-feu-bord)
    );
}

.scene__etincelle {
  position: absolute;
  bottom: calc(var(--y) * var(--u-feu));
  left: calc(50% + var(--x) * var(--u-feu));
  width: calc(2.4 * var(--u-feu));
  height: calc(2.4 * var(--u-feu));
  border-radius: 50%;
  background: var(--c-scene-etincelle);
  opacity: 0.55;
}

@media (prefers-reduced-motion: no-preference) {
  .scene__feu {
    animation: scene-vacille 5.5s ease-in-out infinite;
    will-change: opacity;
  }

  .scene__etincelle {
    animation: scene-monte var(--duree) linear var(--retard) infinite;
    will-change: transform, opacity;
  }
}

@keyframes scene-vacille {
  0%, 100% { opacity: 1; }
  18% { opacity: 0.9; }
  31% { opacity: 0.97; }
  47% { opacity: 0.86; }
  62% { opacity: 0.95; }
  80% { opacity: 0.9; }
}

@keyframes scene-monte {
  0% { transform: translateY(calc(18 * var(--u-feu))); opacity: 0; }
  18% { opacity: 0.9; }
  100% { transform: translateY(calc(-52 * var(--u-feu))); opacity: 0; }
}

/* --- Charpente --- */

.lien-evitement {
  position: absolute;
  top: var(--e-2);
  left: var(--e-2);
  z-index: 10;
  padding: var(--e-2) var(--e-4);
  background: var(--c-nuit-pleine);
  transform: translateY(-300%);
}

.lien-evitement:focus {
  transform: none;
}

.entete-site {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  padding: 0 var(--e-1) 0 var(--e-3);
  border-bottom: 1px solid var(--c-bord);
  background: var(--c-bandeau);
}

.entete-site__nom {
  display: flex;
  align-items: center;
  gap: var(--e-2);
  min-height: var(--cible);
  color: var(--c-cendre);
  font-family: var(--police-titre);
  font-size: 1.3125rem;
  font-weight: 700;
  font-stretch: 75%;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.entete-site__nom:hover {
  color: var(--c-braise-claire);
}

.entete-site__nom .picto {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--c-braise);
}

.entete-site__menu {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
}

.entete-site__menu form {
  display: flex;
}

.entete-site__lien {
  display: flex;
  align-items: center;
  gap: var(--e-2);
  min-height: var(--cible);
  padding: 0 var(--e-3);
  border: 0;
  background: none;
  color: var(--c-cendre);
  font-size: var(--t-dense);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.entete-site__lien:hover {
  background: var(--c-survol);
  color: var(--c-braise-claire);
}

.entete-site__lien[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--c-braise);
}

.entete-site__lien .picto {
  width: 1rem;
  height: 1rem;
}

.entete-site :focus-visible {
  outline-offset: -2px;
}

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--largeur-page);
  margin-inline: auto;
  padding: var(--e-6) var(--marge-page) var(--e-8);
}

@media (max-width: 40rem) {
  :root {
    --t-h1: 2.125rem;
    --t-h2: 1.5rem;
    --t-chiffre: 3.125rem;
    --marge-page: var(--e-3);
  }

  .entete-site {
    padding-inline: var(--e-2) 0;
  }

  .entete-site__menu {
    justify-content: flex-start;
  }

  .entete-site__lien {
    padding-inline: var(--e-2);
  }

  .page {
    padding-block: var(--e-5) var(--e-7);
  }
}

/* Qui a demandé moins d'animations n'en voit aucune. L'ombre qui signale un cadre à
 * faire défiler (composants.css) n'en est pas une : elle suit le doigt, pas le temps. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  :not(.tableau-cadre, .regles__onglets),
  ::before,
  ::after {
    animation: none !important;
  }
}
