/* ============================================================================
   TERRALIS — direction artistique
   ----------------------------------------------------------------------------
   Une seule source de vérité pour les couleurs : les variables ci-dessous.
   Aucune couleur littérale ailleurs (le SVG de la coupe de sol prend ses
   remplissages par classe, pas par attribut).

   Palette : noir profond (pas un noir pur), crème papier, jaune chantier.
   Un seul gris technique pour les annotations secondaires.
   ========================================================================== */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/polices/space-grotesk-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  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;
}

:root {
  /* --- couleurs --- */
  --noir: #12100E;
  --noir-creux: #0D0C0A;
  --noir-surface: #1A1713;
  --creme: #F5EFE1;
  --jaune: #F5C518;
  --gris: #A7A096;

  --trait: rgba(245, 239, 225, 0.20);      /* cadre d'annotation 1 px */
  --trait-fort: rgba(245, 239, 225, 0.42);
  --trait-faible: rgba(245, 239, 225, 0.09);
  --voile: rgba(18, 16, 14, 0.86);

  /* --- typographie --- */
  --f-display: 'Space Grotesk', 'Arial Black', 'Helvetica Neue', Arial, sans-serif;
  --f-texte: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --f-mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;

  /* --- rythme --- */
  --marge: clamp(1.15rem, 4vw, 3.25rem);
  --largeur: 1240px;

  /* Cadre des annotations : surchargé en JS par la projection du modèle 3D. */
  --mx: 24vw;
  --my: 20vh;
  --mw: 52vw;
  --mh: 56vh;

  --progression: 0;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--trait-fort) var(--noir);
  /* Aucun contenu repliable ici, mais le recalage automatique de Chrome
     ramenait le défilement en arrière de plusieurs centaines de pixels quand
     on sautait dans une section (mesuré : 4432 → 3932). */
  overflow-anchor: none;
}

body {
  margin: 0;
  background: var(--noir);
  color: var(--creme);
  font-family: var(--f-texte);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: clip;              /* clip, pas hidden : ne casse pas position: sticky */
  -webkit-font-smoothing: antialiased;
}

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

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--noir); }
::-webkit-scrollbar-thumb { background: var(--trait-fort); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--jaune); }

a { color: var(--creme); text-decoration: none; }
a:hover { color: var(--jaune); }

p { margin: 0; }
img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 2px solid var(--jaune);
  outline-offset: 4px;
}

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

.saut {
  position: absolute;
  top: -100px; left: var(--marge);
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--jaune);
  color: var(--noir);
  font-family: var(--f-mono);
  font-size: 0.8rem;
}
.saut:focus { top: 0.75rem; color: var(--noir); }

/* ============================ PLAN 3D ============================ */
#scene-3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;          /* le défilement reste natif, la molette passe */
}

.repli-3d {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
  align-items: center;
  /* L'engin se tient à droite et le texte à gauche, comme dans la scène
     temps réel : centré, le poster passait sous le titre du hero. */
  justify-content: flex-end;
  padding-right: 5vw;
  background: var(--noir);
}
.repli-3d img {
  width: min(64vw, 960px);
  opacity: 0.62;
  filter: saturate(0.85);
}
.sans-webgl #scene-3d { display: none; }
.sans-webgl .repli-3d { display: flex; }

/* Voile de lisibilité : calque entre la scène et le texte. Son opacité est
   pilotée par la scène (--voile-scene) selon la densité de texte de la zone.
   Sans WebGL, il s'efface : le poster est déjà sombre. */
.voile-scene {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: var(--noir);
  opacity: var(--voile-scene, 0.2);
  transition: opacity 0.45s ease;
}
.sans-webgl .voile-scene { opacity: 0; }

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 30%, rgba(18, 16, 14, 0.72) 100%),
    linear-gradient(to bottom, rgba(18, 16, 14, 0.75) 0%, transparent 22%, transparent 78%, rgba(18, 16, 14, 0.92) 100%);
}

/* ============================ EN-TÊTE ============================ */
.entete {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: 1.05rem var(--marge);
  background: linear-gradient(to bottom, rgba(18, 16, 14, 0.94), rgba(18, 16, 14, 0));
}

.marque {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.marque span { color: var(--jaune); }

.entete__metier,
.entete__compteur,
.lien-fleche {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gris);
}
.entete__metier { margin: 0; }

