/* ============================================================
   GALLERY PAGE — Collage Hero · Cursor · Lightbox
   ============================================================ */

/* Gallery page: cream-tinted dot (dark bg) — already handled by style.css default */

/* ── Gallery page background (off-black warm dark) ── */
.gallery-page {
  background: #0A0A0B;
}
.gallery-main {
  background: #0A0A0B;
  padding-top: clamp(4rem, 8vw, 8rem);
}
.gallery-cta {
  background: #0A0A0B;
}

/* ── Gallery page: headings left-aligned (override global center) ── */
.gallery-page h1,
.gallery-page h2 {
  text-align: left;
}

/* ══════════════════════════════════════════════════
   GALLERY HERO — faithful dc.html implementation
   4-column grid, rAF parallax, film grain, scrim
══════════════════════════════════════════════════ */
.ghero {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 500px;
  overflow: hidden;
  background: #0A0A0B;
  font-family: var(--font-b), system-ui, sans-serif;
}

/* 4-column equal-height grid */
.ghero__grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr;
  gap: 1px;
  background: #0A0A0B;
}

.ghero__cell {
  position: relative;
  overflow: hidden;
}

/* Each image overflows its cell for parallax room (matches dc.html exactly) */
.ghero__img {
  position: absolute;
  left: -6%; top: -12%;
  width: 112%; height: 124%;
  background-size: cover;
  background-position: center;
  transform-origin: center;
  will-change: transform, opacity;
  opacity: 0;
}

/* Radial gradient (matches dc.html) */
.ghero__radial {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 38%, rgba(0,0,0,0) 36%, rgba(8,8,12,0.5) 100%);
}

/* Linear scrim top+bottom (matches dc.html, opacity driven by JS) */
.ghero__scrim {
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(8,8,12,0.42) 0%,
    rgba(8,8,12,0)    22%,
    rgba(8,8,12,0)    52%,
    rgba(8,8,12,0.72) 100%
  );
  opacity: 0.45;
}

/* Film grain (matches dc.html) */
.ghero__grain {
  position: absolute;
  inset: -10%;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: gheroGrainShift 8s steps(6) infinite;
}
@keyframes gheroGrainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-2%, -2%); }
  100% { transform: translate(0, 0); }
}

/* Text block — bottom-left, matches dc.html positioning */
.ghero__content {
  position: absolute;
  left: clamp(20px, 4.5vw, 72px);
  bottom: clamp(28px, 6vh, 84px);
  right: clamp(20px, 4.5vw, 72px);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  animation: gheroContentIn 0.9s cubic-bezier(0.16,1,0.3,1) 1.6s both;
}
@keyframes gheroContentIn {
  to { opacity: 1; }
}
.ghero__title {
  margin: 0;
  color: #f7f6f3;
  font-family: var(--font-h);
  font-weight: 300;
  font-size: clamp(38px, 7vw, 110px);
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 30px rgba(0,0,0,0.45);
  max-width: 14ch;
}
.ghero__title em { font-style: italic; }
.ghero__sub {
  margin: 18px 0 0;
  color: rgba(247,246,243,0.82);
  font-family: var(--font-b);
  font-weight: 300;
  font-size: clamp(13px, 1.4vw, 19px);
  line-height: 1.5;
  letter-spacing: 0.01em;
  max-width: 46ch;
  text-shadow: 0 1px 16px rgba(0,0,0,0.5);
}

/* Scroll cue — centered bottom (matches dc.html) */
.ghero__cue {
  position: absolute;
  left: 50%; bottom: clamp(20px, 4vh, 40px);
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  animation: gheroContentIn 0.7s ease 2.2s both;
}
.ghero__cue-label {
  color: rgba(247,246,243,0.7);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase;
}
.ghero__cue-line {
  width: 1px; height: 30px;
  background: linear-gradient(180deg, rgba(247,246,243,0.7), rgba(247,246,243,0));
  animation: gheroCueBob 2.2s ease-in-out infinite;
}
@keyframes gheroCueBob {
  0%, 100% { transform: translateY(0);   opacity: 0.35; }
  50%       { transform: translateY(9px); opacity: 1; }
}

/* ══════════════════════════════════════════════════
   GALLERY GRID — all A4 portrait (3:4), 4 columns
   Desktop only: enforce A4
══════════════════════════════════════════════════ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

/* All items: uniform A4 portrait on desktop */
@media (min-width: 769px) {
  .gallery-item {
    aspect-ratio: 3 / 4 !important;  /* A4 portrait on desktop */
  }
  /* Remove any span2 wide-format behaviour */
  .gallery-item--span2 {
    grid-column: span 1 !important;
    aspect-ratio: 3 / 4 !important;
  }
}

