/* ═══════════════════════════════════════════════════════════════
   PITCH LAYOUTS — shared STRUCTURAL rules for the composition variants
   emitted by app/lib/section-renderer.ts (the COMPOSITIONS table).

   This file owns geometry only: grid tracks, bleeds, stacking, alignment,
   measure. It sets no colour, no font family, no border, no radius, no
   shadow — those belong to each template's own stylesheet, which hangs off
   [data-layout] and [data-variant].

   That division is the whole point. Structure lives once, so a composition
   behaves the same everywhere; skin lives per template, so two templates
   using the same composition still read as different documents.

   Templates retune proportions through the custom properties below rather
   than by overriding the rules.
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   THE SLIDE MODEL

   A page is a FIXED-ASPECT SLIDE sized to fit the viewport, not a section of a
   scrolling document. Everything inside it is measured in container units (cqw /
   cqh), so type, spacing and rules scale with the page rather than the window.

   Why this is the model and not a preference:

   - The source decks are 1920x1080. A laptop browser at full screen lands between
     1.69 and 1.78 (MacBook Air 1440x812 = 1.77; 14" 1512x894 = 1.69). 16:9 is
     simultaneously the decks' native aspect and effectively laptop-fullscreen, so
     a page can be a true 1:1 of its source slide.
   - Viewport-relative sizing (100vh + clamp(px, vw, px)) cannot be 1:1 with
     anything: the same page renders at different proportions on different screens,
     and content-driven growth pushes it past a screen entirely. Every page-height
     bug in this file — modules 1471px tall, ruled grids drifting out of line with
     their header strip — was a symptom of that, not of the compositions.
   - juicy and geometos were already built this way and never had those bugs.

   A template whose source deck is a different shape (noir's 2.35:1) letterboxes
   INSIDE the 16:9 slide, which is how cinemascope is presented anyway — it does
   not change the page.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --pl-aspect-w: 16;
  --pl-aspect-h: 9;

  /* The slide's own width, in VIEWPORT units — this is the one measurement that
     cannot be a container unit, because it is what establishes the container.
     Chrome that lives outside a slide (fixed corner marks) positions against it
     so it lands on the slide's edges rather than the window's. */
  --pl-slide-w: min(calc(100vw - var(--pl-side-chrome)), calc(100vh * var(--pl-aspect-w) / var(--pl-aspect-h)));

  /* Width taken by chrome fixed beside the canvas, not over it. 0 except where a
     shell sets one (ledger's contents rail, below). Without it, ledger's slides
     were a full 100vw wide starting 210px in: body's overflow-x hid each slide's
     right 210px (page number, date, image), and a rail link that scrolled the
     slide into view shifted it sideways under the rail instead. */
  --pl-side-chrome: 0px;

  /* All page geometry is a percentage of the slide's width. 1cqw = 1% of the
     page, so these read as "this fraction of the page" rather than as pixels
     that mean different things on different screens. */
  --pl-margin: 5cqw;      /* page side margin */
  --pl-gap:    2cqw;      /* default gutter */
  --pl-measure: 34ch;     /* narrow copy column */
  --pl-measure-wide: 78ch;/* full-width copy */
  --pl-min-h:  100cqh;    /* one page */
  --pl-frame:  0px;       /* photo frame stroke (templates set it) */
  --pl-radius: 0px;
}

/* ledger: the canvas sits beside a fixed side rail (#pitch-canvas margin-left:
   var(--rail)). Keyed off the shell's own script tag so the shell is untouched;
   phone mode turns the rail into a top bar and print hides it, and both reset
   this to 0 below. */
:root:has(script[data-template="ledger"]) { --pl-side-chrome: var(--rail, 210px); }

/* The slide itself. Sized to fit BOTH viewport dimensions, so on a screen taller
   than 16:9 it letterboxes rather than overflowing. */
#pitch-canvas > [data-pid] {
  width: var(--pl-slide-w);
  aspect-ratio: var(--pl-aspect-w) / var(--pl-aspect-h);
  margin-inline: auto;
  container-type: size;
  overflow: hidden;
  position: relative;

  /* The slide's height comes from its width and its ratio, and from nothing else.
     29 shells still carry the pre-slide `.hero { height: 100vh }` / `.fullbleed {
     min-height: 100vh }` rules, and because a classic section root IS the slide,
     those rules win on specificity and the page silently stops being 16:9 — the
     cover rendered 1440x900 instead of 1440x810. Rather than edit 29 files (and
     miss the next one), the ratio is made non-negotiable here.

     Viewport units are the single recurring cause of page-sizing bugs in this
     project; this is the guard that makes them harmless. */
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}
/* Images must not inherit the 16/9 fallback the render route injects, or they
   fight the slide's own box. */
#pitch-canvas [data-img-key], #pitch-canvas [data-bg-key] { aspect-ratio: auto; }


/* ── Image slot wrapper ─────────────────────────────────────── */
/* Every content image is wrapped so templates have something to decorate: an
   <img> is a replaced element and renders no ::before/::after, so a frame, mount,
   caption bar or sprocket rail has nowhere to attach without this. The wrapper is
   transparent and takes the box the image would have taken. */
.pl-slot { display: block; position: relative; overflow: hidden; min-width: 0; min-height: 0; }
.pl-slot > img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Grid and flex parents size the wrapper, not the image. */
.pl-cluster-imgs > .pl-slot,
.pl-band > .pl-slot,
.pl-framed > .pl-slot,
.pl-atmos-row > .pl-slot,
.pl-module-cells figure > .pl-slot,
.grid4 > .pl-slot { height: 100%; }
/* Placement wrappers size themselves from the page grid, so the slot inside has to
   fill them. Without this the <img> falls back to its intrinsic height and a
   free-placed frame drags past the page — the wrapper is sized, the picture is not. */
.pl-free-a > .pl-slot, .pl-free-b > .pl-slot, .pl-free-c > .pl-slot,
.pl-row-img > .pl-slot,
.pl-crossing-a > .pl-slot, .pl-crossing-b > .pl-slot,
.pl-overlay-a > .pl-slot, .pl-overlay-b > .pl-slot, .pl-overlay-c > .pl-slot,
.pl-stackpage-a > .pl-slot, .pl-stackpage-b > .pl-slot, .pl-stackpage-c > .pl-slot,
.pl-stagger-row > .pl-slot,
.pl-split-img > .pl-slot, .pl-stack > .pl-slot,
.pl-hero-margin-img > .pl-slot, .pl-hero-behind-img > .pl-slot,
.pl-pin-b > .pl-slot, .pl-pin-c > .pl-slot,
.pl-edge-img > .pl-slot, .pl-rail-img > .pl-slot,
.pl-banner-cut > .pl-slot,
.pl-letterbox-img > .pl-slot, .pl-inset-img > .pl-slot, .pl-margin-still > .pl-slot,
.pl-bleed > .pl-slot, .pl-module-fig > .pl-slot, .pl-runon-img > .pl-slot,
.pl-tile-img > .pl-slot, .pl-sandwich-row > .pl-slot, .pl-cellgrid-img > .pl-slot,
.pl-overlap-back > .pl-slot, .pl-overlap-front > .pl-slot { height: 100%; }

/* ── Per-page chrome slots ──────────────────────────────────── */
/* Six anchored positions inside every slide. Empty until a template gives one a
   `content`; anchoring them here means running marks land on the PAGE's edges,
   which is where every reference deck puts them, and they scale with the page
   because they sit inside its container. */
.pl-chrome { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
/* `.pl-page > .bg ~ *` below sets `position: relative` on every sibling after the
   background image, and it outranks the line above — so on any page whose chrome
   follows a .bg the box collapsed to zero height. The marks still landed near the
   right place by accident (a zero-height box flushed to the foot of a column
   flex), but anything measured against the chrome's own box — an inset page
   keyline, for one — got nothing to measure. Re-assert the declared geometry. */
.pl-page > .bg ~ .pl-chrome { position: absolute; inset: 0; }
.pl-chrome > i {
  position: absolute;
  font-style: normal;
  white-space: pre-line;
  display: block;
}
/* No :empty override here. A slot is filled by giving its ::before a `content`,
   and the <i> stays empty when it is — so an :empty rule would defeat the entire
   mechanism it looks like it is guarding. Unfilled slots render nothing anyway. */
.pl-chrome-tl { top: var(--pl-chrome-y, 2cqw); left:  var(--pl-chrome-x, 2cqw); }
.pl-chrome-tr { top: var(--pl-chrome-y, 2cqw); right: var(--pl-chrome-x, 2cqw); text-align: right; }
.pl-chrome-bl { bottom: var(--pl-chrome-y, 2cqw); left:  var(--pl-chrome-x, 2cqw); }
.pl-chrome-br { bottom: var(--pl-chrome-y, 2cqw); right: var(--pl-chrome-x, 2cqw); text-align: right; }
.pl-chrome-tc { top: var(--pl-chrome-y, 2cqw); left: 50%; transform: translateX(-50%); text-align: center; }
.pl-chrome-bc { bottom: var(--pl-chrome-y, 2cqw); left: 50%; transform: translateX(-50%); text-align: center; }

/* The page number is a counter on the canvas, so any slot can render it with
   `content: counter(pgnum)` without the template tracking indices itself. */
#pitch-canvas { counter-reset: pgnum; }
#pitch-canvas > [data-pid] { counter-increment: pgnum; }

.pl-page {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  /* Bleeds are expressed as negative margins INSIDE the section, so clipping at
     the section edge is safe — and necessary, because a template that draws a page
     border needs the parallax-scaled background to stop at it. */
  overflow: hidden;
}

.pl-page img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* A composition's background image sits behind everything else in that section.
   Templates used to each define this in their own `.bg` rule, which meant a
   composition only worked in the templates that happened to have one. */
/* Applies to ANY section, not just the composition variants: the classic switch
   emits `.bg` as a direct child of its own <section>, and templates used to each
   position it themselves. Rewriting a template's stylesheet therefore dropped its
   background image back into normal flow at natural size — vesper's full-bleed
   pages were running 2,000px tall inside an 810px slide because of exactly this. */
#pitch-canvas [data-pid] .bg,
#pitch-canvas [data-pid] .tex-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}
.pl-page > .bg ~ * { position: relative; z-index: 1; }

/* Classic section roots are the slide's own box. */
#pitch-canvas > [data-pid] > section,
.hero, .fullbleed, .section, .section-dark, .tex-section, .ty { position: relative; }
.hero, .fullbleed, .tex-section, .ty {
  height: 100%; display: flex; flex-direction: column; justify-content: center;
  overflow: hidden; box-sizing: border-box;
}

/* ── Page with side margins and stacked blocks ──────────────── */
.pl-margin-page {
  display: flex;
  flex-direction: column;
  gap: 4cqh;
  padding: 7cqh var(--pl-margin);
  height: 100%;
  box-sizing: border-box;
}
/* A margin page that ends in a bleed is a full page, not a stack that grows. */
.pl-margin-page:has(> .pl-bleed[data-bleed="bottom"]),
.pl-margin-page:has(> .pl-band[data-bleed="bottom"]),
.pl-margin-page:has(> .pl-inset-img),
.pl-margin-page:has(> .pl-margin-still) { height: 100%; }
.pl-margin-page[data-align="end"] { justify-content: flex-end; }

.pl-measure { max-width: var(--pl-measure-wide); }
.pl-measure-lead { max-width: 26ch; }

/* ── Rotated margin title (atelier-blanc) ───────────────────── */
/* The rotation happens on an inner element so the outer box still
   participates in normal flow and reserves the column width it needs. */
.pl-rot {
  display: flex;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  align-self: flex-start;
}
.pl-rot[data-align="center"] { align-self: center; }
.pl-rot[data-align="end"]    { align-self: flex-end; }
.pl-rot-inner { display: flex; flex-direction: row-reverse; gap: .12em; }
.pl-rot-line  { display: block; }

/* ── Two-part title lockup (at-hoppers) ─────────────────────── */
.pl-lockup { display: inline-grid; justify-items: start; }
.pl-lockup-lead { display: block; }
/* The lead word overlaps the main word's cap height — the overlap is what
   makes it a lockup rather than two stacked lines. Templates tune the amount. */
.pl-lockup-main { display: block; margin-top: var(--pl-lockup-overlap, -.28em); }

/* ── Splits ─────────────────────────────────────────────────── */
.pl-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  align-items: stretch;
}
.pl-split[data-img="left"]  { grid-template-areas: "img text"; }
.pl-split[data-img="right"] { grid-template-areas: "text img"; }
.pl-split[data-img="left"]  > .pl-split-img,
.pl-split[data-img="right"] > .pl-split-img { grid-area: img; }
.pl-split > .pl-split-text { grid-area: text; }
.pl-split-img { position: relative; overflow: hidden; }
.pl-split-text {
  display: flex; flex-direction: column; justify-content: center;
  gap: var(--pl-gap);
  padding: 6cqh var(--pl-margin);
  box-sizing: border-box;
}

