/* Via Ferrata Europe — socle commun : tokens, typo, en-tête, boutons, pastilles.
   Direction « Balisage » : voir docs/DESIGN.md */

@font-face {
  font-family: "Fredoka";
  src: url("../fonts/fredoka-latin-wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
/* Le zéro d'Atkinson Hyperlegible est barré par dessin (aucune option OpenType ne l'enlève) : dans le texte courant,
   les chiffres sont donc pris dans Fredoka, comme partout ailleurs sur le site. Zéro rond, non barré. */
@font-face {
  font-family: "VF Chiffres";
  src: url("../fonts/fredoka-latin-wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0030-0039;
  size-adjust: 97%;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-next-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("../fonts/atkinson-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --jaune: #ffcb05;
  --jaune-clair: #fff1b8;
  /* en-tête : vert sapin profond, texte crème (9:1), jaune dessus 6,7:1 */
  --sapin: #0f4a39;
  --sapin-2: #175c48;
  --creme: #f5f1e4;
  --encre: #1b2a24;
  --encre-2: #55625b;
  --papier: #fbfbf6;
  --blanc: #fff;
  --brume: #eef2e8;
  --foret: #e3edd3;
  --lac: #cfe6f3;
  --bleu: #1b6fc2;
  --rouge: #d62b1f;
  --rouge-clair: #fbe3df;
  --vert: #177e40;
  --brun: #9a5b2b;
  --filet: #d5dbcb;
  /* contour des champs et des puces : 3:1 au moins sur tous les fonds clairs */
  --bord: #7f8b84;
  /* liens et petits textes colorés : 5:1 au moins sur les fonds teintés */
  --lien: #155fa8;
  --vert-texte: #146b37;

  --k1: #177e40;
  --k2: #1b6fc2;
  --k3: #f59f00;
  --k4: #d62b1f;
  --k5: #7a2e9a;
  --k6: #1b1b1f;

  --f-titre: "Fredoka", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --f-texte: "VF Chiffres", "Atkinson Next", "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;

  --t-13: 0.8125rem;
  --t-15: 0.9375rem;
  --t-17: 1.0625rem;
  --t-20: 1.25rem;
  --t-24: 1.5rem;
  --t-30: 1.875rem;
  --t-40: 2.5rem;
  --t-54: 3.375rem;

  --r-8: 8px;
  --r-12: 12px;
  --r-18: 18px;
  --socle: 0 3px 0 var(--encre);
  --flotte: 0 6px 20px rgb(27 42 36 / 0.22);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --top-h: 56px;
}

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

/* Filet de sécurité : rien ne doit provoquer de défilement horizontal. Les vraies causes sont traitées à la source
   (min-width: 0, retours à la ligne) ; `clip` ne crée pas de zone de défilement et laisse `sticky` fonctionner. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  accent-color: var(--encre);
  caret-color: var(--bleu);
  scrollbar-color: var(--bord) transparent;
  -webkit-tap-highlight-color: rgb(255 203 5 / 0.35);
}

::selection {
  background: var(--jaune);
  color: var(--encre);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 400 var(--t-17) / 1.5 var(--f-texte);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--f-titre);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: break-word;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--lien);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
}
a:hover {
  color: var(--encre);
}

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

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--bleu);
  outline-offset: 2px;
  border-radius: 6px;
}

[hidden] {
  display: none !important;
}

[id] {
  scroll-margin-top: calc(var(--top-h) + 20px);
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 3000;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--encre);
  color: var(--blanc);
  padding: 0 16px;
  border-radius: var(--r-12);
  font: 500 var(--t-15) var(--f-titre);
}
.skip:focus {
  top: 8px;
  color: var(--blanc);
}
.skip + .skip {
  left: 190px;
}

.ico {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.24em;
}

/* ---------- En-tête : la bande sapin, le panneau jaune en logo ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 16px;
  background: var(--sapin);
  color: var(--creme);
  border-bottom: 2px solid var(--encre);
}
/* Le bleu ne tient pas sur le sapin (2:1) : anneau jaune. */
.top :focus-visible {
  outline-color: var(--jaune);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
  margin-right: auto;
  color: var(--creme);
  text-decoration: none;
  font: 600 var(--t-20) / 1 var(--f-titre);
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.brand > span {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.brand svg {
  width: 34px;
  height: 34px;
  flex: none;
}

.nav {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-12);
  color: var(--creme);
  text-decoration: none;
  font: 500 var(--t-17) / 1 var(--f-titre);
}
.nav a:hover {
  background: var(--sapin-2);
}
/* Sélectionné dans l'en-tête : fond crème, texte sapin (même langage que la bascule de langue). */
.nav a[aria-current="page"] {
  background: var(--creme);
  color: var(--sapin);
}

.lang {
  display: inline-flex;
  flex: none;
  margin-left: 6px;
  border: 2px solid var(--creme);
  border-radius: 999px;
  background: none;
  overflow: hidden;
}
.lang button {
  min-width: 40px;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  background: none;
  font: 600 var(--t-13) / 1 var(--f-titre);
  letter-spacing: 0.02em;
}
.lang button:hover {
  background: var(--sapin-2);
}
.lang button[aria-pressed="true"] {
  background: var(--creme);
  color: var(--sapin);
}
.lang button:focus-visible {
  outline-offset: -3px;
  border-radius: 999px;
}
.lang button[aria-pressed="true"]:focus-visible {
  outline-color: var(--sapin);
}

@media (max-width: 640px) {
  .top {
    padding: 0 10px;
    gap: 4px;
  }
  .brand {
    font-size: var(--t-17);
    gap: 8px;
  }
  .brand svg {
    width: 30px;
    height: 30px;
  }
  .nav a {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
  }
  .nav a span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .nav a .ico {
    width: 24px;
    height: 24px;
  }
  .lang {
    margin-left: 2px;
  }
  .lang button {
    position: relative;
    min-width: 34px;
    min-height: 32px;
  }
  .lang button::after {
    content: "";
    position: absolute;
    inset: -8px 0;
  }
  .brand {
    min-height: 44px;
  }
}
@media (max-width: 460px) {
  .brand {
    font-size: 1rem;
    gap: 7px;
  }
  .brand svg {
    width: 28px;
    height: 28px;
  }
  /* le logo ramène déjà à la carte */
  .nav a[data-nav="map"] {
    display: none;
  }
  .nav a {
    min-width: 42px;
  }
}
@media (max-width: 340px) {
  .brand b {
    display: none;
  }
}
@media (min-width: 641px) {
  .nav a .ico {
    display: none;
  }
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid var(--encre);
  border-radius: var(--r-12);
  background: var(--blanc);
  color: var(--encre);
  box-shadow: var(--socle);
  font: 500 var(--t-17) / 1.1 var(--f-titre);
  text-decoration: none;
  transition:
    transform 140ms var(--ease),
    box-shadow 140ms var(--ease),
    background-color 140ms;
}
.btn:hover {
  background: var(--jaune-clair);
  color: var(--encre);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--encre);
}
.btn--jaune {
  background: var(--jaune);
}
.btn--jaune:hover {
  background: #ffd83d;
}
.btn--encre {
  background: var(--encre);
  color: var(--blanc);
  box-shadow: 0 3px 0 #000;
}
.btn--encre:hover {
  background: #2b3f37;
  color: var(--blanc);
}
.btn--plat {
  box-shadow: none;
  border-color: var(--filet);
}
.btn--plat:active {
  box-shadow: none;
  transform: none;
}
.btn--petit {
  min-height: 40px;
  padding: 0 12px;
  font-size: var(--t-15);
}
@media (pointer: coarse) {
  .btn--petit {
    min-height: 44px;
  }
}
.btn[aria-pressed="true"] {
  background: var(--encre);
  color: var(--blanc);
  box-shadow: 0 1px 0 #000;
  transform: translateY(2px);
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.lien-bouton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  min-height: 28px;
  background: none;
  color: var(--lien);
  font: 500 var(--t-15) var(--f-titre);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.16em;
}
.lien-bouton:hover {
  color: var(--encre);
}

/* ---------- Pastilles de difficulté ---------- */

[data-k="1"] { --k: var(--k1); --k-txt: #fff; }
[data-k="2"] { --k: var(--k2); --k-txt: #fff; }
[data-k="3"] { --k: var(--k3); --k-txt: var(--encre); }
[data-k="4"] { --k: var(--k4); --k-txt: #fff; }
[data-k="5"] { --k: var(--k5); --k-txt: #fff; }
[data-k="6"] { --k: var(--k6); --k-txt: #fff; }

.k {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 34px;
  height: 34px;
  padding: 0 7px;
  border: 2px solid var(--encre);
  border-radius: 999px;
  background: var(--k, var(--encre-2));
  color: var(--k-txt, #fff);
  font: 600 var(--t-15) / 1 var(--f-titre);
  white-space: nowrap;
}
/* Cotation inconnue : « ? » gris, comme sur la carte. */
.k[data-k=""] {
  font-size: 1.15em;
}
.k--petit {
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  font-size: var(--t-13);
}
.k--grand {
  min-width: 64px;
  height: 64px;
  padding: 0 12px;
  border-width: 3px;
  font-size: var(--t-24);
}

/* ---------- Étiquettes ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brume);
  color: var(--encre);
  font: 500 var(--t-13) / 1.3 var(--f-titre);
  white-space: nowrap;
}
.tag .ico {
  width: 15px;
  height: 15px;
}
.tag--ferme {
  background: var(--rouge);
  color: #fff;
}
.tag--famille {
  background: var(--foret);
}
.tag--info {
  background: var(--jaune-clair);
}

/* Balise blanc-rouge-blanc devant les titres de section */
.balise {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 13px;
  border: 1.5px solid var(--encre);
  border-radius: 3px;
  background: linear-gradient(#fff 0 33%, var(--rouge) 33% 67%, #fff 67%);
}

/* ---------- Pages de contenu ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.page--etroite {
  max-width: 820px;
}

.retour {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--encre);
  font: 500 var(--t-15) var(--f-titre);
  text-decoration: none;
}
.retour:hover {
  text-decoration: underline;
}

.h1 {
  font-size: clamp(var(--t-30), 5vw, var(--t-54));
  letter-spacing: -0.01em;
}
.h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-24);
}
.chapo {
  max-width: 62ch;
  font-size: var(--t-20);
  line-height: 1.45;
}
.note {
  color: var(--encre-2);
  font-size: var(--t-15);
}

.etat {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 40px 20px;
  text-align: center;
}
.etat > svg {
  width: 150px;
  height: auto;
}
.etat h2,
.etat h1 {
  font-size: var(--t-24);
}
.etat p {
  max-width: 44ch;
  color: var(--encre-2);
}

body > main {
  flex: 1 0 auto;
  width: 100%;
}

/* ---------- Pied de page ---------- */

.pied {
  border-top: 2px solid var(--encre);
  background: var(--brume);
}
.pied__in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 20px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 24px;
  font-size: var(--t-15);
}
.pied__in p:first-child {
  margin-right: auto;
}
.pied a {
  color: var(--encre);
  font-weight: 700;
}
.pied nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.pied nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 400;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Champs partagés ---------- */

.brand b {
  font-weight: inherit;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 46px;
  padding: 0 40px 0 14px;
  border: 2px solid var(--encre);
  border-radius: var(--r-12);
  background: var(--blanc)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2a24' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 12px center / 18px;
  font: 500 var(--t-17) / 1.2 var(--f-titre);
  text-overflow: ellipsis;
}
.select--petit {
  width: auto;
  min-height: 38px;
  padding: 0 34px 0 12px;
  border-width: 1.5px;
  border-color: var(--bord);
  background-position: right 10px center;
  background-size: 16px;
  font-size: var(--t-15);
}
.select--petit:hover {
  border-color: var(--encre);
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: var(--r-12);
  background: none;
  color: var(--encre);
}
.iconbtn:hover {
  background: rgb(27 42 36 / 0.09);
}
.iconbtn .ico {
  width: 22px;
  height: 22px;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--encre);
  color: #fff;
  font: 600 12px / 1 var(--f-titre);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 4000;
  max-width: min(92vw, 440px);
  padding: 12px 18px;
  border: 2px solid var(--encre);
  border-radius: var(--r-12);
  background: var(--encre);
  color: #fff;
  box-shadow: var(--flotte);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: var(--t-15);
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 180ms,
    transform 180ms var(--ease);
}
.toast.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.toast button {
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: 600 var(--t-15) var(--f-titre);
}
.toast button:hover {
  background: var(--jaune);
  border-color: var(--jaune);
  color: var(--encre);
}
.toast[data-kind="alerte"] {
  background: var(--rouge-clair);
  color: var(--encre);
}

/* Numéros d'urgence : même bandeau sur la fiche et la page À propos. Le numéro au-dessus, son libellé dessous. */
.sos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 6px 16px;
  padding: 14px 18px 12px;
  border: 2px solid var(--encre);
  border-radius: var(--r-18);
  background: var(--rouge);
  color: #fff;
}
.sos h3 {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-17);
}
.sos a {
  display: grid;
  gap: 1px;
  align-content: start;
  min-height: 48px;
  color: #fff;
  font-size: var(--t-13);
  line-height: 1.25;
  text-decoration: none;
}
.sos a:hover b {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.12em;
}
.sos a:focus-visible {
  outline-color: #fff;
}
.sos b {
  font: 600 var(--t-30) / 1.05 var(--f-titre);
}

