/* =========================================================
   Amilub — feuille de style unique
   Palette : calcaire, encre, ocre profond, lavande sourde, garrigue
   Type    : Petrona (titres) / Public Sans (texte, données)
   ========================================================= */

:root {
  --calcaire:      #EEEBE2;
  --calcaire-fonce:#E4E0D3;
  --papier:        #F7F5EF;
  --encre:         #22201C;
  --encre-douce:   #57534A;
  --ocre:          #9A5B23;
  --ocre-clair:    #C08B4E;
  --lavande:       #6B6A86;
  --garrigue:      #5E6B45;
  --filet:         #D6D1C2;

  --serif: "Petrona", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --mesure: 34rem;
  --large: 60rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--calcaire);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 380;
}

/* ---------- Signature : cordon de pierre sèche ---------- */
.cordon {
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='14' viewBox='0 0 120 14'%3E%3Cg fill='%23E4E0D3' stroke='%23C9C2AE' stroke-width='1'%3E%3Cpath d='M0 13.5h120' fill='none'/%3E%3Crect x='1' y='4' width='22' height='9' rx='3'/%3E%3Crect x='25' y='2' width='16' height='11' rx='3'/%3E%3Crect x='43' y='5' width='27' height='8' rx='3'/%3E%3Crect x='72' y='3' width='19' height='10' rx='3'/%3E%3Crect x='93' y='5' width='25' height='8' rx='3'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: bottom left;
  margin: 3.5rem 0 2.5rem;
}

/* ---------- En-tête ---------- */
.bandeau {
  border-bottom: 1px solid var(--filet);
  background: var(--papier);
}
.bandeau-inner {
  max-width: var(--large);
  margin: 0 auto;
  padding: 1.1rem 1.5rem 0.9rem;
}
.marque {
  display: block;
  text-decoration: none;
  color: var(--encre);
}
.marque strong {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  display: block;
  line-height: 1.1;
}
.marque span {
  display: block;
  font-size: 0.78rem;
  color: var(--encre-douce);
  letter-spacing: 0.02em;
  margin-top: 0.25rem;
  max-width: 32rem;
}
nav.principale {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
}
nav.principale a {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: var(--encre-douce);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
nav.principale a:hover { color: var(--ocre); border-bottom-color: var(--ocre-clair); }
nav.principale a[aria-current="page"] { color: var(--encre); border-bottom-color: var(--ocre); }

/* ---------- Bandeau illustré ---------- */
.horizon {
  position: relative;
  background: var(--papier);
  border-bottom: 1px solid var(--filet);
  overflow: hidden;
  line-height: 0;
}
.horizon img {
  display: block;
  width: 100%;
  height: clamp(96px, 13vw, 176px);
  object-fit: cover;
  object-position: 50% 62%;
}
.horizon::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(to bottom, rgba(238,235,226,0), var(--calcaire));
  pointer-events: none;
}
body.accueil .horizon img { height: clamp(150px, 21vw, 290px); }

/* ---------- Trames ---------- */
main { max-width: var(--large); margin: 0 auto; padding: 2.2rem 1.5rem 1rem; }
.mesure { max-width: var(--mesure); }

/* ---------- Titres ---------- */
h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 1.2rem;
  max-width: 22ch;
}
h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 3.4vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.6rem 0 0.9rem;
}
h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  margin: 1.8rem 0 0.5rem;
}
.chapo {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.6vw, 1.35rem);
  line-height: 1.5;
  color: var(--encre-douce);
  max-width: 40rem;
  margin: 0 0 1.5rem;
}
.surtitre {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--ocre);
  margin: 0 0 0.9rem;
}

p { max-width: var(--mesure); margin: 0 0 1.1rem; }
a { color: var(--ocre); text-underline-offset: 0.16em; text-decoration-thickness: 1px; }
a:hover { color: var(--encre); }
strong { font-weight: 700; }

ul, ol { max-width: var(--mesure); padding-left: 1.15rem; margin: 0 0 1.2rem; }
li { margin-bottom: 0.5rem; }

/* ---------- Accueil : bande des communes ---------- */
.bande {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid var(--filet);
  background: var(--papier);
  margin: 2rem 0 0.75rem;
}
.bande div {
  padding: 1.4rem 0.6rem;
  text-align: center;
  border-right: 1px solid var(--filet);
}
.bande div:last-child { border-right: 0; }
.bande b {
  display: block;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
}
.bande em {
  display: block;
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--encre-douce);
  margin-top: 0.3rem;
}
.legende {
  font-size: 0.82rem;
  color: var(--encre-douce);
  max-width: 40rem;
  margin: 0 0 2rem;
}

/* ---------- Chiffres ---------- */
.chiffres {
  border-left: 3px solid var(--lavande);
  padding: 0.2rem 0 0.2rem 1.2rem;
  margin: 2rem 0;
  max-width: 40rem;
}
.chiffres dl { margin: 0; display: flex; flex-wrap: wrap; gap: 1.5rem 2.6rem; }
.chiffres dt {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--lavande);
}
.chiffres dd { margin: 0.3rem 0 0; font-size: 0.85rem; color: var(--encre-douce); max-width: 14rem; }
.chiffres > p { font-size: 0.85rem; color: var(--encre-douce); margin: 1rem 0 0; }

