/* ============================================================
   GALLERY.CSS — Featured section, masonry, photo viewer, reels
   ============================================================ */

/* ============================================================
   FEATURED SECTION
   ============================================================ */
.featured-section {
  padding: 0 clamp(20px, 4vw, 60px) var(--section-pad);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto;
  gap: var(--gap);
  max-width: 1600px;
  margin: 0 auto;
}

/* Featured items layout — handcrafted sizing */
.featured-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-surface);
}
.featured-item:nth-child(1) { grid-column: 1 / 6; grid-row: 1 / 3; }
.featured-item:nth-child(2) { grid-column: 6 / 9; grid-row: 1; }
.featured-item:nth-child(3) { grid-column: 9 / 13; grid-row: 1; }
.featured-item:nth-child(4) { grid-column: 6 / 10; grid-row: 2; }
.featured-item:nth-child(5) { grid-column: 10 / 13; grid-row: 2; }
.featured-item:nth-child(6) { grid-column: 1 / 5; grid-row: 3; }
.featured-item:nth-child(7) { grid-column: 5 / 8; grid-row: 3; }
.featured-item:nth-child(8) { grid-column: 8 / 13; grid-row: 3; }
.featured-item:nth-child(9) { grid-column: 1 / 7; grid-row: 4; }
.featured-item:nth-child(10){ grid-column: 7 / 13; grid-row: 4; }

/* Aspect ratios per position */
.featured-item:nth-child(1) { aspect-ratio: 3/4; }
.featured-item:nth-child(2),
.featured-item:nth-child(3) { aspect-ratio: 4/3; }
.featured-item:nth-child(4) { aspect-ratio: 16/9; }
.featured-item:nth-child(5) { aspect-ratio: 1; }
.featured-item:nth-child(6),
.featured-item:nth-child(7) { aspect-ratio: 4/3; }
.featured-item:nth-child(8) { aspect-ratio: 16/10; }
.featured-item:nth-child(9),
.featured-item:nth-child(10){ aspect-ratio: 16/9; }

.featured-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.04);
  transition: transform 1s var(--ease-out), filter 0.6s ease;
  filter: brightness(0.88);
}
.featured-item:hover img {
  transform: scale(1.08);
  filter: brightness(1);
}

/* Hover overlay */
.featured-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 2;
}
.featured-item:hover .featured-item-overlay { opacity: 1; }

/* Number badge */
.featured-badge {
  position: absolute;
  top: 14px; left: 14px;
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.4);
  padding: 4px 8px;
  z-index: 3;
  backdrop-filter: blur(4px);
}

/* Caption (shown on hover if present) */
.featured-caption {
  position: absolute;
  bottom: 16px; left: 16px; right: 16px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-secondary);
  z-index: 3;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.featured-item:hover .featured-caption {
  opacity: 1;
  transform: translateY(0);
}

/* Entrance animation state */
.featured-item { opacity: 0; transform: translateY(30px); }

/* ============================================================
   GALLERY SECTION HEADER
   ============================================================ */
.gallery-section {
  padding: var(--section-pad) clamp(20px, 4vw, 60px);
}

.gallery-header {
  text-align: left;
  margin-bottom: clamp(32px, 4vw, 56px);
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: clamp(32px, 4vw, 56px);
}
.gallery-eyebrow {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.gallery-title {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ============================================================
   MASONRY GRID
   ============================================================ */
.masonry-grid {
  columns: 4;
  column-gap: var(--gap);
  max-width: 1600px;
  margin: 0 auto;
}

.masonry-item {
  break-inside: avoid;
  display: block;
  margin-bottom: var(--gap);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--bg-surface);

  /* Entrance */
  opacity: 0;
  transform: translateY(24px);
}

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  transform: scale(1.03);
  transition: transform 0.9s var(--ease-out), filter 0.5s ease;
  filter: brightness(0.85);
}
.masonry-item:hover img {
  transform: scale(1.07);
  filter: brightness(1);
}

/* Subtle overlay on hover */
.masonry-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}
.masonry-item:hover .masonry-overlay { opacity: 0.3; }

/* Masonry size variants for visual rhythm */
.masonry-item.size-tall > img, .masonry-item.size-tall .video-poster-wrap { aspect-ratio: 3/4; object-fit: cover; width: 100%; display: block; }
.masonry-item.size-wide > img, .masonry-item.size-wide .video-poster-wrap { aspect-ratio: 16/9; object-fit: cover; width: 100%; display: block; }
.masonry-item.size-square > img, .masonry-item.size-square .video-poster-wrap { aspect-ratio: 1; object-fit: cover; width: 100%; display: block; }
.masonry-item.size-portrait > img, .masonry-item.size-portrait .video-poster-wrap { aspect-ratio: 2/3; object-fit: cover; width: 100%; display: block; }

/* Category label shown when hovering if caption exists */
.masonry-meta {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 14px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.masonry-item:hover .masonry-meta { opacity: 1; }

.video-poster-wrap {
  width: 100%;
  position: relative;
  display: block;
  overflow: hidden;
}

.video-play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.masonry-meta-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================================
   GALLERY EMPTY STATE
   ============================================================ */
.gallery-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
}
.gallery-empty a {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-hover);
}

