/* Fiche commune (/commune/<code>-<nom>) */
.commune-page { align-items: stretch; max-width: 1000px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.commune-page .card { max-width: none; }
.fil { font-size: 13px; color: var(--text-3); }
.fil a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.commune-tete { display: grid; grid-template-columns: 1fr 300px; gap: 16px; padding: 20px; align-items: center; }
.commune-tete h1 { margin: 0; font-size: 30px; color: var(--text); }
.tete-sous { margin: 4px 0 16px; color: var(--text-2); font-size: 14px; }
.chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.chiffres div { border: 1px solid var(--border); padding: 10px; display: grid; }
.chiffres .valeur { font-size: 20px; font-weight: 700; color: var(--text); }
.chiffres .libelle { font-size: 12px; color: var(--text-3); }
.liens { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.bouton { background: var(--blue); color: #fff; padding: 8px 14px; text-decoration: none; font-size: 14px; }
.bouton.secondaire { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.carte-bloc { position: relative; }
#carte-commune, .mini-carte { width: 100%; height: 260px; background: #f3f5f7; display: block; }
/* La carte interactive se prépare sous la carte dessinée, puis la remplace (une carte masquée ne s'initialise pas) */
#carte-commune { position: absolute; inset: 0; opacity: 0; transition: opacity .3s; }
#carte-commune.prete { opacity: 1; }
.mini-carte path.voisine { fill: #e3e8ee; stroke: #fff; }
.mini-carte path.moi { fill: #0079c1; fill-opacity: .55; stroke: #004f80; }
.mini-carte text { fill: #5b6570; text-anchor: middle; font-family: inherit; }
.mini-carte text.nom-moi { fill: #002e4d; font-weight: 700; }
.commentaire { padding-top: 14px; padding-bottom: 4px; max-width: none; }
.commentaire p { margin: 0 0 10px; }
/* Barre de navigation thématique, collée en haut de l'écran pendant le défilement */
.themes { position: sticky; top: 0; z-index: 5; width: 100%; max-width: 1000px; display: flex; gap: 4px; overflow-x: auto;
  background: var(--fg); border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,.06); scrollbar-width: none; }
.themes::-webkit-scrollbar { display: none; }
.themes a { flex: none; padding: 12px 14px; color: var(--text-2); text-decoration: none; font-size: 14px; white-space: nowrap;
  border-bottom: 3px solid transparent; }
.themes a:hover { color: var(--text); background: var(--bg); }
.themes a[aria-current="true"] { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.commune-page .theme { scroll-margin-top: 56px; }
.commune-page .theme[hidden] { display: none; }
/* En mode onglets, la barre reste visible au-dessus de la section ouverte */
.onglets .themes { border-bottom: none; }
/* Services du quotidien */
.essentiels { list-style: none; margin: 8px 20px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.essentiels li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); font-size: 13px; }
.essentiels li.present calcite-icon { color: #2E7D32; }
.essentiels li.absent { color: var(--text-3); background: var(--bg); }
.essentiels li.absent calcite-icon { color: #9AA5B1; }
.essentiels .nom-equipement { flex: 1; }
.essentiels .nombre-equipement { font-weight: 600; color: var(--text); }
.essentiels li.absent .nombre-equipement { font-weight: 400; color: var(--text-3); font-style: italic; }
table.sites { margin-top: 8px; }
table.sites td:first-child { width: 55%; }
table.sites td:nth-child(2) { width: 30%; }
.autres-sites { margin-top: 6px; }
.autres-sites summary { cursor: pointer; color: var(--blue); font-size: 14px; padding: 6px 0; }
.table-scroll { overflow-x: auto; padding: 8px 20px 0; }
table.comparaison td.num { text-align: right; white-space: nowrap; }
table.comparaison td.fort { font-weight: 600; color: var(--text); }
.rang { min-width: 120px; }
.rang-texte { display: none; }
.jauge { display: block; position: relative; height: 8px; min-width: 110px; background: linear-gradient(90deg, #deebf7, #3182bd); border-radius: 4px; }
.jauge span { position: absolute; top: -3px; width: 4px; height: 14px; margin-left: -2px; background: #08306b; border-radius: 2px; }
.note-tableau { padding: 8px 20px 18px; }
.maj { text-align: center; }
.graphiques { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 20px 4px; }
.graphique { border: 1px solid var(--border); background: #fff; min-width: 0; }
/* flex : sans lui, le dessin interne du graphique reste à 150 px de haut */
.graphique arcgis-chart { display: flex; flex-direction: column; width: 100%; height: 300px; }
.graphique.large arcgis-chart { height: 260px; }
.graphique.large-2 { grid-column: 1 / -1; }
.graphique.large-2 arcgis-chart { height: 280px; }
@media (max-width: 760px) {
  .graphiques { grid-template-columns: 1fr; }
  .commune-tete { grid-template-columns: 1fr; }
  .chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #carte-commune, .mini-carte { height: 220px; }
}
/* Contact de la mairie */
.mairie { margin: 4px 20px 0; padding: 14px 16px; border: 1px solid var(--border); background: var(--bg); }
.mairie h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 6px; color: var(--text); }
.mairie-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mairie-coord { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; font-size: 14px; }
.mairie-coord dt { color: var(--text-3); }
.mairie-coord dd { margin: 0; overflow-wrap: anywhere; }
.mairie a { color: var(--blue); }
.mairie-titre { margin: 0 0 4px; font-size: 13px; color: var(--text-3); }
table.horaires th { font-weight: 500; white-space: nowrap; }
table.horaires th, table.horaires td { padding: 3px 8px 3px 0; font-size: 13px; }
.mairies-annexes { margin-top: 10px; font-size: 13px; }
.mairies-annexes summary { cursor: pointer; color: var(--blue); }
.note-mairie { margin: 10px 0 0; font-size: 12px; }
@media (max-width: 760px) { .mairie-grille { grid-template-columns: 1fr; } }
.sous-titre { font-size: 15px; margin: 8px 0 0; color: var(--text); }
/* Mobile : chaque ligne des tableaux comparatifs devient une petite fiche (indicateur, puis une valeur par ligne) */
@media (max-width: 760px) {
  table.comparaison thead { display: none; }
  table.comparaison, table.comparaison tbody, table.comparaison tr, table.comparaison td { display: block; width: 100%; box-sizing: border-box; }
  table.comparaison tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
  table.comparaison td { border: none; padding: 2px 0; text-align: left; }
  table.comparaison td:first-child { font-weight: 600; color: var(--text); padding-bottom: 4px; }
  table.comparaison td.num { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.comparaison td.num::before { content: attr(data-label); color: var(--text-3); text-align: left; font-weight: 400; }
  table.comparaison td.rang-cellule:empty { display: none; }
  table.comparaison td.rang-cellule { padding-top: 6px; }
  /* Pas de survol sur téléphone : le texte de la jauge (info-bulle sur ordinateur) est affiché dessous */
  .rang-texte { display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }
  .table-scroll { overflow-x: visible; }
}
