/* ═══════════════════════════════════════════════════
   Gallery — Senior Victorian Championship 2026
   Depends on /assets/style.css for CSS vars
═══════════════════════════════════════════════════ */

/* ── Page header ── */
.gallery-header {
  background: var(--header-bg);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.gallery-header-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.gallery-header-title span { color: var(--accent); }
.gallery-back-btn {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}
.gallery-back-btn:hover { color: var(--text); }

/* ── Hero / title area ── */
.gallery-hero {
  text-align: center;
  padding: 48px 24px 36px;
  max-width: 820px;
  margin: 0 auto;
}
.gallery-hero h1 {
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.gallery-hero p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

/* ── Play Slideshow button ── */
.btn-slideshow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 26px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 18px;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
}
.btn-slideshow:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}
.btn-slideshow:active { transform: translateY(0); }

/* ── Thumbnail grid ── */
.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
}
.gallery-item {
  height: 250px;
  flex-grow: 1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  min-width: 120px;
  max-width: 480px;
  background: var(--surface);
}
.gallery-item img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  filter: grayscale(1);
  transition: filter 0.45s ease, transform 0.55s ease;
  display: block;
}
.gallery-item:hover img,
.gallery-item:focus-within img {
  filter: grayscale(0);
  transform: scale(1.06);
}
.gallery-loading {
  text-align: center;
  padding: 80px 32px;
  color: var(--muted);
  font-size: 0.95rem;
  width: 100%;
}

/* ── Modal base ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
}
.modal.active { display: block; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  cursor: pointer;
}

/* ── Lightbox ── */
#lightbox {
  display: none;
  align-items: center;
  justify-content: center;
}
#lightbox.active {
  display: flex;
}

.lightbox-container {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100vw - 120px);
  max-height: 90vh;
}

/* Controls bar above the image */
.lightbox-controls {
  position: absolute;
  top: -52px;
  right: 0;
  display: flex;
  gap: 8px;
  z-index: 2;
}

.lb-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.lb-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Image + watermark wrapper */
.lightbox-img-wrap {
  position: relative;
  display: inline-block;
  max-width: calc(100vw - 120px);
  max-height: 85vh;
  line-height: 0;
}
#lb-img {
  display: block;
  max-width: calc(100vw - 120px);
  max-height: 85vh;
  object-fit: contain;
  border-radius: 3px;
}
.watermark {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 320px;
  opacity: 0.38;
  pointer-events: none;
  filter: brightness(3) saturate(0);
  border-radius: 6px;
}

/* Prev / Next arrows */
.lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
  z-index: 2;
}
.lb-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}
.lb-arrow:not(:disabled):hover { background: rgba(255, 255, 255, 0.2); }
.lb-prev { left: -62px; }
.lb-next { right: -62px; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
  z-index: 9999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Slideshow ── */
#slideshow {
  background: #000;
}
.ss-img-wrap {
  position: absolute;
  inset: 0;
}
.ss-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.4s ease;
  animation: kenBurns 10s ease-in-out infinite alternate;
  will-change: opacity, transform;
}
.ss-img.active {
  opacity: 1;
}
@keyframes kenBurns {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

.ss-controls-top {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.ss-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  z-index: 10;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .gallery-header { padding: 14px 16px; }
  .gallery-hero   { padding: 32px 16px 24px; }

  .gallery-item         { height: 150px; min-width: 80px; }

  .lightbox-container   { max-width: 98vw; }
  .lightbox-controls    { top: -48px; gap: 6px; }
  #lb-img               { max-width: 98vw; }
  .lightbox-img-wrap    { max-width: 98vw; }

  .lb-prev { left: -44px; }
  .lb-next { right: -44px; }
  .lb-arrow { width: 36px; height: 36px; font-size: 0.8rem; }

  .watermark { width: 60px; }
}
