/* Tyto homepage scroll story: pinned, scroll-scrubbed render sequences (N1, N2, N3, bridge, N4).
   Scoped to .story so its captions never collide with the rest of the site (e.g. .tile-media .cap). */

.story { position: relative; background: var(--scene-bg, var(--surface-brand)); }
.story .scene { position: relative; height: var(--len, 300vh); background: var(--scene-bg, var(--surface-brand)); }
.story .pin { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.story .pin canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* keeps captions readable over the render without boxing them */
.story .scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(29, 30, 33, .78) 0%, rgba(29, 30, 33, .35) 34%, rgba(29, 30, 33, 0) 55%);
  opacity: var(--scrim, 0); transition: opacity .5s var(--ease);
}

/* captions */
.story .cap {
  position: absolute; left: var(--gutter); bottom: clamp(48px, 12vh, 140px);
  max-width: min(480px, 40vw); display: flex; flex-direction: column; gap: 16px;
  opacity: 0; transform: translateY(18px); pointer-events: none;
  transition: opacity .2s linear, transform .2s linear;
}
.story .cap.on { opacity: 1; transform: none; pointer-events: auto; transition: opacity .6s var(--ease) .18s, transform .8s var(--ease) .18s; }
.story .cap .descriptor { color: var(--gold); }
.story .cap h2 { font-weight: 500; font-size: clamp(34px, 4vw, 60px); line-height: 1.05; letter-spacing: -.015em; color: #fff; text-wrap: balance; }
.story .cap h2 .light { font-weight: 300; display: block; }
.story .cap p { font-weight: 300; font-size: clamp(17px, 1.3vw, 20px); line-height: 1.55; color: var(--gray-light); max-width: 26em; }
.story .cap .btn { align-self: flex-start; margin-top: 8px; }

.story .cap-hero { bottom: auto; top: 50%; transform: translateY(calc(-50% + 18px)); max-width: min(620px, 52vw); }
.story .cap-hero.on { transform: translateY(-50%); }
.story .cap-hero h1 { display: flex; flex-direction: column; gap: 4px; }
.story .cap-hero .quiet { font-weight: 300; font-size: clamp(28px, 2.9vw, 44px); line-height: 1.12; color: #fff; }
.story .cap-hero .loud { font-size: clamp(96px, 12vw, 196px); color: var(--gold); margin-left: -.04em; }
.story .cue { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--gray-medium); }
.story .cue svg { width: 14px; height: 14px; animation: story-nudge 1.8s var(--ease) infinite; }
@keyframes story-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* the page is the door edge: a rail that fills head to sill while the story plays */
.story .rail {
  position: fixed; right: clamp(14px, 2vw, 32px); top: 50%; transform: translateY(-50%); z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
  opacity: var(--rail, 0); transition: opacity .4s var(--ease);
}
.story .rail-track { width: 2px; height: min(46vh, 380px); background: rgba(255, 255, 255, .14); position: relative; overflow: hidden; border-radius: 2px; }
.story .rail-fill { position: absolute; inset: 0; background: var(--gold); transform-origin: top; transform: scaleY(var(--p, 0)); }
.story .rail-label { font-size: 10px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--gray-medium); writing-mode: vertical-rl; transform: rotate(180deg); }

/* loading bar per scene */
.story .scene::after {
  content: ""; position: absolute; left: 0; top: 0; height: 2px; width: calc(var(--loaded, 0) * 100%);
  background: var(--gold); opacity: calc(1 - var(--loaded-done, 0)); transition: width .2s, opacity .6s;
}

/* poster frames: inside <noscript>, so they exist (and download) only without JavaScript,
   where the story becomes a plain stack of stills */
.story .poster { display: block; width: 100%; height: auto; }
html:not(.js) .story .scene { height: auto; }
html:not(.js) .story .pin { position: relative; height: auto; min-height: 70vh; }
html:not(.js) .story .cap { position: relative; left: auto; bottom: auto; top: auto; transform: none; opacity: 1; max-width: none; padding: 32px var(--gutter) 56px; }
html:not(.js) .story canvas, html:not(.js) .story .scrim, html:not(.js) .story .rail, html:not(.js) .story .cue { display: none; }

@media (max-width: 900px) {
  .story .scrim { background: linear-gradient(0deg, rgba(29, 30, 33, .9) 0%, rgba(29, 30, 33, .55) 34%, rgba(29, 30, 33, 0) 60%); }
  .story .cap { max-width: none; right: var(--gutter); bottom: 40px; }
  .story .cap-hero { top: auto; bottom: 40px; transform: translateY(18px); max-width: none; }
  .story .cap-hero.on { transform: none; }
  .story .rail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .story .cap, .story .cap-hero { transition: opacity .2s linear; transform: none !important; }
  .story .cue svg { animation: none; }
}

/* first paint: the opening caption appears without its fade (story.js removes this class after load) */
.story-instant .story .cap, .story-instant .scene .cap { transition: none !important; }

/* review option (?scrim=strong): heavier shading behind captions, for scenes where the door face fills the left */
.scrim-strong .story .scrim { background: linear-gradient(90deg, rgba(29, 30, 33, .9) 0%, rgba(29, 30, 33, .62) 38%, rgba(29, 30, 33, 0) 62%); }
@media (max-width: 900px) { .scrim-strong .story .scrim { background: linear-gradient(0deg, rgba(29, 30, 33, .95) 0%, rgba(29, 30, 33, .7) 40%, rgba(29, 30, 33, 0) 66%); } }