/* A seam sits between the halves. It has no appearance here; templates paint
   it (at-hoppers uses a checkerboard, others a rule or nothing). */
.pl-split[data-seam="on"] { grid-template-columns: 1fr auto 1fr; }
.pl-split[data-seam="on"][data-img="left"]  { grid-template-areas: "img seam text"; }
.pl-split[data-seam="on"][data-img="right"] { grid-template-areas: "text seam img"; }
.pl-seam { grid-area: seam; width: var(--pl-seam-w, 0px); align-self: stretch; }

/* Two stills stacked flush in one half. */
.pl-stack { display: grid; grid-template-rows: 1fr 1fr; overflow: hidden; }

/* ── Free placement on a 12 x 8 page grid (atelier-blanc) ────── */
.pl-free {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  /* minmax(0,1fr) throughout: a bare 1fr row reports its content as the grid's
     max-content height, so one tall image drags the page past a screen. */
  grid-template-rows: repeat(8, minmax(0, 1fr));
  height: 100%;
  padding: 5cqh 0;
  box-sizing: border-box;
  column-gap: var(--pl-gap);
}
/* Deliberately unbalanced: A bleeds left, C bleeds right, B is inset, and the
   copy sits in the hole they leave. */
.pl-free-a    { grid-column: 1 / 6;  grid-row: 1 / 4; margin-left: calc(var(--pl-margin) * -1); }
.pl-free-b    { grid-column: 2 / 6;  grid-row: 5 / 9; }
.pl-free-c    { grid-column: 8 / 13; grid-row: 1 / 8; margin-right: calc(var(--pl-margin) * -1); }
.pl-free .pl-rot { grid-column: 6 / 8; grid-row: 1 / 5; justify-self: center; }
.pl-free-text { grid-column: 6 / 8;  grid-row: 5 / 9; align-self: end; max-width: var(--pl-measure); }

/* ── Bands: images butted together, no gutter, bleeding the page ── */
.pl-band {
  display: grid;
  gap: 0;
  margin-left: calc(var(--pl-margin) * -1);
  margin-right: calc(var(--pl-margin) * -1);
  aspect-ratio: var(--pl-band-ratio, 32 / 9);
}
/* Unequal tracks — an even band reads as a grid, which is a different thing. */
.pl-band[data-count="3"] { grid-template-columns: 1.6fr 1fr 1.1fr; }
.pl-band[data-count="4"] { grid-template-columns: 1.5fr 1fr 1fr 1.3fr; }
.pl-band[data-count="5"] { grid-template-columns: 1.4fr .9fr 1fr .9fr 1.5fr; }
.pl-band[data-bleed="bottom"] { margin-bottom: calc(7cqh * -1); }

.pl-bleed { margin-left: calc(var(--pl-margin) * -1); margin-right: calc(var(--pl-margin) * -1); }
/* The bleed takes whatever height the copy above it leaves, rather than a fixed
   ratio. A fixed ratio pushes the page past one screen at wide viewports, and the
   image then scrolls away from the text it belongs to. */
.pl-bleed[data-bleed="bottom"] {
  margin-bottom: calc(7cqh * -1);
  flex: 1 1 auto;
  min-height: var(--pl-bleed-min, 34cqh);
  overflow: hidden;
}

/* ── Grids ──────────────────────────────────────────────────── */
/* Shared-frame block: cells are separated by the frame stroke itself, so the
   gap is the border colour showing through. */
.pl-framed {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pl-frame, 0px);
  margin: 0 var(--pl-margin);
  aspect-ratio: 16 / 9;
}

.pl-capgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 3cqw;
}
.pl-capgrid figure { margin: 0; display: flex; flex-direction: column; gap: .75em; }
.pl-capgrid img { aspect-ratio: 4 / 3; }

/* ── Copy panels ────────────────────────────────────────────── */
.pl-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--pl-gap);
  padding: 7cqh var(--pl-margin);
  align-items: stretch;
}
.pl-card { display: flex; flex-direction: column; gap: 1em; box-sizing: border-box; }
.pl-card-tight { align-items: center; text-align: center; }

/* The heading breaks out above the panel's top edge (at-hoppers). Templates
   opt in by giving --pl-card-head-lift a value. */
.pl-card-head { margin-top: var(--pl-card-head-lift, 0); }

.pl-margin-cols { display: grid; gap: 3cqw; }
.pl-margin-cols[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.pl-margin-cols:not([data-cols]) { grid-template-columns: repeat(auto-fit, minmax(var(--pl-measure), 1fr)); }
.pl-col { max-width: var(--pl-measure); }

/* ── Cluster: one copy panel, images at mixed heights ───────── */
.pl-cluster {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: var(--pl-gap);
  padding: 0 var(--pl-margin) 7cqh;
  align-items: start;
}
.pl-cluster-imgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: var(--pl-gap);
}
/* One wide frame over two.
   The cluster takes the height the head leaves and its two rows divide THAT, so a
   long head shrinks the pictures instead of pushing them off the page. For the rows
   to be fractions of anything the cluster needs a definite height, which means it
   has to stretch rather than sit at its content height — with `align-items: start`
   the `1fr` rows fall back to max-content and the fixed ratios were the only thing
   holding the page together. */
.pl-cluster { flex: 1 1 auto; min-height: 0; align-items: stretch; }
.pl-cluster-imgs { grid-template-rows: minmax(0, 1.12fr) minmax(0, 1fr); min-height: 0; }
.pl-cluster-imgs > :first-child { grid-column: 1 / -1; }
.pl-cluster-imgs > .pl-slot { height: 100%; min-height: 0; }
.pl-cluster-copy { max-height: 100%; overflow: hidden; }

/* ── Circle portraits (at-hoppers cast row) ─────────────────── */
.pl-circles {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6cqw;
  padding: 0 var(--pl-margin) 4cqh;
  flex: 1 1 auto; min-height: 0;
}
.pl-circle { margin: 0; text-align: center; flex: 0 1 20cqw; }
.pl-circle img { aspect-ratio: 1; border-radius: 50%; height: auto; }
.pl-circle figcaption { margin-top: 1em; }

/* ── Alternating rows ───────────────────────────────────────── */
/* A row list divides the page between its rows rather than stacking past it —
   on a fixed slide, "one row after another" has to mean "each row gets a share". */
.pl-rows {
  display: grid; grid-auto-rows: minmax(0, 1fr);
  gap: 2cqh; padding: 0 var(--pl-margin) 4cqh;
  flex: 1 1 auto; min-height: 0;
}
.pl-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--pl-gap); align-items: center; min-height: 0; overflow: hidden; }
.pl-row[data-side="right"] > .pl-row-img { order: 2; }
.pl-row-img { aspect-ratio: auto; height: 100%; overflow: hidden; min-height: 0; }

/* ── Stills ─────────────────────────────────────────────────── */
/* Letterboxed with the page ground showing on all four sides. */
.pl-letterbox {
  display: flex; flex-direction: column; gap: 1em;
  padding: 5cqh var(--pl-margin);
  height: 100%; box-sizing: border-box; justify-content: center;
}
.pl-letterbox-img { flex: 1 1 auto; min-height: 0; }
.pl-letterbox-img { aspect-ratio: var(--pl-letterbox-ratio, 21 / 9); }
/* Flexes to the page like the other bleeds; the ratio is only a floor. */
.pl-inset-img { flex: 1 1 auto; min-height: var(--pl-inset-min, 46cqh); overflow: hidden; }
.pl-margin-still { flex: 1 1 auto; min-height: 40cqh; overflow: hidden; }

