/* ===========================================================
   Section 6 — Gallery
   "The Cascade Rail" — one large stage image at a time, paired
   with a vertical chapter rail (01–08). A gold "water level"
   line rises down the rail as the journey advances, echoing the
   waterfall motif instead of a dot/arrow slider.
   =========================================================== */

.sec6 {
  position: relative;
  background: var(--onyx);
  padding: clamp(20px, 2.5vw, 35px) 0 clamp(25px, 3vw, 42px);
  overflow: hidden;
}

.sec6::before {
  content: "";
  position: absolute;
  top: 8%;
  left: -16%;
  width: min(52vw, 780px);
  height: min(52vw, 780px);
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--gold) 11%, transparent) 0%,
    transparent 68%
  );
  pointer-events: none;
}

.sec6__inner {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(28px, 6vw, 88px);
}

/* ---------------------------------------------------------
   Eyebrow + heading — same rhythm as sections 2, 3 &amp; 4
   --------------------------------------------------------- */
.sec6__eyebrow {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.6vw, 20px);
  margin: 0 0 clamp(26px, 3.4vw, 40px);

  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.9s var(--ease-luxe),
    transform 0.9s var(--ease-luxe);
}

.sec6__eyebrow-index {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.sec6__eyebrow-rule {
  width: 48px;
  height: 1px;
  background: color-mix(in srgb, var(--gold) 45%, transparent);
}

.sec6__eyebrow-label {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivory-dim);
}

.sec6__head {
  max-width: 900px;
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 1.1s var(--ease-luxe) 0.1s,
    transform 1.1s var(--ease-luxe) 0.1s;
}

.sec6__heading {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ivory);
  font-size: clamp(2rem, 4.6vw, 3.6rem);
  line-height: 1.16;
  letter-spacing: 0.015em;
  margin: 0 0 clamp(18px, 2vw, 26px);
}

.sec6__subhead {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ivory-dim);
  font-size: clamp(1rem, 1.25vw, 1.18rem);
  line-height: 1.75;
  margin: 0;
}

.sec6.is-inview .sec6__eyebrow,
.sec6.is-inview .sec6__head {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------
   Carousel shell — stage (image) + rail (chapters)
   --------------------------------------------------------- */
.sec6__carousel {
  display: flex;
  align-items: stretch;
  gap: clamp(22px, 3vw, 44px);
  margin-top: clamp(48px, 6vw, 76px);

  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 1.1s var(--ease-luxe) 0.16s,
    transform 1.1s var(--ease-luxe) 0.16s;
}

.sec6.is-inview .sec6__carousel {
  opacity: 1;
  transform: none;
}

/* ---- stage ---- */
.sec6__stage {
  position: relative;
  flex: 1 1 66%;
  min-width: 0;
  aspect-ratio: 16 / 8.6;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
  background: var(--onyx-soft);
  box-shadow: 0 26px 60px color-mix(in srgb, var(--onyx) 62%, transparent);
}

.sec6__stage-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.sec6__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transform: scale(1.045);
  transition:
    opacity 1s var(--ease-luxe),
    transform 1.6s var(--ease-luxe);
  pointer-events: none;
}

.sec6__slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  z-index: 2;
}

.sec6__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.sec6__stage-scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 58%;
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--onyx) 88%, transparent) 0%,
    transparent 100%
  );
  z-index: 3;
  pointer-events: none;
}

.sec6__stage-caption {
  position: absolute;
  left: clamp(20px, 3vw, 40px);
  right: clamp(20px, 3vw, 40px);
  bottom: clamp(20px, 3vw, 34px);
  z-index: 4;
  pointer-events: none;
}

.sec6__stage-index {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--gold);
  margin-bottom: 6px;
}

.sec6__stage-index-current {
  font-size: 1.3rem;
}

.sec6__stage-index-total {
  font-size: 0.86rem;
  color: var(--ivory-muted);
}

.sec6__stage-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ivory);
  font-size: clamp(1.5rem, 2.6vw, 2.2rem);
  letter-spacing: 0.015em;
  margin: 0 0 6px;
}

.sec6__stage-desc {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ivory-dim);
  font-size: clamp(0.9rem, 1.05vw, 1rem);
  line-height: 1.6;
  max-width: 46ch;
  margin: 0;
}

