/* Lisière · feuille de style unique. Toutes les valeurs passent par les jetons de :root. */

@font-face {
  font-family: "Young Serif";
  src: url("/fonts/young-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-next-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-next-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-next-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette : la pierre, le toit, le bois, le fil. */
  --calcaire: #e6cf9f;
  --calcaire-rgb: 230 207 159;
  --ocre: #c8913f;
  --ocre-clair: #e3b66a;
  --lauze: #2b3236;
  --lauze-rgb: 43 50 54;
  --lauze-doux: #525b59;
  --chataignier: #34402a;
  --mousse: #a9b57a;
  --papier: #f5ecd9;
  --fil: #b01e2b;
  --fil-sombre: #7c1520;
  --fil-clair: #e0473f;
  --joint: #3a3328;
  --trou: #1d1812;

  /* Teintes des pierres du muret. */
  --pierre-1: #cdb68a;
  --pierre-2: #bfa577;
  --pierre-3: #d8c39b;
  --pierre-4: #b39a6e;

  /* Typographie */
  --police-titre: "Young Serif", "Georgia", serif;
  --police-texte: "Atkinson Hyperlegible Next", "Verdana", sans-serif;
  --t-petit: 0.875rem;
  --t-texte: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --t-moyen: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --t-titre: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
  --t-hero: clamp(2.6rem, 1.2rem + 6.2vw, 7rem);
  --t-montant: clamp(2.6rem, 1.8rem + 3.4vw, 4.5rem);
  --interligne-texte: 1.55;
  --interligne-titre: 1.02;
  --mesure: 34em;

  /* Espacements (échelle de 4) */
  --esp-1: 0.25rem;
  --esp-2: 0.5rem;
  --esp-3: 0.75rem;
  --esp-4: 1rem;
  --esp-5: 1.5rem;
  --esp-6: 2rem;
  --esp-7: 3rem;
  --esp-8: 4.5rem;
  --esp-section: clamp(4rem, 2.5rem + 6vw, 8.5rem);
  --gouttiere: clamp(16px, 4vw, 48px);
  --largeur-max: 1240px;

  /* Formes */
  --rayon: 3px;
  --rayon-carnet: 6px;
  --trait: 2px;
  --trait-fil: 3px;
  --ombre-pose: 6px 6px 0 rgb(0 0 0 / 0.28);
  --ombre-bouton: 0 3px 0 var(--fil-sombre);

  /* Mouvement */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --duree-appui: 160ms;
  --duree-ui: 220ms;
  --duree-revele: 700ms;
  --duree-entree: 1100ms;

  /* Rôles, redéfinis par section sombre */
  --fond: var(--calcaire);
  --encre: var(--lauze);
  --encre-douce: var(--lauze-doux);
  --anneau: var(--lauze);
  --filet: rgb(var(--lauze-rgb) / 0.2);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--calcaire);
  color: var(--lauze);
  font-family: var(--police-texte);
  font-size: var(--t-texte);
  line-height: var(--interligne-texte);
  overflow-x: clip;
}

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

h1,
h2,
h3 {
  font-family: var(--police-titre);
  font-weight: 400;
  line-height: var(--interligne-titre);
  margin: 0;
  text-wrap: balance;
}

h2 {
  font-size: var(--t-titre);
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  max-width: var(--mesure);
  text-wrap: pretty;
}

p + p {
  margin-top: var(--esp-4);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

sup {
  line-height: 0;
}

.appel-note {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.2em;
  font-size: 0.75em;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--fil);
}

:focus-visible {
  outline: 3px solid var(--anneau);
  outline-offset: 3px;
  border-radius: var(--rayon);
}

html:has(.porte[open]) {
  overflow: hidden;
}

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

.evitement {
  position: absolute;
  left: var(--esp-4);
  top: -4rem;
  z-index: 20;
  padding: var(--esp-2) var(--esp-4);
  background: var(--lauze);
  color: var(--papier);
}
.evitement:focus {
  top: var(--esp-4);
}