/* ── Lower third / plates ───────────────────────────────────── */
.pl-lower {
  position: relative; z-index: 2; margin-top: auto;
  display: flex; flex-direction: column; gap: .8em;
  padding: 0 var(--pl-margin) 8cqh;
}
.pl-lower-copy { max-width: var(--pl-measure-wide); }

.pl-plate-page {
  display: flex; align-items: center; justify-content: center;
  height: 100%; padding: var(--pl-margin); box-sizing: border-box;
}
.pl-plate { position: relative; z-index: 2; display: flex; flex-direction: column; gap: .8em; }
.pl-plate-center { align-items: center; text-align: center; margin: auto; }

/* ── Hero compositions ──────────────────────────────────────── */
.pl-hero-lockup {
  position: relative; z-index: 2; margin: auto 0;
  padding: 0 var(--pl-margin);
  display: flex; flex-direction: column; align-items: flex-start; gap: .4em;
}
.pl-hero-foot { margin-top: auto; }

.pl-hero-margin {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  height: 100%;
  padding: 5cqh var(--pl-margin);
  box-sizing: border-box;
}
.pl-hero-margin .pl-rot { grid-column: 3 / 5; grid-row: 1 / 5; }
.pl-hero-margin-img { grid-column: 7 / 13; grid-row: 5 / 9; margin-right: calc(var(--pl-margin) * -1); }
.pl-hero-margin-sub { grid-column: 3 / 7; grid-row: 8; align-self: end; }

.pl-hero-plate { position: relative; z-index: 2; margin: auto auto auto 0; padding: 0 var(--pl-margin); max-width: 46ch; }

.pl-hero-half { display: grid; grid-template-columns: 1fr 1fr; height: 100%; }
.pl-hero-half-img { overflow: hidden; }
.pl-hero-half-text {
  display: flex; flex-direction: column; justify-content: center; gap: .6em;
  padding: 6cqh var(--pl-margin); box-sizing: border-box;
}

/* ── Stats ──────────────────────────────────────────────────── */
/* One screen, with the numerals holding the middle — the stats page is a slide,
   not a scrolling block. */
/* A slide, so the three bands share the page rather than stacking past it. */
.pl-stat-plates {
  position: relative; z-index: 2;
  padding: 6cqh var(--pl-margin);
  height: 100%; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 2cqh; overflow: hidden;
}
.pl-stat-plates > .pl-measure { flex: 0 1 auto; min-height: 0; overflow: hidden; }
.pl-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--pl-gap); }
.pl-stat-rail { display: flex; flex-direction: column; justify-content: center; gap: 3cqh; padding: 6cqh var(--pl-margin); }
.pl-stat { display: flex; flex-direction: column; gap: .25em; }

/* ── Spec table ─────────────────────────────────────────────── */
.pl-table { margin: 0; display: flex; flex-direction: column; }
.pl-table-row { display: grid; grid-template-columns: minmax(8ch, 18ch) 1fr; gap: var(--pl-gap); padding: .7em 0; }
.pl-table-row dd { margin: 0; }
.pl-table-rail { justify-content: center; padding: 6cqh var(--pl-margin); }

/* ── Run-on bleed title (theatre) ───────────────────────────── */
/* Words closed up until they touch, set wide enough to clip off both page edges.
   The closing-up is word-spacing, not a string edit, so the text stays readable
   in the editor and correct in the nav and the export. */
.pl-runon {
  width: 100%;
  overflow: hidden;
  line-height: .8;
}
.pl-runon > span {
  display: block;
  white-space: nowrap;
  word-spacing: var(--pl-runon-spacing, -.32em);
  /* Overshoot the page so the first and last letters are cut by the edge. */
  margin-left: var(--pl-runon-overhang, -3%);
  margin-right: var(--pl-runon-overhang, -3%);
}

/* ── Stacked mid-word title (theatre) ───────────────────────── */
.pl-stacked { display: flex; flex-direction: column; line-height: var(--pl-stacked-leading, .82); }
.pl-stacked > span { display: block; }

/* ── Hero: wordmark behind the image ────────────────────────── */
.pl-hero-behind {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr minmax(0, 46%) 1fr;
  align-items: center;
  padding: 0 var(--pl-margin);
  box-sizing: border-box;
}
.pl-hero-behind > .pl-runon {
  position: absolute; left: 0; right: 0; bottom: var(--pl-hero-behind-baseline, 6%);
  z-index: 0;
}
.pl-hero-behind-img { grid-column: 2; z-index: 1; aspect-ratio: 4 / 3; }
.pl-hero-behind-l { grid-column: 1; z-index: 2; text-align: center; }
.pl-hero-behind-r { grid-column: 3; z-index: 2; text-align: center; }

/* ── Stacked-title beat: copy, three free frames, title in the gap ── */
.pl-stackpage {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: var(--pl-gap);
  height: 100%;
  padding: 5cqh var(--pl-margin);
  box-sizing: border-box;
}
.pl-stackpage-copy { grid-column: 1 / 5;  grid-row: 1 / 4; max-width: var(--pl-measure); }
.pl-stackpage-a    { grid-column: 5 / 9;  grid-row: 1 / 5; }
.pl-stackpage-b    { grid-column: 9 / 13; grid-row: 2 / 6; }
.pl-stackpage-c    { grid-column: 5 / 12; grid-row: 5 / 9; }
.pl-stackpage > .pl-stacked { grid-column: 1 / 5; grid-row: 4 / 9; align-self: end; }

/* ── Dropped-initial quote lockup ───────────────────────────── */
.pl-initial { display: grid; grid-template-columns: auto 1fr; align-items: start; }
.pl-initial-head { grid-column: 1 / -1; line-height: .9; }
.pl-initial-drop { grid-column: 1; line-height: .7; margin-top: -.22em; }
.pl-initial-rest { grid-column: 2; align-self: center; }
.pl-initial-attr { grid-column: 2; }

/* ── Two-up with a note under each frame ────────────────────── */
.pl-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4cqw;
  padding: 7cqh var(--pl-margin);
  align-items: start;
}
.pl-notes figure { margin: 0; display: flex; flex-direction: column; gap: 1.4em; }
.pl-notes img { aspect-ratio: 16 / 10; }

/* ── Run-on title page ──────────────────────────────────────── */
.pl-runon-page {
  display: flex; flex-direction: column; justify-content: center;
  gap: 3cqh;
  height: 100%;
  padding: 7cqh 0;
  box-sizing: border-box;
}
/* The image takes whatever height the title leaves, rather than a fixed ratio —
   otherwise the page overflows its own screen at wide viewports and the title
   scrolls away from the picture it belongs to. */
.pl-runon-img { margin: 0 var(--pl-margin); flex: 1 1 auto; min-height: 0; }
.pl-runon-page > .eyebrow { margin: 0 var(--pl-margin); }

/* ── Ruled module (matcha-latte) ────────────────────────────── */
/* A 4-column grid whose cell boundaries are DRAWN. The rules are the identity, so
   they live here as structure; templates only choose their colour and weight via
   --pl-rule. Columns are uneven — a wide first column for the display title, then
   three narrower ones — because an even four would read as a table. */
.pl-module {
  display: grid;
  grid-template-columns: var(--pl-module-cols, 26.5fr 24fr 24fr 25fr);
  /* minmax(0,1fr), not 1fr: a bare 1fr row reports its content as the grid's
     max-content height, so a tall image makes the whole module — and the page —
     grow past a screen even though the height below says otherwise. */
  grid-template-rows: repeat(6, minmax(0, 1fr));
  /* A definite height, not a minimum: the cells are fractions of a page, and an
     image asked to fill 100% of an indefinite row falls back to its intrinsic
     size and drags the whole module past a screen. */
  height: 100%;
  box-sizing: border-box;
  border-left: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
  border-top: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
}
.pl-module > * {
  border-right: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
  border-bottom: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
  padding: var(--pl-module-pad, 18px);
  min-width: 0;
  box-sizing: border-box;
}

/* The title sits at the BOTTOM of column 1 while the body starts at the TOP of
   column 2. They deliberately do not align — that mismatch is what makes the
   underlying module readable. */
.pl-module-title { grid-column: 1; grid-row: 4 / 7; display: flex; align-items: flex-end; }
.pl-module-title[data-align="start"] { grid-row: 1 / 3; align-items: flex-start; }

.pl-module-cols {
  grid-column: 2 / 5; grid-row: 1 / 3;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--pl-module-pad, 18px);
  padding: var(--pl-module-pad, 18px);
}
.pl-module-cols > .pl-module-col { margin: 0; }

.pl-module-fig { grid-column: 2 / 5; grid-row: 3 / 7; padding: 0; margin: 0; overflow: hidden; }
.pl-module-fig[data-span="top"]  { grid-column: 2 / 5; grid-row: 1 / 4; }
.pl-module-fig[data-span="left"] { grid-column: 1 / 3; grid-row: 1 / 7; }

.pl-module-note  { grid-column: 2; grid-row: 4 / 7; margin: 0; }
/* Empty cells are emitted deliberately: in the deck the ruled void beside a note is
   as much a part of the page as the note. Without them the rules stop mid-page. */
.pl-module-cell { grid-row: 4 / 7; }
.pl-module-cell[data-cell="1"] { grid-column: 1; }
.pl-module-cell[data-cell="3"] { grid-column: 3 / 5; }
.pl-module-quote { grid-column: 3 / 5; grid-row: 1 / 7; display: flex; flex-direction: column; justify-content: center; gap: 3em; }

/* Storyboard: frames in ruled cells, each caption inside its own cell. */
.pl-module-cells {
  grid-column: 2 / 5; grid-row: 1 / 7;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr));
  padding: 0;
}
.pl-module-cells > figure {
  margin: 0; display: flex; flex-direction: column; gap: .8em;
  padding: var(--pl-module-pad, 18px);
  border-right: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
  border-bottom: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
  min-width: 0;
}
.pl-module-cells > figure:nth-child(3n) { border-right: 0; }
.pl-module-cells > figure img { aspect-ratio: 16 / 10; }


