/* --------------------------------------------------------------------------
   Blender Gallery — page-specific styles
   Inherits CSS variables and base styles from ../style.css
   -------------------------------------------------------------------------- */

/* Back link in header / footer */
.gallery-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(124, 156, 255, 0.3);
  background: rgba(124, 156, 255, 0.06);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}

.gallery-back-link:hover {
  border-color: var(--accent);
  background: rgba(124, 156, 255, 0.14);
  color: #fff;
}

/* Gallery group (images / videos separated by heading) */
.gallery-group {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.gallery-group:last-child {
  margin-bottom: 0;
}

.gallery-group__title {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

/* Gallery grid — images */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

/* Gallery grid — videos (fewer, wider columns) */
.gallery-grid--video {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* Individual gallery item */
.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--bg-elevated);
  transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

/* Image items */
.gallery-item--image {
  aspect-ratio: 4 / 3;
  cursor: pointer;
}

.gallery-item--image:hover {
  border-color: rgba(124, 156, 255, 0.35);
  transform: translateY(-3px);
}

.gallery-item--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease-out);
  background: var(--bg-elevated);
}

.gallery-item--image:hover img {
  transform: scale(1.05);
}

/* Hover overlay with zoom icon */
.gallery-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s var(--ease-out);
  pointer-events: none;
}

.gallery-item--image:hover .gallery-item__overlay {
  background: rgba(0, 0, 0, 0.4);
}

.gallery-item__zoom-icon {
  width: 2.25rem;
  height: 2.25rem;
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.gallery-item--image:hover .gallery-item__zoom-icon {
  opacity: 1;
  transform: scale(1);
}

/* Video items */
.gallery-item--video {
  display: flex;
  flex-direction: column;
  background: #000;
}

.gallery-item--video video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
  object-fit: contain;
}

.gallery-item__caption {
  margin: 0;
  padding: 0.6rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-top: 1px solid var(--glass-border);
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out), visibility 0.25s;
}

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

.lightbox__img-wrap {
  max-width: min(90vw, 1280px);
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
  background: var(--bg-elevated);
  display: block;
}

/* Close / nav buttons shared base */
.lightbox__close,
.lightbox__nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.lightbox__close {
  top: 1.25rem;
  right: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
}

.lightbox__close svg,
.lightbox__nav svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
}

.lightbox__prev {
  left: 1.25rem;
}

.lightbox__next {
  right: 1.25rem;
}

.lightbox__counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  user-select: none;
}

@media (max-width: 640px) {
  .lightbox__prev {
    left: 0.5rem;
  }
  .lightbox__next {
    right: 0.5rem;
  }
  .lightbox__nav {
    width: 2.5rem;
    height: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-item--image:hover,
  .gallery-item--image:hover img,
  .gallery-item__zoom-icon {
    transform: none;
    transition: none;
  }
}
