/* ============================================
   EIKO GALLERY — page-specific styles
   ============================================ */

.gallery-page {
  background: var(--paper);
}

/* Gallery doesn't have the globe — give it a subtle static background pattern */
.gallery-page::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 20%, rgba(181, 137, 62, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(122, 46, 30, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(5, 9, 26, 0.015) 0%, transparent 60%);
}

.gallery-page main {
  position: relative;
  z-index: 2;
}

/* ============================================
   Hero
   ============================================ */
.gallery-hero {
  padding: 10rem 2.5rem 4rem;
  max-width: 1600px;
  margin: 0 auto;
}
.gallery-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  opacity: 0.7;
  transition: opacity 0.3s, gap 0.3s var(--ease);
}
.back-link:hover {
  opacity: 1;
  gap: 0.9rem;
}
.gallery-hero-title {
  font-family: var(--f-display);
  font-size: clamp(2.8rem, 10vw, 8rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.045em;
  margin-bottom: 2.5rem;
  max-width: 14ch;
}
.gallery-hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
}
.gallery-hero-title .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  animation: wordReveal 1.1s var(--ease) forwards;
}
.gallery-hero-title .line:nth-child(1) .word { animation-delay: 0.2s; }
.gallery-hero-title .line:nth-child(2) .word:nth-child(1) { animation-delay: 0.35s; }
.gallery-hero-title .line:nth-child(2) .word:nth-child(2) { animation-delay: 0.45s; }
.gallery-hero-title .line:nth-child(3) .word { animation-delay: 0.55s; }
.gallery-hero-title .italic {
  font-style: italic;
  font-weight: 300;
  color: var(--rust);
}
.gallery-hero-title .punctuation {
  display: inline-block;
  color: var(--rust);
  opacity: 0;
  animation: wordReveal 0.6s var(--ease) 1s forwards;
}
.gallery-hero-sub {
  max-width: 38rem;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--muted);
  font-weight: 300;
  opacity: 0;
  animation: fadeIn 1s var(--ease) 1.2s forwards;
}

/* ============================================
   Filter tabs
   ============================================ */
.gallery-filter-section {
  padding: 2rem 2.5rem;
  max-width: 1600px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 241, 232, 0.88);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
.gallery-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.3rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: inherit;
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
.filter-btn:hover {
  border-color: var(--ink);
}
.filter-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.filter-count {
  font-size: 0.7rem;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}
.filter-btn.active .filter-count {
  opacity: 0.7;
}

/* ============================================
   Masonry grid
   ============================================ */
.gallery-grid-section {
  padding: 4rem 2.5rem 8rem;
  max-width: 1600px;
  margin: 0 auto;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 280px;
  gap: 1.25rem;
  position: relative;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(245, 241, 232, 0.8);
  transition: transform 0.6s var(--ease), opacity 0.5s var(--ease);
  cursor: none;
}

/* Touch devices — restore cursor */
@media (hover: none) {
  .gallery-item { cursor: pointer; }
}

.gallery-item[data-size="tall"] { grid-row: span 2; }
.gallery-item[data-size="wide"] { grid-column: span 2; }

.gallery-item.hidden {
  display: none;
}

.gallery-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--paper-warm), var(--paper-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.gallery-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 12px,
      rgba(5, 9, 26, 0.025) 12px,
      rgba(5, 9, 26, 0.025) 13px
    );
  pointer-events: none;
}
.gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s var(--ease);
}
.gallery-item:hover .gallery-image img {
  transform: scale(1.05);
}

.gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem 1.25rem 1.25rem;
  background: linear-gradient(
    to top,
    rgba(5, 9, 26, 0.85) 0%,
    rgba(5, 9, 26, 0.5) 60%,
    transparent 100%
  );
  color: var(--paper);
  transform: translateY(20%);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.4s;
}
.gallery-item:hover .gallery-caption {
  transform: translateY(0);
  opacity: 1;
}
.caption-category {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.6rem;
  background: rgba(181, 137, 62, 0.18);
  border: 1px solid rgba(181, 137, 62, 0.3);
  border-radius: 999px;
}
.gallery-caption strong {
  display: block;
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
  text-transform: none;
}
.gallery-caption span:not(.caption-category) {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: rgba(245, 241, 232, 0.7);
  text-transform: uppercase;
}