.entete__compteur {
  font-variant-numeric: tabular-nums;
  color: var(--creme);
  letter-spacing: 0.08em;
}
.entete__compteur .pct { color: var(--gris); margin-left: 0.15rem; }

.lien-fleche {
  color: var(--creme);
  border: 1px solid var(--trait);
  padding: 0.5rem 0.85rem;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.lien-fleche:hover,
.lien-fleche:focus-visible {
  background: var(--jaune);
  border-color: var(--jaune);
  color: var(--noir);
}

/* ============================ SOMMAIRE LATÉRAL ============================ */
.sommaire {
  position: fixed;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 25;
}
.sommaire ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.62rem;
  justify-items: end;
}
.sommaire a {
  display: block;
  padding: 0.28rem 0;
  color: var(--gris);
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
}
.sommaire a span {
  display: block;
  padding-right: 0.1rem;
  opacity: 0;
  transition: opacity 0.25s;
}
.sommaire a::after {
  content: '';
  display: block;
  width: 18px;
  height: 1px;
  margin-top: 0.2rem;
  background: var(--trait-fort);
  transition: width 0.3s, background-color 0.3s;
  margin-left: auto;
}
.sommaire a:hover span,
.sommaire a:focus-visible span,
.sommaire a[aria-current='true'] span { opacity: 1; }
.sommaire a:hover::after,
.sommaire a:focus-visible::after { width: 30px; background: var(--jaune); }
.sommaire a[aria-current='true']::after { width: 30px; background: var(--jaune); }

/* ============================ SECTIONS ============================ */
main { position: relative; z-index: 2; }

.section {
  position: relative;
  padding-block: clamp(5rem, 13vh, 10rem);
}
.section__inner {
  width: 100%;
  max-width: var(--largeur);
  margin-inline: auto;
  padding-inline: var(--marge);
}

.micro-libelle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  line-height: 1.4;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gris);
}
.micro-libelle::before {
  content: '';
  flex: 0 0 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.titre-section {
  margin: 1.1rem 0 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.15rem, 5.6vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

.section__entete { max-width: 62ch; }
.section__entete--centre {
  margin-inline: auto;
  text-align: center;
}
.section__entete--centre .micro-libelle { justify-content: center; }

.contenu {
  margin-top: clamp(1.5rem, 3vw, 2.4rem);
  max-width: 54ch;
}
.contenu p {
  color: rgba(245, 239, 225, 0.8);
  font-size: clamp(0.98rem, 1.05vw, 1.08rem);
  line-height: 1.66;
}
.contenu p + p { margin-top: 0.9rem; }
.contenu--large { max-width: 60ch; }
.contenu--centre { margin-inline: auto; text-align: center; }

.legende-technique {
  display: inline-block;
  margin: 1.6rem 0 0;
  padding: 0.3rem 0.55rem;
  background: var(--voile);
  border: 1px solid var(--trait-faible);
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gris);
}

/* ============================ 01 — HERO ============================ */
.section--hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: clamp(5.5rem, 12vh, 8rem);
  padding-bottom: clamp(3rem, 9vh, 6rem);
}
.hero__haut {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  padding-inline: var(--marge);
  flex-wrap: wrap;
}
.hero__haut .micro-libelle { max-width: 34ch; }

.titre-hero {
  margin: clamp(2rem, 7vh, 5rem) 0 0;
  padding-inline: var(--marge);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.9rem, 11.2vw, 7.5rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
  text-transform: none;
}
.titre-hero .point { color: var(--jaune); }

.hero__bas {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  padding-inline: var(--marge);
  flex-wrap: wrap;
}
.contenu--hero { max-width: 42ch; margin-top: clamp(1.5rem, 4vh, 2.4rem); }

.hero__legende {
  margin: 0;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gris);
  text-align: right;
}

