/* ========================================
   Scroll film hero ("From the roof down")
   Default (no JS, or reduced motion): five stacked scenes, each a still
   with its caption. js/film.js adds .is-live and turns it into one pinned
   stage whose picture advances frame by frame with the scroll.
   ======================================== */

.film {
  --film-ink: #fff;
  --film-night: #061f49;
  position: relative;
  padding: 0;
  background: var(--film-night);
  color: var(--film-ink);
}

.film-beats {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Default: stacked scenes ---------- */
.film-beat {
  position: relative;
  display: grid;
  align-items: end;
  min-block-size: min(100svb, 46rem);
  isolation: isolate;
  overflow: clip;
}

.film-still {
  position: absolute;
  inset: 0;
  z-index: -2;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.film-beat::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgb(4 16 40 / 0.9) 0%, rgb(4 16 40 / 0.45) 38%, rgb(4 16 40 / 0.05) 70%),
    linear-gradient(to right, rgb(4 16 40 / 0.55), transparent 60%);
}

.film-cap {
  inline-size: min(100% - 2.5rem, 75rem);
  margin-inline: auto;
  padding-block: 3rem 3.5rem;
}

.film-cap > * {
  max-inline-size: 38rem;
}

.film-step {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  font-family: var(--font-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffc9a3;
}

.film-step::before {
  content: "";
  inline-size: 2.5rem;
  block-size: 1px;
  background: currentColor;
}

.film-title {
  margin: 0;
  color: inherit;
  font-family: var(--font-primary);
  font-size: clamp(2rem, 1.1rem + 3.6vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgb(0 0 0 / 0.45);
}

.film-line {
  margin: 1rem 0 0;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
  line-height: 1.5;
  color: rgb(255 255 255 / 0.9);
  text-wrap: pretty;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.5);
}

.film-seo {
  margin: 0 0 0.75rem;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  color: rgb(255 255 255 / 0.85);
}

.film-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.94);
  color: var(--film-night);
  font-size: 0.875rem;
  font-weight: 600;
}

.film-rating .stars {
  color: #f5a623;
  letter-spacing: 0.05em;
}

.film-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: 1.75rem;
}

.film-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-block-size: 3.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: 999px;
  font-family: var(--font-primary);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: translate 0.2s ease, box-shadow 0.2s ease;
}

.film-btn--call {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0.5rem 1.5rem rgb(184 67 0 / 0.45);
}

.film-btn--wa {
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  border: 1px solid rgb(255 255 255 / 0.55);
  backdrop-filter: blur(6px);
}

.film-btn:hover {
  translate: 0 -2px;
}

.film-btn:focus-visible,
.film-skip:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Pieces that only exist for the live film */
.film-stage,
.film-hud,
.film-skip {
  display: none;
}

/* ---------- Live: one pinned stage, picture scrubbed by scroll ---------- */
.film.is-live .film-stage {
  display: block;
  position: sticky;
  inset-block-start: var(--header-height, 5rem);
  block-size: calc(100svb - var(--header-height, 5rem));
  overflow: clip;
}

.film.is-live .film-canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
}

.film.is-live .film-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgb(4 16 40 / 0.88) 0%, rgb(4 16 40 / 0.35) 40%, rgb(4 16 40 / 0) 68%),
    linear-gradient(to right, rgb(4 16 40 / 0.5), transparent 55%);
  pointer-events: none;
}

.film.is-live .film-beats {
  position: relative;
  margin-block-start: calc(-1 * (100svb - var(--header-height, 5rem)));
}

.film.is-live .film-beat {
  min-block-size: 130svb;
  align-items: start;
  overflow: visible;
  isolation: auto;
}

.film.is-live .film-beat:first-child {
  min-block-size: 100svb;
}

.film.is-live .film-beat:last-child {
  min-block-size: 115svb;
}

.film.is-live .film-beat::after,
.film.is-live .film-still {
  display: none;
}

.film.is-live .film-cap {
  position: sticky;
  inset-block-start: calc(var(--header-height, 5rem) + 26svb);
  padding-block: 0 2rem;
}

.film.is-live .film-beat:first-child .film-cap {
  inset-block-start: calc(var(--header-height, 5rem) + 12svb);
}

/* Each caption fades up as its scene arrives and out as it leaves */
@media (prefers-reduced-motion: no-preference) {
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    .film.is-live .film-beat:not(:first-child) .film-cap {
      animation: film-cap-in linear both, film-cap-out linear both;
      animation-timeline: view(), view();
      animation-range: entry 55% entry 95%, exit 50% exit 90%;
    }

    .film.is-live .film-beat:first-child .film-cap {
      animation: film-cap-out linear both;
      animation-timeline: view();
      animation-range: exit 40% exit 85%;
    }
  }
}

@keyframes film-cap-in {
  from {
    opacity: 0;
    translate: 0 2.5rem;
  }
}

@keyframes film-cap-out {
  to {
    opacity: 0;
    translate: 0 -2rem;
  }
}

/* Progress rail */
.film.is-live .film-hud {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 1.5rem;
  translate: 0 -50%;
  z-index: 2;
  margin: 0;
  padding: 0;
  list-style: none;
}

.film-hud li {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
  font-family: var(--font-primary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.55);
  transition: color 0.3s ease;
}

.film-hud li::after {
  content: "";
  inline-size: 1.25rem;
  block-size: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: inline-size 0.3s ease, background-color 0.3s ease;
}

.film-hud li.is-current {
  color: #fff;
}

.film-hud li.is-current::after {
  inline-size: 2.75rem;
  background: #ff9a55;
}

.film.is-live .film-skip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-end: 1.5rem;
  z-index: 2;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  background: rgb(4 16 40 / 0.55);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(6px);
}

.film-scroll-cue {
  display: none;
}

.film.is-live .film-scroll-cue {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-block-start: 2rem;
  font-family: var(--font-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.8);
}

.film-scroll-cue::before {
  content: "";
  inline-size: 1.5rem;
  block-size: 2.25rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 28%, currentColor 0.1875rem, transparent 0.21875rem);
}

/* ---------- Phones ---------- */
@media (max-width: 47.9375em) {
  .film-hud li span {
    display: none;
  }

  .film.is-live .film-hud {
    inset-inline-end: 0.75rem;
  }

  .film.is-live .film-cap {
    inset-block-start: auto;
    inset-block-end: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    padding-block-end: 0;
  }

  .film.is-live .film-beat {
    align-items: end;
  }

  .film.is-live .film-beat:first-child .film-cap {
    inset-block-start: auto;
  }

  .film.is-live .film-skip {
    inset-inline-end: 0.75rem;
  }

  .film.is-live .film-hud {
    display: none;
  }

  .film-btn {
    flex: 1 1 100%;
  }

  .film-cap {
    padding-block-end: 5.5rem;
  }
}