/* ── Copy + edge image rail (dusk-over-jaipur) ──────────────── */
.pl-rail {
  display: grid;
  grid-template-columns: 1fr var(--pl-rail-w, 28%);
  height: 100%;
}
.pl-rail-body {
  display: flex; flex-direction: column; justify-content: center;
  gap: 4cqh;
  padding: 7cqh 5cqw;
}
.pl-rail-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; }
/* The rail bleeds top, bottom and outer edge — it is a slice of the page, not a picture
   placed on it. */
.pl-rail-img { overflow: hidden; }

/* ── Keyline frame inside a full-bleed image (dusk-over-jaipur) ── */
.pl-keyframe {
  position: relative; z-index: 2;
  margin: var(--pl-keyframe-inset, 7cqw);
  border: var(--pl-keyframe-w, 2px) solid var(--pl-keyframe-color, transparent);
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6em; text-align: center;
  padding: 4cqw;
}


/* ── Overlapping triptych (business-as-usual) ───────────────── */
/* The only composition where images overlap. The back plate is wide and short;
   the front frame is narrower and taller, laid over it so the page ground shows
   through the gaps on both sides. */
.pl-overlap {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
}
.pl-overlap-back {
  grid-area: 1 / 1;
  width: 100%;
  aspect-ratio: var(--pl-overlap-back-ratio, 32 / 12);
  overflow: hidden;
}
.pl-overlap-front {
  grid-area: 1 / 1;
  width: var(--pl-overlap-front-w, 46%);
  aspect-ratio: var(--pl-overlap-front-ratio, 1 / 1.05);
  overflow: hidden;
  z-index: 2;
}
.pl-overlap-title {
  grid-area: 1 / 1; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: .4em;
  text-align: center; padding: 0 var(--pl-margin);
}


/* ── Copy over an atmospheric ground (the-symphony) ─────────── */
/* The full-bleed image is WALLPAPER, dimmed by the template. Over it: a title
   with a lead paragraph beneath it holding the left third, and two body columns
   filling the rest. The picture is atmosphere, not content, so there is no image
   row — the page's only images are the ground itself. */
.pl-atmos {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-content: start;
  gap: 2.4cqw;
  height: 100%;
  padding: 8cqh var(--pl-margin);
  box-sizing: border-box;
}
.pl-atmos-head { grid-column: 1; display: flex; flex-direction: column; gap: 3.4cqh; }
.pl-atmos-cols {
  grid-column: 2 / 4;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.4cqw;
  align-content: start;
}

/* ── Diagonal pinwheel (the-symphony) ───────────────────────── */
.pl-pinwheel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 3cqw;
  height: 100%;
  padding: 6cqh var(--pl-margin);
  box-sizing: border-box;
}
/* text TL, image TR, image BL, text BR — the alternation is the composition. */
.pl-pin-a { grid-area: 1 / 1; }
.pl-pin-b { grid-area: 1 / 2; overflow: hidden; }
.pl-pin-c { grid-area: 2 / 1; overflow: hidden; }
.pl-pin-d { grid-area: 2 / 2; align-self: center; }
.pl-pin-b img, .pl-pin-c img { height: 100%; aspect-ratio: auto; }


/* ── Title overlapping an image edge (black-orchid) ─────────── */
/* The title straddles the boundary between the still and the page ground. The
   image holds the left portion; the title starts inside it and runs out onto the
   ground, so neither element fully contains the other. */
.pl-edge {
  display: grid;
  grid-template-columns: var(--pl-edge-img-w, 46%) 1fr;
  grid-template-rows: 1fr auto 1fr;
  height: 100%;
  align-items: center;
}
.pl-edge-img { grid-column: 1; grid-row: 1 / 4; overflow: hidden; height: 100%; }
.pl-edge-img img { height: 100%; aspect-ratio: auto; }
/* Starts inside the image column and overruns into the ground. */
.pl-edge-title { grid-column: 1 / 3; grid-row: 2; z-index: 2; margin-left: var(--pl-edge-overlap, 34%); }
.pl-edge-body  { grid-column: 2; grid-row: 3; align-self: start; padding: 0 var(--pl-margin); }

/* ── Type on a bare field (biohacker cover) ─────────────────── */
/* No image box at all — the page ground IS the picture. Centred by default; a template
   that wants the lockup off-centre moves it with --pl-field-justify. */
.pl-field {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: var(--pl-field-align, center);
  justify-content: var(--pl-field-justify, center);
  gap: .5em;
  padding: 8cqh var(--pl-margin);
  box-sizing: border-box;
  text-align: var(--pl-field-text, center);
}

/* ── Banner title + uneven columns (biohacker) ──────────────── */
/* The title band spans the FULL page width and is closed by a rule; the page's content
   starts below it. The columns are deliberately unequal — an even three reads as a table,
   and the deck's are short/medium/long down the page. */
.pl-banner {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
.pl-banner-head {
  padding: var(--pl-banner-pad, 2cqh) var(--pl-margin);
  border-bottom: var(--pl-rule-w, 1px) solid var(--pl-rule, transparent);
}
.pl-banner-cols {
  display: grid;
  grid-template-columns: var(--pl-banner-cols, 1fr 1fr 1fr);
  gap: var(--pl-gap);
  padding: 5cqh var(--pl-margin);
  align-items: start;
  min-height: 0;
}
/* Each column starts a little lower than the one before it, so the three read as a
   descending stagger rather than a block. */
.pl-banner-col:nth-child(2) { margin-top: var(--pl-banner-stagger, 6cqh); }
.pl-banner-col:nth-child(3) { margin-top: calc(var(--pl-banner-stagger, 6cqh) * 1.4); }
/* Anchored to the bottom-left corner and bleeding off both of its edges. */
.pl-banner-cut {
  position: absolute; left: 0; bottom: 0; z-index: 2;
  width: var(--pl-banner-cut-w, 42%);
  height: var(--pl-banner-cut-h, 46%);
  pointer-events: none;
}

/* ── Copy inside the halves of a diptych (biohacker) ────────── */
.pl-inset-pair { display: grid; grid-template-columns: 1fr 1fr; height: 100%; gap: var(--pl-pair-gap, 0px); }
.pl-inset-half { position: relative; overflow: hidden; display: flex; }
.pl-inset-half > .pl-slot { position: absolute; inset: 0; }
.pl-inset-copy {
  position: relative; z-index: 2;
  margin: 0 auto;
  width: min(72%, var(--pl-measure-wide));
  padding: 6cqh 0;
}
.pl-inset-half[data-pos="top"]    .pl-inset-copy { align-self: flex-start; }
.pl-inset-half[data-pos="bottom"] .pl-inset-copy { align-self: flex-end; }

/* ── Tiling title over halves (the-champion) ────────────────── */
/* The title band spans the page and its copies run off the right edge. The band is
   laid over the top of both halves rather than sitting above them, so the picture
   reads through the outlined letters. */
.pl-tile {
  position: relative;
  display: grid;
  grid-template-columns: var(--pl-tile-split, 1fr 1fr);
  height: 100%;
}
.pl-tile-title {
  position: absolute; left: 0; right: 0; top: var(--pl-tile-top, 4cqh);
  z-index: 3;
  display: flex; align-items: baseline;
  white-space: nowrap; overflow: hidden;
  pointer-events: none;
}
/* The repeats fall away as they run off the edge. */
.pl-tile-echo:nth-of-type(1) { opacity: var(--pl-tile-fade-1, .55); }
.pl-tile-echo:nth-of-type(2) { opacity: var(--pl-tile-fade-2, .25); }
.pl-tile-img { overflow: hidden; }
.pl-tile-img > .pl-slot { height: 100%; }
.pl-tile-text {
  display: flex; flex-direction: column; justify-content: center; gap: 1.4em;
  padding: var(--pl-tile-copy-top, 22cqh) var(--pl-margin) 7cqh;
  min-width: 0; overflow: hidden;
}

/* ── Title across free frames (echoes-of-love) ──────────────── */
/* The title is its own layer above the pictures. The frames overlap each other and
   the title crosses both, so nothing here reserves a column for the type — that is
   the difference between this and every other free-placement composition. */
.pl-crossing {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  height: 100%;
  padding: 6cqh var(--pl-margin);
  box-sizing: border-box;
}
.pl-crossing-a { grid-column: 1 / 8;  grid-row: 1 / 6; z-index: 1; overflow: hidden; }
.pl-crossing-b { grid-column: 6 / 13; grid-row: 4 / 9; z-index: 2; overflow: hidden; }
.pl-crossing-title {
  grid-column: 1 / 10; grid-row: 5 / 8;
  align-self: center; z-index: 3;
  pointer-events: none;
}
.pl-crossing-copy { grid-column: 8 / 13; grid-row: 1 / 4; z-index: 3; align-self: start; }

/* ── Copy panel as a cell of the mosaic (cyber-punch) ───────── */
/* The panel is a grid cell, so the pictures butt against it exactly as they butt
   against each other. The gutter is the page ground showing through, which is why
   the gap is a variable rather than a fixed value: some templates want none. */
.pl-cellgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--pl-cell-gap, 0.5cqw);
  height: 100%;
}
.pl-cellgrid-panel {
  grid-area: 1 / 1;
  display: flex; flex-direction: column; justify-content: center; gap: 3cqh;
  padding: 5cqh var(--pl-margin);
  min-width: 0; overflow: hidden;
}
.pl-cellgrid-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2cqw; }
.pl-cellgrid-img { overflow: hidden; min-width: 0; min-height: 0; }
.pl-cellgrid-img[data-cell="1"] { grid-area: 1 / 2; }
.pl-cellgrid-img[data-cell="2"] { grid-area: 2 / 1; }
.pl-cellgrid-img[data-cell="3"] { grid-area: 2 / 2; }
.pl-cellgrid-img > .pl-slot { height: 100%; }

/* ── Title across a credit band (christmas) ─────────────────── */
/* The band holds the top of the page, the image takes the rest, and the wordmark is
   laid across the boundary so neither contains it. The title's vertical position is
   the whole composition, so it is a property rather than a magic number. */
.pl-seam-hero {
  position: relative;
  display: grid;
  grid-template-rows: var(--pl-seam-band-h, 32%) 1fr;
  height: 100%;
}
.pl-seam-band {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: .4em; padding: 4cqh var(--pl-margin) 0; text-align: center;
}
.pl-seam-img { overflow: hidden; position: relative; }
.pl-seam-img > .pl-slot { position: absolute; inset: 0; }
.pl-seam-title {
  position: absolute; left: 0; right: 0;
  top: var(--pl-seam-band-h, 32%);
  transform: translateY(-58%);
  z-index: 3; text-align: center;
}

