/* gallery.css — White Sand Salon /gallery/ ("Instagram Gallery").
 * Masonry via CSS columns; coastal editorial luxury. Scoped under .gallery so
 * it's inert elsewhere (loaded globally from base.js). Consumes tokens.css. */

.gallery {
  --edge: clamp(1.25rem, 5vw, 4rem);
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7.5rem) var(--edge) clamp(4.5rem, 11vw, 9rem);
  color: var(--ink);
  overflow-x: clip;
}
.gallery .rule {
  display: block;
  width: 64px;
  height: 1px;
  margin: 0 auto var(--space-6);
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.gallery [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.gallery [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.gallery-head {
  max-width: 900px;
  margin: 0 auto clamp(3rem, 7vw, 5rem);
  text-align: center;
}
.gallery-head__eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-100);
  font-weight: var(--fw-medium);
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 var(--space-5);
}
.gallery-head__title {
  font-family: var(--serif);
  font-weight: var(--fw-medium);
  font-size: clamp(2.2rem, 6.46vw, 4.68rem);
  line-height: 0.98;
  letter-spacing: -0.022em;
  margin: 0;
  text-wrap: balance;
}
.gallery-head__intro {
  margin: clamp(1.25rem, 3vw, 2rem) auto 0;
  max-width: 52ch;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  line-height: 1.45;
  color: var(--ink-soft);
}
/* Gold hairline under the masthead, echoing the homepage section rhythm. */
.gallery-head::after {
  content: "";
  display: block;
  width: 64px;
  height: 1px;
  margin: clamp(1.75rem, 4vw, 2.75rem) auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* Instagram square grid ------------------------------------------------------
   Was CSS multi-column masonry — WebKit mislays/blanks animated children inside
   column fragmentation (reproduced in Safari: scattered tiles, blank holes).
   Uniform square grid is Safari-proof and reads as a true IG feed. */
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.75rem, 2vw, 1.25rem);
}
.gallery__tile {
  display: block;
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur-slow) var(--ease);
}
.gallery__tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--gold-light);
}
.gallery__tile:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 3px;
}
.gallery__tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(15, 15, 15, 0.08);
  pointer-events: none;
  transition: box-shadow var(--dur-slow) var(--ease);
}
.gallery__tile:hover::before {
  box-shadow: inset 0 0 0 1px var(--gold-light);
}
/* The signature gallery move: muted-warm grade unifies the feed → true colour
   blooms on hover (Move 1). */
.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: var(--img-grade);
  transition: transform var(--dur-slow) var(--ease), filter var(--dur-slow) var(--ease);
}
.gallery__tile:hover .gallery__img {
  transform: scale(1.05);
}
@media (hover: hover) {
  .gallery__tile:hover .gallery__img {
    filter: var(--img-grade-hover);
  }
}

.gallery-cta {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}

@media (min-width: 720px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1040px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .gallery__tile:hover .gallery__img {
    transform: none;
  }
}
.no-js .gallery [data-reveal] {
  opacity: 1;
  transform: none;
}

/* Editorial outro band — entity-rich prose beneath the masonry (AEO guard). */
.gallery-outro {
  max-width: 60rem;
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  padding: 0 var(--edge);
  text-align: center;
}
.gallery-outro__prose {
  font-family: var(--serif);
  font-weight: var(--fw-regular);
  font-size: clamp(1.25rem, 2.8vw, 1.9rem);
  line-height: 1.4;
  color: var(--ink);
  text-wrap: balance;
}
.gallery-outro__prose p { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .gallery-outro [data-reveal] { opacity: 1; transform: none; }
}