.defilement {
  position: absolute;
  left: var(--marge);
  bottom: clamp(1.2rem, 4vh, 2.4rem);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gris);
}
.defilement__trait {
  display: block;
  width: 1px;
  height: 46px;
  background: linear-gradient(to bottom, var(--creme), transparent);
  animation: glisse 2.6s ease-in-out infinite;
  transform-origin: top;
}
@keyframes glisse {
  0%, 100% { transform: scaleY(0.35); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ============================ 02 — COTES ============================ */
.cotes {
  position: fixed;
  left: var(--mx);
  top: var(--my);
  width: var(--mw);
  height: var(--mh);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.cotes.est-vue { opacity: 1; }

.cote {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cote__valeur {
  display: inline-block;
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--trait);
  background: var(--voile);
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--jaune);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cote__trait { position: absolute; opacity: 0.65; }
.cote__trait--v {
  width: 0;
  border-left: 1px dashed var(--jaune);
  height: 46px;
}
.cote__trait--h {
  height: 0;
  border-top: 1px dashed var(--jaune);
  width: 46px;
}

.cote--haut {
  top: 0; left: 50%;
  transform: translate(-50%, -100%);
  flex-direction: column;
  align-items: center;
}
.cote--haut .cote__trait--v { position: relative; height: 40px; }

/* La cote de largeur a été retirée : posée à gauche du cadre, elle tombait
   forcément sur la colonne de texte (le bloc court jusqu'à x=780, le cadre
   commence à x=804 — mesuré). Les deux cotes restantes, hauteur et longueur,
   se lisent sans ambiguïté, et la largeur est déjà dans la copie. */


.cote--bas {
  bottom: 0; left: 50%;
  transform: translate(-50%, 100%);
  flex-direction: column;
  align-items: center;
}
.cote--bas .cote__trait--h { position: relative; width: 34px; margin-left: auto; margin-right: auto; }

.cote--fiche {
  top: 8%; right: 0;
  transform: translateX(calc(100% + 14px));
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}
.cote--fiche .cote__valeur { color: var(--creme); border-color: var(--trait-faible); }
/* Pas la place à droite : le bloc rentre dans le cadre, aligné à droite. */
.cotes--serre .cote--fiche {
  transform: translateX(-14px);
  align-items: flex-end;
}

/* ============================ 03 — CAPACITÉS ============================ */
.capacites {
  list-style: none;
  margin: clamp(2rem, 5vw, 3.5rem) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--trait);
  border: 1px solid var(--trait);
}
.capacite {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  padding: clamp(1.4rem, 3vw, 2.4rem);
  background: var(--noir);
}
.capacite__num {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--gris);
}
.capacite__titre {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  letter-spacing: -0.02em;
}
.capacite__chiffre {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 3.6vw, 3.1rem);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--jaune);
  font-variant-numeric: tabular-nums;
}
.capacite__texte {
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgba(245, 239, 225, 0.75);
}

/* ============================ 04 — PARC ============================ */
.parc {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

.parc__choix {
  margin: 0;
  padding: 0;
  border: 1px solid var(--trait);
  display: grid;
  gap: 1px;
  background: var(--trait);
  /* Sans align-self, le fieldset s'étire à la hauteur de la fiche et son fond
     (la couleur des filets) apparaît en grand rectangle gris sous les trois
     engins — mesuré : 310 × 390 px de gris uni. */
  align-self: start;
  align-content: start;
}
.parc__choix legend {
  padding: 0 0 0.8rem;
  float: left;
  width: 100%;
}
.parc__choix legend::before { content: none; }

.engin-choix {
  position: relative;
  display: grid;
  gap: 0.15rem;
  padding: 0.95rem 1.1rem;
  background: var(--noir);
  cursor: pointer;
  transition: background-color 0.2s;
}
.engin-choix input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  margin: 0;
}
.engin-choix__nom {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}
.engin-choix__classe {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris);
}
.engin-choix:hover { background: var(--noir-surface); }
.engin-choix:has(input:checked) { background: var(--noir-surface); }
.engin-choix:has(input:checked) .engin-choix__nom { color: var(--jaune); }
.engin-choix:has(input:checked)::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--jaune);
}
.engin-choix:focus-within { outline: 2px solid var(--jaune); outline-offset: -2px; }

.fiche {
  display: grid;
  gap: clamp(1rem, 2vw, 1.6rem);
  align-content: start;
  padding: clamp(1rem, 2vw, 1.5rem);
  background: rgba(18, 16, 14, 0.86);
  border: 1px solid var(--trait-faible);
}
.fiche__entete { display: grid; gap: 0.3rem; }
.fiche__nom {
  margin: 0.1rem 0 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 3.6vw, 2.9rem);
  letter-spacing: -0.03em;
  line-height: 1;
}
.fiche__role {
  font-size: 0.95rem;
  color: var(--gris);
}
.fiche__specs {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(1rem, 3vw, 3rem);
  border-top: 1px solid var(--trait);
}
.fiche__specs > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--trait-faible);
}
.fiche__specs dt {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gris);
}
.fiche__specs dd {
  margin: 0;
  font-family: var(--f-mono);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.fiche__note {
  max-width: 46ch;
  font-family: var(--f-display);
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--creme);
  border-left: 2px solid var(--jaune);
  padding-left: 0.9rem;
}

