/* ============================================================
   TELEO Capital — homepage only
   1. The film: a pinned, scroll-driven hero that travels through
      Idaho (Sawtooths -> Boise -> Shoshone Falls -> Capitol ->
      foothills sunrise) while the carve-out story plays out.
   2. Selected Work: a pinned reel that scrolls horizontally.
   Without JS (or with reduced motion) both fall back to plain,
   readable stacked layouts — nothing is hidden.
   ============================================================ */

/* ------------------------------------------------------------ 1. FILM */
.film { --fh: max(100vh, 560px); position: relative; background: var(--navy-950); color: var(--ivory); }
@supports (height: 100svh) { .film { --fh: max(100svh, 560px); } }
.film__stage {
  position: relative; height: var(--fh);
  overflow: hidden; isolation: isolate; background: var(--navy-950);
}

/* scenes: stacked full-bleed layers, each fades in over the one below */
.film__scene { position: absolute; inset: 0; z-index: 0; opacity: 0; visibility: hidden; will-change: opacity, transform; }
.film__scene:first-child { opacity: 1; visibility: visible; }
.film__scene img, .film__scene video {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover;
}
.film__scene video { opacity: 0; transition: opacity 0.9s ease; }
.film__scene video.is-ready { opacity: 1; }

/* The grade tells the story: muted and overlooked -> full colour, unlocked. */
.film__scene[data-grade="1"] { filter: saturate(0.32) brightness(0.74) contrast(0.96); }
.film__scene[data-grade="2"] { filter: saturate(0.7) brightness(0.86); }
.film__scene[data-grade="3"] { filter: saturate(0.95) brightness(0.94); }
.film__scene[data-grade="4"] { filter: saturate(1.2) brightness(1.1); }

.film__veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5,14,25,0.55) 0%, rgba(5,14,25,0.18) 46%, rgba(5,14,25,0) 72%),
    linear-gradient(180deg, rgba(5,14,25,0.42) 0%, rgba(5,14,25,0.06) 18%, rgba(5,14,25,0.12) 40%, rgba(5,12,22,0.52) 66%, rgba(5,12,22,0.9) 100%);
}