.enveloppe {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: calc(var(--largeur-max) + 2 * var(--gouttiere));
  margin-inline: auto;
  padding-inline: var(--gouttiere);
}

/* ---------- Boutons et liens forts ---------- */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: var(--esp-3) var(--esp-5);
  border: 0;
  border-radius: var(--rayon);
  background: var(--fil);
  color: var(--papier);
  box-shadow: var(--ombre-bouton);
  font: 700 1rem/1.2 var(--police-texte);
  text-align: center;
  cursor: pointer;
  transition:
    transform var(--duree-appui) var(--ease-out),
    box-shadow var(--duree-appui) var(--ease-out),
    background-color var(--duree-ui) ease;
}
.bouton:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 1px 0 var(--fil-sombre);
}
@media (hover: hover) and (pointer: fine) {
  .bouton:hover {
    background: var(--fil-sombre);
  }
}

.bouton-petit {
  min-height: 2.75rem;
  padding: var(--esp-2) var(--esp-4);
  font-size: var(--t-petit);
}

.bouton-grand {
  min-height: 3.5rem;
  padding: var(--esp-4) var(--esp-6);
  font-size: 1.0625rem;
}

.bouton-clair {
  background: var(--ocre-clair);
  color: var(--lauze);
  box-shadow: 0 3px 0 var(--ocre);
}
.bouton-clair:active {
  box-shadow: 0 1px 0 var(--ocre);
}
@media (hover: hover) and (pointer: fine) {
  .bouton-clair:hover {
    background: var(--calcaire);
  }
}

.lien-fort {
  padding: var(--esp-2) 0;
  border: 0;
  background: none;
  color: inherit;
  font: 700 1rem/1.2 var(--police-texte);
  text-decoration: underline;
  text-decoration-thickness: var(--trait);
  text-underline-offset: 0.3em;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--esp-4) var(--esp-6);
  margin-top: var(--esp-5);
}

.petit {
  font-size: var(--t-petit);
  color: var(--encre-douce);
}

/* ---------- En-tête ---------- */

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: var(--esp-5);
  padding: var(--esp-3) var(--gouttiere);
  background: var(--calcaire);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duree-ui) ease;
}
.entete.defile {
  border-bottom-color: var(--filet);
}

.entete-logo {
  display: block;
  color: var(--lauze);
  --logo-fil: var(--fil);
}

.logo {
  width: clamp(104px, 9vw, 132px);
  height: auto;
  aspect-ratio: 346 / 102;
}

.entete-nav {
  display: none;
  gap: var(--esp-5);
  margin-left: auto;
  font-size: var(--t-petit);
  font-weight: 700;
}
.entete-nav a {
  text-decoration: none;
  padding: var(--esp-2) 0;
}
@media (hover: hover) and (pointer: fine) {
  .entete-nav a:hover {
    text-decoration: underline;
  }
}

.entete .bouton {
  margin-left: auto;
}

@media (min-width: 760px) {
  .entete-nav {
    display: flex;
  }
  .entete .bouton {
    margin-left: 0;
  }
}

@media (max-width: 420px) {
  .entete .bouton {
    padding-inline: var(--esp-3);
    font-size: 0.8125rem;
  }
}

/* ---------- Le fil rouge, signature de la page ---------- */

.principal {
  position: relative;
}

.fil {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  overflow: visible;
  pointer-events: none;
}
.fil-actif .fil {
  display: block;
}
.fil-trace {
  fill: none;
  stroke: var(--fil);
  stroke-width: var(--trait-fil);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fil-noeud {
  fill: var(--fil);
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.4);
  opacity: 0;
  transition:
    transform 420ms var(--ease-out),
    opacity 200ms ease;
}
.fil-noeud.atteint {
  transform: scale(1);
  opacity: 1;
}

/* ---------- Hero ---------- */

.hero {
  padding-top: clamp(1.5rem, 1rem + 3vw, 4rem);
}