/* ============================ 06 — RELEVÉS ============================ */
/* Voile latéral : les sections bâties sur un gros plan 3D reçoivent un dégradé
   qui opaque la moitié gauche (celle du texte) et laisse l'engin visible à
   droite. Posé en fond de section et non en pseudo-élément : en z-index:-1 le
   dégradé passait sous le canvas (vérifié, il ne s'affichait pas), alors que le
   fond de section se peint au-dessus de la scène et sous le texte. */
#releves,
#journee {
  background: linear-gradient(100deg,
    rgba(18, 16, 14, 0.96) 0%,
    rgba(18, 16, 14, 0.90) 34%,
    rgba(18, 16, 14, 0.64) 56%,
    rgba(18, 16, 14, 0.10) 82%);
}
/* L'estimateur a son titre centré au-dessus de l'engin plein : sans voile, la
   copie d'introduction se lisait à travers la photo de la machine et semblait
   doublée (mesuré : deux paragraphes à 84 px de haut, 98 px d'écart — pas de
   chevauchement réel, mais un contraste insuffisant). */
#devis {
  background: linear-gradient(180deg,
    rgba(18, 16, 14, 0.94) 0%,
    rgba(18, 16, 14, 0.80) 26%,
    rgba(18, 16, 14, 0.42) 48%,
    rgba(18, 16, 14, 0.55) 74%,
    rgba(18, 16, 14, 0.88) 100%);
}
.section--sol {
  padding: 0;
  min-height: 250vh;            /* la hauteur crée le temps de descente */
}
.sol__puits {
  position: sticky;
  top: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: clamp(4rem, 8vh, 6rem);
}
.sol__grille {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 5vw, 4.5rem);
  align-items: center;
}
.sol__entete { max-width: 40ch; }

.sol {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(150px, 240px) minmax(0, 1fr);
  gap: 1.3rem;
  align-items: start;
}
.sol__graphique {
  position: relative;
  width: 100%;
  aspect-ratio: 320 / 560;
  border: 1px solid var(--trait);
  background: var(--noir-creux);
  overflow: hidden;
}
.sol__graphique svg { display: block; width: 100%; height: 100%; }

.couche { opacity: 0.38; transition: opacity 0.5s ease; }
.couche.est-vue { opacity: 1; }
.couche__fond.couche--remblai { fill: #4E4030; }
.couche__fond.couche--limon { fill: #5C4E3A; }
.couche__fond.couche--graves { fill: #716552; }
.couche__fond.couche--calcaire { fill: #3A352C; }
.sol-hachure { stroke: rgba(245, 239, 225, 0.28); stroke-width: 1; }
.sol-grain { fill: rgba(245, 239, 225, 0.38); }
.sol-regle { stroke: rgba(245, 239, 225, 0.35); stroke-width: 1; }
.sol-regle-grad line { stroke: rgba(245, 239, 225, 0.28); stroke-width: 1; }
.couche__trait {
  stroke: var(--jaune);
  stroke-width: 1.4;
  stroke-dasharray: 5 5;
  opacity: 0.75;
}
.sol__profondeur {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  padding: 0.25rem 0.5rem;
  background: var(--voile);
  border: 1px solid var(--trait);
  font-family: var(--f-mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--jaune);
}

.sol__legende {
  background: rgba(18, 16, 14, 0.92);
  border: 1px solid var(--trait);
  padding: 1rem 1.2rem 1.1rem;
}

.couches {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  border-top: 1px solid var(--trait);
}
.couche-legende {
  display: grid;
  /* minmax(0, 1fr) et non 1fr : un 1fr garde un minimum « min-content », donc le
     mot le plus long de la légende (« ALLUVIONNAIRES ») élargissait la liste
     au-delà de son cadre et poussait la page (mesuré qa/mesure_largeurs.py :
     +63 px à 900, +5 px à 1024). Voir aussi @media 1080 / 640. */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--trait-faible);
  min-width: 0;
  opacity: 0.4;
  transition: opacity 0.4s ease;
}
.couche-legende.est-vue { opacity: 1; }
.couche-legende__nom {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow-wrap: anywhere;   /* « ALLUVIONNAIRES » ne tient plus sous 340 px */
}
.couche-legende__epaisseur {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--jaune);
}
.couche-legende__note {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--gris);
  line-height: 1.5;
  overflow-wrap: break-word;
}
.sol__total {
  margin-top: 0.9rem;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gris);
}
.sol__total strong { color: var(--creme); font-weight: 400; }

