/* The clip player (src/clips.mjs writes the markup, web/js/clips.js runs it).
   Without scripts a clip is a plain video over its cover, with the browser's controls, its key points and its
   transcript. With scripts the cover carries the clip's title and one Play button, and nothing but the cover has
   loaded until that button is pressed. The stage is 16:9 from the first paint, so nothing moves when it loads.
   The film itself is always dark, in both themes; the sheet beside it is paper in light and raised deep teal in dark. */

.cps { display: grid; gap: clamp(28px, 4vw, 44px) clamp(20px, 2.4vw, 32px); }
.cps--many { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.hsec__head + .cps { margin-top: clamp(24px, 3vw, 40px); }

.cp { margin: 0; min-width: 0; container: cp / inline-size; --cp-lap-b: 18px; --cp-lap-r: 0px; --cp-night: #0b1a22; --cp-teal: 16 57 71; --cp-gold: #f6ba6d; --cp-ease: cubic-bezier(0.23, 1, 0.32, 1); }
.cp__in { display: grid; grid-template-columns: minmax(0, 1fr); }

/* ---- the stage ---- */
.cp__stage { position: relative; container: cpstage / inline-size; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate; border-radius: var(--r-lg, 20px); background: var(--cp-night); box-shadow: var(--e3); }
.cp__img, .cp__video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.cp__video { background: transparent; }
.cp__stage:fullscreen { --cp-lap-b: 0px; --cp-lap-r: 0px; border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; background: #000; }
.cp__stage:fullscreen .cp__video { object-fit: contain; }

/* With scripts: the film waits behind a closed door, and the cover stands in front. */
.cp--js .cp__video { clip-path: inset(0 50% 0 50%); transition: clip-path 900ms var(--cp-ease); cursor: pointer; }
.cp--js.cp--open .cp__video { clip-path: inset(0); }
.cp--js .cp__img { translate: var(--cp-shift, 0%) 0; }
.cp--js.cp--open .cp__img { visibility: hidden; transition: visibility 0s 900ms; }

.cp__cover { position: absolute; inset: 0; z-index: 2; display: grid; align-content: center; justify-items: start; gap: 0.9em; padding: 0 5%; color: #fff; cursor: pointer; font-size: clamp(11px, 2.1cqw, 20px);
  /* Solid as far as a still that slides right (--cp-shift), so its edge never shows; then it clears to his face. */
  background: linear-gradient(90deg, rgb(var(--cp-teal)) 0, rgb(var(--cp-teal)) var(--cp-shift, 0%), rgb(var(--cp-teal) / 0.86) calc(30% + var(--cp-shift, 0%) / 2), rgb(var(--cp-teal) / 0) calc(62% + var(--cp-shift, 0%) / 2)); }
.cp--open .cp__cover { visibility: hidden; opacity: 0; transition: opacity 300ms linear, visibility 0s 300ms; }
.cp__h { margin: 0; width: 46%; font: 700 clamp(17px, 4.3cqw, 46px)/1.08 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; color: #fff; }
.cp__h span { display: block; font-weight: 300; }
.cp__go.btn { min-height: 44px; padding: 10px 18px 10px 14px; font-size: clamp(14px, 1.9cqw, 16px); }
.cp__go::before { content: ""; border-left: 0.8em solid currentColor; border-block: 0.5em solid transparent; }
.cp__fail { margin: 0; width: 46%; font: 500 0.95em/1.4 var(--font-text); color: #fff; }

/* His name, for the first seconds. */
.cp__nl { position: absolute; left: 4%; top: 6%; z-index: 3; display: grid; gap: 2px; padding: 0.6em 0.9em 0.65em; border-radius: var(--r-sm, 8px); background: rgb(255 255 255 / 0.97); color: #103947; box-shadow: 0 6px 18px rgb(6 24 30 / 0.3);
  border-top: 2px solid var(--cp-gold); font: 600 clamp(10px, 1.9cqw, 16px)/1.25 var(--font-display); opacity: 0; translate: -10px 0; transition: opacity 400ms ease-out, translate 600ms var(--cp-ease); pointer-events: none; }
.cp__nl small { font: 500 0.82em/1.3 var(--font-text); color: #4a565b; }
.cp__nl.is-on { opacity: 1; translate: 0 0; }

/* Captions, drawn by the page from the clip's captions file. */
.cp__cc { position: absolute; left: 0; right: var(--cp-lap-r); bottom: calc(11% + var(--cp-lap-b)); z-index: 3; display: flex; justify-content: center; padding: 0 5%; pointer-events: none; transition: translate 200ms ease-out; }
.cp--ui .cp__cc, .cp__stage:focus-within .cp__cc { translate: 0 -34px; }
.cp__cc p { margin: 0; padding: 0.4em 0.75em 0.45em; border-radius: var(--r-sm, 8px); background: rgb(var(--cp-teal) / 0.94); color: #fff; box-shadow: 0 6px 18px rgb(6 24 30 / 0.35);
  font: 600 clamp(13px, 3.2cqw, 28px)/1.25 var(--font-display); letter-spacing: -0.01em; text-align: center; text-wrap: balance; }
.cp__cc p:empty, .cp--nocc .cp__cc, .cp--ended .cp__cc { display: none; }
.cp__cc .is-now { color: var(--cp-gold); }

/* The controls. */
.cp__bar { position: absolute; left: 0; right: 0; bottom: var(--cp-lap-b); z-index: 4; display: none; align-items: center; gap: 2px; padding: 18px calc(6px + var(--cp-lap-r)) 10px 6px; background: linear-gradient(0deg, rgb(11 26 34 / 0.88), rgb(11 26 34 / 0)); opacity: 0; transition: opacity 200ms linear; }
.cp--open .cp__bar { display: flex; }
.cp--ui .cp__bar, .cp__stage:focus-within .cp__bar { opacity: 1; }
.cp__bar button { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-pill, 999px); background: none; color: #fff; display: grid; place-items: center; cursor: pointer; }
.cp__bar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cp__bar svg + svg { display: none; }
.cp__bar [aria-pressed="true"] svg:first-child, .cp--playing .cp__play svg:first-child { display: none; }
.cp__bar [aria-pressed="true"] svg + svg, .cp--playing .cp__play svg + svg { display: block; }
.cp__time { padding: 0 8px; color: #fff; font: 500 0.8125rem/1 var(--font-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp__gap { flex: 1; }
@media (hover: hover) { .cp__bar button:hover { background: rgb(255 255 255 / 0.16); } }
.cp__stage :is(button, a, [role="slider"]):focus-visible { outline: 3px solid var(--cp-gold); outline-offset: 2px; box-shadow: 0 0 0 5px rgb(11 26 34 / 0.85); }

/* The line: where the clip is, with a tick at each key point. */
.cp__line { position: absolute; left: 0; right: var(--cp-lap-r); bottom: var(--cp-lap-b); height: 16px; z-index: 5; display: none; cursor: pointer; touch-action: none; }
.cp--open .cp__line { display: block; }
.cp__line::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgb(255 255 255 / 0.3); }
.cp__line i { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--cp-gold); }
.cp__line b { position: absolute; bottom: 0; width: 2px; height: 8px; background: #fff; opacity: 0.9; }
.cp__line:focus-visible { outline-offset: -3px; }

/* The end card: one action. */
.cp__end { position: absolute; inset: 0; z-index: 6; display: grid; align-content: center; justify-items: start; gap: 0.8em; padding: 0 7%; background: rgb(var(--cp-teal)); color: #fff; font-size: clamp(11px, 2.1cqw, 20px);
  clip-path: inset(0 50% 0 50%); visibility: hidden; transition: clip-path 900ms var(--cp-ease), visibility 0s 900ms; }
.cp--ended .cp__end { clip-path: inset(0); visibility: visible; transition: clip-path 900ms var(--cp-ease); }
.cp__end p { margin: 0; font: 600 clamp(15px, 3.4cqw, 32px)/1.15 var(--font-display); letter-spacing: -0.02em; color: #fff; }
.cp__end p span { display: block; font: 400 clamp(12px, 1.9cqw, 17px)/1.4 var(--font-text); letter-spacing: 0; color: #dfe8eb; margin-top: 0.35em; }
.cp__btns { display: flex; flex-wrap: wrap; gap: 0.6em; }
.cp__end .btn { min-height: 44px; padding: 10px 18px; font-size: clamp(13px, 1.9cqw, 16px); }
.cp__again.btn { background: none; color: #fff; border-color: rgb(255 255 255 / 0.7); }

/* ---- the sheet: title, key points, transcript ---- */
.cp__sheet { position: relative; z-index: 2; display: grid; gap: 12px; align-content: start; margin: -18px 12px 0; padding: 20px 20px 16px; border: 1px solid var(--border); border-top: 3px solid var(--gold-mid); border-radius: var(--r-md, 14px); background: var(--paper); color: var(--ink); box-shadow: var(--e2); }
.cp__title { margin: 0; font: 700 clamp(1.05rem, 5.2cqw, 1.4rem)/1.15 var(--font-display); letter-spacing: -0.015em; color: var(--heading); }
.cp__title span { display: block; font-weight: 400; }
.cp__by { margin: 0; font: 500 var(--fs-sm)/1.4 var(--font-text); color: var(--ink-soft); }
.cp__len::before { content: "\00b7\00a0"; }
.cp__points { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-strong); }
.cp__points li { border-bottom: 1px solid var(--border); }
.cp__points li, .cp__points button { color: var(--ink-soft); font: 500 0.9375rem/1.35 var(--font-text); transition: color 200ms linear; }
.cp__points li:not(:has(button)), .cp__points button { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; min-height: 44px; padding: 11px 0; box-sizing: border-box; }
.cp__points button { width: 100%; margin: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.cp__points i { font: 400 1.0625rem/1.2 var(--font-display); font-style: normal; color: var(--accent-ink); }
.cp__points em { font: 500 0.8125rem/1 var(--font-text); font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.cp__points .is-done, .cp__points .is-now { color: var(--ink); }
.cp__points .is-now { box-shadow: inset 3px 0 0 var(--gold-mid); padding-left: 10px; }
.cp__points .is-done i { position: relative; color: transparent; }
.cp__points .is-done i::after { content: ""; position: absolute; left: 1px; top: 0.3em; width: 14px; height: 7px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); rotate: -45deg; }
@media (hover: hover) { .cp__points button:hover { color: var(--ink); } }
.cp__tx summary { display: inline-block; min-height: 32px; padding: 6px 0; font: 600 var(--fs-sm)/1.3 var(--font-display); color: var(--heading); cursor: pointer; text-decoration: underline; text-decoration-color: var(--gold-mid); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.cp__tx p { margin: 6px 0 4px; font: 400 0.9375rem/1.6 var(--font-text); color: var(--ink-soft); }
.cp__sheet :is(button, summary):focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

/* The sheet laps the film's edge like a slip of paper (--cp-lap-b under it, --cp-lap-r beside it): the controls,
   the line and the captions keep clear of the part it covers. */
/* A clip with room: the sheet sits beside the film. */
@container cp (min-width: 760px) {
  .cp__in { grid-template-columns: minmax(0, 1fr) minmax(280px, 30%); align-items: start; --cp-lap-b: 0px; --cp-lap-r: 28px; }
  .cp__sheet { margin: 28px 0 0 -28px; }
}
/* A small film (a phone, or three side by side): its title is on the sheet right under it, so the cover keeps
   only the Play button, and the still sits where it was shot. */
@container cpstage (max-width: 519px) {
  .cp__cover { align-content: end; padding-bottom: calc(var(--cp-lap-b) + 14px); background: linear-gradient(0deg, rgb(var(--cp-teal) / 0.82) 0, rgb(var(--cp-teal) / 0) 58%); }
  .cp__h { display: none; }
  .cp--js .cp__img { translate: 0 0; }
  .cp__end { padding-bottom: var(--cp-lap-b); }
  .cp__end p span { display: none; }
}

/* ---- dark mode: the deep teal, with a lit rim instead of a shadow ---- */
:root[data-theme="dark"] .cp { --cp-teal: 10 37 45; }
:root[data-theme="dark"] .cp__stage { box-shadow: 0 0 0 1px color-mix(in oklab, #8fd0cd 22%, transparent), var(--e3); }
:root[data-theme="dark"] .cp__sheet { background: #143640; border-color: color-mix(in oklab, #8fd0cd 22%, transparent); border-top-color: var(--gold-1); box-shadow: var(--e2); }
:root[data-theme="dark"] .cp__points { border-top-color: color-mix(in oklab, #8fd0cd 34%, transparent); }
:root[data-theme="dark"] .cp__points li { border-bottom-color: color-mix(in oklab, #8fd0cd 18%, transparent); }
:root[data-theme="dark"] .cp__points .is-now { box-shadow: inset 3px 0 0 var(--gold-1); }
:root[data-theme="dark"] .cp__tx summary { text-decoration-color: var(--gold-1); }
:root[data-theme="dark"] .cp__sheet :is(button, summary):focus-visible { outline-color: var(--gold-1); }

/* ---- no motion: reduced motion, or "Stop animations" in the accessibility panel ---- */
@media (prefers-reduced-motion: reduce) {
  .cp__video, .cp__img, .cp__cover, .cp__nl, .cp__cc, .cp__bar, .cp__end, .cp__points li, .cp__points button { transition: none !important; }
  .cp__nl { translate: 0 0; }
}
.a11y-still .cp__video, .a11y-still .cp__img, .a11y-still .cp__cover, .a11y-still .cp__nl, .a11y-still .cp__cc, .a11y-still .cp__bar, .a11y-still .cp__end { transition: none !important; }
.a11y-still .cp__nl { translate: 0 0; }

/* ---- one clip at a time (src/clips.mjs clipsPicker; Aldo, 16 Nov 2026) ----
   A row of paper tabs, each its cover, title and length, over one player of a calm size. Without scripts the row is
   hidden and the clips stand one under another. */
.cpk { max-width: 920px; }
.hsec__head + .cpk { margin-top: clamp(20px, 2.6vw, 32px); }
.cpk__stage { display: grid; gap: clamp(28px, 4vw, 44px); }
.cpk__tabs { display: none; }
.cpk--js .cpk__tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(min(78%, 250px), 1fr); gap: 12px; margin: 0 -6px 18px; padding: 6px 6px 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.cpk--js .cpk__stage > .cp:not(.is-on) { display: none; }
.cpk__tab { scroll-snap-align: start; display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 64px; padding: 8px 12px 8px 8px; border: 0; border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 1px 1px hsl(var(--shadow-hsl) / 0.1), 0 2px 6px hsl(var(--shadow-hsl) / 0.06), 0 14px 26px -16px hsl(var(--shadow-hsl) / 0.3); transition: box-shadow 160ms ease-out, transform 160ms ease-out; }
.cpk__tab[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--gold-mid), 0 14px 26px -16px hsl(var(--shadow-hsl) / 0.3); }
@media (hover: hover) { .cpk__tab:hover { transform: translateY(-1px); } }
.cpk__tab:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.cpk__thumb { display: block; width: 84px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
.cpk__txt { min-width: 0; }
.cpk__t { display: block; font: 500 0.88rem/1.3 var(--font-display); color: var(--heading); text-wrap: balance; }
.cpk__t b { font-weight: 700; }
.cpk__d { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--ink-soft); }
:root[data-theme="dark"] .cpk__tab { background: linear-gradient(180deg, #17353d, #10282f); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 14px 26px -14px rgb(0 0 0 / 0.6); }
:root[data-theme="dark"] .cpk__tab[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--gold-1), 0 14px 26px -14px rgb(0 0 0 / 0.6); }
:root[data-theme="dark"] .cpk__tab:focus-visible { outline-color: var(--gold-1); }
@media (prefers-reduced-motion: reduce) { .cpk__tab { transition: none; } }
.a11y-still .cpk__tab { transition: none; }

/* ---------------------------------------------------- the watch pages -- */
/* /videos/ and /videos/<file>/ (21 Nov 2026): the player is the page's main content; the other clips as cards under it. */
.cp__more { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px 16px; }
.cp__more .cp__tx { flex: 1 1 auto; min-width: 0; }
.cp__watch { flex: none; margin: 0; padding-top: 6px; font-size: 0.875rem; }
.vw .cp { margin-top: 8px; }
.vw-cards { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.vw-card a { display: grid; gap: 8px; color: inherit; text-decoration: none; }
.vw-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; box-shadow: var(--e1); }
.vw-card__t { font-family: var(--font-head, Montserrat, sans-serif); font-weight: 600; line-height: 1.3; }
.vw-card__t b { font-weight: 700; }
.vw-card__d { font-size: 0.85rem; color: var(--ink-soft); }
.vw-card a:hover .vw-card__t, .vw-card a:focus-visible .vw-card__t { text-decoration: underline; }
.vw-more__cta { margin-top: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