.hero-titre {
  position: relative;
  z-index: 2;
  max-width: calc(var(--largeur-max) + 2 * var(--gouttiere));
  margin-inline: auto;
  padding-inline: var(--gouttiere);
}

.hero h1 {
  font-size: var(--t-hero);
  line-height: 0.96;
  letter-spacing: -0.025em;
}

.ligne {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}
.ligne > span {
  display: inline-block;
  animation: monte var(--duree-entree) var(--ease-out) both;
}
.ligne:nth-child(2) > span {
  animation-delay: 90ms;
}

.hero-relance {
  margin-top: var(--esp-4);
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  color: var(--encre-douce);
  animation: apparait 600ms ease 380ms both;
}

.hero-photo {
  position: relative;
  z-index: 2;
  margin: clamp(1.5rem, 1rem + 2vw, 3rem) 0 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  animation: devoile var(--duree-entree) var(--ease-in-out) 120ms both;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 60%;
}

.cadre-repli {
  background-color: var(--chataignier);
  background-image:
    radial-gradient(circle at 50% 100%, transparent 62%, rgb(255 255 255 / 0.04) 63% 67%, transparent 68%),
    radial-gradient(circle at 50% 100%, transparent 62%, rgb(255 255 255 / 0.04) 63% 67%, transparent 68%);
  background-size: 48px 24px;
  background-position: 0 0, 24px 12px;
}

.img-attente {
  transition: opacity 500ms ease;
}
.js .img-attente {
  opacity: 0;
}
.js .img-attente.chargee {
  opacity: 1;
}

.hero-cartouche {
  position: relative;
  z-index: 2;
  margin: 0 var(--gouttiere);
  padding: var(--esp-5) 0 0;
  animation: apparait 600ms ease 520ms both;
}

.hero-promesse {
  font-size: var(--t-moyen);
  line-height: 1.4;
}

@media (max-width: 599px) {
  .hero .actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--esp-2);
  }
  .hero .lien-fort {
    text-align: center;
    padding-block: var(--esp-3);
  }
}

@media (min-width: 600px) {
  .hero-photo {
    aspect-ratio: 16 / 9;
  }
}

/* Grand écran : texte et appel à gauche, photo à droite jusqu'au bord, tout au-dessus de la ligne de flottaison. */
@media (min-width: 960px) {
  .hero {
    --marge-hero: max(var(--gouttiere), calc((100vw - var(--largeur-max)) / 2));
    display: grid;
    grid-template-columns: var(--marge-hero) minmax(0, 6fr) minmax(0, 6fr);
    grid-template-rows: auto 1fr;
    column-gap: var(--esp-7);
    padding-top: var(--esp-6);
  }
  .hero-titre {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    padding: var(--esp-5) 0 0;
    max-width: none;
  }
  .hero h1 {
    font-size: clamp(3rem, 1rem + 4vw, 5.25rem);
  }
  .hero-cartouche {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    padding: var(--esp-6) 0 var(--esp-7);
  }
  .hero-photo {
    grid-column: 3;
    grid-row: 1 / 3;
    aspect-ratio: auto;
    height: clamp(520px, calc(100svh - 7.5rem), 820px);
    margin: 0;
    border-radius: var(--rayon-carnet) 0 0 var(--rayon-carnet);
  }
}

/* ---------- Un samedi, trois temps ---------- */

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

.frise {
  position: relative;
  display: grid;
  gap: var(--esp-6);
  margin: var(--esp-7) 0 0;
  padding: 0 0 0 var(--esp-6);
  list-style: none;
}

/* Fil local : vertical sur mobile, remplacé par le fil de page en grand écran. */
.frise::before {
  content: "";
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 8px;
  width: var(--trait-fil);
  background: var(--fil);
  transform-origin: top;
  transition: transform 1200ms var(--ease-in-out);
}
.js .frise:not(.vu)::before {
  transform: scaleY(0);
}

.frise-temps {
  position: relative;
}