/* ============================ 06 — RELEVÉS ============================ */
.tableau-enveloppe {
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  max-width: 100%;
  overflow-x: auto;
  /* le glissement horizontal reste dans le cadre : il ne se propage pas à la
     page (pas de « scroll chaining » sur mobile). */
  overscroll-behavior-x: contain;
  /* barre de défilement colorée (Chromium, Firefox) : elle reste visible au
     repos et signale, avec la consigne .releves__defilement, qu'il y a une
     suite à droite. */
  scrollbar-color: var(--trait-fort) transparent;
  padding: 1rem 1.2rem 0.2rem;
  background: rgba(18, 16, 14, 0.92);
  border: 1px solid var(--trait);
}
.tableau-enveloppe:focus-visible { outline: 2px solid var(--jaune); outline-offset: 2px; }
/* Pas de règles ::-webkit-scrollbar ici : dès que scrollbar-color est posée,
   Chromium les ignore. La barre reste native, colorée, et occupe 15 px au
   repos (mesuré qa/recette_passe4.py à 390 px), ce qui la rend visible. */
/* Consigne de défilement : le cadre du tableau (min-width 620 px) cesse de
   défiler à 735 px de fenêtre ; la consigne apparaît donc jusqu'à 734 px.
   Seuil mesuré par qa/balayage_largeurs.py, qui vérifie aussi qu'elle n'est
   jamais affichée quand le tableau tient. */
.releves__defilement {
  display: none;
  margin: 0.55rem 0 0;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris);
}
.releves__defilement span { color: var(--jaune); }
.releves {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.releves__legende {
  caption-side: top;
  text-align: left;
  padding-bottom: 0.8rem;
  font-family: var(--f-mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris);
}
.releves th,
.releves td {
  padding: 0.72rem 0.75rem 0.72rem 0;
  text-align: left;
  border-bottom: 1px solid var(--trait-faible);
  font-weight: 400;
  font-size: 0.92rem;
}
.releves thead th {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gris);
  border-bottom-color: var(--trait);
}
.releves tbody th { font-size: 0.95rem; }
.releves td { color: rgba(245, 239, 225, 0.82); }
.releves .num {
  text-align: right;
  font-family: var(--f-mono);
  color: var(--creme);
}
.releves thead .num { text-align: right; }
.releves tbody tr:hover { background: var(--trait-faible); }

/* ============================ 07 — JOURNÉE ============================ */
.journee {
  list-style: none;
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  padding: 1rem 1.4rem 1rem 0;
  position: relative;
  max-width: 760px;
  background: rgba(18, 16, 14, 0.88);
  border: 1px solid var(--trait-faible);
}
.journee::before,
.journee::after {
  content: '';
  position: absolute;
  left: 74px;
  top: 0.4rem;
  width: 1px;
}
.journee::before { bottom: 0.4rem; background: var(--trait); }
.journee::after {
  height: calc(var(--jours, 0) * (100% - 0.8rem));
  background: var(--jaune);
  transition: height 0.12s linear;
}
.journee__item {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 1.6rem;
  padding: 0.85rem 0;
  opacity: 0.32;
  transition: opacity 0.4s ease;
}
.journee__item.est-vue { opacity: 1; }
.journee__item::before {
  content: '';
  position: absolute;
  left: 70px;
  top: 1.15rem;
  width: 9px;
  height: 9px;
  border: 1px solid var(--jaune);
  border-radius: 50%;
  background: var(--noir);
  transition: background-color 0.3s;
}
.journee__item.est-vue::before { background: var(--jaune); }
.journee__heure {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--jaune);
  text-align: right;
  padding-right: 1.5rem;
}
.journee__fait {
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(245, 239, 225, 0.85);
}

