/* styles/gallery.css */
/* Five Dollar Down — Photo grid, YouTube embeds, lightbox */

/* ─── Videos grid ────────────────────────────────────── */
/* Landscape videos */
.videos-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
}

.videos-grid .yt-embed {
  flex: 0 1 520px;
  min-width: 280px;
}

/* Vertical videos */
.videos-grid-vertical {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.videos-grid-vertical .yt-embed {
  flex: 0 1 260px;
  min-width: 160px;
}

.yt-embed {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--c-ink-2);
  aspect-ratio: 16 / 9;
}

.yt-embed[data-orientation="vertical"] {
  aspect-ratio: 9 / 16;
}

.yt-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.yt-thumb {
  position: absolute;
  inset: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform var(--t-base), opacity var(--t-base);
}

.yt-thumb:hover .yt-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
}

.yt-play-bg {
  fill: #ff0000;
  fill-opacity: 0.85;
  transition: fill-opacity var(--t-fast);
}

.yt-thumb:hover .yt-play-bg {
  fill-opacity: 1;
}

.yt-play-arrow {
  fill: #fff;
}

/* ─── Photo gallery grid ─────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: var(--c-ink-2);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-white);
  opacity: 0;
  transition: opacity var(--t-base);
}

.gallery-item:hover .gallery-overlay,
.gallery-item:focus-visible .gallery-overlay {
  opacity: 1;
}

.gallery-item:focus-visible {
  outline: 2px solid var(--c-accent-lt);
  outline-offset: 2px;
}

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

.lightbox.is-open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 80vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

/* Mobile: arrows overlay the image so it can use full width */
@media (max-width: 767px) {
  .lightbox-content {
    max-width: 95vw;
  }

  .lightbox-img {
    max-width: 95vw;
  }

  .lightbox-prev,
  .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--c-white);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--c-accent-dim);
  color: var(--c-accent-lt);
}

.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  outline: 2px solid var(--c-accent-lt);
  outline-offset: 3px;
}

.lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
}
