/* ==================================================================
   Video gallery page -- styles specific to gallery.html only.
   Kept separate from main.css (design tokens like --bg/--gold/--radius
   etc. are defined there and reused here) so the site's primary,
   heavily-trafficked stylesheet doesn't grow or risk breaking for a
   single page.
   ================================================================== */

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */
.gallery-hero {
  padding: 56px 0 32px;
  text-align: center;
}

.gallery-hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 10px 0 12px;
}

.gallery-hero-sub {
  color: var(--text-dim);
  max-width: 56ch;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* ------------------------------------------------------------------
   Toolbar: video count + grid-size control
   ------------------------------------------------------------------ */
.gallery-section {
  padding: 0 0 96px;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.gallery-count {
  color: var(--text-faint);
  font-size: 0.92rem;
  margin: 0;
}

.grid-size-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.grid-size-label {
  color: var(--text-faint);
  font-size: 0.82rem;
  padding: 0 8px 0 4px;
  white-space: nowrap;
}

.grid-size-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.grid-size-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.grid-size-btn:hover {
  color: var(--text);
  background: rgba(201, 162, 75, 0.08);
}

.grid-size-btn.is-active {
  color: var(--bg);
  background: var(--gold);
}

/* ------------------------------------------------------------------
   Grid
   ------------------------------------------------------------------ */
.gallery-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(3, 1fr);
}

.gallery-grid[data-grid-size="2"] { grid-template-columns: repeat(2, 1fr); }
.gallery-grid[data-grid-size="3"] { grid-template-columns: repeat(3, 1fr); }
.gallery-grid[data-grid-size="4"] { grid-template-columns: repeat(4, 1fr); }
.gallery-grid[data-grid-size="6"] { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 980px) {
  .gallery-grid[data-grid-size="4"],
  .gallery-grid[data-grid-size="6"] { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .gallery-grid,
  .gallery-grid[data-grid-size="2"],
  .gallery-grid[data-grid-size="3"],
  .gallery-grid[data-grid-size="4"],
  .gallery-grid[data-grid-size="6"] { grid-template-columns: repeat(2, 1fr); }
}

.gallery-tile {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.gallery-tile:hover,
.gallery-tile:focus-visible {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.gallery-tile-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

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

.gallery-tile-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gallery-tile-play svg {
  width: 44px;
  height: 44px;
  fill: rgba(243, 239, 230, 0.92);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.gallery-tile-title {
  padding: 12px 14px 14px;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

/* Denser grid sizes: smaller title text so tiles stay tidy */
.gallery-grid[data-grid-size="4"] .gallery-tile-title,
.gallery-grid[data-grid-size="6"] .gallery-tile-title {
  font-size: 0.84rem;
  padding: 9px 10px 11px;
}

.gallery-grid[data-grid-size="6"] .gallery-tile-play svg {
  width: 30px;
  height: 30px;
}

.gallery-empty,
.gallery-error {
  text-align: center;
  color: var(--text-faint);
  padding: 48px 0;
}

/* ------------------------------------------------------------------
   Lightbox
   ------------------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 6, 9, 0.92);
  backdrop-filter: blur(4px);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(1600px, 96vw);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 88vh;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: pan-y;
}

@media (max-width: 900px) {
  .lightbox-panel {
    width: 100vw;
    max-height: 100vh;
  }

  .lightbox-stage {
    max-height: 100vh;
    border-radius: 0;
  }

  .lightbox-caption {
    padding: 10px 12px 0;
  }
}

.lightbox-stage iframe {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  border: 0;
}

.lightbox-close {
  position: absolute;
  top: -46px;
  right: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover { border-color: var(--border-strong); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(18, 20, 27, 0.85);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.lightbox-nav svg { width: 22px; height: 22px; }
.lightbox-nav:hover { border-color: var(--border-strong); background: var(--bg-elevated); }
.lightbox-nav:disabled { opacity: 0.3; cursor: default; }
.lightbox-nav:disabled:hover { border-color: var(--border); background: rgba(18, 20, 27, 0.85); }

.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }

@media (max-width: 900px) {
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 8px; right: 8px; background: rgba(18, 20, 27, 0.85); }
}

.lightbox-caption {
  width: 100%;
  padding: 16px 4px 0;
  text-align: center;
}

.lightbox-caption h2 {
  font-size: 1.15rem;
  margin: 0 0 4px;
  color: var(--text);
}

.lightbox-position {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.85rem;
}