.noeud {
  position: absolute;
  top: 0.45rem;
  left: calc(-1 * var(--esp-6));
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fil);
  box-shadow: 0 0 0 5px var(--calcaire);
}

.frise-heure {
  margin-bottom: var(--esp-2);
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  line-height: 1.2;
}

.frise-temps p:not(.frise-heure) {
  max-width: 26em;
}

@media (min-width: 960px) {
  .frise {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--esp-7);
    padding: 0;
  }
  .frise::before {
    top: calc(0.6rem - 1px);
    bottom: auto;
    left: 10px;
    right: 33%;
    width: auto;
    height: var(--trait-fil);
    transform-origin: left;
  }
  .js .frise:not(.vu)::before {
    transform: scaleX(0);
  }
  .frise-temps {
    padding-top: var(--esp-7);
  }
  .noeud {
    top: 0;
    left: 0;
  }
  .fil-actif .frise::before {
    display: none;
  }
}

/* ---------- Aperçu jouable ---------- */

.apercu {
  --fond: var(--chataignier);
  --encre: var(--papier);
  --encre-douce: var(--mousse);
  --anneau: var(--ocre-clair);
  padding-block: var(--esp-section);
  background: var(--chataignier);
  color: var(--papier);
}

.apercu-grille {
  display: grid;
  gap: var(--esp-7);
}

/* Grand écran : titre au-dessus, photo et carnet côte à côte, alignés par le haut. */
@media (min-width: 960px) {
  .apercu-grille {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: var(--esp-8);
    row-gap: 0;
  }
  .apercu-intro {
    display: contents;
  }
  .apercu-intro > h2,
  .apercu-intro > p {
    grid-column: 1 / -1;
  }
  .apercu-photo {
    grid-column: 1;
    margin-top: var(--esp-7);
  }
  .carnet {
    grid-column: 2;
    margin-top: var(--esp-7);
  }
}

.apercu-intro > p {
  margin-top: var(--esp-4);
  color: var(--papier);
}

.apercu-photo {
  position: relative;
  background-color: var(--joint);
  margin: var(--esp-6) 0 0;
  aspect-ratio: 4 / 5;
  max-width: 26rem;
  overflow: hidden;
  border-radius: var(--rayon);
}
.apercu-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.apercu-photo figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.carnet {
  --encre: var(--lauze);
  --encre-douce: var(--lauze-doux);
  --anneau: var(--fil);
  --filet: rgb(var(--lauze-rgb) / 0.22);
  align-self: start;
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.5rem);
  border-radius: var(--rayon-carnet);
  background: var(--papier);
  color: var(--lauze);
  box-shadow: var(--ombre-pose);
}

.carnet-rang {
  font-weight: 700;
  font-size: var(--t-petit);
  color: var(--fil);
}

.carnet-question {
  margin-top: var(--esp-2);
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  line-height: 1.3;
}

.etape {
  animation: apparait 360ms ease both;
}
.etape:focus {
  outline: none;
}

.choix {
  display: grid;
  gap: var(--esp-2);
  margin-top: var(--esp-5);
}

.choix-option {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  min-height: 3rem;
  padding: var(--esp-3) var(--esp-4);
  border: var(--trait) solid var(--filet);
  border-radius: var(--rayon);
  background: transparent;
  color: inherit;
  font: 400 1.0625rem/1.3 var(--police-texte);
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--duree-ui) ease,
    background-color var(--duree-ui) ease,
    transform var(--duree-appui) var(--ease-out);
}
.choix-option::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: var(--trait) solid currentColor;
  transition: background-color var(--duree-ui) ease;
}
.choix-option:active {
  transform: scale(0.98);
}
@media (hover: hover) and (pointer: fine) {
  .choix-option:hover {
    border-color: currentColor;
  }
}
.choix-option.faux {
  color: var(--encre-douce);
  text-decoration: line-through;
  cursor: default;
}
.choix-option.juste {
  border-color: var(--chataignier);
  background: var(--chataignier);
  color: var(--papier);
}
.choix-option.juste::before {
  background: var(--fil-clair);
  border-color: var(--fil-clair);
}

