/*
 * PATCH-6477 — the Films page (/films/, the poster-card hub) and each film's
 * watch page (/films/<slug>), from Cat's layout of 2026-11-08, which the owner
 * approved as drawn (patch-cove:film-watch-layout). Until then this sheet fitted
 * the collection player under the header; the player is the gate's alone now.
 *
 * Colours are the drawing's, which are the site's existing values (Cat: no new
 * colour system), declared once below.
 */

/* PATCH-6700: the inline player's own parts, the Play disc and Try again, one
   definition shared with the home hero. */
@import url("../video-player.css");
/* PATCH-7066 (owner 2026-11-14): the hub's kicker and the space above it are /features', one definition. */
@import url("../page-top.css");

/* The drawing's tokens. --film-page is the one ground every page of the site
   shares (test/page-background.test.mjs). */
:root {
  --film-page: #141413; --film-stage: #1a1a19; --film-text: #ece8e1; --film-text-secondary: #bdb8ae;
  --film-accent: #d97757; --film-accent-text: #f0a98e; --film-border: rgba(255, 253, 247, 0.11);
  --film-font-ui: "Hanken Grotesk", "Hanken Grotesk Fallback", ui-sans-serif, system-ui, sans-serif;
  --film-font-mono: "JetBrains Mono", ui-monospace, monospace;
  /* The names page-top.css's kicker reads. */
  --font-mono: var(--film-font-mono); --accent-text: var(--film-accent-text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--film-page); color: var(--film-text); }

/* PATCH-3827: the hub's column is the header's, so its first line sits under
   the logo: --chrome-width is site-chrome.css's and the 24px is .site-nav's
   side padding. Below 768px the side gutters stay the header's 24px too
   (PATCH-7038, Cat 2026-11-14): at 16px the page started 8px left of its logo. */
main { max-width: var(--chrome-width); margin: 0 auto; padding: 24px 24px 64px; }
/* PATCH-4141: what sits in the column spans it, a watch page's as the hub's (PATCH-6993). */
main > * { max-width: 1132px; }
/* PATCH-7038 (Cat, 2026-11-14): a watch page is one column, the logo's left edge to the player's right edge, so no
   block runs past the player's 1000px. */
.watch-main > * { max-width: 1000px; }

.films-main, .watch-main { color: var(--film-text); font: 16px/1.5 var(--film-font-ui); }
/* PATCH-7273 (Cat's M7): the site's body link, as features.css, blog.css,
   legal.css and getting-started.css draw it: accent text, underlined on hover. */