/* ── Copy band between image rows (geometos) ────────────────── */
/* The band is held BETWEEN two rows of stills rather than above, below or beside
   them. The rows take equal shares of what the band leaves, so a longer band
   shrinks the pictures rather than pushing them off the page. */
.pl-sandwich {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  height: 100%;
  gap: var(--pl-gap);
}
.pl-sandwich-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--pl-gap);
  min-height: 0;
}
.pl-sandwich-row > .pl-slot { height: 100%; }
.pl-sandwich-copy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--pl-sandwich-gap, 4cqw);
  padding: var(--pl-sandwich-pad, 3cqh) var(--pl-margin);
  align-content: center;
  max-height: 100%;
  overflow: hidden;
}

/* ── Offset rows (christmas) ────────────────────────────────── */
.pl-stagger {
  display: flex; flex-direction: column;
  gap: var(--pl-gap);
  flex: 1 1 auto; min-height: 0;
}
.pl-stagger-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--pl-gap); min-height: 0; }
/* The offset is the composition. Row 1 sits to the right of the measure, row 2 to the
   left of it, and their column widths differ so no edge in one row meets one in the other. */
.pl-stagger-row[data-row="1"] {
  margin-left: var(--pl-stagger-indent, 6%);
  margin-right: calc(var(--pl-margin) * -1);
  grid-template-columns: 1.12fr 1fr;
}
.pl-stagger-row[data-row="2"] {
  margin-left: calc(var(--pl-margin) * -1);
  margin-right: var(--pl-stagger-indent, 6%);
  grid-template-columns: 1fr 1.06fr;
}

/* ── Stacked title one corner, copy the other (bright) ──────── */
/* Two blocks pinned to opposite corners of a full-bleed page, with the whole middle
   left to the photograph. Templates choose which corners through the two custom
   properties rather than by overriding the grid. */
.pl-corner {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  height: 100%;
  padding: 7cqh var(--pl-margin);
  box-sizing: border-box;
  gap: var(--pl-gap);
}
.pl-corner-title { grid-area: var(--pl-corner-title-area, 1 / 1); align-self: start; min-width: 0; max-height: 100%; overflow: hidden; }
.pl-corner-copy  { grid-area: var(--pl-corner-copy-area, 2 / 2); align-self: end; min-width: 0; max-height: 100%; overflow: hidden; }

/* ── Framed stills over a full-bleed ground (bright) ────────── */
.pl-overlay {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  height: 100%;
  padding: 6cqh var(--pl-margin);
  box-sizing: border-box;
}
/* Unequal and staggered on purpose — three frames on a common baseline would read as
   a grid, which is the thing this composition is not. */
.pl-overlay-a { grid-column: 1 / 5;  grid-row: 1 / 5; }
.pl-overlay-b { grid-column: 5 / 9;  grid-row: 3 / 8; }
.pl-overlay-c { grid-column: 9 / 13; grid-row: 1 / 7; }
.pl-overlay-title { grid-column: 1 / 8; grid-row: 8; align-self: end; }

/* ── Statement lines, media ─────────────────────────────────── */
.pl-statement-lines { display: flex; flex-direction: column; }
.pl-audio { width: 100%; }
.pl-audio-empty { height: 54px; }
.pl-video { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.pl-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pl-video-full { position: relative; height: 100%; display: flex; flex-direction: column; }
.pl-video-full .pl-video { position: absolute; inset: 0; aspect-ratio: auto; }
.pl-video-full .pl-lower { position: relative; z-index: 2; }

/* ── Spacer ─────────────────────────────────────────────────── */
/* Deliberately empty. It still occupies a full page so the running chrome —
   page number, rails, frame — lands on it, which is the point. */
.pl-page[data-layout="spacer"] { justify-content: center; align-items: center; }
.pl-spacer-rule { width: min(60%, 520px); height: 1px; background: currentColor; opacity: .25; }
.pl-spacer-mark { opacity: .5; }

/* ═══════════════════════════════════════════════════════════════
   CLASSIC VOCABULARY — baseline geometry for the pre-variant markup
   (.wrap, .grid4, .vig-grid, .two-col, …).

   These classes used to get their geometry from each template's own stylesheet,
   which meant rewriting a template's CSS silently un-laid-out every classic
   composition it still used — a four-image grid would stack into a 2,600px
   column and nothing would report it.

   Everything here is geometry only and deliberately low-specificity, so the
   59 templates that already style these rules continue to win.
   ═══════════════════════════════════════════════════════════════ */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--pl-margin); }

.grid4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: var(--pl-gap);
  padding: var(--pl-gap) var(--pl-margin);
  flex: 1 1 auto; min-height: 0;
}
.grid4 > img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; display: block; }

.vig-header { padding: 7cqh var(--pl-margin) 0; }
.vig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--pl-gap);
  padding: var(--pl-gap) var(--pl-margin) 7cqh;
  flex: 1 1 auto; min-height: 0;
}
.vig-card { position: relative; display: flex; flex-direction: column; }
.vig-card > img { width: 100%; aspect-ratio: auto; flex: 1 1 auto; min-height: 0; object-fit: cover; display: block; }
.vig-body { display: flex; flex-direction: column; gap: .5em; padding: 1.2em 0 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 4cqw; align-items: start; }
.stats-gbox { display: grid; grid-template-columns: 1fr 1fr; gap: var(--pl-gap); }

.section, .section-dark { padding: 8cqh 0; }
/* Classic overlay blocks sit inside a fixed slide now, so they are bounded by it
   and centred within it rather than setting the page's height. */
.about-content, .tex-content, .picks-content, .ty-content {
  position: relative; z-index: 2;
  height: 100%; box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center;
  padding: 6cqh var(--pl-margin); overflow: hidden;
}
.about-content > .gbox, .tex-content > .gbox { max-height: 100%; overflow: hidden; }

@media (max-width: 780px) {
  .two-col, .stats-gbox { grid-template-columns: 1fr; }
}

/* ── Narrow screens ─────────────────────────────────────────── */
@media (max-width: 780px) {
  .pl-split,
  .pl-split[data-seam="on"],
  .pl-hero-half { grid-template-columns: 1fr; grid-template-areas: none; }
  .pl-split[data-seam="on"] .pl-seam { display: none; }
  .pl-split-img { aspect-ratio: 4 / 3; }
  .pl-trio,
  .pl-cluster,
  .pl-cluster-imgs,
  .pl-margin-cols[data-cols="3"],
  .pl-stat-row,
  .pl-row { grid-template-columns: 1fr; }
  .pl-row[data-side="right"] > .pl-row-img { order: 0; }
  .pl-band { aspect-ratio: auto; grid-template-columns: 1fr 1fr !important; }
  .pl-circles { flex-wrap: wrap; }
  .pl-free { display: flex; flex-direction: column; gap: var(--pl-gap); padding: 0 var(--pl-margin); }
  .pl-free-a, .pl-free-b, .pl-free-c { margin: 0; aspect-ratio: 4 / 3; }
  /* `safe center`: when the stacked hero is taller than the slide (it is, on a
     phone — see research/MOBILE-AUDIT.md), plain `center` spills it off BOTH
     ends and the title, which comes first, is what disappears (SPRINT-2 F6:
     p-cover-0-title at y = -55). `safe` falls back to start alignment on
     overflow, so whatever is lost is lost from the bottom. */
  .pl-hero-margin { display: flex; flex-direction: column; justify-content: safe center; gap: var(--pl-gap); }
  .pl-hero-margin-img { margin: 0; aspect-ratio: 16 / 9; }
  .pl-rot { writing-mode: horizontal-tb; transform: none; }
  .pl-rot-inner { flex-direction: column; }
  .pl-notes,
  .pl-hero-behind { grid-template-columns: 1fr; }
  .pl-hero-behind { display: flex; flex-direction: column; justify-content: safe center; gap: var(--pl-gap); }
  .pl-hero-behind > .pl-runon { position: static; }
  .pl-hero-behind-l, .pl-hero-behind-r { text-align: left; }
  .pl-stackpage { display: flex; flex-direction: column; gap: var(--pl-gap); }
  .pl-stackpage-a, .pl-stackpage-b, .pl-stackpage-c { aspect-ratio: 4 / 3; }
  .pl-initial { grid-template-columns: 1fr; }
  .pl-initial-drop { display: none; }
  .pl-edge { grid-template-columns: 1fr; }
  .pl-edge-title { grid-column: 1; margin-left: 0; }
  .pl-edge-body { grid-column: 1; }
  .pl-overlap-front { width: 78%; }
  .pl-atmos, .pl-pinwheel { grid-template-columns: 1fr; }
  .pl-atmos > .sec-title, .pl-atmos-cols, .pl-atmos-row { grid-column: 1; grid-row: auto; }
  .pl-atmos-cols, .pl-atmos-row { grid-template-columns: 1fr; }
  .pl-pin-a, .pl-pin-b, .pl-pin-c, .pl-pin-d { grid-area: auto; }
  .pl-pin-b, .pl-pin-c { aspect-ratio: 16 / 9; }
  .pl-banner-cols,
  .pl-corner,
  .pl-inset-pair { grid-template-columns: 1fr; }
  .pl-corner { grid-template-rows: auto auto; }
  .pl-corner-title, .pl-corner-copy { grid-area: auto !important; }
  .pl-tile { grid-template-columns: 1fr; }
  .pl-tile-title { position: static; }
  .pl-tile-echo { display: none; }
  .pl-tile-text { padding-top: 4cqh; }
  .pl-tile-img { aspect-ratio: 16 / 9; }
  .pl-crossing { display: flex; flex-direction: column; gap: var(--pl-gap); }
  .pl-crossing-a, .pl-crossing-b { aspect-ratio: 4 / 3; }
  .pl-cellgrid { grid-template-columns: 1fr; grid-template-rows: auto; }
  .pl-cellgrid-panel, .pl-cellgrid-img { grid-area: auto !important; }
  .pl-cellgrid-img { aspect-ratio: 16 / 9; }
  .pl-cellgrid-cols { grid-template-columns: 1fr; }
  .pl-sandwich { grid-template-rows: auto auto auto; }
  .pl-sandwich-row, .pl-sandwich-copy { grid-template-columns: 1fr; }
  .pl-sandwich-row > .pl-slot { aspect-ratio: 16 / 9; height: auto; }
  .pl-stagger-row { grid-template-columns: 1fr !important; margin-left: 0 !important; margin-right: 0 !important; }
  .pl-seam-hero { grid-template-rows: auto auto; }
  .pl-seam-title { position: static; transform: none; }
  .pl-overlay { display: flex; flex-direction: column; gap: var(--pl-gap); }
  .pl-overlay-a, .pl-overlay-b, .pl-overlay-c { aspect-ratio: 4 / 3; }
  .pl-banner-col:nth-child(2), .pl-banner-col:nth-child(3) { margin-top: 0; }
  .pl-banner-cut { display: none; }
  .pl-inset-half { aspect-ratio: 4 / 3; }
  .pl-module { display: flex; flex-direction: column; }
  .pl-module > * { grid-column: auto !important; grid-row: auto !important; }
  .pl-module-cols,
  .pl-module-cells,
  .pl-rail-cols { grid-template-columns: 1fr; }
  .pl-rail { grid-template-columns: 1fr; }
  .pl-rail-img { aspect-ratio: 16 / 9; }
}

