/* ============================================================
   story.css — cinematic scroll-driven video story (#story)
   + hero / wheel-hub video polish. Hand-written layer, additive
   on top of the compiled Tailwind build (same pattern as
   journey.css / scroll-effects.css). Prefix: .vs-*
   ============================================================ */

/* sticky enabler: the page wrapper's overflow-x:hidden creates a scroll
   container that defeats position:sticky for the pinned story stage;
   overflow-x:clip clips identically without that side effect */
body > .min-h-screen.overflow-x-hidden { overflow-x: clip; }

/* ---------- section shell ---------- */
.vs-section {
  position: relative;
  background:
    radial-gradient(60% 50% at 78% 12%, oklch(70% 0.17 65 / 0.16), transparent 70%),
    radial-gradient(50% 40% at 12% 85%, oklch(55% 0.13 145 / 0.14), transparent 70%),
    linear-gradient(160deg, oklch(32% 0.06 145), oklch(22% 0.045 145));
  color: oklch(97.5% 0.018 85);
}

.vs-head { padding-top: 6rem; padding-bottom: 1rem; }
@media (min-width: 768px) { .vs-head { padding-top: 8rem; } }

/* scroll runway: N stages x stage-height + one viewport to unpin */
.vs-wrap {
  position: relative;
  height: calc(7 * 88vh + 100vh);
}

.vs-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: clip;
  display: flex;
  align-items: center;
}

.vs-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
@media (min-width: 768px) {
  .vs-stage {
    grid-template-columns: 3.5rem minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 2.5rem;
    padding-inline: 1.5rem;
  }
  /* static fallback hides the rail, so drop its 3.5rem track or the
     frame collapses into it */
  .vs-static .vs-stage {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

/* ---------- progress rail ---------- */
.vs-rail {
  position: relative;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 0.4rem 0;
}
@media (min-width: 768px) { .vs-rail { display: flex; } }

.vs-rail-line {
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: oklch(97.5% 0.018 85 / 0.14);
  border-radius: 999px;
  overflow: hidden;
}
.vs-rail-fill {
  position: absolute;
  inset: 0 0 auto 0;
  height: 0%;
  background: linear-gradient(180deg, oklch(82% 0.16 82), oklch(70% 0.17 65));
  border-radius: 999px;
}

.vs-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid oklch(97.5% 0.018 85 / 0.22);
  background: oklch(22% 0.045 145 / 0.85);
  color: oklch(97.5% 0.018 85 / 0.55);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.35s ease;
}
.vs-dot:hover { border-color: oklch(82% 0.16 82 / 0.6); color: oklch(97.5% 0.018 85); }
.vs-dot.is-active {
  background: linear-gradient(135deg, oklch(82% 0.16 82), oklch(70% 0.17 65));
  border-color: transparent;
  color: oklch(22% 0.02 60);
  transform: scale(1.12);
  box-shadow: 0 6px 20px -6px oklch(70% 0.17 65 / 0.7);
}

/* ---------- media frame ---------- */
.vs-frame-wrap { position: relative; display: flex; justify-content: center; }

.vs-frame {
  position: relative;
  aspect-ratio: 9 / 16;
  height: min(48vh, 30rem);
  max-width: 100%;
  border-radius: 1.8rem;
  overflow: hidden;
  background: oklch(22% 0.02 60);
  box-shadow:
    0 30px 80px -30px oklch(70% 0.17 65 / 0.45),
    0 0 0 1px oklch(97.5% 0.018 85 / 0.12);
  isolation: isolate;
}
@media (min-width: 768px) { .vs-frame { height: min(74vh, 40rem); } }

/* ambient glow behind the frame */
.vs-frame-wrap::before {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: -1;
  background: radial-gradient(50% 50% at 50% 50%, oklch(70% 0.17 65 / 0.28), transparent 70%);
  filter: blur(40px);
  pointer-events: none;
}

.vs-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.65s ease, transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.vs-video.is-active { opacity: 1; transform: scale(1.001); }

/* caption-legibility gradient (also softens the corner watermark) */
.vs-frame::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 26%;
  background: linear-gradient(to top, oklch(22% 0.02 60 / 0.75), transparent);
  pointer-events: none;
}

.vs-chapter {
  position: absolute;
  left: 1.1rem;
  bottom: 1rem;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: oklch(97.5% 0.018 85 / 0.85);
}

/* ---------- copy column ---------- */
.vs-copybox { position: relative; min-height: 16rem; }
@media (max-width: 767.98px) { .vs-copybox { min-height: 13rem; margin-top: 1.1rem; } }

.vs-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transform: translateY(26px);
  visibility: hidden; /* keep hidden chapters out of tab order + AT */
  transition:
    opacity 0.55s ease,
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s 0.55s;
  pointer-events: none;
}
.vs-copy.is-active {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0.12s;
}

.vs-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: oklch(82% 0.16 82);
}
.vs-title {
  margin-top: 0.9rem;
  font-family: "Fraunces", ui-serif, serif;
  font-weight: 500;
  font-size: clamp(1.6rem, 3.6vw, 2.9rem);
  line-height: 1.08;
}
.vs-title em { font-style: italic; color: oklch(82% 0.16 82); }
.vs-text {
  margin-top: 1rem;
  max-width: 34rem;
  font-size: 1rem;
  line-height: 1.7;
  color: oklch(97.5% 0.018 85 / 0.72);
}
.vs-fact {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.4rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid oklch(82% 0.16 82 / 0.35);
  background: oklch(82% 0.16 82 / 0.1);
  font-size: 0.78rem;
  font-weight: 600;
  color: oklch(93% 0.06 85);
  width: fit-content;
}
.vs-fact svg { flex: none; }