.carnet-retour {
  min-height: 1.6em;
  margin-top: var(--esp-4);
  font-weight: 700;
}
.carnet-retour.bon {
  color: var(--chataignier);
}

.etape[data-etape="resolue"] > p:not(.carnet-rang):not(.carnet-question) {
  margin-top: var(--esp-3);
}

/* Le muret de pierre sèche : chaque pierre est un bouton. */
.muret {
  display: grid;
  gap: 5px;
  margin-top: var(--esp-5);
  padding: 6px;
  border-radius: var(--rayon-carnet);
  background: var(--joint);
}

.muret-rang {
  display: flex;
  gap: 5px;
  height: calc(var(--h, 1) * clamp(34px, 5vw, 46px));
}

.pierre {
  position: relative;
  flex: var(--l, 1) 1 0;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--r, 30%);
  background: var(--teinte, var(--pierre-1));
  box-shadow:
    inset 0 -4px 0 rgb(0 0 0 / 0.16),
    inset 0 2px 0 rgb(255 255 255 / 0.22);
  transform: translateY(var(--decale, 0));
  cursor: pointer;
  transition:
    transform var(--duree-appui) var(--ease-out),
    filter var(--duree-ui) ease,
    background-color var(--duree-ui) ease;
}
.pierre:active {
  transform: translateY(var(--decale, 0)) scale(0.96);
}
@media (hover: hover) and (pointer: fine) {
  .pierre:hover {
    filter: brightness(1.08);
    transform: translateY(calc(var(--decale, 0px) - 1px));
  }
}
.pierre:focus-visible {
  outline-color: var(--fil-clair);
  z-index: 1;
}

/* La croix gravée */
.pierre.marquee::before,
.pierre.marquee::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: rgb(43 34 24 / 0.72);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.35);
}
.pierre.marquee::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.pierre.marquee::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.pierre.vide {
  animation: tremble 280ms var(--ease-out);
}
.pierre.vide-vu {
  filter: saturate(0.6) brightness(0.92);
}

.pierre.ouverte {
  background: var(--trou);
  box-shadow: inset 0 4px 6px rgb(0 0 0 / 0.6);
}
.rouleau {
  position: absolute;
  inset: 18% 12%;
  animation: sort 520ms var(--ease-out) both;
}
.rouleau svg {
  width: 100%;
  height: 100%;
}

/* ---------- Pour qui ---------- */

.pour-qui {
  padding-block: var(--esp-section);
}

.pour-qui-grille {
  display: grid;
  gap: var(--esp-7);
}

.pour-qui-texte h2 {
  max-width: 12em;
  margin-bottom: var(--esp-5);
}

.retour {
  margin: 0;
  padding-top: var(--esp-5);
  border-top: var(--trait) solid var(--lauze);
}

.retour-titre {
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  line-height: 1.2;
}

.retour-sous {
  margin-top: var(--esp-2);
  font-size: var(--t-petit);
  color: var(--lauze-doux);
}

.barres {
  display: grid;
  gap: var(--esp-5);
  margin-top: var(--esp-6);
}

.barre-ligne {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--esp-2) var(--esp-4);
  align-items: baseline;
}

.barre-etiquette {
  font-size: var(--t-petit);
}

.barre-valeur {
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  line-height: 1;
}
.barre-perte .barre-valeur {
  color: var(--lauze-doux);
}
.barre-gain .barre-valeur {
  color: var(--fil);
}

.barre-piste {
  grid-column: 1 / -1;
  position: relative;
  height: 22px;
  background: linear-gradient(var(--lauze), var(--lauze)) 50% 0 / 2px 100% no-repeat;
}

