/* ============================================================
   Terrains Naturels — feuille de style commune
   Édité par Bivouacs Huttopia
   Design : sobre, esprit « guide de terrain / document cadastral »
   Typo : Source Serif 4 (titres) + Inter (texte) + mono (références)
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Palette validée (specs §7) */
  --papier:      #E9E6D7; /* fond principal, vert-de-gris */
  --papier-2:    #E1DDCB; /* variation légèrement plus soutenue */
  --encre:       #20281D; /* texte principal */
  --foret:       #242C1F; /* fonds foncés, bandeau collectivités */
  --terre:       #6E5A3E; /* bordures, secondaire */
  --eau:         #57685A; /* mer, rivière */
  --brique:      #9C4A2E; /* accent unique : CTA, « recommandé » */
  --brique-fonce:#813a22;

  /* Dérivés utilitaires */
  --encre-70:  rgba(32, 40, 29, 0.70);
  --encre-55:  rgba(32, 40, 29, 0.55);
  --encre-12:  rgba(32, 40, 29, 0.12);
  --encre-08:  rgba(32, 40, 29, 0.08);
  --papier-90: rgba(233, 230, 215, 0.90);
  --papier-60: rgba(233, 230, 215, 0.60);

  /* Typographie */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", "Menlo", monospace;

  /* Mesures */
  --max:        1240px;
  --measure:    92ch;   /* largeur de lecture élargie */
  --gutter:     clamp(1.1rem, 4vw, 2.4rem);
  --radius:     4px;    /* léger adoucissement des cartes */
  --bordure:    1px solid var(--encre-12);
  --bordure-fr: 1px solid var(--terre);
}

/* ---------- 2. Reset léger ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.68;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brique); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.18; color: var(--encre); margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
h3 { font-size: clamp(1.18rem, 1.8vw, 1.4rem); }
p  { margin: 0 0 1.1em; }

/* ---------- 3. Utilitaires ---------- */
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.measure { max-width: var(--measure); }
.eyebrow {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--terre);
  margin: 0 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}
.eyebrow::before { content: ""; width: 1.6rem; height: 1px; background: var(--terre); display: inline-block; }
.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; }

