/* ==========================================================================
   Blog Gallery Lightbox — prefixe blg-*
   ASAPH Toulouse © 2026
   ========================================================================== */

/* ── Variables & reset carte ────────────────────────────────────────────── */
:root {
  --blg-ambient: 10, 14, 20;
  --blg-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --blg-ease:   cubic-bezier(0.22, 1, 0.36, 1);
}

body.blg-modal-open { overflow: hidden; }

/* ── Card hover — shadow pulse coloré ──────────────────────────────────── */
@keyframes blg-card-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(125, 191, 120, 0.12); }
  50%       { box-shadow: 0 10px 44px rgba(125, 191, 120, 0.38), 0 2px 8px rgba(61, 107, 56, 0.18); }
}

.bl-card:hover {
  animation: blg-card-pulse 2.4s ease-in-out infinite;
}

.bl-card__link-cover {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .bl-card:hover { animation: none; }
}

/* ── Overlay ─────────────────────────────────────────────────────────────── */
.blg-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms var(--blg-ease), visibility 280ms;
}

.blg-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* classe temporaire pour mesurer la mise en page avant animation */
.blg-overlay.blg-measure {
  visibility: visible !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Backdrop ────────────────────────────────────────────────────────────── */
.blg-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(var(--blg-ambient), 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  transition: background-color 600ms ease;
}

/* Vignette radiale */
.blg-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 38%, rgba(0, 0, 0, 0.50) 100%);
  pointer-events: none;
}

/* ── Bouton fermer ────────────────────────────────────────────────────────── */
.blg-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff !important;
  caret-color: #fff !important;
  cursor: pointer;
  transition: background 0.22s, transform 0.32s var(--blg-spring);
  padding: 0;
}

.blg-close:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.1) rotate(90deg);
}

.blg-close svg { display: block; }

/* ── Stage (zone centrale photo + flèches) ──────────────────────────────── */
.blg-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-height: calc(100dvh - 10rem);
  padding: 0 0.5rem;
}

/* ── Flèches navigation ──────────────────────────────────────────────────── */
.blg-nav {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff !important;
  caret-color: #fff !important;
  cursor: pointer;
  transition: background 0.22s, transform 0.22s;
  padding: 0;
  position: relative;
  z-index: 2;
}

.blg-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
}

.blg-nav svg { display: block; }

/* ── Photo wrap ──────────────────────────────────────────────────────────── */
.blg-photo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-width: min(88vw, 1280px);
  max-height: 100%;
  min-height: 120px;
  overflow: hidden;
  border-radius: 12px;
  will-change: transform;
}

/* ── Skeleton shimmer ────────────────────────────────────────────────────── */
@keyframes blg-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.blg-skeleton {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: none;
  background: linear-gradient(
    90deg,
    rgba(125, 191, 120, 0.06) 0%,
    rgba(125, 191, 120, 0.18) 40%,
    rgba(125, 191, 120, 0.06) 80%
  );
  background-size: 200% 100%;
  min-height: 240px;
}

.blg-skeleton.is-active {
  display: block;
  animation: blg-shimmer 1.6s ease-in-out infinite;
}

/* ── Photo principale ────────────────────────────────────────────────────── */
.blg-photo {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 11rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform, opacity;
  transition: transform 0.4s var(--blg-ease);
}

.blg-photo.is-zoomed {
  cursor: zoom-out;
  transition: transform 0.3s var(--blg-ease);
}

/* Wipe reveal — première apparition */
@keyframes blg-wipe {
  from { clip-path: inset(0 100% 0 0 round 8px); }
  to   { clip-path: inset(0 0% 0 0 round 8px); }
}

.blg-photo.blg-wipe {
  animation: blg-wipe 420ms var(--blg-ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .blg-photo.blg-wipe { animation: none; clip-path: none; }
}

/* ── Caption ─────────────────────────────────────────────────────────────── */
.blg-caption {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  padding: 0.4rem 1rem 0.2rem;
  letter-spacing: 0.01em;
  min-height: 1.6em;
}

/* ── Dots ────────────────────────────────────────────────────────────────── */
.blg-dots {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: center;
  padding: 0.3rem 1rem;
}

.blg-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.28);
  border: none;
  cursor: pointer;
  padding: 0;
  color: transparent !important;
  caret-color: transparent !important;
  transition: width 320ms var(--blg-spring), background 320ms ease;
}

.blg-dot.is-active {
  width: 22px;
  background: rgba(var(--blg-ambient), 1);
  /* Fallback pour les cas où ambient = noir */
  background-color: #7dbf78;
}

/* ── Thumbnails strip ────────────────────────────────────────────────────── */
.blg-thumbs-wrap {
  width: 100%;
  max-width: min(88vw, 1280px);
  padding: 0.25rem 0.5rem 0.75rem;
}

.blg-thumbs-track {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 0.25rem;
}

.blg-thumbs-track::-webkit-scrollbar { display: none; }

.blg-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  transition: border-color 0.22s, transform 0.22s var(--blg-spring), opacity 0.22s;
  color: transparent !important;
  caret-color: transparent !important;
  scroll-snap-align: center;
  opacity: 0.65;
}

.blg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.blg-thumb:hover { opacity: 0.88; }

.blg-thumb.is-active {
  border-color: #7dbf78;
  transform: scale(1.1);
  opacity: 1;
}

/* ── Scroll progress bar (strip) ─────────────────────────────────────────── */
.blg-scroll-progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  margin-top: 0.3rem;
  position: relative;
  overflow: hidden;
}

.blg-scroll-progress__bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: #7dbf78;
  border-radius: 2px;
  transition: width 180ms ease;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .blg-nav {
    width: 40px;
    height: 40px;
  }

  .blg-stage { gap: 0.4rem; }

  .blg-close {
    top: 0.75rem;
    right: 0.75rem;
    width: 38px;
    height: 38px;
  }

  .blg-thumb { width: 50px; height: 50px; }
}