.barre {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: calc(var(--part) * 50% - 1px);
  transition: transform 900ms var(--ease-out);
}
.barre-perte .barre {
  right: calc(50% + 1px);
  background: var(--lauze-doux);
  transform-origin: right;
}
.barre-gain .barre {
  left: calc(50% + 1px);
  background: var(--fil);
  transform-origin: left;
}
.js .retour:not(.vu) .barre {
  transform: scaleX(0);
}
.barre-gain .barre {
  transition-delay: 220ms;
}

.retour figcaption {
  margin-top: var(--esp-6);
  max-width: var(--mesure);
}

@media (min-width: 960px) {
  .pour-qui-grille {
    grid-template-columns: 6fr 5fr;
    gap: var(--esp-8);
    align-items: start;
  }
  .retour {
    margin-top: var(--esp-8);
  }
}

/* ---------- Communes ---------- */

.communes {
  --fond: var(--lauze);
  --encre: var(--calcaire);
  --encre-douce: rgb(var(--calcaire-rgb) / 0.8);
  --anneau: var(--ocre-clair);
  --filet: rgb(var(--calcaire-rgb) / 0.4);
  padding-block: var(--esp-section);
  background-color: var(--lauze);
  background-image:
    radial-gradient(circle at 50% 100%, transparent 62%, rgb(255 255 255 / 0.035) 63% 67%, transparent 68%),
    radial-gradient(circle at 50% 100%, transparent 62%, rgb(255 255 255 / 0.035) 63% 67%, transparent 68%);
  background-size: 56px 28px;
  background-position: 0 0, 28px 14px;
  color: var(--calcaire);
}
.communes h2 {
  color: var(--papier);
  max-width: 13em;
  margin-bottom: var(--esp-5);
}
.communes .appel-note {
  color: var(--ocre-clair);
}

.communes-grille {
  display: grid;
  gap: var(--esp-7);
}

.prix {
  align-self: start;
}

.prix-montant {
  font-family: var(--police-titre);
  font-size: var(--t-montant);
  line-height: 1;
  color: var(--ocre-clair);
}

.prix-legende {
  margin-top: var(--esp-2);
}

.echelle {
  margin: var(--esp-6) 0 0;
  max-width: 30rem;
}
.echelle-dessin {
  width: 100%;
  height: auto;
  overflow: visible;
}
.echelle-dessin text {
  fill: var(--calcaire);
  font: 400 13px var(--police-texte);
}
.echelle-axe {
  stroke: rgb(var(--calcaire-rgb) / 0.35);
  stroke-width: 1.5;
}
.echelle-borne {
  stroke: var(--calcaire);
  stroke-width: 2;
}
.echelle-fil {
  fill: none;
  stroke: var(--fil-clair);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1200ms var(--ease-in-out);
}
.js .echelle:not(.vu) .echelle-fil {
  stroke-dashoffset: 1;
}
.echelle-noeud {
  fill: var(--fil-clair);
}
.echelle figcaption {
  margin-top: var(--esp-3);
  font-size: var(--t-petit);
  color: var(--encre-douce);
}

.payeur {
  margin-top: var(--esp-7);
}
.payeur-choix {
  margin-top: var(--esp-5);
  animation: apparait 300ms ease both;
}
.choix-sombre {
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin-top: var(--esp-3);
}
.choix-sombre .choix-option {
  color: var(--calcaire);
}
.payeur-merci {
  margin-top: var(--esp-5);
  padding-left: var(--esp-4);
  border-left: var(--trait-fil) solid var(--fil-clair);
  animation: apparait 300ms ease both;
}
.payeur-merci:focus {
  outline: none;
}

@media (min-width: 960px) {
  .communes-grille {
    grid-template-columns: 6fr 5fr;
    gap: var(--esp-8);
  }
  .prix {
    padding-top: var(--esp-2);
  }
}

/* ---------- Appel à l'action ---------- */

.appel {
  --anneau: var(--lauze);
  padding-block: var(--esp-section);
  background: var(--ocre-clair);
  color: var(--lauze);
}
.appel h2 {
  max-width: 14em;
}
.appel-texte p {
  margin-top: var(--esp-5);
}
.appel .bouton {
  margin-top: var(--esp-6);
}

