/* =========================================================
   Gallery page — 3-column grid of vertical rectangles.
   Cells fade in one-by-one left-to-right, top-to-bottom as
   the user scrolls through the section.
   Builds on tokens from ../index.css and page.css.
   ========================================================= */

/* ---- Page intro overrides (tighten the cream hero) ---- */
.gal-intro {
  padding-top: 96px;
  padding-bottom: 40px;
}

/* =========================================================
   GALLERY — cream canvas
   ========================================================= */
.snake-gallery {
  position: relative;
  z-index: 2;
  background: var(--cream);
  padding: 36px 28px 64px;
  border-radius: 0 0 44px 44px;
  box-shadow: 0 60px 80px -50px rgba(0, 0, 0, 0.5);
}

.snake-gallery__inner {
  max-width: 1320px;
  margin: 0 auto 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* Rows auto-size from each cell's aspect-ratio. */
  grid-auto-rows: auto;
  /* Partial small gaps — visible but tight, like a board's seams */
  column-gap: 12px;
  row-gap: 16px;
}

.snake-gallery__inner:last-of-type {
  margin-bottom: 0;
}

/* ---- Section labels — Estate / Photo Shoots & Film / Ceremonies &
   Events. Plain text markers, not part of the reveal system (only
   .snake-cell is watched by gallery.js). ---- */
.snake-gallery__section-title {
  max-width: 1320px;
  margin: 0 auto 28px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

.snake-gallery__section-title:not(:first-child) {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}

/* =========================================================
   CELL — vertical rectangle with reveal state
   ========================================================= */
.snake-cell {
  position: relative;
  margin: 0;
  overflow: hidden;
  /* Skip layout/paint work for offscreen cells — big win once the
     grid holds 20+ full-size photos. aspect-ratio keeps the box
     sized correctly while contents are unrendered. */
  content-visibility: auto;
  background: #1a1a16;
  border-radius: 16px;
  /* Vertical rectangle — bigger now that we're at 3 cols */
  aspect-ratio: 3 / 4;

  /* Initial state — JS toggles .is-visible based on scroll position.
     Cells rise in slightly out of focus and resolve sharp, like a
     photograph settling into a print. */
  opacity: 0;
  transform: translateY(28px) scale(0.94);
  filter: blur(14px);
  transition:
    opacity 0.5s var(--ease),
    transform 0.6s var(--ease),
    filter 0.7s var(--ease),
    box-shadow 0.6s var(--ease);
  will-change: transform, opacity, filter;
}

.snake-cell.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .snake-cell {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

.snake-cell:hover {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  z-index: 4;
}

.snake-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition: transform 0.8s var(--ease);
  will-change: transform;
}

.snake-cell:hover img {
  transform: scale(1.10);
}

/* =========================================================
   CLOSING LINE
   ========================================================= */
.snake-closing {
  margin: 56px auto 0;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(13px, 1.4vw, 18px);
  letter-spacing: 0.01em;
  color: rgba(28, 29, 26, 0.3);
}

.snake-closing__mark {
  font-style: normal;
  font-size: 16px;
  color: rgba(28, 29, 26, 0.18);
  flex-shrink: 0;
}

/* =========================================================
   RESPONSIVE — tablet (≤1024px): keep 3 cols, tighten gaps
   ========================================================= */
@media (max-width: 1024px) {
  .snake-gallery {
    padding: 28px 20px 88px;
  }

  .snake-gallery__inner {
    column-gap: 10px;
    row-gap: 12px;
  }
}

/* =========================================================
   RESPONSIVE — mobile (≤720px): 2-column grid
   ========================================================= */
@media (max-width: 720px) {
  .snake-gallery {
    padding: 22px 14px 72px;
    border-radius: 0 0 28px 28px;
  }

  .snake-gallery__inner {
    grid-template-columns: repeat(2, 1fr);
    column-gap: 8px;
    row-gap: 10px;
  }

  .snake-cell {
    border-radius: 12px;
  }

  .snake-closing {
    margin-top: 36px;
    font-size: 12px;
  }
}