/* Empty state */
.gallery-empty {
  grid-column: 1 / -1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 6rem 2rem;
  text-align: center;
  color: var(--muted);
}
.gallery-empty.show {
  display: flex;
}
.empty-mark {
  font-size: 2rem;
  color: var(--rust);
  opacity: 0.5;
}
.gallery-empty p {
  font-family: var(--f-display);
  font-size: 1.2rem;
  font-style: italic;
}

/* ============================================
   Lightbox
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(5, 11, 26, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.lightbox.open {
  display: flex;
  opacity: 1;
}
.lightbox-content {
  max-width: min(90vw, 1200px);
  max-height: 85vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: lightboxIn 0.5s var(--ease);
}
@keyframes lightboxIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.lightbox-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 75vh;
  background: linear-gradient(135deg, var(--paper-warm), var(--paper-dim));
  border: 1px solid rgba(245, 241, 232, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.lightbox-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 14px,
      rgba(5, 9, 26, 0.03) 14px,
      rgba(5, 9, 26, 0.03) 15px
    );
}
.lightbox-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.lightbox-caption {
  color: var(--paper);
  text-align: center;
}
.lightbox-caption .caption-category {
  margin-bottom: 0.75rem;
}
.lightbox-caption strong {
  display: block;
  font-family: var(--f-display);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.lightbox-caption span:not(.caption-category) {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245, 241, 232, 0.6);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: transparent;
  border: 1px solid rgba(245, 241, 232, 0.2);
  color: var(--paper);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s;
  z-index: 2;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(245, 241, 232, 0.1);
  border-color: rgba(245, 241, 232, 0.5);
}
.lightbox-close {
  top: 2rem;
  right: 2rem;
}
.lightbox-prev {
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox-next {
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
}
.lightbox-counter {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(245, 241, 232, 0.6);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Bottom CTA
   ============================================ */
.gallery-cta-section {
  padding: 8rem 2.5rem;
  background: var(--navy-950);
  color: var(--paper);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.gallery-cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(181, 137, 62, 0.15), transparent 60%);
}
.gallery-cta-section > * { position: relative; }
.gallery-cta-title {
  font-family: var(--f-display);
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 3rem;
}
.gallery-cta-title .line { display: block; }
.gallery-cta-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--gold-light);
}
.gallery-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 2.5rem;
  border: 1px solid var(--gold-light);
  color: var(--gold-light);
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background 0.3s, color 0.3s;
}
.gallery-cta-btn:hover {
  background: var(--gold-light);
  color: var(--navy-950);
}

/* Active nav link indicator */
.nav-link.active {
  opacity: 1;
}
.nav-link.active::after {
  width: 100%;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery-item[data-size="wide"] {
    grid-column: span 2;
  }
}
@media (max-width: 768px) {
  .gallery-hero { padding: 7rem 1.25rem 3rem; }
  .gallery-hero-meta { flex-direction: column; align-items: flex-start; gap: 1rem; margin-bottom: 2rem; }
  .gallery-hero-title { font-size: clamp(2.2rem, 12vw, 4rem); }
  .gallery-hero-sub { font-size: 0.98rem; }

  .gallery-filter-section {
    padding: 1.25rem 1.25rem;
  }
  .gallery-filters {
    gap: 0.4rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0 -1.25rem;
    padding: 0 1.25rem;
  }
  .gallery-filters::-webkit-scrollbar { display: none; }
  .filter-btn {
    padding: 0.6rem 1rem;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  .gallery-grid-section { padding: 2rem 1.25rem 5rem; }
  .gallery-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 240px;
    gap: 1rem;
  }
  .gallery-item[data-size="wide"],
  .gallery-item[data-size="tall"] {
    grid-column: span 1;
    grid-row: span 1;
  }

  /* On mobile, show caption permanently (no hover) */
  .gallery-caption {
    transform: translateY(0);
    opacity: 1;
  }

  .lightbox { padding: 1rem; }
  .lightbox-close { top: 1rem; right: 1rem; width: 42px; height: 42px; }
  .lightbox-prev { left: 0.5rem; width: 42px; height: 42px; }
  .lightbox-next { right: 0.5rem; width: 42px; height: 42px; }
  .lightbox-caption strong { font-size: 1.2rem; }
  .lightbox-counter { bottom: 1rem; }

  .gallery-cta-section { padding: 5rem 1.25rem; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-auto-rows: 200px; }
  .gallery-caption { padding: 1rem; }
  .gallery-caption strong { font-size: 1rem; }
  .caption-category { font-size: 0.6rem; padding: 0.2rem 0.5rem; }
}