.franchises {
  display: grid;
  gap: var(--esp-5);
  margin: var(--esp-8) 0 0;
  padding-top: var(--esp-6);
  border-top: var(--trait) solid var(--lauze);
}
.franchises dt {
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  line-height: 1.25;
}
.franchises dd {
  margin: var(--esp-2) 0 0;
  max-width: 28em;
}

@media (min-width: 960px) {
  .franchises {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--esp-7);
  }
}

@media (max-width: 599px) {
  .appel .bouton {
    width: 100%;
  }
}

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

.pied {
  --anneau: var(--ocre-clair);
  padding-block: var(--esp-8) var(--esp-7);
  background: var(--lauze);
  color: var(--calcaire);
  font-size: var(--t-petit);
}
.pied a {
  text-decoration-color: var(--ocre-clair);
}
.logo-pied {
  color: var(--calcaire);
  --logo-fil: var(--fil-clair);
}
.pied-projet {
  margin-top: var(--esp-5);
  max-width: 44em;
}
.pied-titre {
  margin-top: var(--esp-7);
  font-size: var(--t-moyen);
}
.notes {
  display: grid;
  gap: var(--esp-3);
  max-width: 62em;
  margin: var(--esp-4) 0 0;
  padding-left: 1.4em;
}
.notes li:target {
  outline: var(--trait) solid var(--ocre-clair);
  outline-offset: 6px;
}
.retour-note {
  font-weight: 700;
}
.pied-registre {
  margin-top: var(--esp-6);
  max-width: 62em;
  color: rgb(var(--calcaire-rgb) / 0.8);
}

/* ---------- Fausse porte ---------- */

.porte {
  --encre: var(--lauze);
  --encre-douce: var(--lauze-doux);
  --anneau: var(--fil);
  --filet: rgb(var(--lauze-rgb) / 0.2);
  width: min(36rem, calc(100% - 2 * var(--esp-4)));
  max-height: calc(100dvh - 2 * var(--esp-4));
  padding: 0;
  border: 0;
  border-radius: var(--rayon-carnet);
  background: var(--papier);
  color: var(--lauze);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity var(--duree-ui) ease,
    transform 260ms var(--ease-out),
    overlay 260ms allow-discrete,
    display 260ms allow-discrete;
}
.porte[open] {
  opacity: 1;
  transform: none;
}
@starting-style {
  .porte[open] {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
.porte::backdrop {
  background: rgb(var(--lauze-rgb) / 0.66);
  opacity: 0;
  transition:
    opacity var(--duree-ui) ease,
    overlay 260ms allow-discrete,
    display 260ms allow-discrete;
}
.porte[open]::backdrop {
  opacity: 1;
}
@starting-style {
  .porte[open]::backdrop {
    opacity: 0;
  }
}

.porte-formulaire,
.porte-merci {
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
}

.porte-tete {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--esp-4);
}
.porte h2 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem);
}

.porte-fermer {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: -0.4rem -0.6rem 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lauze);
  cursor: pointer;
  transition: background-color var(--duree-ui) ease, transform var(--duree-appui) var(--ease-out);
}
.porte-fermer svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.porte-fermer:active {
  transform: scale(0.94);
}
@media (hover: hover) and (pointer: fine) {
  .porte-fermer:hover {
    background: rgb(var(--lauze-rgb) / 0.08);
  }
}

.porte-franchise {
  margin-top: var(--esp-4);
  padding: var(--esp-3) var(--esp-4);
  border-left: var(--trait-fil) solid var(--fil);
  background: rgb(var(--calcaire-rgb) / 0.55);
}

