/* =====================================================================
   Page Réalisations (maquette B) : registre complet, chantiers récents en photos, opérations en images, communes et questions.
   #photos reprend la grille de #logements (.p-realisations-grille) : photos de 800 px, jamais agrandies.
   Mêmes jetons que b.css ; aucun dégradé, aucune ombre, angles droits.
   Audit : docs/_analyse/pages-b/PREUVES.md § 2 ; relectures du 20/10/2026.
   ===================================================================== */

/* ---------- Registre : aide, case « En cours », état, boutons du pied ---------- */
html:not(.js) .p-realisations-aide { display: none; }
.p-realisations-encours { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--filet-fort); border-radius: 2px; background: var(--blanc); color: var(--encre); font: 700 1rem/1.1 var(--f-body); cursor: pointer; }
.p-realisations-encours:hover { border-color: var(--encre); }
.p-realisations-encours input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--encre); cursor: pointer; }
.p-realisations-etat { margin: 0 0 12px; color: var(--encre-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.p-realisations-pied { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.p-realisations-sources { max-width: 760px; margin-top: 18px; color: var(--encre-3); font-size: .95rem; }
.p-realisations-sources b { color: var(--encre-2); }

/* Barre d'outils : les filtres sur une rangée, puis la case « En cours » et la recherche, à gauche */
.p-realisations-reg .b-filtres { flex: 1 1 100%; }
.p-realisations-reg .b-registre__outils { justify-content: flex-start; }

/* Cadre du tableau : une vraie bordure, que le fond des lignes paires ne recouvre plus */
.p-realisations-reg .b-table-wrap { box-shadow: none; border: 1px solid var(--filet); }
/* L'étiquette « En cours » ne colle pas à l'année (elle est le premier élément de la cellule) */
.p-realisations-reg .b-table td .b-etiquette:first-child { margin-left: 8px; }
/* Une ligne par chantier : la commune ne se coupe pas ; la source (« Mémoire, marché public ») seulement sur grand écran */
@media (min-width: 700px) {
  .p-realisations-reg .b-table--registre td:nth-child(3) { white-space: nowrap; }
}
@media (min-width: 1200px) {
  .p-realisations-reg .b-table--registre td:nth-child(6) { white-space: nowrap; }
}
/* Tablette (700 à 1023 px) : cellules moins larges, les six colonnes tiennent sans défilement horizontal */
@media (min-width: 700px) and (max-width: 1023px) {
  .p-realisations-reg .b-table--registre th,
  .p-realisations-reg .b-table--registre td { padding-left: 10px; padding-right: 10px; }
}
/* Téléphone : quatre lignes par carte (chantier ; maître d'ouvrage ; commune et année ; type), sans la source */
@media screen and (max-width: 699px) {
  .p-realisations-reg .b-table--registre tr { grid-template-columns: auto 1fr; column-gap: 10px; }
  .p-realisations-reg .b-table--registre td:nth-child(-n + 2),
  .p-realisations-reg .b-table--registre td:nth-child(5) { grid-column: 1 / -1; }
  .p-realisations-reg .b-table--registre td:nth-child(6),
  .p-realisations-sources { display: none; }
  .p-realisations-reg .b-table td .b-etiquette:first-child { margin-left: 6px; }
}

/* 25 lignes à l'écran, à toutes les largeurs, puis « Afficher les 95 autres chantiers ».
   Le script de la page pose .is-court, puis .is-ouvert au premier filtre ou à la première recherche.
   L'impression garde toute la liste filtrée.
   Maquette : quand « Points à valider » est allumé (classe show-todo sur html, site.js), les lignes qui portent une question
   restent affichées au-delà de la 25e ; sinon le bouton annonce des points qu'aucune ligne visible ne porte. */
@media screen {
  html:not(.show-todo) .p-realisations-reg.is-court:not(.is-ouvert) .b-table--registre tbody tr:nth-child(n + 26),
  html.show-todo .p-realisations-reg.is-court:not(.is-ouvert) .b-table--registre tbody tr:nth-child(n + 26):not([data-todo]) { display: none; }
}

/* ---------- Quelques opérations en images : jamais plus de 1,3 fois la taille réelle ---------- */
/* Colonnes de 240 à 280 px : quatre par rangée sur bureau, même avec une barre de défilement.
   En recadrage cover, book-26 (259 × 194) est agrandie 1,08 fois, book-24 (275 × 183) et book-70 (308 × 183) 1,02 fois. */
.p-realisations-grille { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 280px)); justify-content: space-between; }
/* Le nom écrit suffit : les logos carrés ou très larges seraient illisibles à 22 px de haut */
.p-realisations-grille .b-cartouche dd img { display: none; }
/* Téléphone : une rangée qui défile, comme sur l'accueil (fiches de 292 px au plus : book-26 à 1,13) */
@media (max-width: 699px) {
  .p-realisations-grille { display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 12px; scrollbar-width: thin; scrollbar-color: var(--filet-fort) transparent; }
  .p-realisations-grille .b-fiche { flex: 0 0 min(82%, 292px); scroll-snap-align: start; }
}

/* ---------- Communes : un lien par commune, avec son nombre de chantiers ---------- */
.p-realisations-communes a { display: block; margin: -4px -10px; padding: 4px 10px; color: var(--encre); text-decoration: none; }
.p-realisations-communes a:hover { color: var(--marron); text-decoration: underline; text-decoration-thickness: 2px; }
.p-realisations-communes .b-compte { color: var(--encre-3); opacity: 1; }

/* ---------- Impression : la liste seule ---------- */
@media print {
  .site-header, .drawer, .mobile-bar, .toast, .skip-link, .site-footer,
  .b-hero, .b-filet, .b-registre__outils, .p-realisations-aide, .p-realisations-etat, .p-realisations-pied,
  #photos, #logements, #communes, .b-contact { display: none !important; }
  body { background: #fff; }
  .b-section { padding-block: 0; background: #fff; }
  .b-table-wrap, .p-realisations-reg .b-table-wrap { border: 1px solid var(--filet-fort); }
  .b-table tr { break-inside: avoid; }
  .b-table td { padding: 5px 8px; font-size: 10pt; }
}
