/* ============================================================
   Section 6 · Gallery — "See Barcelona. See It Differently."
   Not a plain slider: a layered "viewfinder" carousel — the active
   frame sits centred and sharp while its neighbours recede either
   side, scaled down, dimmed and softly blurred, so depth itself
   does the work a dozen thumbnails would otherwise do. A slow Ken
   Burns drift on the active frame, an Instagram-style filling
   progress dash per slide and an art-directed caption underneath
   read as a curated photo story rather than a stock gallery widget.
   ============================================================ */

.s6 {
  position: relative;
  overflow: hidden;
  background: var(--ground);
  padding: clamp(2rem, 5vh, 4.5rem) 0 clamp(2.5rem, 6vh, 5rem);
  isolation: isolate;
}

/* ambient depth — family corner-arc device, this time bottom-right
   in a terracotta/ember blend (every other corner is already taken
   by s2/s4/s5) */
.s6::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      circle at 94% 92%,
      transparent 13.6rem,
      color-mix(in srgb, var(--terracotta) 15%, transparent) 13.9rem,
      transparent 14.3rem,
      transparent 19.1rem,
      color-mix(in srgb, var(--ember) 8%, transparent) 19.4rem,
      transparent 19.8rem
    ),
    linear-gradient(
      to bottom,
      var(--ground-deep) 0%,
      var(--ground) 18%,
      var(--ground) 82%,
      var(--ground-deep) 100%
    );
}

.s6-wrap {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--page-x);
}

/* ---------- editorial intro (centred, quiet, before the spectacle) ---------- */
.s6-intro {
  max-width: 42rem;
  margin: 0 auto;
  text-align: center;
}

.s6-intro .eyebrow {
  justify-content: center;
}

.s6-heading {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.9rem, 3.4vw, 3.1rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: 0.6rem;
}

.s6-heading em {
  font-style: italic;
  color: var(--ember);
}

.s6-sub {
  margin: 1rem auto 0;
  max-width: 34rem;
  font-size: clamp(1rem, 0.8vw + 0.7rem, 1.14rem);
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------- carousel ---------- */
.s6-carousel {
  position: relative;
  margin-top: clamp(2.75rem, 6vw, 4.5rem);
}

.s6-track {
  position: relative;
  height: clamp(21rem, 52vw, 34rem);
}

.s6-slide {
  --s6-o: 0;
  --s6-a: 0;
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(56%, 620px);
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--ground-deep);
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.6);
  transform: translateX(calc(var(--s6-o) * 56%))
    scale(max(0.6, calc(1 - var(--s6-a) * 0.16)));
  opacity: max(0, calc(1 - var(--s6-a) * 0.42));
  z-index: calc(10 - var(--s6-a));
  filter: brightness(max(0.55, calc(1 - var(--s6-a) * 0.14)))
    blur(calc(var(--s6-a) * 1.4px));
  transition:
    transform 0.9s var(--ease-luxe),
    opacity 0.9s var(--ease-luxe),
    filter 0.9s var(--ease-luxe);
  cursor: pointer;
  pointer-events: none;
}

.s6-slide[data-active="true"] {
  cursor: default;
  pointer-events: auto;
}

.s6-slide[data-neighbor="true"] {
  pointer-events: auto;
}

.s6-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 12s linear;
}

/* slow Ken Burns drift, only while a slide is centred and settled */
.s6-slide[data-active="true"] img {
  transform: scale(1.16);
}

.s6-frame-tick {
  position: absolute;
  z-index: 2;
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
}

.s6-frame-tick-tl {
  top: calc(50% - clamp(10.5rem, 26vw, 17rem) - 1rem);
  left: calc(50% - min(28%, 310px) - 1rem);
  border-top: 1px solid var(--hairline-ember);
  border-left: 1px solid var(--hairline-ember);
}

.s6-frame-tick-br {
  bottom: calc(50% - clamp(10.5rem, 26vw, 17rem) - 1rem);
  right: calc(50% - min(28%, 310px) - 1rem);
  border-bottom: 1px solid var(--hairline-ember);
  border-right: 1px solid var(--hairline-ember);
}

/* ---------- prev/next arrows ---------- */
.s6-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  color: var(--ink);
  background: color-mix(in srgb, var(--ground-deep) 55%, transparent);
  backdrop-filter: blur(6px);
  transform: translateY(-50%);
  transition:
    border-color 0.35s ease,
    color 0.35s ease,
    transform 0.35s ease;
}

.s6-nav svg {
  width: 1.1rem;
  height: 1.1rem;
}

.s6-nav:hover {
  border-color: var(--ember);
  color: var(--ember);
}

.s6-prev {
  left: clamp(0.5rem, 3vw, 2.5rem);
}

.s6-prev:hover {
  transform: translate(-3px, -50%);
}

.s6-next {
  right: clamp(0.5rem, 3vw, 2.5rem);
}

.s6-next:hover {
  transform: translate(3px, -50%);
}

/* ---------- caption bar ---------- */
.s6-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  max-width: 1280px;
  margin: clamp(1.75rem, 3.5vw, 2.5rem) auto 0;
  padding: 0 var(--page-x);
}

.s6-bar-index {
  font-family: var(--font-display);
  font-weight: 300;
  white-space: nowrap;
}

.s6-bar-index b {
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  color: var(--ember);
  font-weight: 300;
}

.s6-bar-index i {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.s6-caption {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.s6-caption-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.s6-caption-sub {
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ---------- progress dashes (story-bar style) ---------- */
.s6-dashes {
  display: flex;
  gap: 0.5rem;
}

.s6-dash {
  position: relative;
  width: 2.1rem;
  height: 2px;
  background: var(--hairline);
  overflow: hidden;
}

.s6-dash i {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(0);
  background: var(--ember);
}

@keyframes s6-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.s6-dash.is-active.is-filling i {
  animation: s6-fill 5.5s linear forwards;
}

/* ---------- scroll reveal ---------- */
.s6-intro > *,
.s6-carousel {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.s6.is-in .s6-intro > *,
.s6.is-in .s6-carousel {
  opacity: 1;
  transform: none;
}

.s6.is-in .s6-heading {
  transition-delay: 0.05s;
}
.s6.is-in .s6-sub {
  transition-delay: 0.1s;
}
.s6.is-in .s6-carousel {
  transition-delay: 0.18s;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .s6-slide {
    width: min(72%, 560px);
  }

  .s6-slide[data-a="2"],
  .s6-slide[data-a="3"] {
    opacity: 0 !important;
  }

  .s6-nav {
    width: 2.3rem;
    height: 2.3rem;
  }
}

@media (max-width: 640px) {
  .s6-track {
    height: clamp(17rem, 82vw, 22rem);
  }

  .s6-slide {
    width: min(84%, 420px);
  }

  .s6-frame-tick {
    display: none;
  }

  .s6-nav {
    width: 2.1rem;
    height: 2.1rem;
  }

  .s6-prev {
    left: 0.35rem;
  }

  .s6-next {
    right: 0.35rem;
  }

  .s6-bar {
    grid-template-columns: 1fr;
    row-gap: 0.85rem;
    text-align: center;
  }

  .s6-bar-index {
    order: -1;
  }

  .s6-dashes {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .s6-intro > *,
  .s6-carousel,
  .s6-slide,
  .s6-slide img,
  .s6-dash i {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}
