/* Product photo gallery with thumbnails (product page hero)
   Used with tailwind_theme/product-gallery.js. The stage reuses .product-img-wrap, so it keeps the
   hero photo's size, border and shadow from cabin-led-product.css.
   Optional video: when the gallery has a .gal-video, the first item is the video. It plays over a
   blurred, dimmed copy of the first photo, and the whole tall video shows (nothing is cropped). */

.gal { position: relative; }
.gal-stage { isolation: isolate; }
/* Same photo box size on every product page (a few page stylesheets size their single photo differently) */
.hero-media--single .gal-stage.product-img-wrap { height: 520px !important; min-height: 520px !important; max-height: 520px !important; aspect-ratio: auto !important; }
@media (max-width: 1023px) {
  .hero-media--single .gal-stage.product-img-wrap { height: 380px !important; min-height: 380px !important; max-height: 380px !important; }
}

.gal-track {
  position: relative; display: flex; height: 100%;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; overscroll-behavior-x: contain; outline: none;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-track:focus-visible { box-shadow: inset 0 0 0 2px #60a5fa; }

.gal-slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: start; overflow: hidden; background: #0f1d33; }
.gal-stage .gal-slide img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: filter 450ms ease, transform 600ms ease;
}
/* Photos that would lose too much when cropped to fill the box (very tall or very wide; set by the script,
   or always for .is-tall): show the whole photo over a blurred copy of itself. */
.gal-stage .gal-slide.is-tall img,
.gal-stage .gal-slide.is-contain img { object-fit: contain; }
.gal-stage .gal-slide.is-tall img.gal-fill,
.gal-stage .gal-slide.is-contain img.gal-fill { object-fit: cover; filter: blur(18px) brightness(0.75); transform: scale(1.15); }
.gal-stage .gal-slide:not(.is-tall):not(.is-contain) img.gal-fill { display: none; }

/* Optional label on a photo, e.g. a product version ("Bayonet mount") */
.gal-caption {
  position: absolute; top: 0.75rem; left: 0.75rem; z-index: 1; pointer-events: none;
  padding: 0.3rem 0.65rem; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #f8fafc; background: rgba(7,16,30,0.72); border: 1px solid rgba(148,163,184,0.28); border-radius: 9999px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity 300ms ease;
}
.gal.is-video .gal-slide.is-hero .gal-caption { opacity: 0; } /* a photo's label isn't shown over the video */

/* Video (first item) */
.gal-video {
  position: absolute; top: 0; left: 50%; height: 100%; width: auto; z-index: 2;
  opacity: 0; pointer-events: none; background: #0f1d33;
  transform: translateX(-50%) scale(0.96);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.14), 0 20px 60px rgba(0,0,0,0.6);
  transition: opacity 450ms ease, transform 550ms cubic-bezier(.2,.7,.2,1);
}
.gal.is-video .gal-video { opacity: 1; transform: translateX(-50%) scale(1); }
.gal.is-video .gal-slide.is-hero img { filter: blur(10px) brightness(0.45); transform: scale(1.08); }

/* Pause / Play button, shown on the video item only */
.gal-toggle {
  position: absolute; left: 0.75rem; bottom: 0.75rem; z-index: 3;
  display: none; align-items: center; gap: 0.4rem; min-height: 32px; padding: 0.4rem 0.75rem;
  font: inherit; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #f8fafc; cursor: pointer;
  background: rgba(7,16,30,0.72); border: 1px solid rgba(148,163,184,0.28); border-radius: 9999px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background 200ms ease, border-color 200ms ease;
}
.gal.on-video .gal-toggle { display: inline-flex; }
.gal-toggle:hover, .gal-toggle:focus-visible { background: rgba(30,78,216,0.82); border-color: rgba(96,165,250,0.45); }
.gal-toggle .gal-i-play { display: none; }
.gal-toggle.is-paused .gal-i-play { display: block; }
.gal-toggle.is-paused .gal-i-pause { display: none; }
@media (hover: none) {
  .gal-toggle { min-height: 40px; padding: 0.5rem 0.85rem; font-size: 0.6875rem; }
}

/* Photo count badge (links to the gallery page). Base look comes from .gallery-hero-badge in site.css. */
.gal-badge { pointer-events: auto; z-index: 3; text-decoration: none; font-variant-numeric: tabular-nums; }
.gal-badge:hover, .gal-badge:focus-visible { background: rgba(30,78,216,0.82); border-color: rgba(96,165,250,0.45); }

/* Thumbnail strip */
.gal-thumbs { position: relative; display: flex; gap: 8px; margin-top: 10px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.gal-thumbs::-webkit-scrollbar { display: none; }
.gal-thumbs[hidden] { display: none; }
.gal-thumb {
  position: relative; flex: 1 1 56px; min-width: 44px; height: 52px; padding: 0;
  border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #0f1d33;
  cursor: pointer; opacity: 0.55; transition: opacity 200ms ease, border-color 200ms ease;
}
.gal-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gal-thumb:hover { opacity: 0.85; }
.gal-thumb:focus-visible { opacity: 1; outline: 2px solid #60a5fa; outline-offset: 1px; }
.gal-thumb.on { opacity: 1; border-color: #3b82f6; }
.gal-thumb .gal-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7,16,30,0.35); }
.gal-thumb .gal-play svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6)); }

@media (prefers-reduced-motion: reduce) {
  .gal-track { scroll-behavior: auto; }
  .gal-stage .gal-slide img, .gal-video { transition: none; }
}
