/* =========================================================================
   OFELIM - Page Réalisations
   Complément à styles.css : carte en tête, grille de vignettes, bouton
   « + » et fiche détaillée en modale. Charte inchangée (Outfit / Inter,
   vert sauge, cuivre, angles droits).
   ========================================================================= */

/* ---------- Carte en tête de section ---------- */
.references .map-wrap { margin-bottom: 90px; }
#map-operations { height: 520px; }
.op-popup { font-family: var(--police-texte); }
.op-popup strong {
  display: block;
  font-family: var(--police-titre); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--noir); font-size: .9rem; line-height: 1.3;
  margin-bottom: 8px;
}
.op-popup button {
  background: none; border: none; padding: 0 0 3px;
  font-family: var(--police-titre); font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--noir); border-bottom: 1px solid var(--cuivre);
  cursor: pointer;
}
.op-popup button:hover { color: var(--cuivre); }

/* ---------- Titre ---------- */
.references .ops-header { margin-bottom: 56px; max-width: none; }

/* ---------- Grille de vignettes ---------- */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}
.ops-grid + .ops-grid { margin-top: 32px; }
.ops-grid[hidden] { display: none; }
.ops-more + .ops-grid { margin-top: 40px; }

.op-card {
  /* flex colonne : un <button> centre son contenu par défaut, la photo
     doit rester collée en haut quel que soit le nombre de lignes du nom */
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  width: 100%;
  padding: 0; margin: 0;
  background: var(--blanc-casse);
  border: 1px solid var(--gris-clair);
  text-align: left;
  cursor: pointer;
  font: inherit; color: inherit;
  transition: transform .3s ease, box-shadow .3s ease;
  min-width: 0;
}
.op-card:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(26,26,26,.10); }
.op-card:focus-visible { outline: 3px solid var(--cuivre); outline-offset: 3px; }

.op-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--vert-sauge-clair);
}
.op-card-img img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
  transition: transform .6s ease;
}
.op-card:hover .op-card-img img { transform: scale(1.04); }

/* Vignette neutre quand l'opération n'a pas encore de visuel */
.op-card-img--vide {
  display: flex; align-items: center; justify-content: center;
  background: var(--vert-sauge-clair);
}
.op-card-img--vide::before {
  content: "";
  position: absolute; inset: 18px;
  border: 1px solid rgba(111,139,124,.35);
}
.op-card-img--vide span {
  position: relative;
  font-family: var(--police-titre);
  font-size: .72rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--vert-sauge-fonce);
}

.op-card-body {
  padding: 22px 26px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.op-card-texte { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 auto; }
/* Client accompagné : logo (ou nom) à droite du nom et de la ville */
.op-card-client {
  flex: 0 0 auto;
  width: 84px; height: 52px;
  display: flex; align-items: center; justify-content: flex-end;
}
.op-card-client img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain; display: block;
}
.op-card-client--texte {
  width: auto; max-width: 110px; height: auto;
  padding: 6px 10px;
  border: 1px solid var(--gris-clair);
  font-family: var(--police-titre);
  font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--vert-sauge-fonce);
  text-align: center; line-height: 1.3;
}
.op-card-nom {
  font-family: var(--police-titre);
  font-weight: 700; font-size: 1.05rem; line-height: 1.3;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--noir);
  overflow-wrap: anywhere;
}
/* Ville sur une seconde ligne, en minuscules */
.op-card-ville {
  font-family: var(--police-texte);
  font-size: .92rem; line-height: 1.4;
  color: var(--gris-texte);
  text-transform: none; letter-spacing: 0;
  overflow-wrap: anywhere;
}

/* ---------- Bouton « + » ---------- */
.ops-more {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  margin-top: 56px;
}
.ops-more-btn {
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid rgba(0,0,0,.25);
  color: var(--noir);
  font-family: var(--police-titre); font-size: 2rem; font-weight: 300; line-height: 1;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}
.ops-more-btn:hover,
.ops-more-btn:focus-visible { background: var(--cuivre); border-color: var(--cuivre); color: var(--blanc); outline: none; }
.ops-more-btn[aria-expanded="true"] .ops-more-icone::before { content: "\2212"; }
.ops-more-icone::before { content: "+"; }
.ops-more-label {
  font-family: var(--police-titre);
  font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--gris-texte);
}