/* ── Slide-fitting guards ───────────────────────────────────────
   A fixed slide clips rather than grows, so the blocks that overlay a page are
   bounded by it and centred inside it. Anything still too long is over-written
   copy, which is the author's call to make — but it must not silently push the
   page out of shape. */
.hero, [data-layout="hero"] > *:not(.bg):not(.pl-chrome) { max-height: 100%; }
.hero-content, .pl-hero-lockup, .pl-hero-plate, .pl-hero-half-text, .pl-hero-behind-l, .pl-hero-behind-r {
  max-height: 100%; overflow: hidden;
}
.pl-plate-page > *, .pl-lower, .pl-measure { max-height: 100%; overflow: hidden; }
.pl-stat-row { flex: 0 0 auto; }
.pl-cluster, .pl-trio, .pl-framed, .pl-capgrid, .pl-band, .pl-notes, .pl-atmos-row {
  min-height: 0;
}
.pl-page > .wrap { flex: 0 0 auto; }

/* ── Classic sections inside a fixed slide ──────────────────────
   The classic switch predates the slide model: its sections were written as blocks in
   a scrolling document, with an inline `min-height` and generous vertical padding.

   Two things go wrong when one of those is made the slide itself:

   - `min-height: 92cqh` on the slide is SELF-REFERENTIAL. Container units on a container
     resolve against its nearest ancestor container, or — when there is none — the small
     viewport. So the page came out 92% of the WINDOW's height instead of its own, and
     every classic page rendered a few percent off 16:9 on every screen.
   - The content is taller than the page, so it ran off the bottom rather than being
     centred in what space there is.

   Both are corrected here rather than in twenty-odd inline styles. Content that still
   does not fit is clipped symmetrically, which is the honest failure for a fixed slide;
   the real fix for a given layout is a composition, and that is what the deck passes add. */
#pitch-canvas > [data-pid]:not(.pl-page) {
  display: flex; flex-direction: column; justify-content: center;
}
#pitch-canvas > [data-pid]:not(.pl-page) > *:not(.pl-chrome):not(.bg):not(.tex-bg) {
  max-height: 100%;
}

/* The classic 2x2 beat board was sized for a scrolling page: a head block, then four
   cards at their natural height. On a slide the four cards have to divide whatever the
   head leaves, so the board flexes and its rows are fractions rather than auto. */
[data-layout="beats"][data-variant="grid"] > div:nth-of-type(2) {
  flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(0, 1fr);
}
[data-layout="beats"][data-variant="grid"] > div:nth-of-type(2) > div {
  min-height: 0; overflow: hidden;
}
[data-layout="beats"][data-variant="grid"] > div:nth-of-type(2) > div > div[style*="aspect-ratio"] {
  aspect-ratio: auto !important; flex: 1 1 auto; min-height: 0;
}
[data-layout="beats"][data-variant="grid"] > div:nth-of-type(2) > div { display: flex; flex-direction: column; }

/* The classic full-bleed band stack asked each of its four bands for a fixed 26cqh,
   which is 104% of a page before the header is counted. On a slide the bands divide
   what the header leaves. */
[data-layout="mosaic"][data-variant="strip"] > div:nth-of-type(2) { flex: 1 1 auto; min-height: 0; }
[data-layout="mosaic"][data-variant="strip"] > div:nth-of-type(2) > div {
  height: auto !important; min-height: 0 !important; flex: 1 1 0;
}

/* The classic alternating-rows beat list stacked four full-width rows at their natural
   height — around twice a page. On a slide the rows divide what the head leaves. */
[data-layout="beats"][data-variant="rows"] > div:nth-of-type(2),
[data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; gap: 1.5cqh;
}
[data-layout="beats"][data-variant="rows"] > div:nth-of-type(2) > div,
[data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) > div {
  flex: 1 1 0; min-height: 0; overflow: hidden;
}
[data-layout="beats"][data-variant="rows"] > div:nth-of-type(2) > div > div[style*="aspect-ratio"] {
  aspect-ratio: auto !important; height: 100%;
}

/* The classic vertical timeline stacked four steps at their natural height under a
   head block — a page and a quarter. The steps now divide what the head leaves, and
   each step's frame flexes instead of holding a 3:2 ratio it has no room for. */
[data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
}
[data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) > div[style*="grid-template-columns"] {
  flex: 1 1 0; min-height: 0; overflow: hidden; padding-bottom: 1.2cqw !important;
}
[data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) > div > div[style*="aspect-ratio"] {
  aspect-ratio: auto !important; height: 100%; min-height: 0;
}

/* The scroll strip's cards are a px-wide column (300px) holding an 84px numeral
   and a 4:5 frame, so each card is ~470px tall before its copy. Where the page is
   shorter than that (a 1024x768 landscape tablet: 576px), the beat names and text
   fell off the slide entirely. The strip may shrink to what the head leaves (never
   grow), and the frame gives up height first, so a page with room is unchanged:
   1440x900 and 1920x1080 measure identical; 1280x800 loses 6px of frame. */
[data-layout="beats"][data-variant="scroll"] > div:nth-of-type(2) {
  flex: 0 1 auto; min-height: 0;
}
[data-layout="beats"][data-variant="scroll"] > div:nth-of-type(2) > div {
  display: flex; flex-direction: column; min-height: 0;
}
[data-layout="beats"][data-variant="scroll"] > div:nth-of-type(2) > div > div[style*="aspect-ratio"] {
  flex: 0 1 auto; min-height: 0;
}

/* ── cta ────────────────────────────────────────────────────────
   One action per page (SPRINT-2 C2.1). Geometry only, as everywhere in this
   file: the button's colour, radius and type come from each template's own
   stylesheet hanging off [data-layout="cta"], so a CTA reads as part of the
   document rather than as a widget dropped onto it.

   The URL is drawn beside the label and hidden on screen, not omitted. A PDF of
   this page is a piece of paper, and a button reading "Book a call" with no
   address on it is a dead button — see the print block at the end. */
.pl-cta { height: 100%; box-sizing: border-box; display: flex; position: relative; }
.pl-cta-centred {
  flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 1.6cqh; padding: 8cqh var(--pl-margin);
}
.pl-cta-band {
  align-items: center; justify-content: space-between; gap: var(--pl-gap);
  padding: 8cqh var(--pl-margin);
}
.pl-cta-band-text { display: flex; flex-direction: column; gap: 1.2cqh; min-width: 0; }
.pl-cta-card { align-items: center; justify-content: center; padding: 8cqh var(--pl-margin); }
.pl-cta-card-inner {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: 1.4cqh;
  padding: 5cqh 4cqw; max-width: 46cqw; min-width: 0;
}

.pl-cta-eyebrow { letter-spacing: .25em; text-transform: uppercase; }
.pl-cta-title { line-height: 1.05; }
.pl-cta-note { max-width: var(--pl-measure); }
.pl-cta-centred .pl-cta-note { margin-inline: auto; }
.pl-cta-action { display: flex; flex-direction: column; gap: .6cqh; align-items: flex-start; }
.pl-cta-centred .pl-cta-action { align-items: center; }
/* flex-start rather than `inherit`: inside the card the parent is a plain column
   whose default is `stretch`, which made the button span the whole card — a
   full-width bar reads as a banner, not as one thing to click. */

/* The button is a box with a border; templates decide what kind of box. */
.pl-cta-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1.6cqh 3cqw; text-decoration: none; cursor: pointer;
  border: 1px solid currentColor; border-radius: var(--pl-radius);
}
.pl-cta-btn[data-style="plain"] { border-color: transparent; padding-inline: 0; text-decoration: underline; }
/* An unusable link still renders — the author sees their own button in the
   editor before they have pasted an address — but it must not look clickable. */
.pl-cta-btn[data-dead="1"] { opacity: .45; cursor: default; }

/* On screen the address is redundant: the label is a link. On paper it is the
   only way to follow it. */
.pl-cta-url { display: none; }

@media print {
  .pl-cta-url { display: block; }
  .pl-cta-btn { border-style: dashed; }
}

/* ── print: one page per section, and nothing else on a page of its own ──
   Each shell breaks after every section. After the LAST one, that break put the
   footer (credit line, "Confidential") on a page by itself: N sections printed
   N+1 pages in 40 of 61 templates. The footer now shares the last page.
   The nav is on-screen chrome — anchor links nobody can follow on paper — and
   where a shell turns its rail into a static block (ledger) it took a page of
   its own. The cover section carries the title. */
@media print {
  nav { display: none !important; }
  :root:has(script[data-template="ledger"]) { --pl-side-chrome: 0px; }
  #pitch-canvas > [data-pid]:nth-last-child(1 of [data-pid]) { break-after: auto !important; }
}

/* ── beforeafter ────────────────────────────────────────────────
   Two states of one frame (SPRINT-2 C4.2). Geometry only, as everywhere here:
   the seam's colour, the label's type and the tag's ground come from each
   template's own stylesheet hanging off [data-layout="beforeafter"].

   Deliberately CSS-only. A draggable handle would need script inside the shell,
   and this page has to survive the PDF and the print path — where a control
   nobody can move is worse than a split that simply shows both states. */
