/* ============================================================
   AKAR Galerie, Page dédiée (aligned to tech-minimal system)
   ============================================================ */

/* ----------- Hero galerie ----------- */
.gal-hero {
  padding: 140px 0 60px;
  position: relative;
  overflow: hidden;
}

.gal-hero .hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.gal-hero .container { position: relative; z-index: 2; }

.gal-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
  transition: color 0.2s ease, gap 0.2s ease;
}
.gal-back:hover { color: var(--text); gap: 14px; }

.gal-hero-title {
  margin: 24px 0 32px;
}

.gal-hero-lede {
  max-width: 660px;
  margin-bottom: 56px;
}

.gal-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  margin-bottom: 40px;
}
.gal-stat {
  padding-right: 48px;
  padding-left: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}
.gal-stat:first-child { padding-left: 0; }
.gal-stat:not(:first-child) { padding-left: 48px; }
.gal-stat:last-child { border-right: 0; padding-right: 0; }
.gal-stat .stat-label {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.gal-stat .stat-value {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
  font-feature-settings: "tnum";
}
.gal-stat .unit { font-size: 16px; color: var(--accent); margin-left: 2px; }

/* ----------- Filtres ----------- */
.gal-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gal-filters button {
  padding: 0 18px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}
.gal-filters button:hover {
  color: var(--text);
  border-color: #3a3a3a;
  background: var(--surface-2);
}
.gal-filters button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* ----------- Masonry ----------- */
.gal-wrap {
  padding: 80px 0 100px;
  position: relative;
  z-index: 2;
}
/* Galerie épurée : images uniquement, dégage la nav fixe en haut */
.gal-wrap--bare {
  padding-top: 120px;
}
@media (max-width: 700px) {
  .gal-wrap--bare { padding-top: 90px; }
}

.gal-masonry {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.gal-item {
  display: block;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.gal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.gal-item.is-hidden { display: none; }

.gal-item img,
.gal-item video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: brightness(0.95) saturate(0.95);
  transition: transform 0.6s ease, filter 0.4s ease;
}
.gal-item:hover img,
.gal-item:hover video {
  transform: scale(1.04);
  filter: brightness(1.05) saturate(1.05);
}

.gal-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(9,24,48,0.85) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}
.gal-item:hover::after { opacity: 1; }

.gal-item__num {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gal-item__num::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--accent);
  display: inline-block;
}
.gal-item:hover .gal-item__num {
  opacity: 1;
  transform: translateY(0);
}

/* ----- Légende éditoriale sur chaque vignette ----- */
.gal-item__cap {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 38px 14px 14px;
  font-family: var(--ff-sans);
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(to top, rgba(9, 24, 48, 0.92) 0%, rgba(9, 24, 48, 0.45) 58%, transparent 100%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.gal-item__cap::before {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--accent);
  margin-bottom: 7px;
}
.gal-item:hover .gal-item__cap {
  opacity: 1;
  transform: translateY(0);
}
.gal-item.is-video .gal-item__cap { padding-bottom: 14px; }
@media (hover: none) {
  /* Sur tactile, on garde la légende lisible en permanence */
  .gal-item__cap { opacity: 1; transform: none; }
  .gal-item__num { opacity: 1; transform: none; }
}

.gal-item__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border: 1px solid var(--accent);
  background: rgba(200, 50, 58, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  transition: transform 0.25s ease, background 0.25s ease;
}
.gal-item:hover .gal-item__play {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--accent);
}
.gal-item__play svg {
  width: 22px;
  height: 22px;
  color: #fff;
  margin-left: 2px;
}

.gal-item__tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  z-index: 2;
}

/* ----------- End block ----------- */
.gal-end {
  margin-top: 96px;
  padding: 80px 0 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.gal-end .section-label { justify-content: center; max-width: 600px; margin: 0 auto 32px; }
.gal-end h3 {
  margin-bottom: 20px;
}
.gal-end .lead {
  margin: 0 auto 32px;
  max-width: 50ch;
}
.gal-end-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ----------- Lightbox ----------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 13, 28, 0.97);
  backdrop-filter: blur(16px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 32px;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__media {
  max-width: 90%;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__media img,
.lightbox__media video {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  display: block;
}

.lightbox__close,
.lightbox__nav {
  position: absolute;
  width: 48px;
  height: 48px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.lightbox__close:hover,
.lightbox__nav:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.lightbox__close {
  top: 24px;
  right: 32px;
  font-size: 24px;
  line-height: 1;
}
.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 28px;
  line-height: 1;
}
.lightbox__nav--prev { left: 24px; }
.lightbox__nav--next { right: 24px; }

.lightbox__caption {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}
.lightbox__counter {
  position: absolute;
  top: 24px;
  left: 32px;
  font-family: var(--ff-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}

/* ----------- Responsive ----------- */
@media (max-width: 1200px) {
  .gal-masonry { grid-template-columns: repeat(3, 1fr); }
  .gal-stats { grid-template-columns: repeat(2, 1fr); }
  .gal-stat:nth-child(2) { border-right: 0; }
  .gal-stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); padding-bottom: 16px; }
  .gal-stat:nth-child(n+3) { padding-top: 16px; }
}
@media (max-width: 720px) {
  .gal-hero { padding: 100px 0 40px; }
  .gal-wrap { padding: 40px 0 60px; }
  .gal-masonry { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .gal-stats { grid-template-columns: 1fr; gap: 16px 0; }
  .gal-stat {
    padding: 12px 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--border);
    min-width: 0;
  }
  .gal-stat:last-child { border-bottom: 0; }
  .lightbox { padding: 16px; }
  .lightbox__close { top: 16px; right: 16px; }
  .lightbox__nav--prev { left: 12px; }
  .lightbox__nav--next { right: 12px; }
  .lightbox__counter { top: 16px; left: 16px; font-size: 10px; }
}
@media (max-width: 380px) {
  .gal-masonry { grid-template-columns: 1fr; }
}