.question {
  display: grid;
  gap: var(--esp-2);
  margin: var(--esp-6) 0 0;
  padding: 0;
  border: 0;
}
.question legend {
  margin-bottom: var(--esp-3);
  padding: 0;
  font-family: var(--police-titre);
  font-size: var(--t-moyen);
  line-height: 1.25;
}
.legende-aide {
  display: block;
  margin-top: var(--esp-1);
  font-family: var(--police-texte);
  font-size: var(--t-petit);
  color: var(--lauze-doux);
}
.question label {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  min-height: 2.9rem;
  padding: var(--esp-2) var(--esp-4);
  border: var(--trait) solid var(--filet);
  border-radius: var(--rayon);
  cursor: pointer;
  transition: border-color var(--duree-ui) ease, background-color var(--duree-ui) ease;
}
.question input {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--fil);
}
.question label:has(input:checked) {
  border-color: var(--fil);
  background: rgb(176 30 43 / 0.07);
}
.question label:has(input:focus-visible) {
  outline: 3px solid var(--anneau);
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .question label:hover {
    border-color: var(--lauze-doux);
  }
}

.porte-erreur {
  min-height: 1.5em;
  margin-top: var(--esp-4);
  color: var(--fil);
  font-weight: 700;
}
.porte-formulaire .bouton {
  width: 100%;
  margin-top: var(--esp-2);
}

.porte-merci {
  animation: apparait 360ms ease both;
}
.porte-merci:focus {
  outline: none;
}
.porte-merci p {
  margin-top: var(--esp-4);
}
.porte-merci .bouton {
  margin-top: var(--esp-6);
}
.porte-noeud {
  width: 120px;
  margin-bottom: var(--esp-4);
}
.porte-noeud path {
  fill: none;
  stroke: var(--fil);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 200;
  animation: trace 900ms var(--ease-in-out) both;
}
.porte-noeud circle {
  fill: var(--fil);
  animation: apparait 300ms ease 600ms both;
}

@media (max-width: 599px) {
  .porte {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: var(--rayon-carnet) var(--rayon-carnet) 0 0;
    transform: translateY(100%);
    transition:
      opacity var(--duree-ui) ease,
      transform 340ms var(--ease-drawer),
      overlay 340ms allow-discrete,
      display 340ms allow-discrete;
  }
  .porte[open] {
    transform: none;
  }
  @starting-style {
    .porte[open] {
      transform: translateY(100%);
    }
  }
}

/* ---------- Révélations au défilement ---------- */

.js [data-revele] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--duree-revele) ease,
    transform var(--duree-revele) var(--ease-out);
}
.js [data-revele].vu {
  opacity: 1;
  transform: none;
}
.js .frise-temps:nth-child(2) {
  transition-delay: 80ms;
}
.js .frise-temps:nth-child(3) {
  transition-delay: 160ms;
}

/* ---------- Animations ---------- */

@keyframes monte {
  from {
    transform: translateY(105%);
  }
}
@keyframes apparait {
  from {
    opacity: 0;
  }
}
@keyframes devoile {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0);
  }
}
@keyframes tremble {
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
}
@keyframes sort {
  from {
    opacity: 0;
    transform: translateY(30%) scale(0.9);
  }
}
@keyframes trace {
  from {
    stroke-dashoffset: 200;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Mouvement réduit : on garde les fondus, on retire les déplacements. */
@media (prefers-reduced-motion: reduce) {
  .ligne > span,
  .hero-photo {
    animation: apparait 400ms ease both;
  }
  .js [data-revele] {
    transform: none;
  }
  .pierre.vide {
    animation: none;
  }
  .rouleau {
    animation: apparait 200ms ease both;
  }
  .barre,
  .echelle-fil {
    transition: none;
  }
  .porte,
  .porte[open] {
    transform: none;
  }
  @starting-style {
    .porte[open] {
      transform: none;
    }
  }
  .bouton:active,
  .choix-option:active {
    transform: none;
  }
  .pierre:active {
    transform: translateY(var(--decale, 0));
  }
  .js .frise::before,
  .js .frise:not(.vu)::before {
    transform: none;
    transition: none;
  }
  .fil-noeud {
    transition: opacity 200ms ease;
    transform: none;
  }
  .porte-noeud path {
    animation: none;
  }
}