.pl-ba { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; padding: 7cqh var(--pl-margin); gap: 1.4cqh; }
.pl-ba-eyebrow { letter-spacing: .25em; text-transform: uppercase; }
.pl-ba-title { line-height: 1.05; }
.pl-ba-note { max-width: var(--pl-measure-wide); }

/* seam — two halves butted with no gutter, so the eye compares across the join */
.pl-ba-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0; flex: 1 1 auto; min-height: 0; }
.pl-ba-half { margin: 0; position: relative; display: flex; flex-direction: column; min-height: 0; }
.pl-ba-half > .pl-slot { flex: 1 1 auto; min-height: 0; }
.pl-ba-half + .pl-ba-half { border-left: 1px solid currentColor; }
.pl-ba-label { padding-top: .8cqh; }

/* reveal — both states in one rectangle, the "after" clipped to the right half */
.pl-ba-frame { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.pl-ba-layer { position: absolute; inset: 0; }
.pl-ba-layer > .pl-slot { height: 100%; }
.pl-ba-layer[data-state="after"] { clip-path: inset(0 0 0 50%); }
.pl-ba-seamline { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: currentColor; }
.pl-ba-tag { position: absolute; bottom: 2cqh; }
.pl-ba-tag[data-side="l"] { left: 2cqw; }
.pl-ba-tag[data-side="r"] { right: 2cqw; }

/* stacked — one above the other, each label in the margin beside its own frame */
.pl-ba-stacked { flex-direction: row; gap: var(--pl-gap); }
.pl-ba-head { width: 30%; flex-shrink: 0; display: flex; flex-direction: column; gap: 1.2cqh; justify-content: center; }
.pl-ba-rows { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--pl-gap); }
.pl-ba-row { flex: 1 1 0; min-height: 0; display: flex; align-items: stretch; gap: 1.2cqw; }
.pl-ba-rowlabel { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .18em; text-transform: uppercase; flex-shrink: 0; }
.pl-ba-row > .pl-slot { flex: 1 1 auto; min-width: 0; }

@media (max-width: 780px) {
  .pl-ba-pair { grid-template-columns: 1fr; }
  .pl-ba-half + .pl-ba-half { border-left: 0; border-top: 1px solid currentColor; }
  .pl-ba-stacked { flex-direction: column; }
  .pl-ba-head { width: auto; }
  .pl-ba-rowlabel { writing-mode: horizontal-tb; transform: none; }
}

/* ── Author-only hints (Trace URB-2433) ─────────────────────────────────
   The renderer is shared by the editor, shares, the PDF and the public
   gallery, and it wrote "Add a direct audio URL … in the editor" into all of
   them, so a client was told to use an editor they do not have. Hidden here by
   default; the runtime's editor-mode stylesheet (scripts/runtime-glue.js,
   injectEditorStyles) shows it, the one place an author can act on it.
   shareId cannot make this call: the editor canvas and the public gallery
   both render with shareId "preview". */
.pl-hint { display: none; }

/* ── Phone mode: the reflowed document (SPRINT-3 C1a, Trace URB-2416) ───────
   Decided in URB-1908: below 768px a treatment is a document, not a deck. Each
   section runs full width at its NATURAL height and the sections stack, so
   nothing is clipped by a 16:9 box that is 219px tall on a phone
   (research/MOBILE-AUDIT.md §1).

   767.98px, not the 780px blocks above: those still apply up to 780, as they
   always have. PORTRAIT tablets reflow too (Trace URB-2432, decided
   2026-09-28): up to 1024px wide in portrait, so iPad Pro 12.9" portrait
   (exactly 1024) is included and every landscape tablet, including iPad mini
   at 1024x768, stays a slide. All three phone-mode blocks share this query.

   `screen` because the PDF renders this same shell through Chromium, and a
   paper page can be narrower than 768 CSS px. Print keeps the slide model.

   container-type drops from `size` to `inline-size`: `size` needs a definite
   height, which a document section does not have. cqw keeps meaning "% of the
   section's width". cqh now resolves against the viewport instead of the page,
   which leaves the ~50 cqh paddings and gaps as reasonable document spacing.
   The only page-HEIGHT cqh value, --pl-min-h, has no consumer. 
   Landscape PHONES reflow too (S7-C4, URB-4694, 2026-10-29): at 844x390 the
   slide letterboxes to 693x390, and the px floors that keep copy readable no
   longer fit a slide that small — reader copy clipped on 19 of 61 templates
   (cast captions, director's notes, story beats). The clause is capped at
   500px tall AND 960px wide, so a landscape tablet (1024x768) and a short
   desktop window stay slides. */
@media screen and (max-width: 767.98px), screen and (max-width: 1024px) and (orientation: portrait), screen and (orientation: landscape) and (max-width: 960px) and (max-height: 500px) {
  /* overflow stays `hidden`: at natural height no in-flow copy can reach the
     edge, and the parallax .bg (translated on scroll) must not paint over the
     neighbouring section. The min-height is the slide this section used to be:
     layouts whose content is entirely absolute (meridian's `still`: an image
     with an overlaid caption) have no in-flow height and collapsed to 1px
     without it. Flowing content grows past it. !important because the slide
     root pins min-height to 0 with !important (see above). */
  #pitch-canvas > [data-pid] {
    width: 100%;
    aspect-ratio: auto;
    container-type: inline-size;
    min-height: calc(100vw * var(--pl-aspect-h) / var(--pl-aspect-w)) !important;
  }

  /* Page roots filled the slide's fixed box; now they wrap their content. */
  .pl-page,
  .hero, .fullbleed, .tex-section, .ty,
  .pl-cta, .pl-ba { height: auto; }

  /* The slide-fitting guards exist to clip into a fixed box. There is no fixed
     box here, so they would only ever hide copy. */
  .hero, [data-layout="hero"] > *:not(.bg):not(.pl-chrome),
  .hero-content, .pl-hero-lockup, .pl-hero-plate, .pl-hero-half-text,
  .pl-hero-behind-l, .pl-hero-behind-r,
  .pl-plate-page > *, .pl-lower, .pl-measure,
  .pl-cluster-copy, .pl-stat-plates > .pl-measure,
  .about-content > .gbox, .tex-content > .gbox,
  #pitch-canvas > [data-pid]:not(.pl-page) > *:not(.pl-chrome):not(.bg):not(.tex-bg) {
    max-height: none;
    overflow: visible;
  }

  /* Classic boards that divided a fixed page height between their rows go back
     to rows at natural height, which is what they were before the slide model. */
  [data-layout="beats"][data-variant="grid"] > div:nth-of-type(2) { grid-auto-rows: auto; }
  [data-layout="beats"][data-variant="grid"] > div:nth-of-type(2) > div,
  [data-layout="beats"][data-variant="rows"] > div:nth-of-type(2) > div,
  [data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) > div,
  [data-layout="beats"][data-variant="timeline"] > div:nth-of-type(2) > div[style*="grid-template-columns"] {
    flex: none; overflow: visible;
  }
  [data-layout="mosaic"][data-variant="strip"] > div:nth-of-type(2) > div {
    flex: none; aspect-ratio: 21 / 9;
  }

  /* `.pl-split[data-img="right"]` names its grid areas at (0,2,0), which beats
     the 780px block's `.pl-split { grid-template-areas: none }` at (0,1,0). The
     named areas force an implicit second column, the image stretches to the
     text's row height, and 4/3 turns ~800px of height into a 1067px-wide image
     (atelier dirnote/concept/look, measured). Same specificity, later file wins. */
  .pl-split[data-img] { grid-template-areas: none; }
  .pl-split-img { align-self: start; }

  /* Template rules that were right for a 16:9 page and push copy off a phone,
     each found by sweeping all 61 templates at 390px. #pitch-canvas outranks the
     templates' own inline <style>, which loads after this file. */
  /* `anywhere`, not `break-word`: only `anywhere` lowers min-content, and several
     sections are centred flex children that size to min-content (vantage's
     46px "Cinematography" held its .wrap at 508px in a 390px page). */
  /* riot sinks its titles past the page edge on purpose (`--pl-clip: -9cqh`,
     a negative margin on :root). Under inline-size, 9cqh re-bases to 9% of the
     VIEWPORT, 76px at 844, and that hid whole lines of intro copy. A document
     does not crop its type. Redefined here, it wins for every descendant. */
  #pitch-canvas { overflow-wrap: anywhere; --pl-clip: 0px; }
  #pitch-canvas .wrap { padding-inline: var(--pl-margin); max-width: 100%; } /* auric: fixed 72px gutters; vantage: 508px */
  /* Templates re-impose page height from their own inline <style>, which loads
     after this file and wins at equal specificity (riot: .pl-page.hero held at
     219px with 60px of copy below it). */
  #pitch-canvas .pl-page,
  #pitch-canvas .hero, #pitch-canvas .fullbleed,
  #pitch-canvas .tex-section, #pitch-canvas .ty { height: auto; max-height: none; }
  /* Classic sections centre their children, so a child shrink-wraps: ledger's
     `columns` section came out 180px wide at x=210. A document column is the
     full width of the page. */
  #pitch-canvas > [data-pid]:not(.pl-page) > * { align-self: stretch; }
  /* Composition pages too (C1b): ledger's stats/table page shrink-wrapped to
     165px at x=210, and with `overflow-wrap: anywhere` its min-content is
     tiny, so the table's value track collapsed to 0px and the 28px stat
     numbers spilled out of it. */
  #pitch-canvas > [data-pid].pl-page > *:not(.bg):not(.tex-bg):not(.pl-chrome) { align-self: stretch; }
  /* The section renderer writes multi-column grids as INLINE styles, e.g.
     ledger's `minmax(180px, 26%) 1fr`, which leaves ~150px for body copy at
     390. A reflowed document is one column; inline needs !important.
     Auto-fill grids already adapt, so they are left alone. */
  #pitch-canvas [data-pid] [style*="grid-template-columns"]:not([style*="auto-fill"]):not([style*="auto-fit"]) {
    grid-template-columns: 1fr !important;
  }
  #pitch-canvas .pl-split-text { margin-inline: 0; }       /* carmine card: -8cqw overlap onto the image */
  .pl-runon { overflow: visible; }                        /* apex: run-on crop cuts words at this width */
  .pl-runon > span { white-space: normal; margin-inline: 0; } /* apex/broadside chapter: nowrap + overhang ran 12px off */
  /* Grid and flex items default to min-width: auto (= min-content) and refuse to
     shrink below their longest line; envoy's rail body sat 5px wider than a
     390px page. Letting layout children shrink makes long copy wrap instead. */
  #pitch-canvas [class*="pl-"] > * { min-width: 0; }
  /* dispatch & co.: the cover copy is absolutely placed over the image
     (bottom/left in px), so the section had no in-flow height and the title
     sat 135px outside it. In flow, the section grows to hold it; the .bg is
     still absolute behind. */
  #pitch-canvas .hero-content {
    position: relative; inset: auto; max-width: none;
    margin: 6cqw var(--pl-margin);
  }

  /* Running marks are slide furniture ("Treatment by … / Date · Year"), sized
     against a page that no longer exists. A document does not carry them. */
  .pl-chrome { display: none; }
}