/* ---------- Fiche détaillée (modale) ---------- */
.op-modal[hidden] { display: none; }
.op-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background: rgba(26,26,26,.72);
  animation: opFondu .25s ease;
}
@keyframes opFondu { from { opacity: 0; } to { opacity: 1; } }
.op-modal-panel {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 64px);
  background: var(--blanc);
  display: flex; flex-direction: column;
  overflow-y: auto;
  animation: opMontee .35s cubic-bezier(.22, 1, .36, 1);
}
@keyframes opMontee { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.op-modal-fermer {
  /* collée en haut à droite et visible pendant le défilement de la fiche */
  position: sticky; top: 16px; align-self: flex-end;
  margin: 16px 16px -64px 0; z-index: 3;
  width: 48px; height: 48px;
  background: var(--blanc); color: var(--noir);
  border: 1px solid var(--gris-clair);
  font-size: 1.6rem; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, color .2s ease;
}
.op-modal-fermer:hover, .op-modal-fermer:focus-visible { background: var(--cuivre); color: var(--blanc); border-color: var(--cuivre); outline: none; }

/* Bandeau visuel : les perspectives sont presque toutes au format paysage,
   le visuel occupe donc toute la largeur et le texte vient en dessous */
.op-modal-visuels {
  background: var(--vert-sauge-clair);
  display: flex; flex-direction: column;
  flex: none;
}
.op-modal-principale {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 52vh;
  background: var(--vert-sauge-clair);
}
.op-modal-principale img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  position: absolute; inset: 0;
}
.op-modal-principale.op-card-img--vide { aspect-ratio: 16 / 6; }
.op-modal-vignettes {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px;
  background: var(--blanc);
  border-top: 1px solid var(--gris-clair);
}
.op-modal-vignettes button {
  width: 76px; height: 58px;
  padding: 0; border: 2px solid transparent;
  background: var(--gris-clair);
  cursor: pointer; overflow: hidden;
}
.op-modal-vignettes button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.op-modal-vignettes button[aria-current="true"],
.op-modal-vignettes button:focus-visible { border-color: var(--cuivre); outline: none; }

/* Texte sous le visuel */
.op-modal-contenu {
  padding: 44px 56px 56px;
}
.op-modal-section ul.op-programme li { display: flex; align-items: center; gap: 14px; }
.op-picto { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--cuivre); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.op-modal-categorie {
  display: inline-block;
  font-family: var(--police-titre);
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--cuivre);
  margin-bottom: 14px;
}
.op-modal-contenu h2 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  color: var(--noir);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}
.op-modal-adresse {
  font-size: .9rem; color: var(--gris-texte);
  margin-bottom: 28px;
}
.op-modal-section { margin-top: 30px; }
.op-modal-section h3 {
  font-family: var(--police-titre);
  font-size: .9rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--noir);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--vert-sauge);
}
.op-modal-section p { font-size: .98rem; color: var(--gris-texte); line-height: 1.7; overflow-wrap: anywhere; }
.op-modal-section ul { list-style: none; display: grid; gap: 8px; }
.op-modal-section ul li {
  padding: 12px 16px;
  background: var(--blanc-casse);
  border-left: 3px solid var(--cuivre);
  font-size: .95rem; color: var(--noir);
  overflow-wrap: anywhere;
}
.op-modal-section ul.op-acteurs li { border-left-color: var(--vert-sauge); }
.op-modal-section ul.op-acteurs strong { color: var(--noir); font-weight: 600; }
.op-modal-section ul.op-acteurs span { color: var(--gris-texte); }

/* Pas de défilement de la page derrière la modale */
body.op-modal-ouverte { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .ops-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .ops-grid + .ops-grid { margin-top: 24px; }
  #map-operations { height: 420px; }
  .op-modal-contenu { padding: 36px 36px 44px; }
}
@media (max-width: 720px) {
  .ops-grid { grid-template-columns: 1fr; gap: 20px; }
  .ops-grid + .ops-grid { margin-top: 20px; }
  .references .map-wrap { margin-bottom: 60px; padding: 8px; }
  #map-operations { height: 320px; }
  .references .ops-header { margin-bottom: 36px; }
  .op-card-body { padding: 18px 20px 20px; gap: 12px; }
  .op-card-client { width: 72px; height: 46px; }
  .op-card-nom { font-size: .98rem; }
  .ops-more { margin-top: 36px; }
  .op-modal { padding: 0; align-items: stretch; }
  .op-modal-panel { max-height: none; width: 100%; min-height: 100vh; animation: none; }
  .op-modal-fermer { top: 12px; margin: 12px 12px -60px 0; }
  .op-modal-principale { aspect-ratio: 4 / 3; }
  .op-modal-contenu { padding: 32px 22px 40px; }
  .op-modal-vignettes button { width: 64px; height: 48px; }
}

/* Logos partenaires sur petit écran : la grille d'origine dépassait la largeur du téléphone */
@media (max-width: 720px) {
  .partenaire-logo { padding: 28px 16px; min-height: 120px; }
  .partenaire-logo img { max-width: 100%; max-height: 56px; }
}