.vs-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, oklch(82% 0.16 82), oklch(70% 0.17 65));
  color: oklch(22% 0.02 60);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  width: fit-content;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  box-shadow: 0 14px 35px -14px oklch(70% 0.17 65 / 0.7);
}
.vs-cta:hover { transform: translateY(-2px); box-shadow: 0 20px 45px -14px oklch(70% 0.17 65 / 0.85); }

/* mobile chapter dots (under copy) */
.vs-dots-m {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.8rem;
}
@media (min-width: 768px) { .vs-dots-m { display: none; } }
.vs-dot-m {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: oklch(97.5% 0.018 85 / 0.25);
  transition: all 0.3s ease;
}
.vs-dot-m.is-active {
  width: 1.4rem;
  background: linear-gradient(90deg, oklch(82% 0.16 82), oklch(70% 0.17 65));
}

/* ---------- static fallback (reduced motion / no JS engine) ---------- */
.vs-static .vs-wrap { height: auto; }
.vs-static .vs-pin { position: static; height: auto; overflow: visible; padding: 3rem 0 5rem; }
.vs-static .vs-rail { display: none; }
.vs-static .vs-copybox { min-height: 0; }
.vs-static .vs-copy {
  position: static;
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
  margin-bottom: 2.2rem;
}
.vs-static .vs-video { transition: none; transform: none; }
.vs-static .vs-video.is-active { opacity: 1; }

/* ---------- hero video (swapped in place of hero-pour.jpg) ---------- */
.vs-hero-video {
  will-change: transform;
  background: oklch(22% 0.02 60);
}

/* ---------- motion pause toggle (WCAG 2.2.2) ---------- */
.vs-motion-toggle {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid oklch(22% 0.02 60 / 0.2);
  background: oklch(97.5% 0.018 85 / 0.82);
  color: oklch(22% 0.02 60);
  backdrop-filter: blur(8px);
  cursor: pointer;
  box-shadow: 0 10px 30px -12px oklch(40% 0.05 60 / 0.4);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.vs-motion-toggle:hover {
  transform: scale(1.08);
  border-color: oklch(70% 0.17 65 / 0.6);
}
.vs-motion-toggle .vs-mt-play { display: none; }
.vs-motion-toggle.is-paused .vs-mt-pause { display: none; }
.vs-motion-toggle.is-paused .vs-mt-play { display: block; }

/* ---------- #process "Four honest steps" photo grid (.pr-*) ---------- */
.pr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.pr-tile {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 1.4rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  outline: 1px solid transparent;
  transition: outline-color 0.35s ease, transform 0.35s ease;
}
.pr-tile:hover {
  outline-color: oklch(70% 0.17 65 / 0.55);
  transform: translateY(-3px);
}
.pr-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.pr-tile:hover img { scale: 1.07; }

.pr-cap {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.4rem 0.9rem 0.7rem;
  background: linear-gradient(to top, oklch(22% 0.02 60 / 0.72), transparent);
  color: oklch(97.5% 0.018 85);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.pr-cap span {
  font-family: "Fraunces", ui-serif, serif;
  font-size: 0.85rem;
  color: oklch(82% 0.16 82);
}

/* staggered pop-in once main.js reveals the column */
[data-reveal].animate-reveal .pr-tile {
  animation: pr-pop 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
[data-reveal].animate-reveal .pr-tile:nth-child(2) { animation-delay: 0.12s; }
[data-reveal].animate-reveal .pr-tile:nth-child(3) { animation-delay: 0.24s; }
[data-reveal].animate-reveal .pr-tile:nth-child(4) { animation-delay: 0.36s; }
@keyframes pr-pop {
  from { opacity: 0; transform: translateY(26px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

/* slow, desynced Ken Burns drift (runs for everyone — owner decision;
   ?vsmotion=0 and the pause toggle remain the opt-outs) */
.pr-tile img { animation: pr-ken 16s ease-in-out infinite alternate; }
.pr-tile:nth-child(2) img { animation-delay: -4s; }
.pr-tile:nth-child(3) img { animation-delay: -8s; }
.pr-tile:nth-child(4) img { animation-delay: -12s; }
@keyframes pr-ken {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.12) translate(-2%, 2%); }
}

/* ---------- #gallery caption legibility ---------- */
/* the compiled tiles' scrim (from-charcoal/85 via-charcoal/10) thins out
   too fast for busy/light posters, leaving white captions unreadable —
   replace it with a taller, stronger ramp on every tile */
#gallery .group > .bg-gradient-to-t {
  background: linear-gradient(to top,
    oklch(22% 0.02 60 / 0.94) 0%,
    oklch(22% 0.02 60 / 0.62) 30%,
    oklch(22% 0.02 60 / 0.22) 58%,
    transparent 84%);
  opacity: 0.88;
}
#gallery .group:hover > .bg-gradient-to-t,
#gallery .group:focus-visible > .bg-gradient-to-t { opacity: 1; }

/* grounding shadows so the white captions read on any image */
#gallery .group h3 {
  text-shadow:
    0 1px 2px oklch(22% 0.02 60 / 0.9),
    0 3px 16px oklch(22% 0.02 60 / 0.65);
}
#gallery .group p {
  color: oklch(97.5% 0.018 85 / 0.96);
  text-shadow:
    0 1px 2px oklch(22% 0.02 60 / 0.85),
    0 2px 10px oklch(22% 0.02 60 / 0.55);
}
#gallery .group .text-oil { text-shadow: 0 1px 3px oklch(22% 0.02 60 / 0.9); }

/* ---------- print / tiny screens guard ---------- */
@media (max-height: 480px) {
  .vs-frame { height: 78vh; }
  .vs-copybox { min-height: 10rem; }
}