/* ---------- Boutons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.8rem 0; }
.bouton {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--ocre);
  color: var(--ocre);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.bouton:hover { background: var(--ocre); color: var(--papier); }
.bouton.plein { background: var(--ocre); color: var(--papier); }
.bouton.plein:hover { background: var(--encre); border-color: var(--encre); }

/* ---------- Blocs encadrés ---------- */
.encadre {
  background: var(--papier);
  border: 1px solid var(--filet);
  padding: 1.3rem 1.4rem;
  margin: 2rem 0;
  max-width: 40rem;
}
.encadre h3 { margin-top: 0; }
.encadre p:last-child, .encadre ul:last-child { margin-bottom: 0; }

/* ---------- Les neuf questions ---------- */
.grille-questions { max-width: 44rem; margin: 2rem 0; }
details.question {
  border-top: 1px solid var(--filet);
  padding: 0;
}
details.question:last-of-type { border-bottom: 1px solid var(--filet); }
details.question > summary {
  cursor: pointer;
  list-style: none;
  padding: 1.05rem 2rem 1.05rem 3.1rem;
  position: relative;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}
details.question > summary::-webkit-details-marker { display: none; }
details.question > summary::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 1.15rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--lavande);
}
details.question > summary::after {
  content: "+";
  position: absolute;
  right: 0.4rem;
  top: 0.95rem;
  font-family: var(--sans);
  font-size: 1.25rem;
  color: var(--ocre);
  line-height: 1.4;
}
details.question[open] > summary::after { content: "–"; }
details.question > summary:hover { color: var(--ocre); }
.question-corps { padding: 0 0 1.3rem 3.1rem; }
.question-corps p { font-size: 0.95rem; }
.question-corps ul { font-size: 0.95rem; margin-bottom: 0.6rem; }
.renvoi { font-size: 0.82rem; color: var(--encre-douce); }

/* ---------- Listes de demandes ---------- */
ol.demandes { list-style: none; padding: 0; max-width: 42rem; counter-reset: d; }
ol.demandes > li {
  counter-increment: d;
  border-top: 1px solid var(--filet);
  padding: 1.25rem 0 1.25rem 3.1rem;
  position: relative;
  margin: 0;
}
ol.demandes > li:last-child { border-bottom: 1px solid var(--filet); }
ol.demandes > li::before {
  content: counter(d, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--lavande);
}
ol.demandes b {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}
ol.demandes p { margin: 0; font-size: 0.95rem; }

/* ---------- Tableaux ---------- */
.tableau-enveloppe { overflow-x: auto; margin: 1.8rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.9rem;
  background: var(--papier);
}
th, td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--filet);
  vertical-align: top;
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--encre-douce);
  font-weight: 700;
  border-bottom: 1px solid var(--encre-douce);
}
td a { font-weight: 600; }

/* ---------- Fiche projet ---------- */
.identite { margin: 1.5rem 0 0; max-width: 42rem; }
.identite div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.9rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--filet);
  font-size: 0.93rem;
}
.identite div:last-child { border-bottom: 1px solid var(--filet); }
.identite dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--encre-douce);
  padding-top: 0.2rem;
}
.identite dd { margin: 0; }

.etat { display: inline-block; white-space: nowrap; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.15rem 0.45rem; border: 1px solid; }
.etat.repondu { color: var(--garrigue); border-color: var(--garrigue); }
.etat.partiel  { color: var(--ocre); border-color: var(--ocre); }
.etat.absent   { color: var(--lavande); border-color: var(--lavande); }

/* ---------- Pied de page ---------- */
footer {
  border-top: 1px solid var(--filet);
  background: var(--papier);
  margin-top: 4rem;
  padding: 2.2rem 1.5rem 3rem;
}
.pied-inner { max-width: var(--large); margin: 0 auto; }
.pied-inner p { font-size: 0.85rem; color: var(--encre-douce); max-width: 40rem; }
.pied-liens { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 1.2rem; }
.pied-liens a { font-size: 0.85rem; font-weight: 600; text-decoration: none; }
.pied-liens a:hover { text-decoration: underline; }
.maj { font-size: 0.78rem; color: var(--encre-douce); margin-top: 1.5rem; }

/* ---------- Accessibilité ---------- */
a:focus-visible, summary:focus-visible, .bouton:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ocre);
  outline-offset: 3px;
}
.saut {
  position: absolute; left: -9999px;
}
.saut:focus { position: static; display: inline-block; padding: 0.5rem 1rem; background: var(--ocre); color: var(--papier); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 42rem) {
  body { font-size: 1rem; }
  main { padding: 2rem 1.15rem 1rem; }
  .bandeau-inner { padding: 1rem 1.15rem 0.8rem; }
  .bande { grid-template-columns: repeat(2, 1fr); }
  .bande div { border-bottom: 1px solid var(--filet); }
  .bande div:nth-child(2n) { border-right: 0; }
  .bande div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .identite div { grid-template-columns: 1fr; gap: 0.2rem; }
  details.question > summary { padding-left: 2.5rem; font-size: 1.05rem; }
  .question-corps { padding-left: 2.5rem; }
  ol.demandes > li { padding-left: 2.5rem; }
  .cordon { margin: 2.5rem 0 2rem; }
}
