/* GL Grid 1.1 — galerie justifiée + visionneuse. Aucune dépendance. */

.gl-grid { width: 100%; }
.gl-grid *, .gl-grid *::before, .gl-grid *::after { box-sizing: border-box; }

.gl-grid-row { display: flex; }
.gl-grid-row + .gl-grid-row { margin-top: var(--gl-gap, 4px); }

.gl-grid-cell {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  background: #111;
  padding: 0;
  border: 0;
  cursor: zoom-in;
}
.gl-grid-cell + .gl-grid-cell { margin-left: var(--gl-gap, 4px); }

.gl-grid-cell picture { display: block; width: 100%; height: 100%; }

.gl-grid-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;                 /* garde-fou : certains thèmes ajoutent une bordure invisible */
  opacity: 0;
  transition: opacity .45s ease;
}
.gl-grid-cell img.is-loaded { opacity: 1; }

/* voile au survol */
.gl-grid-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gl-ov-color, #fff);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.gl-grid-cell:hover::after,
.gl-grid-cell:focus-visible::after { opacity: var(--gl-ov-opacity, .3); }
.gl-grid-cell:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
/* pas de curseur « agrandir » quand la visionneuse est désactivée */
.gl-grid-cell.is-static { cursor: default; }

/* protection : pas de sélection ni de glisser-déposer des photos */
.gl-grid.is-protected img,
.gl-lb img {
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* repli sans JavaScript */
.gl-grid noscript img { max-width: 32%; height: auto; margin: 0 1% 1% 0; }

/* ---------- visionneuse ---------- */
.gl-lb {
  position: fixed;
  inset: 0;
  /* le thème Zephyr monte très haut sur sa barre supérieure : on passe au-dessus de tout */
  z-index: 2147483647;
  background: #070707;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s ease;
  touch-action: none;
  overscroll-behavior: contain;
}
.gl-lb.is-open { opacity: 1; }

.gl-lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gl-lb-img {
  max-width: 94vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform .18s ease-out, filter .25s ease;
  will-change: transform;
  cursor: zoom-in;
}
.gl-lb.is-zoomed .gl-lb-img { cursor: grab; transition: none; }
.gl-lb.is-zoomed .gl-lb-img:active { cursor: grabbing; }
.gl-lb.is-loading .gl-lb-img { filter: blur(8px); }

.gl-lb-cap {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, .78);
  font-size: 13px;
  letter-spacing: .04em;
  pointer-events: none;
}

/* flèches */
.gl-lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}
.gl-lb-btn:hover { background: rgba(255, 255, 255, .22); }
.gl-lb-prev { left: 16px; }
.gl-lb-next { right: 16px; }

/* barre d'outils (diaporama, lien, fermer) */
.gl-lb-tools {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.gl-lb-tool {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.gl-lb-tool:hover { background: rgba(255, 255, 255, .22); }
.gl-lb-tool.is-done { background: rgba(120, 220, 140, .30); color: #d8ffe4; }

.gl-lb-count {
  position: absolute;
  top: 24px;
  left: 20px;
  color: rgba(255, 255, 255, .6);
  font-size: 13px;
  letter-spacing: .06em;
  z-index: 2;
}

/* en plein écran (diaporama), on efface l'interface */
.gl-lb:fullscreen .gl-lb-count,
.gl-lb:fullscreen .gl-lb-btn { opacity: 0; transition: opacity .3s ease; }
.gl-lb:fullscreen:hover .gl-lb-count,
.gl-lb:fullscreen:hover .gl-lb-btn { opacity: 1; }
.gl-lb:fullscreen .gl-lb-img { max-width: 100vw; max-height: 100vh; }

@media (max-width: 600px) {
  .gl-lb-btn { width: 44px; height: 44px; font-size: 22px; }
  .gl-lb-prev { left: 6px; }
  .gl-lb-next { right: 6px; }
  .gl-lb-tool { width: 40px; height: 40px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .gl-grid-cell img, .gl-grid-cell::after, .gl-lb, .gl-lb-img { transition: none; }
}

/* ---------- galerie privée ---------- */
.gl-grid-lock {
  max-width: 420px;
  margin: 40px auto;
  padding: 28px 26px;
  border: 1px solid rgba(128, 128, 128, .35);
  border-radius: 10px;
  text-align: center;
}
.gl-grid-lock-txt { margin: 0 0 16px; opacity: .8; }
.gl-grid-lock form { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.gl-grid-lock input {
  flex: 1 1 190px;
  padding: 11px 14px;
  border: 1px solid rgba(128, 128, 128, .45);
  border-radius: 6px;
  font-size: 15px;
}
.gl-grid-lock button {
  padding: 11px 20px;
  border: 0;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.gl-grid-lock button:hover { background: #333; }

/* ---------- bandeau d'appel en fin de galerie ---------- */
.gl-grid-cta {
  margin: 42px auto 8px;
  padding: 30px 24px;
  max-width: 720px;
  text-align: center;
  border-top: 1px solid rgba(128, 128, 128, .28);
}
/* en tête de galerie : pas de trait au-dessus, et on aère vers le bas */
.gl-grid-cta--top {
  margin: 8px auto 26px;
  padding: 8px 24px 22px;
  border-top: 0;
}
.gl-grid-cta-note {
  margin: 0 0 18px;
  font-size: 1.05rem;
  line-height: 1.55;
  /* le thème hérite d'un gris sombre (rgb(87,87,87)) illisible sur son fond sombre.
     La classe est posée en JS d'après la clarté du fond réellement peint —
     `prefers-color-scheme` se trompait : le navigateur est en clair, le site en sombre. */
  color: #e9e9ea;
  opacity: 1;
}
.gl-grid-cta.gl-sur-clair .gl-grid-cta-note  { color: #2b2b2d; }
.gl-grid-cta.gl-sur-sombre .gl-grid-cta-note { color: #ececed; }
.gl-grid-cta-btn {
  display: inline-block;
  padding: 14px 34px;
  border-radius: 3px;
  background: #8a1c1c;
  color: #fff !important;
  font-size: .95rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-decoration: none !important;
  transition: background .25s ease, transform .25s ease;
}
.gl-grid-cta-btn:hover {
  background: #a32222;
  transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) { .gl-grid-cta-btn { transition: none; } }
