/* Pages éditoriales — carnet, journal, fiches communales, à propos.
   Même identité que la page d'accueil : bleu nuit, sarcelle, ambre, DM Sans.
   Les pages légales gardent legal.css, plus sobre. */

:root {
  --navy: #0b1d35;
  --navy-mid: #132847;
  --navy-deep: #060f1c;
  --teal: #0d9488;
  --teal-light: #14b8a8;
  --teal-pale: #5eead4;
  --teal-bg: #f0fdfa;
  --amber: #e8810a;
  --amber-light: #fef3e2;
  --violet: #7c3aed;
  --bg: #f9f8f6;
  --white: #ffffff;
  --ink: #0f1923;
  --soft: #4a5568;
  --muted: #6b7a8a;
  --border: #e4e7ec;
  --r: 14px;
  --r-lg: 20px;
  /* Alias attendus par les schémas SVG des articles (var(--accent) etc.). */
  --accent: var(--teal);
  --flux: var(--violet);
  --card: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px; line-height: 1.7; -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--teal); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 4px;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.lecture { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* Transitions douces entre les pages du site (navigateurs compatibles). */
@view-transition { navigation: auto; }

/* ── En-tête ─────────────────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 29, 53, .96); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo svg { width: 32px; height: 32px; }
.logo-text { font-size: 21px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.logo-text span { color: var(--teal-light); }
.nav-liens { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; }
.nav-liens a { color: rgba(255, 255, 255, .7); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-liens a:hover, .nav-liens a[aria-current="page"] { color: #fff; }
.nav-liens a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--teal-light); padding-bottom: 4px; }
.nav-cta {
  background: var(--amber); color: #fff; padding: 9px 18px; border-radius: 10px;
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.nav-cta:hover { background: #d4740a; }
@media (max-width: 860px) { .nav-liens { display: none; } }

/* Barre de progression de lecture, pilotée par le défilement (CSS seul).
   Les navigateurs qui ne connaissent pas animation-timeline n'affichent rien. */
.progression { display: none; }
@supports (animation-timeline: scroll()) {
  .progression {
    display: block; position: fixed; top: 64px; left: 0; right: 0; height: 3px; z-index: 49;
    background: linear-gradient(90deg, var(--teal-light), var(--amber));
    transform-origin: 0 50%; transform: scaleX(0);
    animation: progression linear both; animation-timeline: scroll(root);
  }
  @keyframes progression { to { transform: scaleX(1); } }
}

/* ── Bandeau d'ouverture ─────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(ellipse at 75% 20%, var(--navy-mid), var(--navy) 70%);
  padding: 64px 0 72px;
}
.hero::after {
  content: ""; position: absolute; inset: auto -10% -60% auto; width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(13, 148, 136, .22), transparent 62%); pointer-events: none;
}
.hero > .wrap, .hero > .lecture { position: relative; z-index: 1; }
.hero-grille { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; align-items: center; }
@media (max-width: 860px) { .hero-grille { grid-template-columns: 1fr; gap: 28px; } }
.hero h1 {
  font-size: clamp(30px, 4.4vw, 52px); line-height: 1.08; font-weight: 800;
  letter-spacing: -.035em; margin: 0 0 18px; text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--teal-light); }
.hero .chapo { font-size: clamp(17px, 1.6vw, 20px); color: rgba(255, 255, 255, .72); margin: 0 0 22px; max-width: 60ch; text-wrap: pretty; }
.hero .meta { font-size: 14px; color: rgba(255, 255, 255, .55); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero .meta span + span::before { content: "·"; margin-right: 14px; opacity: .6; }
.hero-couverture { position: absolute; inset: 0; z-index: 0; opacity: .55; }
.hero-couverture img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-couverture::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--navy) 18%, rgba(11, 29, 53, .7) 55%, rgba(11, 29, 53, .15));
}

.pastille {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--teal-pale); background: rgba(20, 184, 168, .12); border: 1px solid rgba(94, 234, 212, .35);
  padding: 5px 13px; border-radius: 100px; margin-bottom: 18px;
}
.pastille.claire { color: var(--teal); background: var(--teal-bg); border-color: #99f6e4; }
.pastille .point { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }

/* ── Cartes et grilles ───────────────────────────────────── */
.section { padding: 64px 0; }
.section-titre { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -.03em; margin: 0 0 10px; line-height: 1.15; text-wrap: balance; }
.section-intro { color: var(--soft); max-width: 62ch; margin: 0 0 30px; }
.grille { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.carte {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
a.carte { color: inherit; text-decoration: none; }
a.carte:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -18px rgba(11, 29, 53, .35); border-color: #b7ece4; }
.carte-visuel { aspect-ratio: 5 / 2; background: var(--navy); overflow: hidden; }
.carte-visuel img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
a.carte:hover .carte-visuel img { transform: scale(1.05); }
.carte-corps { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.carte h2, .carte h3 { font-size: 19px; line-height: 1.3; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.carte p { margin: 0; color: var(--soft); font-size: 15px; line-height: 1.6; }
.carte-corps .pastille { align-self: flex-start; margin-bottom: 4px; }
.carte .meta { margin-top: auto; padding-top: 8px; font-size: 13px; color: var(--muted); }
.carte.une { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; }
.carte.une .carte-visuel { aspect-ratio: auto; min-height: 280px; }
.carte.une h2 { font-size: clamp(22px, 2.4vw, 30px); }
@media (max-width: 760px) { .carte.une { grid-template-columns: 1fr; } .carte.une .carte-visuel { min-height: 180px; } }
@media (prefers-reduced-motion: reduce) { a.carte, a.carte:hover, .carte-visuel img { transition: none; transform: none; } }

/* ── Chiffres clés ───────────────────────────────────────── */
.kpis {
  display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-top: -44px; position: relative; z-index: 2;
}
.kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px 20px; box-shadow: 0 12px 30px -20px rgba(11, 29, 53, .45);
  display: flex; gap: 14px; align-items: flex-start;
}
.kpi .ico { flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
            background: var(--teal-bg); color: var(--teal); }
.kpi .ico.ambre { background: var(--amber-light); color: var(--amber); }
.kpi .ico svg { width: 21px; height: 21px; }
.kpi .val { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .lib { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* Barres horizontales (activités, équipements, créations). */
.barres { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
.barre { display: grid; grid-template-columns: minmax(150px, 230px) 1fr auto; gap: 14px; align-items: center; font-size: 15px; }
.barre .nom { color: var(--ink); font-weight: 500; }
.barre .piste { height: 12px; background: #eef1f4; border-radius: 6px; overflow: hidden; }
.barre .remplie { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--teal), var(--teal-light)); }
.barre .remplie.gris { background: #aab6c2; }
.barre .remplie.ambre { background: linear-gradient(90deg, #f0a43a, var(--amber)); }
.barre .val { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 4.5ch; text-align: right; }
.barre .val small { font-weight: 400; color: var(--muted); }
@media (max-width: 600px) { .barre { grid-template-columns: 1fr auto; } .barre .piste { grid-column: 1 / -1; order: 3; } }

.tuiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 18px 0; }
.tuile { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.tuile .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--teal-bg); color: var(--teal); margin-bottom: 10px; }
.tuile .ico svg { width: 19px; height: 19px; }
.tuile .val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tuile .lib { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* ── Corps d'article ─────────────────────────────────────── */
.feuille {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg);
  margin-top: -40px; position: relative; z-index: 2; padding: 44px 0 36px;
  box-shadow: 0 24px 60px -40px rgba(11, 29, 53, .5);
}
.prose { font-size: 18px; color: #1f2a37; }
.prose > p:first-child { font-size: 20px; line-height: 1.65; color: var(--ink); }
.prose > p:first-child::first-letter {
  float: left; font-size: 3.4em; line-height: .9; font-weight: 800; color: var(--teal);
  margin: 6px 10px 0 0;
}
.prose h2 {
  font-size: 26px; font-weight: 800; letter-spacing: -.025em; line-height: 1.2;
  margin: 46px 0 14px; padding-left: 16px; border-left: 4px solid var(--teal-light); text-wrap: balance;
}
.prose p { margin: 0 0 18px; text-wrap: pretty; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 1.3rem; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--teal); }
.prose strong { color: var(--ink); }
.prose .chiffre {
  font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, transparent 58%, rgba(20, 184, 168, .28) 58%);
  padding: 0 2px; white-space: nowrap;
}
.prose figure { margin: 34px -24px; padding: 22px 24px 18px; background: var(--bg); border-radius: var(--r); }
@media (min-width: 820px) { .prose figure { margin-left: -56px; margin-right: -56px; padding: 26px 56px 20px; } }
.prose .schema { width: 100%; height: auto; display: block; background: var(--white); border: 1px solid var(--border); border-radius: 12px; }
.prose .schema text { font-family: "DM Sans", system-ui, sans-serif; }
.prose figcaption { font-size: 14.5px; color: var(--soft); margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--amber); }

/* ── Encadrés ────────────────────────────────────────────── */
.bandeau-cta {
  background: radial-gradient(ellipse at 85% 0%, rgba(20, 184, 168, .25), transparent 55%), var(--navy);
  color: #fff; border-radius: var(--r-lg); padding: 34px 36px; margin: 40px 0;
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
}
.bandeau-cta h2, .bandeau-cta h3 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; border: 0; padding: 0; }
.bandeau-cta p { margin: 0; color: rgba(255, 255, 255, .7); font-size: 15.5px; }
.bandeau-cta .liens { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
@media (max-width: 700px) { .bandeau-cta { grid-template-columns: 1fr; padding: 28px 24px; } }
.bouton {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  background: var(--amber); color: #fff; font-weight: 700; font-size: 15px;
  padding: 12px 22px; border-radius: 11px; text-decoration: none; white-space: nowrap;
}
.bouton:hover { background: #d4740a; }
.bouton.contour { background: transparent; border: 1px solid rgba(255, 255, 255, .3); color: #fff; }
.bouton.contour:hover { background: rgba(255, 255, 255, .08); }

.encadre { background: var(--teal-bg); border: 1px solid #b7ece4; border-radius: var(--r); padding: 20px 22px; margin: 26px 0; }
.encadre h3 { margin: 0 0 6px; font-size: 16px; }
.encadre p:last-child { margin-bottom: 0; }
.avert { background: var(--amber-light); border: 1px solid #f6d7a7; border-radius: var(--r); padding: 18px 22px; margin: 26px 0; font-size: 15px; color: #6b4a14; }
.avert strong { color: #4a3209; }

/* Inscription à la lettre (partiel _abonnement.html). */
.abo {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 28px 30px; margin: 40px 0 0; position: relative; overflow: hidden;
}
.abo::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--teal-light), var(--amber)); }
.abo h2 { font-size: 21px; margin: 0 0 6px; letter-spacing: -.02em; border: 0; padding: 0; }
.abo p { margin: 0 0 16px; color: var(--soft); font-size: 15px; }
.abo form { display: flex; gap: 10px; flex-wrap: wrap; }
.abo input { flex: 1 1 240px; padding: 12px 14px; font: inherit; font-size: 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); color: inherit; }
.abo button { padding: 12px 22px; font: inherit; font-size: 15px; font-weight: 700; border: 0; border-radius: 11px; background: var(--teal); color: #fff; cursor: pointer; }
.abo button:hover { background: #0b7f75; }
.abo button[disabled] { opacity: .55; cursor: default; }
.abo .mention { font-size: 12.5px; margin: 12px 0 0; color: var(--muted); }
.abo .retour { font-size: 14px; margin: 12px 0 0; }
.abo .retour.ko { color: #b91c1c; }

/* ── Silhouettes de communes ─────────────────────────────── */
.silhouette { display: block; width: 100%; height: auto; overflow: visible; }
.silhouette path { fill: rgba(20, 184, 168, .14); stroke: var(--teal-pale); stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hero .silhouette { max-height: 300px; filter: drop-shadow(0 0 24px rgba(20, 184, 168, .35)); }
.carte-visuel.commune { display: grid; place-items: center; padding: 18px; background: radial-gradient(circle at 50% 40%, var(--navy-mid), var(--navy)); }
.carte-visuel.commune .silhouette { max-height: 120px; width: auto; }
.grand-solde { font-size: clamp(64px, 10vw, 120px); font-weight: 800; letter-spacing: -.05em; line-height: .9; color: var(--teal-light); }
.grand-solde small { display: block; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .6); font-weight: 600; margin-top: 10px; }

/* Apparition au défilement (navigateurs compatibles, mouvement réduit respecté). */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .apparait { animation: apparait linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    @keyframes apparait { from { opacity: 0; transform: translateY(26px); } }
  }
}

/* ── Pied de page ────────────────────────────────────────── */
.pied-cta { background: var(--navy); color: #fff; text-align: center; padding: 76px 0; position: relative; overflow: hidden; margin-top: 70px; }
.pied-cta::before { content: ""; position: absolute; top: -220px; left: 50%; transform: translateX(-50%); width: 640px; height: 640px; background: radial-gradient(circle, rgba(13, 148, 136, .22), transparent 60%); pointer-events: none; }
.pied-cta h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 800; letter-spacing: -.03em; margin: 0 0 12px; position: relative; }
.pied-cta p { color: rgba(255, 255, 255, .62); margin: 0 auto 30px; max-width: 54ch; position: relative; }
.pied-cta .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; position: relative; }
.pied { background: var(--navy-deep); color: rgba(255, 255, 255, .5); font-size: 13.5px; padding: 48px 0 30px; }
.pied-grille { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
@media (max-width: 860px) { .pied-grille { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .pied-grille { grid-template-columns: 1fr; } }
.pied h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .65); margin: 0 0 14px; }
.pied a { display: block; color: rgba(255, 255, 255, .45); text-decoration: none; margin-bottom: 9px; }
.pied a:hover { color: rgba(255, 255, 255, .85); }
.pied .marque-p p { margin: 12px 0 0; line-height: 1.7; max-width: 34ch; }
.pied-bas { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 22px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* Utilitaires */
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