/* ============================ 08 — REFUS ============================ */
.refus {
  list-style: none;
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  padding: 0;
  border-top: 1px solid var(--trait-fort);
}
.refus__item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: baseline;
  padding: clamp(1.1rem, 2.6vw, 1.9rem) 0;
  border-bottom: 1px solid var(--trait);
}
.refus__num {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  color: var(--gris);
}
.refus__texte {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.2rem, 2.8vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  max-width: 28ch;
}

/* ============================ 09 — DEVIS ============================ */
.section--devis .section__entete { max-width: 70ch; }

.devis {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(1.5rem, 3vw, 2.8rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  padding: clamp(1.2rem, 2.6vw, 2.2rem);
  border: 1px solid var(--trait-fort);
  background: rgba(18, 16, 14, 0.94);
}
.devis__grille { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; align-content: start; min-width: 0; }

/* Min-content des <select> : la liste déroulante la plus longue
   (« Facile — camion au bord de fouille ») mesurait 348 px et imposait sa
   largeur à la colonne de grille, donc à la page (+12 px à 390). Avec
   min-width: 0, la colonne prend la largeur disponible et le texte de l'option
   est rogné par le select lui-même, pas par la fenêtre. */
.champ { display: grid; gap: 0.4rem; min-width: 0; }
.champ label {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gris);
}
.champ__saisie {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--trait-fort);
  min-width: 0;   /* sans ça, le min-content du <select> (348 px) déborde la colonne */
}
.champ__saisie:focus-within { border-bottom-color: var(--jaune); }
.champ input,
.champ select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.65rem 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--creme);
  font-family: var(--f-mono);
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  appearance: none;
}
.champ select { cursor: pointer; padding-right: 1.4rem; }
.champ select option { background: var(--noir-surface); color: var(--creme); }
.champ__saisie:has(select)::after {
  content: '';
  position: absolute;
  right: 0.15rem;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--gris);
  border-bottom: 1px solid var(--gris);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.champ__unite {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--gris);
}
.aide {
  font-size: 0.76rem;
  color: var(--gris);
  line-height: 1.5;
}

.devis__resultat {
  display: grid;
  gap: 0.7rem;
  align-content: start;
  padding-left: clamp(1.2rem, 2.6vw, 2.4rem);
  border-left: 1px solid var(--trait);
}
.devis__fourchette {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 4.2vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--jaune);
  font-variant-numeric: tabular-nums;
}
.devis__a {
  font-family: var(--f-texte);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gris);
}
.devis__message {
  min-height: 1.3em;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--creme);
}
.devis__message[data-etat='saisie-invalide'],
.devis__message[data-etat='trop-petit'],
.devis__message[data-etat='au-dela-bareme'] {
  border-left: 2px solid var(--jaune);
  padding-left: 0.7rem;
  color: rgba(245, 239, 225, 0.9);
}
/* --- Détail du calcul, pleine largeur sous les deux blocs -------------------
   Avant : le tableau vivait dans la moitié droite de la carte (482 px de large
   à 1600 px de fenêtre, 95 px pour la colonne « prix unitaire »), d'où un
   en-tête sur deux lignes, un poste sur deux lignes et des montants collés aux
   prix (écart mesuré 0 px). Il est maintenant enfant direct de `.devis` et
   s'étale sur les deux colonnes de la grille. */
.devis__detail-cadre {
  grid-column: 1 / -1;
  overflow-x: auto;          /* écrans étroits : le tableau défile, la carte ne déborde pas */
}
.devis__detail {
  width: 100%;
  min-width: min-content;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.devis__detail th,
.devis__detail td {
  padding: 0.62rem 0 0.62rem 1.8rem;
  border-bottom: 1px solid var(--trait-faible);  /* filet léger, pas de zébrage */
  text-align: right;                             /* numérique : décimales alignées */
  white-space: nowrap;                           /* aucune cellule sur deux lignes */
  font-weight: 400;
  font-size: 0.82rem;
  vertical-align: baseline;
}
.devis__detail thead th:first-child,
.devis__detail tbody th {
  padding-left: 0;
  text-align: left;
}
.devis__detail th:nth-child(1) { width: 46%; }
.devis__detail th:nth-child(2) { width: 20%; }
.devis__detail th:nth-child(3) { width: 17%; }
.devis__detail th:nth-child(4) { width: 17%; }
.devis__detail thead th {
  padding-top: 0.2rem;
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris);
  border-bottom-color: var(--trait);
}
.devis__detail tbody th { color: rgba(245, 239, 225, 0.9); }
.devis__detail td { font-family: var(--f-mono); color: rgba(245, 239, 225, 0.78); }
.devis__detail .montant { color: var(--creme); }
.devis__detail thead .num { text-align: right; }
.devis__mention {
  margin-top: 0.3rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--jaune);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--creme);
}

