/* public/assets/css/galerie-spe/galerie.css */

/* Variables de design */
:root {
  --brand-color: #FF6233;
  --text-light: #f0f0f0;
  --bg-dark-trans: rgba(12, 12, 12, 0.95);
  --shadow-light: rgba(255, 255, 255, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.5);
  --timing-fast: 0.3s;
}

/* =========================================================
 *  FIX "bandes blanches" + débordement horizontal
 *  - body margin par défaut (8px) => bandes blanches
 *  - 100vw peut créer un overflow (scrollbar) => “contenu plus large”
 *  On scope à la page galerie spe (bodyClass du controller)
 * ========================================================= */
html, body { width: 100%; }

body.galerie-spe-detail,
body.galerie-spe-index {
  margin: 0;                 /* supprime les bandes blanches */
  overflow-x: hidden;        /* fallback */
  overflow-x: clip;          /* moderne: évite scroll horizontal */
}

/* =========================================================
 *   FULL-BLEED : sort du container 1200px du layout internal
 *   (sans toucher au layout)
 * ========================================================= */
.gallery-page--bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow-x: clip; /* évite un scroll horizontal */
}

/* IMPORTANT : 100vw inclut la scrollbar -> on préfère 100dvw si dispo */
@supports (width: 100dvw) {
  .gallery-page--bleed {
    width: 100dvw;
    margin-left: calc(50% - 50dvw);
    margin-right: calc(50% - 50dvw);
  }
}

/* Styles de la page principale */
.gallery-page {
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  min-height: 100vh;

  /* IMPORTANT : on évite le chevauchement du header */
  padding: 2rem 0 4rem;
}

/* Sur mobile : fixed peut être instable */
@media (max-width: 768px) {
  .gallery-page {
    background-attachment: scroll;
  }
}

/* =========================================================
 *   Galerie (Masonry Grid)
 * ========================================================= */
.masonry-gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  position: relative;
  z-index: 2;
}

.masonry-gallery .grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.masonry-gallery .grid-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 25px var(--shadow-dark);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform var(--timing-fast) ease, border-color var(--timing-fast) ease;
  background: #000;
  aspect-ratio: 2/3;
}

.masonry-gallery .grid-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.masonry-gallery .grid-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity var(--timing-fast) ease;
  display: grid;
  place-content: center;
  color: var(--brand-color);
  font-size: 2.5rem;
}

.masonry-gallery .grid-item:hover {
  transform: translateY(-5px);
  border-color: var(--brand-color);
}

.masonry-gallery .grid-item:hover img {
  transform: scale(1.05);
}

.masonry-gallery .grid-item:hover .overlay {
  opacity: 1;
}

/* ================= LIGHTBOX ================= */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-dark-trans);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox-backdrop.is-open {
  display: grid;
  opacity: 1;
}

.lightbox-content {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 1rem;
  place-items: center;
  max-width: 100%;
}

.lightbox-image-box {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  user-select: none;
}

/* Watermark Overlay (si ton JS l’utilise) */
.protection-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.watermark-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--watermark-cols, 3), 1fr);
  grid-template-rows: repeat(6, 1fr);
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.watermark-grid span {
  font-weight: bold;
  color: rgba(255, 255, 255, 1);
  user-select: none;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.lightbox-caption {
  color: var(--text-light);
  text-align: center;
  padding: 0.5rem;
  font-family: 'Montserrat', sans-serif;
}
.lightbox-caption .caption-text {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}
.lightbox-caption .caption-author {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-top: 0.2rem;
  font-style: italic;
  color: var(--brand-color);
}

/* Nav Buttons */
.lightbox-nav,
.lightbox-close {
  position: fixed;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;

  /* IMPORTANT : pas "all" */
  transition: transform 0.2s ease, background-color 0.2s ease;

  width: 50px;
  height: 50px;
  z-index: 10001;
}

/* Position des flèches */
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}
.lightbox-nav.prev { left: 20px; }
.lightbox-nav.next { right: 20px; }

/* Hover des flèches (on garde translateY) */
.lightbox-nav:hover {
  background: var(--brand-color);
  transform: translateY(-50%) scale(1.08);
}

/* Close */
.lightbox-close {
  top: 20px;
  right: 20px;
  background: transparent;
  font-size: 2.5rem;
}
.lightbox-close:hover {
  background: var(--brand-color);
  transform: scale(1.08);
}

@media (max-width: 768px) {
  .masonry-gallery .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  .lightbox-nav { width: 40px; height: 40px; font-size: 1.2rem; }
}
