/* ============================================================
   Research films · player chrome + drawing vocabulary
   Colours come from the site tokens (main.css) with fallbacks,
   so a film looks right in both themes and on the preview page.
   ============================================================ */
.film {
  --f-bg: var(--film-bg, #FBF8F1);
  --f-panel: var(--film-panel, #ECE4D4);
  --f-ink: var(--film-ink, #1C1A17);
  --f-muted: var(--film-muted, #6B6558);
  --f-line: var(--film-line, #D9CFBD);
  --f-accent: var(--film-accent, #B4281E);
  --f-accent2: var(--film-accent2, #0B6B5F);
  --f-good: var(--film-good, #0B6B5F);
  --f-warn: var(--film-warn, #E2A21C);
  --f-bad: var(--film-bad, #B4281E);
  --f-c1: var(--film-c1, #0B6B5F);
  --f-c2: var(--film-c2, #C98A12);
  --f-c3: var(--film-c3, #B4281E);
  --f-c4: var(--film-c4, #3F4F9E);
  --f-c5: var(--film-c5, #7a4a8c);
  --f-c6: var(--film-c6, #5d7a2a);
  /* The pictures are laid out for these exact typefaces (several labels are measured),
     so they are fixed here and do NOT follow the page fonts. Keep these families in the
     page's font <link>. The player chrome (caption, buttons, time) follows the page. */
  --f-font: "Anek Latin", "Anek Bangla", "Anek Devanagari", system-ui, sans-serif;
  --f-display: "Newsreader", "Tiro Bangla", "Tiro Devanagari Hindi", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --f-ui: var(--font-sans, "Anek Latin", system-ui, sans-serif);
  --f-ui-mono: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  margin: 0;
  display: block;
  color: var(--f-ink);
  font-family: var(--f-ui);
}
[data-theme="dark"] .film {
  --f-bg: var(--film-bg, #1D1A16);
  --f-panel: var(--film-panel, #1B1814);
  --f-ink: var(--film-ink, #EDE6D8);
  --f-muted: var(--film-muted, #9C9484);
  --f-line: var(--film-line, #35302A);
  --f-accent: var(--film-accent, #F0736A);
  --f-accent2: var(--film-accent2, #55C7B2);
  --f-good: var(--film-good, #55C7B2);
  --f-warn: var(--film-warn, #F2B84B);
  --f-bad: var(--film-bad, #F0736A);
  --f-c1: var(--film-c1, #55C7B2);
  --f-c2: var(--film-c2, #F2B84B);
  --f-c3: var(--film-c3, #F0736A);
  --f-c4: var(--film-c4, #8fa2ff);
  --f-c5: var(--film-c5, #c79be0);
  --f-c6: var(--film-c6, #a9c96a);
}

/* before the script runs (or if it never does) keep the space */
.film:not(.film-ready) { aspect-ratio: 800 / 560; background: var(--f-bg); border-radius: 14px; }

.film-stage {
  position: relative;
  aspect-ratio: 800 / 560;
  background: var(--f-bg);
  border: 1px solid var(--f-line);
  border-radius: 14px;
  overflow: hidden;
}
.film-stage svg { display: block; width: 100%; height: 100%; cursor: pointer; user-select: none; -webkit-user-select: none; }

.film-bigplay {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px 10px 14px; border-radius: 999px; border: 0;
  background: var(--f-ink); color: var(--f-bg);
  font: 600 14px/1 var(--f-ui); letter-spacing: .01em;
  cursor: pointer; box-shadow: 0 6px 24px rgba(0,0,0,.22);
  transition: transform .2s ease, opacity .2s ease;
}
.film-bigplay svg { width: 18px; height: 18px; }
.film-bigplay:hover { transform: translateX(-50%) translateY(-2px); }
.film[data-state="playing"] .film-bigplay,
.film[data-state="paused"] .film-bigplay,
.film[data-state="ended"] .film-bigplay,
.film[data-state="error"] .film-bigplay { opacity: 0; pointer-events: none; }
.film-bigplay[hidden] { display: none; }
.film[data-state="idle"] .film-stage svg { opacity: .9; }

.film-caption {
  display: flex; gap: 12px; align-items: baseline;
  min-height: 3.1em; margin: 14px 2px 8px;
  font: 500 clamp(15px, 1.5vw, 17px)/1.45 var(--f-ui);
  color: var(--f-ink);
}
.film-beat-no {
  flex: none; font: 500 12px/1 var(--f-ui-mono); letter-spacing: .06em;
  color: var(--f-muted); min-width: 2.4em;
}
.film-beat-no:empty { display: none; }

.film-controls { display: flex; align-items: center; gap: 8px; }
.film-btn {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--f-line); background: transparent;
  color: var(--f-ink); cursor: pointer; padding: 0;
  transition: background .15s ease, border-color .15s ease;
}
.film-btn svg { width: 18px; height: 18px; }
.film-btn:hover { background: var(--f-panel); border-color: var(--f-muted); }
.film-btn:focus-visible, .film-bigplay:focus-visible, .film-scrub:focus-visible { outline: 2px solid var(--f-accent2); outline-offset: 2px; }
.film-toggle { background: var(--f-ink); color: var(--f-bg); border-color: var(--f-ink); }
.film-toggle:hover { background: var(--f-ink); opacity: .85; }
.film-time { flex: none; font: 500 12px/1 var(--f-ui-mono); color: var(--f-muted); min-width: 6.4em; text-align: right; font-variant-numeric: tabular-nums; }

.film-track { position: relative; flex: 1 1 auto; height: 36px; display: flex; align-items: center; min-width: 60px; }
.film-scrub {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; margin: 0;
  border-radius: 4px; cursor: pointer;
  background: linear-gradient(to right, var(--f-ink) var(--p, 0%), var(--f-line) var(--p, 0%));
}
.film-scrub::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--f-ink); border: 2px solid var(--f-bg); }
.film-scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--f-ink); border: 2px solid var(--f-bg); }
.film-ticks { position: absolute; left: 7px; right: 7px; top: 50%; height: 0; pointer-events: none; }
.film-ticks i { position: absolute; top: -5px; width: 2px; height: 10px; margin-left: -1px; background: var(--f-bg); opacity: .9; }

.film-steps { margin-top: 10px; font-size: 14px; color: var(--f-muted); }
.film-steps summary { cursor: pointer; width: fit-content; font: 500 12px/1.6 var(--f-mono); letter-spacing: .04em; }
.film-steps ol { margin: 8px 0 0; padding-left: 1.3em; line-height: 1.55; }
.film[data-state="error"] .film-steps { color: var(--f-ink); }
.film[data-state="error"] .film-controls, .film[data-state="error"] .film-caption { display: none; }

@media (max-width: 520px) {
  .film-step { display: none; }
  .film-time { min-width: 0; }
  /* captions can run to three lines on a phone: reserve them so the page
     does not move while a film plays */
  .film-caption { min-height: calc(3 * 1.45em); }
}
/* comfortable tap targets on touch screens */
@media (pointer: coarse), (max-width: 899px) {
  .film-btn { width: 44px; height: 44px; }
  .film-track { height: 44px; }
  .film-steps summary { padding-block: 10px; }
}

/* ── drawing vocabulary used inside the SVG ─────────────── */
.film svg text { font-family: var(--f-font); fill: var(--f-ink); }
.film svg .t-display { font-family: var(--f-display); font-weight: 500; }
.film svg .t-mono { font-family: var(--f-mono); }
.film svg .t-xs { font-size: 20px; }
.film svg .t-sm { font-size: 24px; }
.film svg .t-md { font-size: 30px; font-weight: 600; }
.film svg .t-lg { font-size: 40px; font-weight: 600; }
.film svg .t-xl { font-size: 64px; font-weight: 600; }
.film svg .t-b { font-weight: 700; }
.film svg .t-cond { font-stretch: 85%; }   /* condensed, for labels inside small boxes */
/* phones: the canvas is 800 units wide and is shown 360 to 390px wide, so the two
   small sizes are lifted to read at about 11 to 13px (kept after the sizes above so
   that they win). Labels are placed in canvas units and the five films were laid
   out to hold up to 26 and 28 here: after changing these, re-check every beat of
   every film at 360 and 390px. */
@media (max-width: 520px) {
  .film svg .t-xs { font-size: 25px; }
  .film svg .t-sm { font-size: 27px; }
  /* condensed labels sit in boxes of a fixed width: taller and narrower, same width */
  .film svg .t-xs.t-cond { font-size: 24px; font-stretch: 75%; }
}
.film svg .ta-m { text-anchor: middle; }
.film svg .ta-e { text-anchor: end; }
.film svg .num { font-variant-numeric: tabular-nums; }

.film svg .fi-bg { fill: var(--f-bg); }       .film svg .st-bg { stroke: var(--f-bg); }
.film svg .fi-panel { fill: var(--f-panel); } .film svg .st-panel { stroke: var(--f-panel); }
.film svg .fi-ink { fill: var(--f-ink); }     .film svg .st-ink { stroke: var(--f-ink); }
.film svg .fi-muted { fill: var(--f-muted); } .film svg .st-muted { stroke: var(--f-muted); }
.film svg .fi-line { fill: var(--f-line); }   .film svg .st-line { stroke: var(--f-line); }
.film svg .fi-accent { fill: var(--f-accent); }   .film svg .st-accent { stroke: var(--f-accent); }
.film svg .fi-accent2 { fill: var(--f-accent2); } .film svg .st-accent2 { stroke: var(--f-accent2); }
.film svg .fi-good { fill: var(--f-good); }   .film svg .st-good { stroke: var(--f-good); }
.film svg .fi-warn { fill: var(--f-warn); }   .film svg .st-warn { stroke: var(--f-warn); }
.film svg .fi-bad { fill: var(--f-bad); }     .film svg .st-bad { stroke: var(--f-bad); }
.film svg .fi-c1 { fill: var(--f-c1); } .film svg .st-c1 { stroke: var(--f-c1); }
.film svg .fi-c2 { fill: var(--f-c2); } .film svg .st-c2 { stroke: var(--f-c2); }
.film svg .fi-c3 { fill: var(--f-c3); } .film svg .st-c3 { stroke: var(--f-c3); }
.film svg .fi-c4 { fill: var(--f-c4); } .film svg .st-c4 { stroke: var(--f-c4); }
.film svg .fi-c5 { fill: var(--f-c5); } .film svg .st-c5 { stroke: var(--f-c5); }
.film svg .fi-c6 { fill: var(--f-c6); } .film svg .st-c6 { stroke: var(--f-c6); }
/* role colours: use these so every film speaks the same language */
.film svg .fi-model { fill: var(--f-accent2); } .film svg .st-model { stroke: var(--f-accent2); }  /* the model / machine / LLM judge */
.film svg .fi-human { fill: var(--f-warn); }    .film svg .st-human { stroke: var(--f-warn); }     /* people: annotators, community, users */
.film svg .fi-drift { fill: var(--f-bad); }     .film svg .st-drift { stroke: var(--f-bad); }      /* drift, loss, error, deleted text */
.film svg .fi-none { fill: none; }      .film svg .st-none { stroke: none; }
.film svg .lc-round { stroke-linecap: round; stroke-linejoin: round; }