/* ============================ 10 — CHUTE ============================ */
.section--chute {
  min-height: 100svh;
  display: flex;
  align-items: center;
}
.titre-chute {
  margin: 1rem 0 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.3rem, 8.4vw, 6.4rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
}
.contenu--chute { max-width: 62ch; }
.contenu--chute p { color: rgba(245, 239, 225, 0.82); font-size: clamp(1rem, 1.15vw, 1.12rem); }

.chute__agence {
  display: grid;
  gap: 0.4rem;
  margin-top: clamp(2.5rem, 6vh, 4rem);
  padding-top: 1.3rem;
  border-top: 1px solid var(--trait-fort);
  max-width: 42ch;
}
.chute__lien {
  justify-self: start;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: 0.02em;
}
.chute__lien span { color: var(--jaune); }
.chute__contact {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--gris);
  line-height: 1.7;
}
.chute__contact a { color: var(--creme); text-decoration: underline; text-underline-offset: 3px; }

/* ============================ PIED ============================ */
.pied {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.4rem var(--marge);
  border-top: 1px solid var(--trait);
  background: var(--noir);
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gris);
}
.pied a { color: var(--gris); text-decoration: underline; text-underline-offset: 3px; }
.pied a:hover { color: var(--jaune); }

.sans-js {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  margin: 0;
  padding: 0.7rem var(--marge);
  background: var(--jaune);
  color: var(--noir);
  font-size: 0.85rem;
}

/* ============================ ADAPTATIONS ============================ */
@media (max-width: 1080px) {
  .cote--fiche { display: none; }
  /* Deux colonnes ne laissent plus assez de largeur à la légende de sol : à
     1 024 px elle tombait à 165 px, le texte se repliait hors de son cadre et
     poussait la page (+5 px mesurés) ; à 900 px, 113 px et +63 px. Sous
     1 080 px, l'en-tête passe au-dessus de la coupe et la figure prend toute
     la largeur utile. */
  .sol__grille { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .sommaire { display: none; }
  .entete { grid-template-columns: auto 1fr auto; }
  .entete__metier { display: none; }
  .capacites { grid-template-columns: minmax(0, 1fr); }
  .parc { grid-template-columns: minmax(0, 1fr); }
  .parc__choix { grid-auto-flow: row; }
  .fiche__specs { grid-template-columns: minmax(0, 1fr); }
  .sol__grille { grid-template-columns: minmax(0, 1fr); }
  .section--sol { min-height: 200vh; }
  .sol { grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); }
  .devis { grid-template-columns: minmax(0, 1fr); }
  .devis__detail th,
  .devis__detail td { padding-left: 1rem; }       /* moins d'air, plus de place au texte */
  .devis__detail tbody th { white-space: normal; }  /* le poste peut se replier */
  .devis__resultat {
    padding-left: 0;
    padding-top: 1.3rem;
    border-left: 0;
    border-top: 1px solid var(--trait);
  }
  .journee__item { grid-template-columns: 62px minmax(0, 1fr); gap: 1.1rem; }
  .journee::before,
  .journee::after { left: 62px; }
  .journee__item::before { left: 58px; }
  .journee__heure { padding-right: 1.1rem; font-size: 0.72rem; }
  .refus__item { grid-template-columns: 34px minmax(0, 1fr); }
  .legende-technique { position: static; margin-top: 1.6rem; text-align: left; }
  .hero__legende { text-align: left; }
  .titre-hero { font-size: clamp(2.6rem, 12.5vw, 4.2rem); }
}