/* ---- prev / next ---- */
.sec6__nav {
  position: absolute;
  top: clamp(16px, 2vw, 22px);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ivory) 30%, transparent);
  background: color-mix(in srgb, var(--onyx) 55%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ivory);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition:
    border-color 0.3s var(--ease-luxe),
    color 0.3s var(--ease-luxe),
    background 0.3s var(--ease-luxe);
}

.sec6__nav svg {
  width: 16px;
  height: 16px;
}

.sec6__nav--prev {
  right: 68px;
}

.sec6__nav--next {
  right: 18px;
}

.sec6__nav:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: color-mix(in srgb, var(--onyx) 80%, transparent);
}

/* ---------------------------------------------------------
   Rail — the vertical chapter list + rising water-level fill
   --------------------------------------------------------- */
.sec6__rail {
  position: relative;
  flex: 0 0 clamp(230px, 24vw, 320px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-left: clamp(20px, 2.2vw, 28px);
}

.sec6__rail::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: color-mix(in srgb, var(--ivory) 14%, transparent);
}

.sec6__rail-fill {
  position: absolute;
  left: 0;
  top: 2px;
  width: 2px;
  height: var(--fill, 12.5%);
  background: linear-gradient(to bottom, var(--gold-soft), var(--gold));
  box-shadow: 0 0 10px color-mix(in srgb, var(--gold) 60%, transparent);
  transition: height 0.6s var(--ease-luxe);
}

.sec6__rail-fill::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px color-mix(in srgb, var(--gold) 75%, transparent);
  transform: translateX(-50%);
}

.sec6__rail-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: clamp(9px, 1.1vw, 13px) 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--ivory) 10%, transparent);
  text-align: left;
}

.sec6__rail-item:last-child {
  border-bottom: none;
}

.sec6__rail-num {
  min-width: 24px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ivory-muted);
  transition: color 0.35s var(--ease-luxe);
}

.sec6__rail-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  transition:
    color 0.35s var(--ease-luxe),
    transform 0.35s var(--ease-luxe);
}

.sec6__rail-item:hover .sec6__rail-label {
  color: var(--ivory);
}

.sec6__rail-item.is-active .sec6__rail-num {
  color: var(--gold);
}

.sec6__rail-item.is-active .sec6__rail-label {
  color: var(--ivory);
  transform: translateX(4px);
}

/* ---------------------------------------------------------
   Tablet — stack stage above a horizontal chapter strip
   --------------------------------------------------------- */
@media (max-width: 900px) {
  .sec6__carousel {
    flex-direction: column;
  }

  .sec6__stage {
    aspect-ratio: 16 / 10;
  }

  .sec6__rail {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    height: auto;
    gap: 4px;
    padding-left: 0;
    padding-top: clamp(14px, 2vw, 18px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .sec6__rail::-webkit-scrollbar {
    display: none;
  }

  .sec6__rail::before {
    left: 4px;
    right: 4px;
    top: 0;
    bottom: auto;
    width: auto;
    height: 1px;
  }

  .sec6__rail-fill {
    left: 4px;
    top: 0;
    height: 2px;
    width: var(--fill, 12.5%);
  }

  .sec6__rail-fill::after {
    left: auto;
    right: -3px;
    bottom: 50%;
    transform: translateY(50%);
  }

  .sec6__rail-item {
    flex: 0 0 auto;
    width: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 108px;
    padding: clamp(12px, 2vw, 16px) clamp(14px, 2vw, 18px);
    border-bottom: none;
    border-right: 1px solid color-mix(in srgb, var(--ivory) 10%, transparent);
  }

  .sec6__rail-item:last-child {
    border-right: none;
  }

  .sec6__rail-item.is-active .sec6__rail-label {
    transform: none;
  }
}

@media (max-width: 640px) {
  .sec6 {
    padding: clamp(60px, 15vw, 90px) 0 clamp(56px, 13vw, 82px);
  }

  .sec6__heading {
    font-size: clamp(1.8rem, 8vw, 2.4rem);
  }

  .sec6__stage {
    aspect-ratio: 4 / 3.6;
  }

  .sec6__nav {
    width: 36px;
    height: 36px;
  }

  .sec6__nav--prev {
    right: 58px;
  }

  .sec6__nav--next {
    right: 14px;
  }

  .sec6__stage-title {
    font-size: clamp(1.2rem, 6vw, 1.5rem);
  }

  .sec6__stage-desc {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sec6__slide,
  .sec6__rail-fill,
  .sec6__rail-num,
  .sec6__rail-label {
    transition-duration: 0.01ms !important;
  }
}
