/* =====================================================================
   film.css — the click-through packet film.
   Loaded after site.css; adds nothing but this page's furniture.

   Rule this file exists to enforce:
   the moving picture is one surface, and every word lives either
   beneath it in a bordered panel or inside a solid chip that sits on
   top of it. No caption ever floats on bare video.
   ===================================================================== */

.film { padding-top: var(--space-6); }

.film__head { max-width: 60ch; }
.film__title {
  font-size: clamp(2rem, 5.2vw, 3.2rem);
  margin: var(--space-2) 0 var(--space-3);
}
.film__head .lede { max-width: 56ch; }

/* ------------------------------- stage -------------------------------- */
.film__stagewrap {
  margin: var(--space-6) auto 0;
  width: min(100%, 760px);
}

/* Desktop: the film sits BESIDE the copy, not under it. Stacked, the pouch
   fell below the fold on a laptop and the headline left half the page empty.
   The caption stays in the right column, still outside the picture. */
@media (min-width: 920px) {
  .film {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.32fr);
    column-gap: clamp(28px, 5vw, 72px);
    align-items: start;
  }
  .film__head { max-width: 46ch; }
  .film__player { width: 100%; }
  .film__stagewrap { width: 100%; margin-top: 0; }
}

.film__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #14100c;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  isolation: isolate;
}
.film__stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.film__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #14100c;
}

/* the still that stands in for the clip: full-bleed, never a black gap */
.film__frame {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #14100c;
}

/* the only two pieces of type allowed over the picture — both opaque chips */
.film__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  margin: 0;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 246, 221, 0.94);
  border: 1px solid rgba(58, 42, 28, 0.22);
  color: #2a1c10;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 6px 16px -12px rgba(0, 0, 0, 0.8);
}

.film__comfort {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(0);
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(58, 42, 28, 0.28);
  background: rgba(255, 246, 221, 0.97);
  color: #2a1c10;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, 0.85);
  animation: cue-in 220ms ease both;
}
.film__cue[hidden] { display: none; }
.film__cue:hover { background: #fbeab4; }
.film__cue { z-index: 3; }

/* ------------------------------- cover -------------------------------- */
/* Shown the instant the page paints: logo, the film's title, and honest
   progress while the nine clips are pulled into memory behind it. */
.film__cover {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(120% 90% at 50% 12%, #FCF6E2 0%, #F4E2B4 46%, #E3BF77 78%, #C4974A 100%);
  transition: opacity 420ms ease, transform 420ms ease;
}
.film__cover.is-up { opacity: 0; transform: translateY(-8px); }
.film__cover[hidden] { display: none; }
.film__cover-logo {
  width: 58px; height: 58px;
  border-radius: 50%;
  box-shadow: 0 10px 24px -14px rgba(58, 42, 28, 0.9);
}
.film__cover-kicker {
  margin: 6px 0 0;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(58, 42, 28, 0.62);
}
.film__cover-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4.6vw, 2.3rem);
  font-weight: 800;
  line-height: 1.05;
  color: #2a1c10;
}
.film__cover-sub {
  margin: 0;
  max-width: 34ch;
  font-size: 0.86rem;
  color: rgba(42, 28, 16, 0.72);
}
.film__cover-bar {
  width: min(220px, 60%);
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(58, 42, 28, 0.15);
  overflow: hidden;
}
.film__cover-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #352517;
  transition: width 200ms ease;
}
.film__cover-note {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: rgba(58, 42, 28, 0.58);
}
@keyframes cue-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ----------------------------- progress ------------------------------- */
.film__bar {
  margin-top: var(--space-4);
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--tint-strong);
  overflow: hidden;
}
.film__bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 80ms linear;
}
.film__time {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-ink-2);
  letter-spacing: 0.04em;
}

/* ------------------------------ caption ------------------------------- */
/* deliberately a separate panel: cream card on the page background,
   with its own border, radius and padding. Never overlaps the video. */
.film__caption {
  margin-top: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  background: var(--color-cream);
  color: var(--color-ink);
  box-shadow: var(--shadow-soft);
}
.film__kicker {
  margin: 0 0 8px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-ink-2);
}
.film__heading {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 3.4vw, 1.8rem);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 10px;
}
.film__body { margin: 0; max-width: 62ch; color: var(--color-ink); }
.film__meta {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  font-size: 0.82rem;
  color: var(--color-ink-2);
}

/* ------------------------------ controls ------------------------------ */
.film__controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.film__nav { flex: 0 0 auto; }
.film__nav[disabled] { opacity: 0.4; cursor: default; }
.film__dots {
  display: flex;
  flex: 1 1 auto;
  justify-content: center;
  gap: 6px;
}
.film__dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--tint-strong);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}
.film__dots button:hover { background: var(--chip-hover); }
.film__dots button[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.35);
}

.film__hint {
  margin-top: var(--space-3);
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-ink-2);
}

/* ---------------------------- scroll drive ---------------------------- */
/* The track is the scrollbar the film is painted on. It is tall enough to
   give every chapter its own stretch of page; the stage pins to the top of
   the screen and never moves while the track goes by under it. Nine
   chapters × 78vh is roughly seven screens of pour. */