/* text panels */
.film__panel { position: relative; z-index: 2; }
.film__panel--hero {
  position: absolute; inset: 0; display: flex; align-items: flex-end;
  padding-bottom: clamp(4.5rem, 12vh, 8.5rem);
}
.film__panel--hero .wrap, .film__panel .wrap { width: 100%; }
.film .eyebrow { color: #fff; text-shadow: 0 0 2px rgba(5,14,25,0.95), 0 1px 3px rgba(5,14,25,0.9), 0 2px 18px rgba(5,14,25,0.6); }
.film .eyebrow b { color: var(--gold-soft); font-weight: 600; }
.film .display { max-width: 26ch; margin-top: 1.4rem; text-shadow: 0 2px 6px rgba(5,14,25,0.6), 0 4px 34px rgba(5,14,25,0.5); }
.film__intro { margin-top: 1.6rem; max-width: 54ch; font-size: var(--fs-lede); color: #fff; line-height: 1.5; text-shadow: 0 1px 4px rgba(5,14,25,0.8), 0 2px 22px rgba(5,14,25,0.55); }
.film__actions { margin-top: 2.2rem; }
.film__line {
  margin-top: 1.3rem; max-width: 24ch;
  font-family: var(--title); font-weight: 600;
  font-size: clamp(1.9rem, 3.5vw, 3.2rem); line-height: 1.08; letter-spacing: -0.005em;
  text-shadow: 0 2px 6px rgba(5,14,25,0.65), 0 4px 34px rgba(5,14,25,0.55);
}
.film__panel--final .display { max-width: 12ch; }
/* White button on the final scene: the orange outline disappeared into the sunset. */
.film__panel--final .btn {
  border: 1px solid #fff; color: #fff; background: rgba(5,14,25,0.28);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.film__panel--final .btn:hover { background: #fff; color: var(--navy-900); border-color: #fff; box-shadow: var(--shadow-2); }

/* static (no-JS / reduced-motion) layout of the steps */
.film__steps { background: var(--navy-950); padding-block: clamp(3.5rem, 8vw, 6rem); }
.film__steps .wrap { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
.film__rail, .film__foot { display: none; }

/* ---- live (pinned, scroll-driven) mode: JS adds .is-live ---- */
.film.is-live { height: 560vh; }
.film.is-live .film__stage { position: sticky; top: 0; }
.film.is-live .film__steps {
  position: sticky; top: 0; z-index: 3;
  height: var(--fh); margin-top: calc(-1 * var(--fh));
  padding: 0; background: none; pointer-events: none;
}
.film.is-live .film__steps .wrap { display: block; position: relative; height: 100%; }
.film.is-live .film__panel[data-panel] { will-change: opacity, transform, filter; }
.film.is-live .film__steps .film__panel {
  position: absolute; left: var(--gutter); right: var(--gutter);
  bottom: clamp(4.5rem, 13vh, 9rem);
  opacity: 0; visibility: hidden;
}
.film.is-live .film__steps .film__panel--final { top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; }
.film.is-live .film__panel a { pointer-events: auto; }

/* chapter rail (right edge) */
.film.is-live .film__rail {
  position: absolute; z-index: 4; right: clamp(1.25rem, 2.4vw, 2rem); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.7rem; text-align: right;
  font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.film__rail li { display: flex; align-items: center; justify-content: flex-end; gap: 0.7rem; color: rgba(244,239,230,0.55); transition: color 0.5s var(--ease); }
.film__rail li i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; transition: background 0.5s var(--ease), transform 0.5s var(--ease); }
.film__rail li.is-on { color: #fff; text-shadow: 0 1px 8px rgba(5,14,25,0.8); }
.film__rail li.is-on i { background: var(--gold); transform: scale(1.5); }

/* skip link */
.film.is-live .film__foot {
  position: absolute; z-index: 4; right: clamp(1.25rem, 2.4vw, 2rem); bottom: 1.6rem;
  display: flex; align-items: center; gap: 1.4rem;
  font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ice);
}
.film__foot a { border-bottom: 1px solid transparent; transition: color 0.3s, border-color 0.3s; }
.film__foot a:hover { color: #fff; border-color: currentColor; }
.film__foot span { display: inline-flex; align-items: center; gap: 0.6rem; }
.film__foot span::after {
  content: ""; width: 9px; height: 9px; border-right: 2px solid var(--ice); border-bottom: 2px solid var(--ice);
  transform: rotate(45deg); animation: scrollArrow 1.8s var(--ease) infinite;
}
@media (max-width: 1024px) { .film.is-live .film__rail { display: none; } }
@media (max-width: 620px) {
  .film.is-live .film__foot span { display: none; }
  .film__veil { background: linear-gradient(180deg, rgba(5,14,25,0.45) 0%, rgba(5,14,25,0.1) 20%, rgba(5,12,22,0.55) 55%, rgba(5,12,22,0.94) 100%); }
}

/* ------------------------------------------------------------ 2. SELECTED WORK REEL */
.reel { position: relative; }
.reel__stage { padding-block: clamp(4rem, 9vw, 8rem) 0; }
.reel__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; }
.reel__head .h2 { margin-top: 0.4rem; }
.reel__count { display: none; align-items: center; gap: 1rem; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.14em; color: var(--ink-soft); }
.reel__bar { position: relative; width: 6rem; height: 1px; background: var(--line-dark); }
.reel__bar i { position: absolute; inset: 0; background: var(--gold); transform-origin: left center; transform: scaleX(0); }
.reel__viewport { margin-top: clamp(1.8rem, 4vw, 2.6rem); }
.reel__track {
  display: flex; flex-direction: column; gap: 1.6rem;
  max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter);
}

.reel__card {
  display: grid; grid-template-columns: 1fr 1fr;
  width: 100%; flex: none;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line-dark);
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
}
.reel__card:hover { box-shadow: var(--shadow-2); border-color: rgba(215,87,19,0.55); }
.reel__media { position: relative; min-height: clamp(15rem, 34vh, 24rem); overflow: hidden; background: var(--sand); }
.reel__img { position: absolute; inset: 0; background-size: cover; background-repeat: no-repeat; transition: transform 1.2s var(--ease); }
.reel__card:hover .reel__img { transform: scale(1.04); }
.reel__body { display: flex; flex-direction: column; padding: clamp(1.5rem, 2.6vw, 2.4rem); min-width: 0; }
.reel__card .study__title { font-size: clamp(2.1rem, 3.3vw, 3.1rem); }
.reel__card .study__desc { margin-top: 1rem; }
.reel__card .study__meta { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line-dark); gap: 1rem clamp(1rem, 2vw, 2rem); }
.reel__card .study__cta { margin-top: auto; padding-top: 1.6rem; align-self: flex-start; }
.reel__card:hover .study__cta { gap: 0.85rem; }

/* ---- live (pinned, horizontal) mode: JS adds .is-live ---- */
.reel.is-live .reel__stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  display: flex; flex-direction: column;
  padding-block: calc(var(--nav-h) + 1.25rem) clamp(1.2rem, 3vh, 2rem);   /* clear the header when it slides back in */
}
.reel.is-live .reel__head { flex: none; width: 100%; }
.reel.is-live .reel__count { display: flex; }
.reel.is-live .reel__viewport { flex: 1 1 auto; min-height: 0; margin-top: clamp(1rem, 3vh, 2rem); display: flex; align-items: center; }
.reel.is-live .reel__track {
  flex-direction: row; align-items: stretch; gap: clamp(1.5rem, 2.6vw, 2.5rem);
  width: max-content; max-width: none; margin: 0;
  padding-inline: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
  max-height: 100%;
  will-change: transform;
}
.reel.is-live .reel__card { width: min(72vw, 64rem); }
.reel.is-live .reel__media { min-height: 0; }
@media (max-height: 700px) {
  .reel.is-live .study__desc { font-size: 0.98rem; line-height: 1.5; }
  .reel.is-live .reel__card .study__title { font-size: clamp(1.9rem, 2.8vw, 2.5rem); }
  .reel.is-live .reel__body { padding: 1.3rem 1.6rem; }
}
.reel__after { padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem); }
/* Pinned mode: the link sits at the foot of the pinned stage, so it stays put
   for the whole horizontal scroll and only leaves with the section. */
.reel.is-live .reel__after { flex: none; width: 100%; padding-block: clamp(0.8rem, 2.5vh, 1.6rem) clamp(0.6rem, 2vh, 1.4rem); }

@media (max-width: 820px) {
  .reel__card { grid-template-columns: 1fr; }
  .reel__media { min-height: 0; aspect-ratio: 16 / 10; }
}