/* ---------- 4. En-tête / navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--papier-90);
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: var(--bordure-fr);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 60px;
}
.brand {
  font-family: var(--serif); font-weight: 600; font-size: 1.12rem;
  color: var(--encre); letter-spacing: -.01em; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .55rem;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 15px; height: 15px; flex: none;
  border: 1.5px solid var(--terre);
  position: relative;
}
.brand .mark::after { content:""; position:absolute; inset:3px; border:1px solid var(--terre); }
.nav-links { display: flex; align-items: center; gap: .2rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--encre); font-size: .92rem; font-weight: 500;
  padding: .5rem .7rem; display: inline-block; border-bottom: 2px solid transparent;
}
.nav-links a:hover { text-decoration: none; border-bottom-color: var(--terre); }
.nav-links a[aria-current="page"] { border-bottom-color: var(--brique); color: var(--brique); }
.nav-toggle { display: none; background: none; border: var(--bordure-fr); color: var(--encre); font-family: var(--mono); font-size: .8rem; padding: .45rem .7rem; cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-block; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--papier); border-bottom: var(--bordure-fr);
    padding: .4rem var(--gutter) 1rem;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .7rem .2rem; border-bottom: 1px solid var(--encre-12); }
}

/* ---------- 5. Bandeaux à fond foncé + motif topographique ---------- */
.band-dark {
  background-color: var(--foret);
  color: var(--papier);
  position: relative;
  overflow: hidden;
}
.band-dark::before {
  /* courbes de niveau très discrètes (specs §7) */
  content: "";
  position: absolute; inset: 0;
  background-image: url("../img/contours.svg");
  background-size: 640px auto;
  opacity: .10;
  pointer-events: none;
}
.band-dark h1, .band-dark h2, .band-dark h3 { color: var(--papier); }
.band-dark .eyebrow { color: var(--papier-60); }
.band-dark .eyebrow::before { background: var(--papier-60); }
.band-dark a { color: #d99b83; }

/* ---------- 6. Boutons / CTA ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--sans); font-weight: 600; font-size: .95rem;
  padding: .72rem 1.25rem; border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brique); color: #fff; }
.btn-primary:hover { background: var(--brique-fonce); }
.btn-ghost { background: transparent; color: var(--encre); border-color: var(--terre); }
.btn-ghost:hover { background: var(--encre-08); }
.band-dark .btn-ghost { color: var(--papier); border-color: var(--papier-60); }
.band-dark .btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-arrow::after { content: "→"; font-family: var(--mono); }

/* ---------- 7. Hero d'accueil ---------- */
.hero { padding: clamp(2.6rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3.4rem); }
.hero .lead { font-size: clamp(1.08rem, 1.6vw, 1.28rem); color: var(--encre-70); max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.hero-meta { margin-top: 2.2rem; font-family: var(--mono); font-size: .78rem; color: var(--terre); letter-spacing: .04em; }
.hero-figure { margin: 2.6rem 0 0; border: var(--bordure-fr); border-radius: var(--radius); overflow: hidden; }
.hero-figure img { width: 100%; display: block; aspect-ratio: 16 / 7; object-fit: cover; }

/* ---------- 8. Élément signature : les 5 planches ---------- */
.planches-section { padding: clamp(2rem, 5vw, 4rem) 0; border-top: var(--bordure-fr); border-bottom: var(--bordure-fr); }
.planches {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  border: var(--bordure-fr);
}
.planche {
  appearance: none; background: var(--papier-2); border: none;
  border-right: var(--bordure-fr);
  padding: 0; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; color: var(--encre);
  transition: background-color .15s ease;
  font-family: inherit;
}
.planche:last-child { border-right: none; }
.planche:hover { background: #d8d4c1; }
.planche[aria-selected="true"] { background: var(--foret); color: var(--papier); }
.planche[aria-selected="true"] .planche-fig { border-bottom-color: rgba(255,255,255,.18); }
.planche-fig {
  aspect-ratio: 3 / 4; width: 100%;
  border-bottom: var(--bordure-fr);
  display: block;
}
.planche-fig svg { width: 100%; height: 100%; display: block; }
.planche-label {
  padding: .8rem .7rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.planche-num { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; color: var(--terre); }
.planche[aria-selected="true"] .planche-num { color: var(--papier-60); }
.planche-name { font-family: var(--serif); font-size: 1rem; font-weight: 600; }

.planche-panel {
  border: var(--bordure-fr); border-top: none;
  background: var(--foret); color: var(--papier);
  padding: clamp(1.4rem, 3vw, 2.2rem);
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.4rem, 4vw, 3rem);
  position: relative; overflow: hidden;
}
.planche-panel h3 { color: var(--papier); }
.planche-panel .desc { color: var(--papier-90); max-width: 46ch; }
.usages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.usage {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid rgba(255,255,255,.14);
}
.usage:last-child { border-bottom: none; }
.usage-name { color: var(--papier); font-weight: 500; }
.usage-tag {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .2rem .5rem; white-space: nowrap;
  color: var(--papier-60); border: 1px solid rgba(255,255,255,.2);
}
.usage-tag.reco { color: #fff; background: var(--brique); border-color: var(--brique); }

@media (max-width: 780px) {
  .planches { grid-template-columns: repeat(2, 1fr); }
  .planche:nth-child(2n) { border-right: none; }
  .planche-fig { aspect-ratio: 16 / 9; }
  .planche-panel { grid-template-columns: 1fr; }
}

/* ---------- 9. Grille de piliers (accueil) ---------- */
.piliers { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.1rem; }
.pilier-card {
  border: var(--bordure-fr); border-left: 3px solid var(--terre); border-radius: var(--radius);
  padding: clamp(1.5rem, 2.6vw, 2.1rem); background: var(--papier);
  display: flex; flex-direction: column; gap: .55rem; min-height: 210px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
}
.pilier-card:hover {
  text-decoration: none; background: var(--papier-2);
  border-left-color: var(--brique);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -12px rgba(32,40,29,.35);
}
.pilier-num { font-family: var(--mono); font-size: .8rem; letter-spacing: .14em; color: var(--terre); }
.pilier-card h3 { margin: 0; color: var(--encre); font-size: 1.32rem; }
.pilier-card p { margin: 0; color: var(--encre-70); font-size: .96rem; }
.pilier-card .more { margin-top: auto; padding-top: 1rem; font-weight: 600; color: var(--brique); font-size: .92rem; }

/* ---------- 10. Section générique ---------- */
.section { padding: clamp(2.4rem, 5vw, 4.4rem) 0; }
.section-head { max-width: 74ch; margin-bottom: 2.2rem; }
.section-head p { color: var(--encre-70); font-size: 1.05rem; }

/* ---------- 11. Page-pilier : grille de sous-articles ---------- */
.subgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.2rem; }
.subcard {
  border: var(--bordure-fr); border-top: 3px solid var(--terre); border-radius: var(--radius);
  padding: 1.7rem 1.8rem; background: var(--papier);
  display: flex; flex-direction: column; gap: .6rem; min-height: 216px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
}
.subcard:hover {
  text-decoration: none; background: var(--papier-2);
  border-top-color: var(--brique);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -12px rgba(32,40,29,.35);
}
.subcard .kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; color: var(--terre); text-transform: uppercase; }
.subcard h3 { margin: 0; font-size: 1.26rem; color: var(--encre); }
.subcard p { margin: 0; font-size: .93rem; color: var(--encre-70); }
.subcard .more { margin-top: auto; padding-top: .6rem; color: var(--brique); font-weight: 600; font-size: .88rem; }
.subcard .draft { font-family: var(--mono); font-size: .68rem; color: var(--terre); border: 1px solid var(--encre-12); padding: .1rem .4rem; align-self: flex-start; }

/* ---------- 12. Fil d'ariane ---------- */
.crumb { font-family: var(--mono); font-size: .76rem; color: var(--terre); letter-spacing: .04em; padding: 1.1rem 0 0; }
.crumb a { color: var(--terre); }
.crumb span { color: var(--encre-55); }

/* ---------- 13. Article long-form ---------- */
.article { padding: 1.4rem 0 3.5rem; }
.article-header { max-width: var(--measure); margin-bottom: 2rem; padding-bottom: 1.6rem; border-bottom: var(--bordure-fr); }
.article-header h1 { margin-bottom: .5rem; }
.article-header .standfirst { font-size: 1.18rem; color: var(--encre-70); font-family: var(--serif); line-height: 1.5; }
.article-meta { margin-top: 1.2rem; font-family: var(--mono); font-size: .76rem; color: var(--terre); display: flex; flex-wrap: wrap; gap: 1.2rem; }
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.4rem; padding-top: 1.2rem; border-top: var(--bordure); }
.prose h3 { margin-top: 1.8rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.prose li { margin-bottom: .5em; }
.prose strong { color: var(--encre); }
.prose blockquote {
  margin: 1.6rem 0; padding: .3rem 0 .3rem 1.3rem;
  border-left: 3px solid var(--terre); color: var(--encre-70);
  font-family: var(--serif); font-size: 1.08rem;
}
.prose a { border-bottom: 1px solid rgba(156,74,46,.35); }
.prose a:hover { text-decoration: none; border-bottom-color: var(--brique); }

/* Encadré / callout */
.callout {
  border: var(--bordure-fr); background: var(--papier-2);
  padding: 1.2rem 1.4rem; margin: 1.8rem 0;
}
.callout .callout-title { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--terre); margin-bottom: .5rem; }
.callout p:last-child { margin-bottom: 0; }
.callout.accent { border-left: 4px solid var(--brique); }

/* Note de source */
.source { font-size: .82rem; color: var(--encre-55); font-style: italic; }

/* Sources en liste : une source par ligne */
.source-list { list-style: none; margin: .3rem 0 0; padding: 0; }
.source-list li { font-size: .84rem; color: var(--encre-55); padding: .4rem 0; border-bottom: 1px solid var(--encre-08); }
.source-list li:last-child { border-bottom: none; }
.source-list a { color: var(--brique); }

/* Bloc « Plateformes & ressources » (au-dessus des sources) */
.platforms { border: var(--bordure-fr); border-top: 3px solid var(--terre); border-radius: var(--radius); background: var(--papier); padding: 1.4rem 1.5rem; margin: 2.4rem 0 1.4rem; }
.platforms .platforms-title { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--terre); margin-bottom: .3rem; }
.platforms .platforms-intro { font-size: .9rem; color: var(--encre-70); margin: 0 0 1rem; }
.platforms ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .1rem .6rem; }
.platforms li { border-bottom: 1px solid var(--encre-08); padding: .55rem 0; }
.platforms a { font-weight: 600; color: var(--brique); border-bottom: none; }
.platforms a::after { content: " ↗"; font-family: var(--mono); font-size: .8em; color: var(--terre); }
.platforms .plat-desc { display: block; font-size: .82rem; color: var(--encre-55); font-weight: 400; }
.platforms li.reco { border-bottom-color: var(--brique); }
.platforms li.reco a { color: var(--brique); }
.platforms li.reco .plat-tag { font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--brique); padding: .05rem .35rem; margin-left: .4rem; }