@media (max-width: 640px) {
  /* Sous 640 px, la coupe et sa légende ne cohabitent plus : à 390 px la
     légende tombait à 127 px de large, ses notes sortaient du cadre et
     poussaient la page (+66 px mesurés). On empile : la coupe garde une
     largeur lisible, la légende prend toute la page. */
  .sol { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
  .sol__graphique { width: min(190px, 58%); margin-inline: auto; }
}

/* Seuil mesuré (qa/balayage_largeurs.py) : le cadre du tableau cesse de
   défiler à 735 px de fenêtre ; la consigne apparaît donc jusqu'à 734 px,
   c'est-à-dire exactement tant qu'il reste quelque chose à droite. */
@media (max-width: 734px) {
  .releves__defilement { display: block; }
}

@media (max-width: 520px) {
  .entete { padding: 0.85rem var(--marge); gap: 0.8rem; }
  .marque { font-size: 0.9rem; letter-spacing: 0.12em; }
  .lien-fleche { font-size: 0.6rem; padding: 0.45rem 0.6rem; }
  .defilement { display: none; }
}

/* ============================ MOUVEMENT RÉDUIT ============================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .couche,
  .couche-legende,
  .journee__item { opacity: 1; }
  .journee::after { height: calc(100% - 0.8rem); }
}

/* ============================ IMPRESSION ============================ */
@media print {
  #scene-3d, .vignette, .sommaire, .entete, .repli-3d { display: none; }
  body { background: #fff; color: #000; }
}

/* ============================================================================
   BLOCS DE CONTENU (textes fournis par CONTENU.md, 23/10/2026)
   Styles ajoutés pour les blocs qui n'existaient pas dans la première version :
   liste à quatre pièces du modèle, « ce qu'on ne fait pas » des capacités,
   motifs des refus, mentions de fin de section.
   ========================================================================== */

.contenu__chapeau {
  color: var(--creme);
  font-size: clamp(1rem, 1.15vw, 1.12rem);
}

/* --- 02 : les quatre pièces, numérotées à la main ------------------------ */
.modele__liste {
  list-style: none;
  margin: 1.3rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.95rem;
  counter-reset: piece;
}
.modele__liste li {
  position: relative;
  padding-left: 2.3rem;
  color: rgba(245, 239, 225, 0.74);
  font-size: 0.94rem;
  line-height: 1.6;
}
.modele__liste li::before {
  counter-increment: piece;
  content: "0" counter(piece);
  position: absolute;
  left: 0;
  top: 0.18rem;
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--jaune);
}
.modele__liste strong { color: var(--creme); font-weight: 600; }

/* --- 03 : ce qu'on ne fait pas ------------------------------------------ */
.capacite__refus {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--trait-faible);
  color: rgba(245, 239, 225, 0.6);
  font-size: 0.84rem;
  line-height: 1.55;
}
.capacite__refus span {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--f-mono);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--jaune);
}
.capacites__chute {
  max-width: 62ch;
  margin-top: clamp(1.7rem, 3vw, 2.5rem);
  color: rgba(245, 239, 225, 0.72);
  font-size: 0.95rem;
  line-height: 1.66;
}

/* --- 04 : phrase de fiche ------------------------------------------------- */
.fiche__detail {
  margin-top: 0.9rem;
  color: rgba(245, 239, 225, 0.72);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* --- 05 : chute de la coupe de sol --------------------------------------- */
.sol__chute {
  max-width: 46ch;
  margin-top: 1.4rem;
  color: rgba(245, 239, 225, 0.66);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* --- 06 : mention sous le tableau ---------------------------------------- */
.releves__chute {
  margin-top: 1.4rem;
  color: rgba(245, 239, 225, 0.66);
  font-size: 0.9rem;
}

/* --- 08 : motifs des refus ------------------------------------------------ */
.refus__corps { display: grid; gap: 0.55rem; }
.refus__type {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--jaune);
}
.refus__motif {
  max-width: 52ch;
  color: rgba(245, 239, 225, 0.66);
  font-size: 0.9rem;
  line-height: 1.55;
}
.refus__chute {
  max-width: 56ch;
  margin-top: 1.7rem;
  color: rgba(245, 239, 225, 0.7);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* --- 10 : la chute -------------------------------------------------------- */
.chute__aveu {
  color: var(--jaune);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 1.9vw, 1.45rem);
  letter-spacing: -0.01em;
}
.chute__mention {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris);
}
.contenu--chute a { color: var(--jaune); text-decoration: underline; text-underline-offset: 3px; }