.films-main a, .watch-main a { color: var(--film-accent-text); text-decoration: none; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.films-main a:hover, .watch-main a:hover { text-decoration: underline; }
.films-main a:focus-visible, .watch-main a:focus-visible, .watch-video:focus-visible { outline: 2px solid var(--film-accent-text); outline-offset: 4px; }

/* ---- The hub: poster cards, three columns from 1024px, two from 768px, one below. */
/* The h1 is page-top.css's, as /features' is (PATCH-7066), and the intro sits its 14px margin under it, as /features' does. */
.films-intro { margin: 0; max-width: 68ch; color: var(--film-text-secondary); }
.film-group { margin-top: 32px; }
.film-group h2 { margin: 0 0 16px; font-size: var(--chrome-h2-size); line-height: 1.3; font-weight: 600; }
.film-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.film-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.films-main .film-card { text-decoration: none; }
/* The poster keeps its own ratio: a film's words are never cropped to fit a uniform thumbnail.
   PATCH-7272 (design review M3): it holds every film card's play glyph and length badge (site-chrome.css's
   .film-play and .film-duration), so its box is the positioned one, and the box carries the frame. */
.film-card-poster { position: relative; display: block; overflow: hidden; margin-bottom: 8px; background: var(--film-stage); border: 1px solid var(--film-border); border-radius: 12px; }
.film-card img { display: block; width: 100%; height: auto; }
.film-card-title { font-size: 20px; line-height: 1.3; font-weight: 600; }
.film-card-meta { color: var(--film-text-secondary); font: 12px/1.5 var(--film-font-mono); }
@media (max-width: 1023px) { .film-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .films-main, .watch-main { padding: 16px 24px 64px; }
  .film-cards { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .film-group { margin-top: 24px; }
}
/* PATCH-7066: the hub starts as far below the header as /features does, at every width (page-top.css),
   so this comes after the phone rule above, whose top it replaces. A watch page keeps its own. */
.films-main { padding-top: var(--page-top); }

/* ---- A watch page: one native player near the top, then its text, then its series (PATCH-7038).
   PATCH-6993 (owner 2026-11-13): its column is the hub's, so every block starts
   under the header's logo as /films/ does; Cat's centred 1000px column (PR #260
   round 1) started 66px inside it at 1440. The player and its caption keep
   Cat's 1000px, on that left edge, so Saul's qualification under it stays
   above the fold at 1440 x 900; at the column's 1132px it fell below. */
.watch-back, .watch-access a, .watch-all a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
/* PATCH-7273 (Cat's B1): "Read the film in text ↓" (.watch-access) is a body
   link, site-chrome.css's accent underlined at rest; these two stay quiet. */
.watch-main .watch-back, .watch-main .watch-all a { color: var(--film-text-secondary); }
.watch-back { text-decoration: none; }
.watch-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px; margin: 4px 0 16px; }
/* PATCH-7272 (design review M1): the film's title is every inner page's h1, site-chrome.css's --chrome-h1-size at 700. */
.watch-heading h1 { margin: 0; font-size: var(--chrome-h1-size); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.watch-meta { margin: 0; color: var(--film-text-secondary); font: 12px/1.5 var(--film-font-mono); }
/* PATCH-6478: a trailer's sound line ("Sound: classical strings, no speech"), on its own line under the title and its length. */
.watch-sound { flex-basis: 100%; margin: -12px 0 0; color: var(--film-text-secondary); font: 12px/1.5 var(--film-font-mono); }
.watch-figure { max-width: 1000px; margin: 0; }
/* PATCH-6700: video-player.css's names for this page's tokens. */
.watch-figure {
  --player-text: var(--film-text); --player-text-secondary: var(--film-text-secondary); --player-accent-text: var(--film-accent-text);
  --player-rail: var(--film-stage); --player-border: var(--film-border); --player-ground: var(--film-page); --player-font: var(--film-font-ui);
  /* PATCH-6964: the bar's; the rest take video-player.css's defaults, the home's token values. */
  --player-accent: var(--film-accent); --player-input: var(--film-stage); --player-mono: var(--film-font-mono);
}
/* Its width and height attributes reserve the asset's own ratio before it loads: 1790/1080 for a film. Contained, never cropped or stretched. */
.watch-video { display: block; width: 100%; height: auto; object-fit: contain; background: var(--film-stage); border: 1px solid var(--film-border); border-radius: 12px; }
.watch-description { margin-top: 12px; color: var(--film-text-secondary); }
.watch-qualification { margin: 0; color: var(--film-text-secondary); font-size: 14px; }
.watch-access { display: flex; flex-wrap: wrap; gap: 0 16px; margin: 0; }
.watch-all { margin: 8px 0 0; }
.watch-text { margin-top: 32px; }
/* PATCH-7038: a 1px rule, 48px under the film in text, ends this film's part of the page; the series, or a
   standalone film's All films, comes after it. */
.watch-series, .watch-main > .watch-all { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--film-border); }
.watch-series h2, .watch-text h2 { margin: 0 0 12px; font-size: var(--chrome-h2-size); line-height: 1.3; font-weight: 600; }
.watch-series-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.watch-series-trailers { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.watch-series-list a { display: flex; align-items: center; gap: 10px; min-height: 48px; height: 100%; padding: 8px 12px; border: 1px solid var(--film-border); border-radius: 8px; font-size: 14px; text-decoration: none; overflow-wrap: anywhere; }
/* The film on screen: aria-current, and not by colour alone: a heavier border and weight. */
.watch-series-list a[aria-current="page"] { border: 2px solid var(--film-accent); padding: 7px 11px; font-weight: 600; color: var(--film-accent-text); background: rgba(217, 119, 87, 0.08); }
.watch-number { color: var(--film-text-secondary); font: 12px/1.5 var(--film-font-mono); }
/* PATCH-7091: a trailer's tile adds its player's line under the title, as the figcaption reads; the number sits
   on the title's line, and the tiles in a row keep one height. */
.watch-series-trailers a { align-items: baseline; }
.watch-series-trailers .watch-number { flex: none; }
.watch-series-description { display: block; margin-top: 4px; color: var(--film-text-secondary); font-size: 14px; font-weight: 400; }
/* Its heading lands below the sticky header, whatever height the header has (PATCH-6051). Its reading width
   stays 68ch on the column's left edge (PATCH-6993). */
.watch-text { max-width: 68ch; scroll-margin-top: calc(var(--chrome-header-h, 58px) + 16px); }
.watch-text p { margin: 0 0 16px; }
.watch-words { margin: 0 0 16px; padding-left: 16px; border-left: 2px solid var(--film-border); color: var(--film-text-secondary); }
.watch-words p { margin: 8px 0; }
@media (max-width: 767px) {
  .watch-heading { display: block; }
  .watch-meta { margin-top: 8px; }
  .watch-sound { margin-top: 0; }
  .watch-text { margin-top: 24px; }
  .watch-series, .watch-main > .watch-all { margin-top: 40px; padding-top: 24px; }
  .watch-series-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .watch-series-trailers { grid-template-columns: minmax(0, 1fr); }
}

/* PATCH-7089 (Saul, PR #329, 2026-11-14; fix round 2): a page with Saul's
   qualification keeps the home hero's rule for a screen too short for the
   player and what follows it (PATCH-6688, marketing/index.html): the player
   narrows, so the whole qualification is still on the first screen. The
   reserve is the header and 17rem, the back link and title above the player
   and the description and qualification under it: a 1440 x 900 or 390 x 844
   screen keeps the full player (Saul's passing numbers), a 1024 x 768,
   1280 x 720 or 1366 x 768 window narrows it. 18rem is the floor, as the
   home's. */
.watch-main:has(> .watch-qualification) > .watch-figure { max-width: min(1000px, max(18rem, calc((100svh - var(--chrome-header-h, 58px) - 17rem) * var(--watch-ratio, 16 / 9)))); }

/* PATCH-6732 (owner 2026-11-11, an iPhone in landscape; Cat's design): on a
   short, wide screen the full-width player was taller than the room under the
   header, so the picture's bottom and its controls were never on screen
   together. There the figure is capped by the screen's height, the header and
   2rem for the gaps, at the film's own ratio (--watch-ratio, set on the figure
   from its width and height by scripts/film-watch.mjs). It stays on the
   column's left edge (PATCH-7038, Cat 2026-11-14): centred, it broke the one
   left edge every other block keeps. The same query as the home hero's.
   PATCH-7089 (Saul, PR #329, 2026-11-14; fix round 2): a page with a
   qualification is laid out there as the home hero is (PATCH-6732, Cat's
   design, consult fb6019f1; Saul cleared it 2026-11-11, consult 5f224fa2).
   The player sits at the left, starting under the header, as wide as the
   screen's height allows (the header and 2.5rem for the gaps), at most 60% of
   the row; beside it and top-aligned, the back link, the title, the
   qualification, the description and the Read link. Round 1's player under
   the title was 277px of an 844px screen, what the owner rejected on the home
   (PATCH-6732). The description is the figure's own figcaption, so the figure
   spans both columns as a subgrid, the picture in the first and the caption in
   the second, as the home's views do (PATCH-6955); the blocks beside it sit
   above the figure's box (z-index), so it never covers the back link. Beside
   a player this size the description does not fit above the qualification,
   so it follows the qualification, whose whole text is on the first screen
   with the title and Play. The DOM order, the words, the 14px and the video's
   aria-describedby are unchanged. The placements below name no qualification:
   they take effect only where .watch-main is a grid. */
@media (min-width: 640px) and (max-height: 500px) {
  .watch-figure { max-width: calc((100svh - var(--chrome-header-h, 58px) - 2rem) * var(--watch-ratio, 16 / 9)); }
  .watch-main:has(> .watch-qualification) { display: grid; grid-template-columns: fit-content(60%) minmax(0, 1fr); grid-template-rows: repeat(7, auto) 1fr; column-gap: 24px; align-items: start; }
  .watch-main:has(> .watch-qualification) > .watch-figure { display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; max-width: none; }
  .watch-main:has(> .watch-qualification) .watch-stage:not(.player-fullscreen) { max-width: calc((100svh - var(--chrome-header-h, 58px) - 2.5rem) * var(--watch-ratio, 16 / 9)); }
  .watch-main:has(> .watch-qualification) .watch-heading { display: contents; }
  /* PATCH-7089 fix round 3 (Saul, 2026-11-14): at 667 x 325, the iPhone SE's
     landscape room under Safari's toolbar, the player is already the home
     hero's 371px, so the title makes the room: at 20px with no top margin,
     Building Patch's 291-character qualification ends at 300 (it ended at 332
     at 24px), and at 323 even if the title wraps to two lines. The films
     without a qualification keep 24px (the shortest query below). */
  .watch-main:has(> .watch-qualification) .watch-heading h1 { margin: 0 0 8px; font-size: 20px; }
  /* PATCH-7272 (the merge-gate review's N1): the page's section headings are
     never larger than its h1, so here they take the h1's 20px. */
  .watch-main:has(> .watch-qualification) :is(.watch-series, .watch-text) h2 { font-size: 20px; }
  .watch-main:has(> .watch-qualification) .watch-meta { margin-top: 12px; }
  .watch-main:has(> .watch-qualification) .watch-sound { margin: 0; }
  /* Where the page is a grid: the picture in the first column from the top, the rest in the second. */
  .watch-main > * { grid-column: 1 / -1; }
  .watch-main > .watch-figure { grid-row: 1 / span 8; }
  .watch-stage { grid-column: 1; grid-row: 1 / -1; align-self: start; }
  .watch-main > .watch-back, .watch-heading > *, .watch-main > .watch-qualification, .watch-description, .watch-main > .watch-access { grid-column: 2; z-index: 1; }
  .watch-main > .watch-back { grid-row: 1; justify-self: start; }
  .watch-heading h1 { grid-row: 2; }
  .watch-main > .watch-qualification { grid-row: 3; }
  .watch-meta { grid-row: 4; }
  .watch-sound { grid-row: 5; }
  .watch-description { grid-row: 6; }
  .watch-main > .watch-access { grid-row: 7; }
}
/* PATCH-7390 (Saul's memo 2026-11-19 §3: the whole qualification local to the
   player before play, especially at 667 x 325, never shrunk, clipped or moved
   into the transcript): the Operations trailer's qualification is 308
   characters, the longest, so in the 224px column beside a 371px player it
   ran to 382 at 667 x 325 and 667 x 375 and to 403 at 640 x 360. On that page
   alone, below 800px wide on the shortest screens, the player takes at most
   44% of the row instead of 60%, so the column beside it is wide enough: the
   title fits on one line and the qualification ends at 296 at 667 x 325 (272px
   player), 275 at 750 x 340 and 319 at 640 x 360 (the one-off measurement in
   the PR). 844 x 390 and wider keep the 60% layout, where it already fits, and
   the other qualified pages are untouched. The words, the 14px and the DOM
   order are unchanged; Saul reviews the placement on the PR. */
@media (min-width: 640px) and (max-width: 799px) and (max-height: 400px) {
  .watch-main:has(.watch-video[poster="../films/video/operations-trailer.jpg"]) { grid-template-columns: fit-content(44%) minmax(0, 1fr); }
}
/* PATCH-7089 fix round 2: the films without a qualification take the same
   layout on the shortest of those screens, the rules above that make it
   repeated for every page. Under their title the capped player still ran past
   the bottom at 640 x 360, 667 x 375 and 844 x 390, its Play with it at the
   first two; beside the title the picture and its Play fit. Taller short
   screens (932 x 430, 1280 x 500) keep the cap above, as they were. With no
   qualification its row has no height. */
@media (min-width: 640px) and (max-height: 400px) {
  .watch-main { display: grid; grid-template-columns: fit-content(60%) minmax(0, 1fr); grid-template-rows: repeat(7, auto) 1fr; column-gap: 24px; align-items: start; }
  .watch-main > .watch-figure { display: grid; grid-template-columns: subgrid; grid-template-rows: subgrid; max-width: none; }
  .watch-stage:not(.player-fullscreen) { max-width: calc((100svh - var(--chrome-header-h, 58px) - 2.5rem) * var(--watch-ratio, 16 / 9)); }
  .watch-heading { display: contents; }
  .watch-heading h1 { margin: 4px 0 8px; font-size: 24px; }
  /* PATCH-7272 (N1): the section headings take the h1's 24px here too. */
  .watch-series h2, .watch-text h2 { font-size: 24px; }
  .watch-meta { margin-top: 12px; }
  .watch-sound { margin: 0; }
}

/* The footer brings its own top margin. */
.films-main + *, .watch-main + * { margin-top: 0; }