/* ============================================================
   PHOTO VIEWER CUSTOM STYLES (PhotoSwipe overrides)
   ============================================================ */
.pswp {
  --pswp-bg: rgba(0,0,0,0.96);
  --pswp-placeholder-bg: #101010;
  --pswp-icon-color: rgba(255,255,255,0.65);
  --pswp-icon-color-secondary: rgba(255,255,255,0.3);
  --pswp-icon-stroke-color: rgba(0,0,0,0.4);
  --pswp-icon-stroke-width: 1.2px;
  backdrop-filter: blur(24px) saturate(1.5);
}
.pswp__top-bar { padding: 16px 20px; }
.pswp__button--arrow {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}
.pswp__button--arrow:hover { opacity: 1; }

/* Caption bar */
.pswp__custom-caption {
  background: rgba(0,0,0,0.5);
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 10px 20px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.pswp__custom-caption .caption-title {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 2px;
}
.pswp__custom-caption .caption-meta {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

/* ============================================================
   REELS SECTION
   ============================================================ */
.reels-section {
  padding: 0 0 var(--section-pad);
  display: none; /* controlled by JS */
}

.reels-cinematic {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 60px);
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 6vw, 96px);
}

.reel-item {
  position: relative;
  opacity: 0;
  transform: translateY(40px);
}

.reel-stage {
  position: relative;
  background: #000;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.8);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* Base aspect ratios */
.reel-stage.vertical {
  max-width: 400px;
  aspect-ratio: 9/16;
}
.reel-stage.horizontal {
  max-width: 800px;
  aspect-ratio: 16/9;
}
.reel-stage:fullscreen,
.reel-stage:-webkit-full-screen {
  max-width: none !important;
  width: 100vw !important;
  height: 100vh !important;
}

.reel-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Custom controls bar */
.reel-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 20px 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.reel-stage:hover .reel-controls,
.reel-stage.paused .reel-controls { opacity: 1; }

.reel-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  transition: background 0.2s ease, color 0.2s ease;
  font-size: 14px;
}
.reel-btn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.reel-btn svg { pointer-events: none; }

/* Progress bar */
.reel-progress-wrap {
  flex: 1;
  height: 20px;           /* tall hit area for easy seeking */
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
}
.reel-progress-track {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.15);
  border-radius: 1px;
  position: relative;
  transition: height 0.15s ease;
}
.reel-progress-wrap:hover .reel-progress-track {
  height: 4px;
}
.reel-progress-bar {
  height: 100%;
  background: rgba(255,255,255,0.85);
  border-radius: 1px;
  width: 0%;
  transition: width 0.1s linear;
}
.reel-progress-wrap:hover .reel-progress-bar {
  background: #fff;
}

/* Time display */
.reel-time {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 300;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Volume */
.reel-volume-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
input[type="range"].reel-volume-slider {
  width: 60px;
  appearance: none;
  height: 2px;
  background: rgba(255,255,255,0.2);
  border-radius: 1px;
  outline: none;
  cursor: pointer;
}
input[type="range"].reel-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

/* Rotate badge — admin-only, hidden from front-end; kept for selector completeness */
.reel-rotate-btn {
  display: none; /* removed from front-end UI */
}

/* Play overlay icon */
.reel-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.reel-stage.paused .reel-play-overlay { opacity: 1; pointer-events: auto; }
.reel-stage.ended  .reel-play-overlay { opacity: 1; pointer-events: auto; }

/* Ended state — replay hint */
.reel-stage.ended .reel-play-icon {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
}

.reel-play-icon {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.reel-play-icon svg { color: #fff; }

/* Reel info below */
.reel-info {
  margin-top: 18px;
  padding: 0 4px;
}
.reel-info-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.reel-info-meta {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .masonry-grid { columns: 3; }
}
@media (max-width: 900px) {
  .masonry-grid { columns: 2; }

  /* Featured grid collapses */
  .featured-grid {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
  }
  .featured-item {
    grid-column: unset !important;
    grid-row: unset !important;
    aspect-ratio: 16/9 !important;
  }
  .featured-item:nth-child(1),
  .featured-item:nth-child(5) { aspect-ratio: 4/3 !important; }
}
@media (max-width: 600px) {
  .masonry-grid { columns: 2; column-gap: 6px; }
  .masonry-item { margin-bottom: 6px; }
  /* .reel-volume-wrap { display: none; } - Removed to allow volume control on mobile */
}
@media (max-width: 400px) {
  .masonry-grid { columns: 1; }
}

/* Mobile Fullscreen Fix */
:-webkit-full-screen video.reel-video {
  object-fit: contain !important;
}
:fullscreen video.reel-video {
  object-fit: contain !important;
}
.reel-stage:fullscreen {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none !important;
  width: 100vw !important;
  height: 100vh !important;
}
.reel-stage:fullscreen video {
  object-fit: contain !important;
}