/* ── Gallery item — hover + click ── */
.gallery-item {
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.92) translateY(40px);
  transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1),
              transform 0.9s cubic-bezier(0.16,1,0.3,1);
}
.gallery-item.from-left  { transform: scale(0.92) translateX(-50px); }
.gallery-item.from-right { transform: scale(0.92) translateX(50px); }
.gallery-item.visible    { opacity: 1; transform: none; }

.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform 0.7s cubic-bezier(0.16,1,0.3,1),
              filter 0.4s;
}
.gallery-item:hover img {
  transform: scale(1.05) translateY(-3px);
  filter: brightness(1.08);
}
.gallery-item__label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(to top, rgba(13,11,9,0.8) 0%, transparent 100%);
  color: rgba(253,250,246,0.8);
  font-size: 0.7rem; font-weight: 300;
  letter-spacing: 0.14em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.35s;
}
.gallery-item:hover .gallery-item__label { opacity: 1; }

/* delay attributes */
.gallery-item[data-delay="100"] { transition-delay: 0.10s; }
.gallery-item[data-delay="150"] { transition-delay: 0.15s; }
.gallery-item[data-delay="200"] { transition-delay: 0.20s; }
.gallery-item[data-delay="250"] { transition-delay: 0.25s; }
.gallery-item[data-delay="300"] { transition-delay: 0.30s; }
.gallery-item[data-delay="350"] { transition-delay: 0.35s; }
.gallery-item[data-delay="400"] { transition-delay: 0.40s; }
.gallery-item[data-delay="450"] { transition-delay: 0.45s; }

/* ══════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0;
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16,1,0.3,1);
}
.lightbox.open {
  opacity: 1; pointer-events: auto;
}
.lightbox__backdrop {
  position: absolute; inset: 0;
  background: rgba(7, 5, 3, 0.93);
  cursor: none;
}
.lightbox__stage {
  position: relative; z-index: 1;
  max-width: 90vw; max-height: 90svh;
  display: flex; flex-direction: column; align-items: center;
  transform: scale(0.95);
  transition: transform 0.45s cubic-bezier(0.16,1,0.3,1);
}
.lightbox.open .lightbox__stage { transform: scale(1); }
.lightbox__img {
  max-width: 88vw;
  max-height: 82svh;
  width: auto; height: auto;
  object-fit: contain;
  display: block;
}
.lightbox__label {
  margin-top: 1rem;
  font-family: var(--font-b);
  font-size: 0.7rem; font-weight: 300;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(253,250,246,0.5);
}
.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute; z-index: 2;
  background: none; border: none;
  color: rgba(253,250,246,0.7);
  font-size: 1.6rem; line-height: 1;
  transition: color 0.2s, transform 0.2s;
  cursor: none;
  padding: 0.5rem;
}
.lightbox__close { top: 1.5rem; right: 1.5rem; font-size: 1.1rem; }
.lightbox__prev  { left: 1.5rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; }
.lightbox__next  { right: 1.5rem; top: 50%; transform: translateY(-50%); font-size: 2.5rem; }
.lightbox__close:hover { color: var(--cream); transform: rotate(90deg); }
.lightbox__prev:hover  { color: var(--cream); transform: translateY(-50%) translateX(-4px); }
.lightbox__next:hover  { color: var(--cream); transform: translateY(-50%) translateX(4px); }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Tablet ≤760px — 2×2 grid, matches dc.html breakpoint exactly */
@media (max-width: 760px) {
  .gallery-page,
  .gallery-page * { cursor: auto !important; }
  .cursor { display: none; }

  .ghero {
    height: 100svh;
    min-height: 100svh;
  }

  .ghero__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr 1fr;
  }

  .ghero__content {
    left: clamp(16px, 5vw, 32px);
    right: clamp(16px, 5vw, 32px);
    bottom: clamp(20px, 5vh, 60px);
  }
  .ghero__title {
    font-size: clamp(32px, 9vw, 60px);
  }
  .ghero__sub {
    font-size: clamp(12px, 2.5vw, 15px);
  }

  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-item { aspect-ratio: 3/4 !important; }
  .gallery-item--span2 { grid-column: span 1 !important; aspect-ratio: 3/4 !important; }
}

@media (max-width: 480px) {
  .ghero {
    height: 100svh;
    min-height: 100svh;
  }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .ghero__cue { display: none; }
}