/* Tableau de données */
.data-table { width: 100%; border-collapse: collapse; margin: 1.6rem 0; font-size: .92rem; }
.data-table th, .data-table td { text-align: left; padding: .65rem .8rem; border-bottom: var(--bordure); vertical-align: top; }
.data-table thead th { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--terre); border-bottom: var(--bordure-fr); }
.data-table tbody tr:hover { background: var(--papier-2); }
.table-scroll { overflow-x: auto; }

/* Sommaire d'article */
.toc { border: var(--bordure-fr); padding: 1rem 1.2rem; margin-bottom: 2rem; }
.toc .toc-title { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--terre); margin-bottom: .6rem; }
.toc ol { list-style: decimal; margin: 0; padding-left: 1.3rem; }
.toc li { margin-bottom: .3rem; }
.toc a { color: var(--encre); }

/* CTA de fin d'article */
.article-cta { margin: 2.6rem 0 0; }

/* Renvoi croisé */
.crosslink { border-top: var(--bordure-fr); margin-top: 2.4rem; padding-top: 1.4rem; }
.crosslink .kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--terre); }

/* ---------- 14. Bloc CTA Bivouacs ---------- */
.cta-band { padding: clamp(2.4rem, 5vw, 3.8rem) 0; }
.cta-band .inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.4rem, 4vw, 3rem); align-items: center; }
.cta-band h2 { margin-bottom: .6rem; }
.cta-band p { color: var(--papier-90); max-width: 48ch; }
@media (max-width: 760px) { .cta-band .inner { grid-template-columns: 1fr; } }