/* ── Phone mode: type scale (SPRINT-3 C1b, Trace URB-2417) ─────────────────
   Measured before this block, at 390px across all 61 templates: 2,323 of 4,777
   visible text elements (49%) computed under 12px, down to 1.1px, and 69 over
   40px, up to 84px. The cause is one fact from two ends: type was written in
   cqw of a 1440px page (inline, by section-renderer.ts, and in template sheets),
   or in fixed px sized for that page.

   Nearly all of it carries a field id `p-<section>-<role>`, so the scale is
   keyed on ROLE, not on template: one set of tiers, every template inherits
   it. !important because half the sizes are inline `font-size: Ncqw`.
   Line-heights are unitless everywhere (checked), so larger type cannot
   overlap. cqw here is % of the section, which is now the page width. */
@media screen and (max-width: 767.98px), screen and (max-width: 1024px) and (orientation: portrait), screen and (orientation: landscape) and (max-width: 960px) and (max-height: 500px) {
  #pitch-canvas {
    --pl-phone-title:   clamp(26px, 8.4cqw, 40px); /* ~33px at 390, 36 at 430 */
    --pl-phone-display: clamp(28px, 9cqw, 40px);   /* stat numbers, statements */
    --pl-phone-quote:   clamp(19px, 5.4cqw, 24px); /* pull quotes, leads */
    --pl-phone-sub:     clamp(16px, 4.6cqw, 19px);
    --pl-phone-body:    clamp(15px, 4cqw, 17px);
    --pl-phone-caption: 13px;
    --pl-phone-label:   12px;                      /* eyebrows, kickers, labels: usually caps + tracking */
    /* The copy measures are in ch, so they grow with the type: at 15px, 34ch
       is ~358px, wider than a 390 page's text area. .pl-margin-cols uses it
       as a grid MINIMUM (auto-fit, minmax(34ch, 1fr)) and overflowed by 20px
       (opaline). On a phone the measure is the page. */
    --pl-measure: 100%;
    --pl-measure-wide: 100%;
  }

  #pitch-canvas [id^="p-"]:is([id*="text"], [id*="-col"], [id$="-intro"], [id$="-note"],
    [id$="-overview"], [id*="-item"], [id$="-contact"], [id$="-attribution"]) {
    font-size: var(--pl-phone-body) !important;
  }
  #pitch-canvas [id^="p-"]:is([id$="-sub"], [id$="-role"]) { font-size: var(--pl-phone-sub) !important; }
  #pitch-canvas [id^="p-"]:is([id$="-quote"], [id$="-lead"]) { font-size: var(--pl-phone-quote) !important; }
  #pitch-canvas [id^="p-"][id$="-caption"] { font-size: var(--pl-phone-caption) !important; }
  #pitch-canvas [id^="p-"]:is([id$="-eyebrow"], [id$="-kicker"], [id$="label"], [id$="name"],
    [id$="-capL"], [id$="-capR"], [id$="-cap"], [id*="-sw"]),
  #pitch-canvas .vig-eye { font-size: var(--pl-phone-label) !important; }
  #pitch-canvas [id^="p-"]:is([id$="num"], [id$="-statement"]) { font-size: var(--pl-phone-display) !important; }
  #pitch-canvas [id^="p-"][id$="-title"] { font-size: var(--pl-phone-title) !important; }
  /* Titles built from spans (run-on lines, riot's stacked words) size each
     span separately; on a phone the title is one size. */
  #pitch-canvas [id^="p-"][id$="-title"] * { font-size: inherit !important; }
  /* The rest of a drop-cap line carries its own template size (overture: 9px
     inside a 21px quote). On a phone the initial is hidden (780px block), so
     the line is just the quote. */
  #pitch-canvas .pl-initial-rest { font-size: inherit !important; }
  /* Unlabelled renderer copy with a class hook: the audio empty-state hint. */
  #pitch-canvas .pl-hint { font-size: var(--pl-phone-caption) !important; }
  /* Readable type needs a readable measure. The renderer writes text columns
     as inline `max-width: Ncqw`, proportioned for a 1440 page: 29.2cqw is
     420px there and 114px on a phone, where a 31px title wraps a word per
     line. In a one-column document the page margin is the measure. */
  #pitch-canvas [data-pid] [style*="max-width"][style*="cqw"] { max-width: none !important; }
  /* Overlay copy the renderer places with inline position:absolute (the
     `still` caption: bottom-left over the image) had no in-flow height, so at
     phone size it outgrew its section by up to 155px (envoy). In flow, the
     section grows to hold it; the image stays absolute behind. :has() keys
     this to boxes that hold fields, not decorative layers. */
  #pitch-canvas [data-pid] [style*="position:absolute"]:has([id^="p-"]) {
    position: relative !important; inset: auto !important;
    margin: var(--pl-margin);
  }
  /* Not scaled on purpose: [aria-hidden] ghost numerals (beat and chapter
     "01"s) are ornaments that duplicate the order. They are not reader text,
     and they do not overflow (C1a sweep). */
}

/* Landscape phones (S7-C4): the tiers above scale with the page WIDTH, which is
   844-932px here, so titles hit the 40px cap while a composition that keeps its
   columns gives them a ~130px column — signal's chapter title broke mid-word
   onto three lines. Scaled to what a 430 portrait phone gets instead. */
@media screen and (orientation: landscape) and (max-width: 960px) and (max-height: 500px) {
  #pitch-canvas {
    --pl-phone-title:   clamp(24px, 3.3cqw, 30px);
    --pl-phone-display: clamp(26px, 3.6cqw, 32px);
  }
}

/* ── Phone mode: template nav (SPRINT-3 C1c, Trace URB-2418) ───────────────
   At 390px, folio's nav ran to x=1447 with 9 of 12 destinations off-screen,
   meridian's widened the layout viewport to 408px, and ledger's 210px fixed
   side rail left the document a 165px column (research/MOBILE-AUDIT.md §4;
   C1a/C1b logs).

   Surveyed all 61 shells first: every one has exactly one bare <nav> holding
   a brand (.nav-brand ×56, .nav-logo ×4) and ul.nav-links, which the runtime
   fills (#pitch-nav-links). geometos's .nav-trigger is a static label, not a
   script. Given markup that uniform, a single-row horizontal scroller is the
   robust choice: no script enters the shell (C2.1's rule), nothing to keep in
   sync with a menu state, and it works the same in all 61.

   `html body nav …` because the templates style `nav` / `.nav-links` in their
   own inline <style>, which loads after this file. */
@media screen and (max-width: 767.98px), screen and (max-width: 1024px) and (orientation: portrait), screen and (orientation: landscape) and (max-width: 960px) and (max-height: 500px) {
  :root:has(script[data-template="ledger"]) { --pl-side-chrome: 0px; } /* the rail is a top bar here */
  html body nav {
    top: 0; left: 0; right: 0; bottom: auto;
    width: 100%; max-width: 100vw; height: auto; min-height: 48px;
    display: flex; flex-direction: row; flex-wrap: nowrap;
    align-items: center; justify-content: flex-start; gap: 8px;
    padding: 0 0 0 16px; box-sizing: border-box;
    overflow: hidden; /* the row scrolls; the bar never widens the page */
  }
  html body nav > :not(.nav-links):not(#pitch-nav-links) { flex: 0 0 auto; }
  html body nav :is(.nav-brand, .nav-logo) {
    max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* :is() with the id: ledger styles `.nav-links, #pitch-nav-links` as a
     column, and an id outranks any class chain. 50 shells also carry a
     fleet-wide `nav .nav-links` scroller from 51828d4, capped at 68vw; this
     complements it and lets the row take whatever the brand leaves. */
  html body nav :is(.nav-links, #pitch-nav-links) {
    flex: 1 1 auto; min-width: 0; max-width: none; height: auto;
    display: flex; flex-direction: row; flex-wrap: nowrap; gap: 0;
    margin: 0; padding: 0 12px 0 0;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    /* A soft fade at the right edge says "there is more" without a scrollbar. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  html body nav :is(.nav-links, #pitch-nav-links)::-webkit-scrollbar { display: none; }
  html body nav :is(.nav-links, #pitch-nav-links) > li { flex: 0 0 auto; list-style: none; }
  html body nav :is(.nav-links, #pitch-nav-links) a {
    display: flex; align-items: center;
    min-height: 44px; padding: 0 10px; /* 44px tap target */
    font-size: 12px; white-space: nowrap;
  }

  /* ledger's side rail: the only one of 61. It becomes the same top row, and
     the content stops reserving the rail's width. Both at once, or the
     content slides under a fixed 210px rail. */
  html body nav .rail-foot { display: none; }
  /* geometos's nav ornaments (a label, two rules and a static "Index") left
     the scrolling row 110px, narrower than one "Director's Note" link. */
  html body nav :is(.nav-lbl, .nav-line, .nav-trigger) { display: none; }
  /* A jump lands the section under the fixed 48–54px bar (measured: folio
     #music at top 0). Leave room for it. */
  #pitch-canvas > [data-pid] { scroll-margin-top: 56px; }
  html body #pitch-canvas, html body footer { margin-left: 0; }
}