.film__track {
  position: relative;
  height: calc(9 * 78vh);
}
.film__stagewrap {
  position: sticky;
  top: 84px;
  align-self: start;
}
.film__stage { cursor: default; }

/* the caption changes chapter by chapter — keep the card from resizing
   the column as the copy length changes under the reader's eye */
.film__caption { min-height: 15rem; }

.film__hint kbd {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 1px 5px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--tint);
}

@media (max-width: 640px) {
  .film__track { height: calc(9 * 70vh); }
  .film__stagewrap { top: 62px; }
  .film__caption { min-height: 17rem; }
}

/* ------------------------------- legend ------------------------------- */
.film__legendwrap { padding: var(--space-5); }
.film__legendwrap .h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 var(--space-3);
}
.film__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}
.film__legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}
.film__legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(58, 42, 28, 0.18);
}
.film__note { margin-top: var(--space-4); max-width: 66ch; color: var(--color-ink-2); }

/* -------------------------------- small ------------------------------- */
@media (max-width: 640px) {
  .film { padding-top: var(--space-5); }
  .film__stagewrap { width: 100%; margin-top: var(--space-5); }
  .film__caption { padding: var(--space-4); }
  .film__controls { flex-wrap: wrap; }
  .film__dots { order: -1; width: 100%; flex-basis: 100%; margin-bottom: 6px; }
  .film__nav { flex: 1 1 0; }
  .film__badge { top: 10px; left: 10px; font-size: 0.66rem; }
  .film__cue { bottom: 12px; font-size: 0.84rem; padding: 10px 16px; }
}

@media print {
  .film__track, .film__stagewrap, .film__controls, .film__hint { display: none !important; }
  .film__caption { border: 1px solid #999; box-shadow: none; }
}


/* ------------------------- phone: the pouch leads -------------------- */
/* On a phone the picture was a letterbox in the top half of the screen.
   Now the stage takes most of the viewport, the frame is cropped to the
   pouch, and the words that used to live only below it sit on the window. */
@media (max-width: 919px) {
  .film__stage {
    height: min(68vh, 620px);
    aspect-ratio: auto;
  }
}

.film__frame { object-position: center 45%; }

@media (max-width: 919px) {
  .film__frame { object-position: center 50%; }
}

/* what went in, in the clear window */
.film__chip {
  position: absolute;
  left: 50%;
  bottom: 8%;
  z-index: 2;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  background: rgba(255, 246, 221, 0.95);
  border: 1px solid rgba(58, 42, 28, 0.22);
  color: #2a1c10;
  font-family: var(--font-serif);
  font-size: clamp(0.92rem, 2.6vw, 1.1rem);
  font-weight: 700;
  text-transform: lowercase;
  white-space: nowrap;
  box-shadow: 0 10px 24px -16px rgba(0, 0, 0, 0.85);
}

/* the two side buttons */
.film__pop {
  position: absolute;
  top: 52%;
  z-index: 3;
  max-width: 42%;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(58, 42, 28, 0.28);
  background: rgba(255, 246, 221, 0.94);
  color: #2a1c10;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 10px 22px -16px rgba(0, 0, 0, 0.8);
}
.film__pop--left { left: 10px; transform: translateY(-50%); }
.film__pop--right { right: 10px; transform: translateY(-50%); }
.film__pop[aria-expanded="true"] { background: #fbeab4; }

/* the card either button opens */
.film__pop-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  padding: 18px 20px 16px;
  border-radius: var(--radius);
  background: #FFF8E6;
  border: 1px solid rgba(58, 42, 28, 0.25);
  color: #2a1c10;
  box-shadow: 0 22px 44px -26px rgba(0, 0, 0, 0.85);
}
.film__pop-panel[hidden] { display: none; }
.film__pop-title {
  margin: 0 0 6px;
  padding-right: 22px;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 800;
  text-transform: lowercase;
}
.film__pop-body { margin: 0; font-size: 0.86rem; color: #4a3626; }
.film__pop-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2a1c10;
}
.film__pop-close {
  position: absolute;
  top: 4px;
  right: 8px;
  border: 0;
  padding: 4px 6px;
  background: transparent;
  color: #2a1c10;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 640px) {
  .film__pop { font-size: 0.68rem; padding: 6px 10px; max-width: 40%; }
  .film__chip { bottom: 7%; }
}

/* ------------------- what the overlays are for ----------------------- */
/* The frames already carry their own left card ("this pour") and right
   card (source) on a wide screen, so the chip and the two buttons would
   only repeat them there. On a phone the stage crops to the pouch and
   those cards fall outside the frame — that is where the chip and the
   two pop-overs do the work. */
@media (min-width: 920px) {
  .film__chip, .film__pop, .film__pop-panel { display: none; }
}

@media (max-width: 919px) {
  /* centre on the pouch itself, not the baked-in cards beside it */
  .film__frame { object-position: center 50%; }
}