/* ---------- 15. Simulateur ---------- */
.simulateur { border: var(--bordure-fr); background: var(--papier-2); }
.sim-grid { display: grid; grid-template-columns: 1fr 1fr; }
.sim-controls { padding: clamp(1.4rem, 3vw, 2rem); border-right: var(--bordure-fr); }
.sim-result { padding: clamp(1.4rem, 3vw, 2rem); background: var(--foret); color: var(--papier); position: relative; overflow: hidden; }
.sim-field { margin-bottom: 1.3rem; }
.sim-field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .5rem; }
.sim-field .hint { font-size: .82rem; color: var(--encre-55); margin-top: .3rem; }
.sim-field select, .sim-field input[type="number"] {
  width: 100%; font-family: var(--sans); font-size: 1rem; padding: .6rem .7rem;
  border: var(--bordure-fr); background: var(--papier); color: var(--encre);
}
.sim-field input[type="range"] { width: 100%; accent-color: var(--brique); }
.sim-result .sim-label { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--papier-60); }
.sim-result .sim-value { font-family: var(--serif); font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; margin: .2rem 0 .1rem; }
.sim-result .sim-range { color: var(--papier-90); font-size: .95rem; }
.sim-result .sim-note { margin-top: 1.4rem; font-size: .82rem; color: var(--papier-60); border-top: 1px solid rgba(255,255,255,.14); padding-top: 1rem; }
@media (max-width: 680px) { .sim-grid { grid-template-columns: 1fr; } .sim-controls { border-right: none; border-bottom: var(--bordure-fr); } }

/* ---------- 16. FAQ ---------- */
.faq-item { border-bottom: var(--bordure-fr); }
.faq-item summary { cursor: pointer; padding: 1.1rem 0; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-family: var(--mono); color: var(--brique); font-size: 1.4rem; line-height: 1; }
.faq-item[open] summary::after { content: "–"; }
.faq-item .faq-body { padding: 0 0 1.3rem; color: var(--encre-70); max-width: var(--measure); }

/* ---------- 17. Pied de page ---------- */
.site-footer { background: var(--foret); color: var(--papier-90); margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 2rem; padding: clamp(2.4rem, 4vw, 3.4rem) 0; }
.footer-grid h4 { color: var(--papier); font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; margin-bottom: 1rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: .5rem; }
.footer-grid a { color: var(--papier-90); font-size: .92rem; }
.footer-grid a:hover { color: #fff; }
.footer-brand p { color: var(--papier-60); font-size: .9rem; max-width: 34ch; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding: 1.2rem 0; font-size: .8rem; color: var(--papier-60); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-bottom a { color: var(--papier-60); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- 18. Divers ---------- */
.pill { display: inline-block; font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--terre); border: 1px solid var(--terre); padding: .18rem .5rem; }
.pill.reco { color: #fff; background: var(--brique); border-color: var(--brique); }
hr.rule { border: none; border-top: var(--bordure-fr); margin: 2.4rem 0; }
.notice { font-family: var(--mono); font-size: .78rem; color: var(--terre); background: var(--papier-2); border: var(--bordure); padding: .7rem 1rem; }
