/* ==========================================================================
   project-detail.css
   The drawing-set layout for the 25 project detail pages. Template E1.

   Loaded by projects/*.html AFTER ../styles.css. Deliberately NOT merged into
   styles.css: that file is shared by every page on the site, so anything added
   there propagates to writing / travels / pictures / explore / archive / 404
   and the homepage. This is needed by the project pages only, so it lives with
   them.

   It reuses styles.css tokens (:root) and its shared chrome (.site-header,
   .crumb, .project-section-nav, .site-footer, .project-detail-nav). Everything
   declared here is scoped under .cs-* (the sheet set) or .pl-* (a plate).

   THE IDEA. A project page is a drawing SET. One sheet per section, each sheet
   headed SHEET nn OF nn / SUBJECT, and every image is a numbered PLATE with a
   title block strip under it. There is no drawing furniture for its own sake:
   no zone markings, no corner brackets, no repeated foot title block, no
   revision table. What varies sheet to sheet is the COMPOSITION, a two-column
   cover, a full-width text sheet, plates two or three up, because that variety
   is what keeps eight sheets from reading as one template.

   Three numbers carry the brief: the gutter between the left and right columns
   (up to 6.5rem), the measure of the body copy (66ch at 1.78), and the quiet
   around each sheet.

   Type is limited to the six :root tiers. Mono chrome is --fs-micro when it is
   inert and --fs-label only when it is pressable. A box means you can press it,
   and the only boxed things on a page are the plates (a drawing field is the
   established exception) and the source links.

   The markup is generated by tools/build_project_pages.py, which chooses the
   column layout of each sheet from how many images that section carries. After
   it has run the HTML is the source of truth and is hand-editable, which is how
   the rest of this site works.
   ========================================================================== */

.cs-main {
    /* Sheet padding, and the one number that carries the brief: the left/right
       separation. */
    --pad: clamp(1.1rem, 3vw, 3.2rem);
    --gutter: clamp(1.8rem, 6vw, 6.5rem);
    padding-top: var(--header-height);
    background: var(--bg-deep);
    /* clip, not hidden: hidden would make this a scroll container and break
       the sticky section nav. */
    overflow: clip;
}

.cs-main [id] { scroll-margin-top: calc(var(--header-height) + 4.6rem); }

/* --- Breadcrumb bar ----------------------------------------------------- */

.cs-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1.5rem;
    padding: 0.8rem var(--page-pad);
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.cs-topbar .crumb { margin: 0; }

/* One piece of metadata, not four. */
.cs-topbar-meta {
    margin: 0;
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    letter-spacing: 0.13em;
    text-transform: uppercase;
}
.cs-topbar-meta b { color: var(--ink); font-weight: 700; }

/* --- The sheet ---------------------------------------------------------- */

.cs-set {
    display: grid;
    gap: clamp(0.9rem, 2vw, 1.6rem);
    padding: clamp(0.9rem, 2vw, 1.6rem) var(--page-pad) clamp(2.5rem, 5vw, 4.5rem);
}

/* One hairline. No inner frame, no registration brackets, no zone strip. The
   sheet reads as paper on a table because the page behind it is --bg-deep. */
.cs-sheet {
    width: 100%;
    max-width: 92rem;
    margin-inline: auto;
    padding: var(--pad);
    border: 1px solid var(--line);
    background: var(--bg);
}

/* .cs-set is a grid, so every sheet is a grid ITEM, and a grid item's default
   min-width is auto, which resolves to min-content. Anything inside a sheet
   that refuses to shrink below a certain width - a table, most obviously -
   therefore widens the whole sheet past the viewport, and .cs-main's
   overflow:clip then HIDES that overflow rather than scrolling it, so the last
   column of the table becomes unreachable instead of merely cramped. Pinning
   the floor at 0 down the whole chain is what lets each block's own overflow
   rule do the scrolling, which is what .cs-table-wrap is for. */
.cs-sheet,
.cs-read,
.cs-split,
.cs-cover,
.cs-stack,
.cs-body { min-width: 0; }

/* Scoped with .cs-main purely for specificity: .pl and .cs-facts both reset
   their own margin further down the file, and at equal specificity the later
   rule would win and collapse the gap above every plate. */
.cs-main .cs-sheet > * + * { margin-top: clamp(1.7rem, 3.6vw, 3.2rem); }

/* --- Sheet header: the one piece of chrome that stayed ------------------ */

.cs-id {
    margin: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.cs-id b { color: var(--ink); font-weight: 700; }
.cs-id i { margin: 0 0.55rem; font-style: normal; }

/* --- Headings ----------------------------------------------------------- */

.cs-sheet h1 {
    margin: 0;
    font: 900 var(--fs-display)/0.84 var(--display);
    letter-spacing: -0.062em;
    text-transform: uppercase;
}

.cs-sheet h2 {
    margin: 0;
    font: 900 var(--fs-section)/0.96 var(--display);
    letter-spacing: -0.042em;
    text-transform: uppercase;
    text-wrap: balance;
}

.cs-sheet h1 em,
.cs-sheet h2 em { color: var(--signal); font-style: normal; }

/* --- Sheet 01 cover ----------------------------------------------------- */

.cs-cover {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: var(--gutter);
    align-items: start;
}

.cs-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.5rem;
    margin: 0 0 1rem;
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.cs-kicker b { color: var(--ink); font-weight: 700; }

.cs-deck {
    max-width: 54ch;
    margin: clamp(1.4rem, 2.6vw, 2.2rem) 0 0;
    color: var(--ink);
    font-size: var(--fs-body);
    line-height: 1.7;
}

/* --- Reading layout ----------------------------------------------------- */

/* Heading in its own column, copy in its own column, a very wide gutter
   between them. This and .cs-split are the only two text arrangements on the
   page, which is the point. */
.cs-read {
    display: grid;
    grid-template-columns: minmax(0, 0.76fr) minmax(0, 1fr);
    gap: var(--gutter);
    align-items: start;
}

.cs-body { max-width: 66ch; }

.cs-body p {
    margin: 0 0 1.25em;
    color: var(--muted-light);
    font-size: var(--fs-body);
    line-height: 1.78;
}
.cs-body p:first-child { color: var(--ink); }
.cs-body p:last-child { margin-bottom: 0; }

/* Subheads, for the rare section long enough to need skimming. Stays inside
   the three heading tiers at --fs-block. */
.cs-body h3 {
    margin: 2.2rem 0 0.8rem;
    color: var(--ink);
    font: 900 var(--fs-block)/1.05 var(--display);
    letter-spacing: -0.03em;
    text-transform: uppercase;
}
.cs-body > *:first-child { margin-top: 0; }

.cs-body strong { color: var(--ink); font-weight: 700; }

/* A filename, a path, a flag. It steps up to --ink exactly like strong does,
   because that is already this sheet's move for "the eye should stop here", and
   it changes typeface to mono, which is the site's inert-data voice. NO box: a
   border or tinted pill would read as pressable, and a run of prose must never
   promise that. Sized in em, not a --fs- token, because this is an optical
   correction rather than a new tier - mono runs large at a shared nominal size,
   and em is what lets one rule sit correctly inside the deck (--fs-body), the
   facts list (--fs-small) and a pull quote (--fs-block) at once. No padding or
   background, so the 1.78 line rhythm is untouched. */
.cs-body code,
.cs-deck code,
.cs-facts dd code {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

/* A backticked link label keeps the link's colour, so --ink cannot quietly
   strip a .text-link of its affordance. */
.cs-body a code,
.cs-deck a code,
.cs-facts dd a code { color: inherit; }

/* A list is a list, not a set of boxes. The arrow is the only ink it gets. */
.cs-body ul {
    display: grid;
    gap: 0.6rem;
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.cs-body li {
    position: relative;
    padding-left: 1.6rem;
    color: var(--muted-light);
    font-size: var(--fs-body);
    line-height: 1.7;
}

.cs-body li::before {
    position: absolute;
    left: 0;
    color: var(--signal);
    content: "\2192";
}

/* A pulled claim. Inert, so no box: it earns emphasis from the rule and the
   size instead. */
.cs-pull {
    max-width: 30ch;
    margin: 1.8rem 0;
    padding-left: 1.2rem;
    border-left: 2px solid var(--signal);
    color: var(--ink);
    font: 650 var(--fs-block)/1.35 var(--display);
    letter-spacing: -0.015em;
}

/* Media one side, heading over copy the other. Same gutter, and the text
   column is given the larger share so the measure survives the split. */
.cs-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    gap: var(--gutter);
    align-items: start;
}

.cs-main .cs-stack > * + * { margin-top: clamp(1.2rem, 2.4vw, 2rem); }

/* --- Schedules, as label and value. No item numbers, no header row. ------ */

.cs-facts-title {
    margin: 0 0 0.55rem;
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.cs-facts-title b { color: var(--ink); font-weight: 700; }

.cs-facts {
    margin: 0;
    border-top: 2px solid var(--ink);
}
.cs-facts > div {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: 0.3rem 1.3rem;
    padding: 0.7rem 0 0.8rem;
    border-bottom: 1px solid var(--line);
}
.cs-facts dt {
    color: var(--muted);
    font: 700 var(--fs-micro)/1.75 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.cs-facts dd {
    margin: 0;
    color: var(--ink);
    font-size: var(--fs-small);
    line-height: 1.55;
}
/* The whole raspberry budget of the page: the one row that records what is
   NOT known. At most one per page, so it stays a signal. */
.cs-facts .is-alert dt,
.cs-facts .is-alert dd { color: var(--raspberry); }

/* Three columns of label over value, for a schedule that is neither one column
   nor two. Not emitted by the generator; here because the pages are
   hand-editable and a schedule sometimes wants it. */
.cs-facts--3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: clamp(1.2rem, 3.5vw, 3.4rem);
}
.cs-facts--3 > div { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }

/* --- Schedules that are wider than label and value ---------------------- */

/* There was no table anywhere on this site before this block, so the house
   style for one is set here. A table is INERT data: hairlines, no fill, no
   hover, no border box. That is the same rule the rest of the page runs on, a
   box means you can press it, and it is why the parts cards further down look
   boxed and this does not.

   .cs-facts stays what it is: the five-row schedule beside the title. This is
   for the rest, where the data has three columns and a <dl> would lie about
   its shape. */

.cs-table-wrap {
    /* A wide table scrolls inside itself. The page body never scrolls
       sideways, which is the one thing a table can break on a phone. */
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
    border-top: 2px solid var(--ink);
    color: var(--ink);
    font-size: var(--fs-small);
    text-align: left;
}

.cs-table th {
    padding: 0.65rem 1.4rem 0.6rem 0;
    border-bottom: 1px solid var(--line-strong);
    color: var(--muted);
    font: 700 var(--fs-micro)/1.75 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
}

.cs-table td {
    /* Tabular figures are the entire reason to draw a table rather than write
       a list: a column of numbers has to line up to be compared. */
    padding: 0.7rem 1.4rem 0.75rem 0;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
    line-height: 1.55;
    vertical-align: baseline;
}

.cs-table :is(th, td):last-child { padding-right: 0; }

/* Column one names the row, so it anchors it. Weight only: no mono, no
   uppercase and no nowrap, because a parameter name can be a short sentence
   and none of those three survive one. */
.cs-table td:first-child { font-weight: 650; }

/* Same convention as .cs-facts .is-alert, and the same discipline: the
   raspberry is spent only on recording what is NOT known, so an unmeasured
   cell reads as a hole in the record rather than a value someone forgot. */
.cs-table .is-alert { color: var(--raspberry); }

.cs-table caption {
    margin-bottom: 0.6rem;
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    letter-spacing: 0.18em;
    text-align: left;
    text-transform: uppercase;
}
.cs-table caption b { color: var(--ink); font-weight: 700; }

/* --- Plates ------------------------------------------------------------- */

/* A column, so that plates sharing a row can be the same height without one of
   them showing a bare strip under its title block: the caption field takes up
   the slack instead, which is what an oversized note box looks like on paper. */
.pl {
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 0;
    border: 1px solid var(--line);
    background: var(--bg);
    isolation: isolate;
}

/* The registration tick the index plates carry, kept at rest so it works on a
   phone. Decorative, so it never eats a click. */
.pl::after {
    position: absolute;
    z-index: 3;
    top: 0;
    right: 0;
    width: 0.8rem;
    height: 0.8rem;
    border-top: 1px solid var(--signal);
    border-right: 1px solid var(--signal);
    content: "";
    opacity: 0.6;
    pointer-events: none;
}

.pl-field {
    position: relative;
    flex: 0 0 auto;
    aspect-ratio: var(--ar, 16 / 9);
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: var(--bg-deep);
}
.pl-field img,
.pl-field video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--fit, cover);
    /* --zoom pushes a render that sits in an empty viewport out to the edges of
       the plate. Hand-applied only, and only where nothing gets cut. */
    transform: scale(var(--zoom, 1));
}

/* A plate whose field ratio was set by the ROW it sits in rather than by its
   own picture. Contain, so the odd one out is letterboxed onto the field
   colour rather than cropped. Below 760px the row is one column again and the
   plate gets its own --ar-sm back, at which point contain fills exactly. */
.pl--fit { --fit: contain; }

/* Schematic and drawing exports: shown whole on their own paper colour, never
   cropped. Any letterbox lands on the cream the export was drawn on, so it
   reads as sheet margin rather than as a gap. */
.pl--doc { --fit: contain; }
.pl--doc .pl-field { max-height: min(70svh, 46rem); background: var(--paper); }

/* Renders whose backdrop was keyed out in the media build. There is no
   background left to crop into, so cover would bite into the subject itself.
   The field colour showing through the transparency IS the intended look: the
   board sits on the sheet the way the line drawings do. */
.pl--cut { --fit: contain; }

/* A portrait plate is a NARROW plate. Left at full sheet width a 3:4 photograph
   is over 1500px tall, and cropping it to landscape throws away half the
   picture, so the plate itself gets narrower instead and the picture stays
   whole. --pl-max is computed per plate from the real aspect ratio so every
   tall plate lands at about the same height. */
.pl--tall {
    max-width: min(100%, var(--pl-max, 32rem));
    margin-inline: auto;
}

/* Title block strip, three fields: plate number, title, view. Hairlines are the
   1px grid gap, so the wrap needs no first-child border bookkeeping. */
.pl-tb {
    display: grid;
    flex: 0 0 auto;
    /* All three tracks can shrink: with a fixed `auto` on the view cell a
       long label ate the title's track and clipped it. */
    grid-template-columns: auto minmax(0, 1fr) minmax(0, auto);
    gap: 1px;
    background: var(--line);
}
.pl-cell {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
    padding: 0.5rem 0.8rem 0.55rem;
    background: var(--bg);
}
.pl-cell > span {
    color: var(--muted);
    font: 700 var(--fs-micro)/1 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.pl-cell > b {
    color: var(--ink);
    font: 800 var(--fs-small)/1.2 var(--display);
    letter-spacing: -0.005em;
    text-transform: uppercase;
    overflow-wrap: break-word;
}

/* The caption says only what the title block does not. It is always drawn, even
   when there is nothing to add, because it is the field that evens a row out. */
.pl-cap {
    flex: 1 1 auto;
    margin: 0;
    padding: 0.6rem 0.8rem 0.7rem;
    border-top: 1px solid var(--line);
    color: var(--muted-light);
    font-size: var(--fs-small);
    line-height: 1.55;
}

/* --- Plate rows --------------------------------------------------------- */

.cs-2up {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.9rem, 2vw, 1.5rem);
}

/* Three up is the tightest row on the site. It is what a sheet gets when the
   section carries three or more pictures, and the trade is that each plate is
   about a third of the sheet, so the title block cannot stay on one line. */
.cs-3up {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(0.9rem, 2vw, 1.5rem);
}

/* Title over a two-field footer rather than three fields across. Nothing is
   dropped, it just wraps, which is what keeps a 22rem plate legible. */
.cs-3up .pl-tb { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cs-3up .pl-cell--title { grid-column: 1 / -1; order: -1; }

/* A figure placed inside the copy column by a [[media:]] or [[row:]] directive
   rather than by the sheet layout. */
.cs-body > .pl,
.cs-body > .cs-2up,
.cs-body > .cs-3up { margin: 1.8rem 0; }

/* Dimension callout, for a plate whose real dimensions are on the record.
   Hand-applied: the generator has no dimensions to draw. */
.pl-dim {
    position: absolute;
    z-index: 2;
    color: var(--ink);
    font: 700 var(--fs-micro)/1 var(--mono);
    letter-spacing: 0.1em;
}
.pl-dim::before,
.pl-dim::after { position: absolute; background: currentColor; content: ""; }
.pl-dim span {
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 0.18rem 0.4rem;
    background: var(--bg);
    white-space: nowrap;
}
.pl-dim--x { height: 1px; background: currentColor; }
.pl-dim--x::before,
.pl-dim--x::after { top: -4px; width: 1px; height: 9px; }
.pl-dim--x::before { left: 0; }
.pl-dim--x::after { right: 0; }
.pl-dim--x span { transform: translate(-50%, -50%); }
.pl-dim--y { width: 1px; background: currentColor; }
.pl-dim--y::before,
.pl-dim--y::after { left: -4px; width: 9px; height: 1px; }
.pl-dim--y::before { top: 0; }
.pl-dim--y::after { bottom: 0; }
.pl-dim--y span { transform: translate(-50%, -50%) rotate(-90deg); }

/* --- The unissued plate -------------------------------------------------- */

/* A DESIGNED state, not a broken placeholder. Same vocabulary as
   .plate-field--empty on the projects index: ruled grid, cut diagonal, stamped
   REF. It says "this drawing has not been issued yet", which is true and
   deliberate, rather than looking like a failed image load. Naming the file it
   is waiting for is what makes filling it cheap: the page says exactly what to
   drop in. */

.pl--empty { border-style: dashed; }
.pl--empty::after { opacity: 0.35; }

.pl-field--empty {
    display: grid;
    place-items: center;
    /* width is stated because max-height plus an aspect ratio would otherwise
       shrink the field sideways to keep the ratio, leaving the ruled grid short
       of the plate edge. Here the ratio is a floor for narrow screens only. */
    width: 100%;
    aspect-ratio: var(--ar, 21 / 9);
    max-height: 26rem;
    background:
        repeating-linear-gradient(0deg, transparent 0 19px, var(--line) 19px 20px),
        repeating-linear-gradient(90deg, transparent 0 19px, var(--line) 19px 20px),
        var(--bg-deep);
}

.pl-field--empty::before {
    position: absolute;
    inset: 0;
    background: linear-gradient(103deg, transparent 49%, var(--line) 49% 49.5%, transparent 49.5%);
    content: "";
}

.pl-stamp {
    position: relative;
    display: grid;
    gap: 0.5rem;
    justify-items: center;
    padding: 0.9rem 1.1rem;
    box-shadow: 0 0 0 1px var(--line);
    background: var(--bg-deep);
    text-align: center;
}

.pl-stamp b {
    color: var(--muted);
    font: 700 var(--fs-body)/1 var(--mono);
    letter-spacing: 0.2em;
}

.pl-stamp span {
    max-width: 30ch;
    color: var(--muted);
    font: 700 var(--fs-micro)/1.6 var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pl-stamp code {
    max-width: 34ch;
    color: var(--muted);
    font: 400 var(--fs-micro)/1.5 var(--mono);
    opacity: 0.7;
    overflow-wrap: anywhere;
}

/* --- Video plates -------------------------------------------------------- */

/* At most one autoplaying loop per page, marked data-autoplay; everything else
   is click to play. Under reduced motion nothing autoplays and the poster
   stands in, so the page still reads as a set of stills. app.js drives this
   against .pd-video and .pd-video-play, which is why those two class names
   survive the move to plate vocabulary. */

.pd-video-play {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: grid;
    place-items: center;
    border: 0;
    background: rgba(17, 20, 24, 0.28);
    color: #fff;
    cursor: pointer;
    font: 700 var(--fs-label)/1 var(--mono);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transition: background 300ms var(--ease-out);
}

.pd-video-play span {
    padding: 0.75rem 1.1rem;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
    background: rgba(17, 20, 24, 0.55);
}

.pd-video-play:hover,
.pd-video-play:focus-visible { background: rgba(17, 20, 24, 0.12); }

.pd-video.is-playing .pd-video-play { display: none; }

.pd-video .pd-video-poster {
    position: absolute;
    display: none;
    inset: 0;
}

/* --- Diagram plates ------------------------------------------------------ */

/* A diagram is a PLATE, not a new kind of object. It gets the same field, the
   same three-cell title block, the same number in the PL-nn run and the same
   place in a .cs-2up row as a photograph does. Only the contents of the field
   differ, inline SVG instead of an <img>, which is why this is a handful of
   rules and not a layout.

   The stroke vocabulary is the one the exploded assembly on the homepage
   already uses: .cd-line is the outline, .cd-thin is interior detail, .cd-lead
   is a leader out to a label, .cd-dash is a centreline or a path that does not
   exist yet, .cd-label is the text. styles.css scopes its copy of those names
   under .assembly-svg / .e30-svg, so there is no collision here: one vocabulary
   sitewide, two scopes, and no edit to the shared stylesheet. */

.pl--dwg .pl-field {
    aspect-ratio: var(--ar, 16 / 7);
    max-height: min(64svh, 40rem);
    padding: clamp(1rem, 3vw, 2.4rem);
    background: var(--paper);
}

.pl--dwg svg {
    width: 100%;
    height: 100%;
    /* The drawing is authored to its viewBox; letting it letterbox inside the
       field is what keeps a wide block diagram legible on a narrow sheet. */
    overflow: visible;
    color: var(--ink);
}

/* Stroke weight scales WITH the drawing, deliberately. The labels inside these
   SVGs are 9px and 7.5px in user units, so they already scale when the plate
   letterboxes; pinning the lines to device pixels instead (vector-effect:
   non-scaling-stroke, which this block used to carry) made the line-to-type
   relationship drift with the viewport, and it broke the draw-in outright: a
   pathLength-normalised dash gets measured against the device-space path, which
   is a different length, so no shape ever finished. A drawing scales as a
   drawing. */
.pl--dwg :is(.cd-line, .cd-thin, .cd-dash, .cd-lead) {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.pl--dwg .cd-thin { stroke-width: 0.8; opacity: 0.55; }
.pl--dwg .cd-dash { stroke-width: 0.8; stroke-dasharray: 5 5; opacity: 0.4; }
.pl--dwg .cd-lead { stroke-width: 0.8; opacity: 0.45; }

.pl--dwg .cd-label {
    fill: currentColor;
    font: 700 9px var(--mono);
    letter-spacing: 0.07em;
}
.pl--dwg .cd-label--sub { fill: var(--muted); font-size: 7.5px; }

/* One accent per drawing, on the one path that carries the point. Same budget
   as the raspberry row in a schedule: it only reads as emphasis while it stays
   rare. */
.pl--dwg .cd-line--key { stroke: var(--signal); stroke-width: 1.7; }
.pl--dwg .cd-label--key { fill: var(--signal); }

/* Strokes draw themselves in when the plate first scrolls into view, off the
   generic [data-reveal] observer already in app.js. pathLength="1" normalises
   every shape to one unit long, so a single dasharray hides all of them
   whatever their real length. All 497 shapes across the 16 drawings carry it.

   Two things here are load-bearing, and both were how every drawing on the site
   came to be stuck half-finished: boxes drawn as two of their four sides,
   arrowheads floating off the end of their shafts, leaders stopping in mid-air.

   The reveal is keyed on the SHAPE ELEMENTS, not on a [pathLength] attribute
   selector. CSS lower-cases attribute names in selectors, SVG keeps its camel
   case, and the two rules below did not survive that round trip the same way:
   the rule that hides the strokes matched and the rule that brings them back
   did not. Same selector shape .console-drawing uses in styles.css.

   And the draw-in is an ANIMATION, not a transition, so the dash exists only
   while it runs. At rest the geometry carries no dash at all, which is what
   makes a finished drawing independent of dash arithmetic rather than hostage
   to it. */
.js .pl--dwg[data-reveal] :is(path, line, polyline, polygon, rect, circle, ellipse) {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}
.js .pl--dwg[data-reveal] text { opacity: 0; }
.js .pl--dwg.is-visible :is(path, line, polyline, polygon, rect, circle, ellipse) {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: cd-draw 900ms var(--ease-in-out);
}

/* The centreline dash, re-asserted: the reveal rules above outrank
   `.pl--dwg .cd-dash`, so a path that does not exist yet drew solid. The argus
   caption promises a bypass "drawn dashed" and it was a plain line. */
.js .pl--dwg.is-visible .cd-dash { stroke-dasharray: 5 5; }

@keyframes cd-draw {
    from { stroke-dasharray: 1; stroke-dashoffset: 1; }
    to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}
.js .pl--dwg.is-visible text { opacity: 1; transition: opacity 400ms ease 650ms; }

/* --- Parts: the projects that are more than one project ------------------ */

/* Some projects are two bodies of work wearing one name. Gray is a robot that
   was designed and built with someone else in 2021, and a walking policy being
   trained alone in simulation since 2026. Presented as one page, neither half
   gets credit and a reader cannot tell where the seam is. So the seam is drawn:
   the parent page carries the arrangement, the schedule and the diagram, and
   hands off here.

   These cards ARE pressable, so they get the box. That is the whole rule, and
   it is why the schedule above has hairlines instead of one. */

.cs-parts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: clamp(0.8rem, 1.8vw, 1.3rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.cs-part {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.15rem 1.25rem 1.25rem;
    border: 1px solid var(--line-strong);
    background: var(--bg);
    transition: border-color 200ms ease;
}
.cs-part:hover,
.cs-part:focus-within { border-color: var(--signal); }

.cs-part-ref {
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.cs-part-ref b { color: var(--ink); font-weight: 700; }

.cs-part h3 {
    margin: 0;
    color: var(--ink);
    font: 650 var(--fs-block)/1.16 var(--display);
    letter-spacing: -0.02em;
}
/* The whole card is the hit target, struck from the heading link so the
   accessible name stays the part title. Same device the index plates use. */
.cs-part h3 a::after { position: absolute; inset: 0; content: ""; }
.cs-part h3 a:focus-visible { outline: none; }
.cs-part:focus-within { outline: 2px solid var(--signal); outline-offset: 2px; }

.cs-part p {
    margin: 0;
    color: var(--muted-light);
    font-size: var(--fs-small);
    line-height: 1.6;
}

.cs-part-meta {
    margin-top: auto;
    padding-top: 0.9rem;
    color: var(--muted);
    font: 700 var(--fs-micro)/1.5 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.cs-part-meta b { color: var(--signal); font-weight: 700; }

/* --- Source links -------------------------------------------------------- */

.cs-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cs-link {
    display: inline-flex;
    align-items: baseline;
    gap: 0.6rem;
    max-width: 100%;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--line-strong);
    color: var(--ink);
    font: 700 var(--fs-label)/1.5 var(--mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 200ms ease, border-color 200ms ease;
}
.cs-link:hover,
.cs-link:focus-visible { border-color: var(--signal); color: var(--signal); }
.cs-link i { color: var(--signal); font-style: normal; }

/* --- Responsive --------------------------------------------------------- */

/* Two fold points, because the two arrangements run out of room at different
   widths. A .cs-split puts the copy in half a sheet, so it hits the bottom of
   a 62ch measure first and folds early. A .cs-read gives the copy the larger
   track and holds two columns down to 1080. Both are folded well before 900. */
@media (max-width: 1240px) {
    .cs-split { grid-template-columns: minmax(0, 1fr); }
    .cs-main .cs-split > * + * { margin-top: clamp(1.4rem, 3.4vw, 2.4rem); }
}

@media (max-width: 1080px) {
    .cs-cover,
    .cs-read { grid-template-columns: minmax(0, 1fr); }
    .cs-main .cs-cover > * + *,
    .cs-main .cs-read > * + * { margin-top: clamp(1.4rem, 3.4vw, 2.4rem); }
    .cs-body { max-width: 68ch; }
    .cs-facts--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    /* Two boards side by side at this width are too small to compare, so they
       stack at full plate size instead. Three up has further to fall, so it
       drops to two first and only stacks at 760. */
    .cs-2up { grid-template-columns: minmax(0, 1fr); }
    .cs-3up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pl--doc .pl-field { max-height: none; }
}

@media (max-width: 600px) {
    body.pd-stage { --gut: max(5vw, 1rem); }
}

@media (max-width: 760px) {
    .cs-main { --pad: 1rem; }
    .cs-sheet { border-inline: 0; margin-inline: calc(var(--page-pad) * -1); width: auto; }
    .cs-3up { grid-template-columns: minmax(0, 1fr); }
    /* One plate per row again, so each one gets its own ratio back and the
       contained ones fill their field exactly. */
    .pl-field { aspect-ratio: var(--ar-sm, var(--ar, 16 / 9)); }
    .pl--tall { max-width: 100%; }
    .cs-facts > div,
    .cs-facts--3 { grid-template-columns: minmax(0, 1fr); }
    .cs-facts > div { gap: 0.35rem; }
    /* The table keeps its columns and scrolls inside its wrapper instead of
       folding: a spec row read as a stack of labels stops being comparable,
       which was the only reason to draw it as a table. */
    .cs-table { font-size: 0.8rem; }
    .cs-table :is(th, td) { padding-right: 1rem; }

    /* A diagram cannot compress the way a table can. A table reflows, so it
       stays readable at any width; an SVG scales uniformly, so at 324px a 9px
       label lands at four and a half and the drawing becomes a grey strip. So
       below this width it stops scaling and starts panning, holding a size
       where the labels are still type. Same bargain the wide table makes. */
    .pl--dwg .pl-field {
        aspect-ratio: auto;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        padding: 1rem;
    }
    .pl--dwg svg {
        width: 620px;
        min-width: 620px;
        height: auto;
    }
}

@media (max-width: 620px) {
    .pl-tb { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pl-cell--title { grid-column: 1 / -1; order: -1; }
}

@media print {
    .pl,
    .cs-sheet { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
    .cs-link,
    .cs-part,
    .pd-video-play { transition: none; }

    /* app.js marks everything visible immediately under reduced motion, so the
       drawing is already complete here; killing the transition is what stops it
       animating to a state it is in. */
    .js .pl--dwg.is-visible :is(path, line, polyline, polygon, rect, circle, ellipse),
    .js .pl--dwg.is-visible text { transition: none; animation: none; }

    .pd-video video { display: none; }
    .pd-video .pd-video-poster { display: block; }
}

/* ==========================================================================
   THE STAGE
   The 2026 project-detail redesign, generated by tools/build_project_pages.py.

   A project page stopped being a sheaf of bordered sheets and became a
   theatre: a full-bleed hero, one strip of facts, then copy bands alternating
   with runs of photographs butted edge to edge on a hairline. Nothing sits on
   top of a picture except the hero copy and the closing card, and both of
   those have a scrim under them.

   EVERYTHING BELOW IS SCOPED. The theatre classes are all .pd-*, and every
   override of a SHARED component (.site-header, .site-footer, .crumb,
   .project-detail-nav) is scoped under body.pd-stage, which the generator
   emits. Without that scoping a change here would silently repaint the header
   on writing / travels / pictures / explore, which share those components and
   do not load this file's body class.

   THE COLOUR MODEL, three groups, and the split is the whole mechanism:
     :root                      what never flips. Text that sits ON a
                                photograph is white on a scrim in BOTH themes,
                                because the thing behind it is a picture, not
                                the page. Getting this wrong is how the light
                                theme first shipped an unreadable closing line.
     :root, [data-theme=dark]   the dark palette, which is the default.
     [data-theme=light]         the site's own paper and ink, with --signal
                                back to the true #bf5700 because it needs no
                                lifting on a light ground.
   Dark is the design and therefore the default, and prefers-color-scheme is
   deliberately NOT consulted: a reader on a light desktop still gets the page
   as it was drawn. The header carries a Light / Dark button and the choice
   persists in localStorage["ieb-pd-theme"].

   body.pd-stage then REMAPS the site tokens (--ink, --bg, --line, --signal,
   --muted ...) onto the stage palette. That is what recolours the shared
   header, footer and breadcrumb without a rule per property, and it is why
   only a handful of explicit overrides follow.
   ========================================================================== */

:root {
    /* Ibrahim asked for at least 10 percent clear on each side of a project
       page, so the gutter is now a floor of 10vw rather than a clamp that
       topped out at 2.9rem. At 1440 that is 144px a side instead of 46. The
       photo runs inset with it: full bleed was the old behaviour and it is what
       the 10 percent rule is overriding. Below 600px the floor drops to 5vw,
       because 10 percent of a 390px phone is 39px a side and a three-up run of
       photographs has nothing left to render into. */
    --gut: max(10vw, 1.15rem);

    /* On a photograph, in both themes. */
    --on-photo: #ece7dc;
    --on-photo-dim: #c6bfb2;
    /* The accent on a photograph is always the lifted one: the true #bf5700
       carries only about 3.5:1 against the closing card's scrim. */
    --on-photo-signal: #e06a12;
}

:root,
:root[data-theme="dark"] {
    --stage: #13110f;          /* a step under the darkest pixel in the photographs */
    --stage-lift: #1b1816;
    --rope: #ece7dc;
    --rope-dim: #a9a294;
    --dust: #948d80;           /* was #7e776b, which is 3.99:1 on --stage-lift */
    --stage-line: rgba(236, 231, 220, 0.14);
    --stage-signal: #e06a12;   /* the site's #bf5700, lifted to clear AA on the stage */
    --stage-signal-hi: #c95c0d;
    --stage-signal-tx: #e06a12; /* see below; already clears AA on this ground */
    /* A FILLED button is measured against its own fill, not against the page,
       so the lift that makes orange TEXT readable on the stage works against it
       here: white on #e06a12 is 3.37:1 and white on #c95c0d is 4.18:1, both
       under the 4.5 that the button's small mono label needs. The unlifted
       site orange is the correct fill in both themes, because white on #bf5700
       is 4.59:1 and white on #a34a00 is 5.94:1. Do not point these at
       --stage-signal. */
    --stage-btn: #bf5700;
    /* The site's accent button hovers to raspberry on every other page, so this
       does too. NOT --stage-alert: that is the LIFTED #e2739f, which is correct
       for raspberry TEXT on the dark stage and wrong as a fill, exactly the trap
       the rest state fell into. White on the true #872657 is 8.59:1. */
    --stage-btn-hi: #872657;
    --stage-alert: #e2739f;    /* the site's raspberry, same lift */
}

:root[data-theme="light"] {
    /* White, not the site's cream paper. The photographs carry a lot of warm
       wood and rope, and on #f2efe5 the whole page read as one beige field with
       the pictures barely separated from the ground. --bg on the rest of the
       site is #ffffff, so this is also the closer match. */
    --stage: #ffffff;
    --stage-lift: #f2f3f0;
    --rope: #111418;
    --rope-dim: #4e565d;
    --dust: #5d656c;
    --stage-line: rgba(17, 20, 24, 0.18);
    --stage-signal: #bf5700;
    --stage-signal-hi: #a34a00;
    /* The accent for SMALL type, and the one place section 11 of the layout
       spec was wrong. The true #bf5700 is fine at heading size, where AA asks
       3, and it clears 4.59:1 on white. But the PL numbers, the crumb key, a
       link inside a paragraph and the REF on the unissued band are all SMALL
       text, where AA asks 4.5, and most of them sit on --stage-lift, where
       #bf5700 measures 4.12:1. #a34a00 is the same hue one step down and
       measures 5.94 on --stage and 5.33 on --stage-lift. Dark needs no such
       split, so the token is simply --stage-signal there. */
    --stage-signal-tx: #a34a00;
    /* Same fill in both themes. See the note in the dark block. */
    --stage-btn: #bf5700;
    --stage-btn-hi: #872657;
    --stage-alert: #872657;
}

/* The page ground starts at the ROOT element, not at the body. styles.css sets
   html { background: var(--bg); color-scheme: light; scrollbar-color: ... } for
   the whole site, and body.pd-stage cannot reach it, so a dark project page was
   drawing a WHITE scrollbar track down its full height and would rubber band to
   white on overscroll. Scoped on the attribute the resolver writes, which only
   ever appears on a page that also loads this file. */
html[data-theme] {
    background: var(--stage);
    scrollbar-color: var(--stage-signal) var(--stage);
}
html[data-theme="dark"] { color-scheme: dark; }

body.pd-stage {
    --bg: var(--stage);
    --bg-deep: var(--stage);
    --surface: var(--stage);
    --surface-raised: var(--stage-lift);
    --paper: var(--stage-lift);
    --ink: var(--rope);
    --ink-dark: var(--rope);
    --muted: var(--dust);
    --muted-light: var(--rope-dim);
    --line: var(--stage-line);
    --line-strong: var(--stage-line);
    --signal: var(--stage-signal);
    --signal-soft: var(--stage-signal-tx);
    --raspberry: var(--stage-alert);

    background: var(--stage);
    color: var(--rope);
}

/* --- Shared chrome, recoloured for the stage ---------------------------- */

/* The site header is fixed everywhere else, which is right for a page whose
   hero is a full screen. Here the hero is a band, so the header goes back into
   the flow as a sticky bar and .cs-main loses its header-height offset. Both
   states are declared because .is-scrolled (app.js) outranks a single class. */
body.pd-stage .site-header,
body.pd-stage .site-header.is-scrolled {
    position: sticky;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--stage) 92%, transparent);
    backdrop-filter: blur(8px);
}

body.pd-stage .status-dot {
    background: var(--signal);
    box-shadow: none;
    animation: none;
}

/* Pinned to --stage-btn rather than inheriting --signal. body.pd-stage maps
   --signal to --stage-signal, which in dark is the LIFTED #e06a12, and white on
   that is 3.37:1: the rest state failed worse than the hover did. */
body.pd-stage .header-btn--accent {
    background: var(--stage-btn);
    border-color: var(--stage-btn);
    color: #fff;
}
body.pd-stage .header-btn--accent:hover,
body.pd-stage .header-btn--accent:focus-visible {
    border-color: var(--stage-btn-hi);
    background: var(--stage-btn-hi);
    color: #fff;
}

body.pd-stage .header-btn--theme {
    cursor: pointer;
    background: none;
    font-family: var(--mono);
}

body.pd-stage .cs-main {
    padding-top: 0;
    background: var(--stage);
}
body.pd-stage .cs-main [id] { scroll-margin-top: calc(var(--header-height) + 1rem); }

body.pd-stage .cs-topbar {
    justify-content: flex-start;
    padding: 0.6rem var(--gut);
    border-bottom: 1px solid var(--line);
    background: var(--stage);
}
body.pd-stage .crumb {
    font-weight: 400;
    font-size: 0.6rem;
    letter-spacing: 0.16em;
}
body.pd-stage .crumb a:hover,
body.pd-stage .crumb a:focus-visible { color: var(--rope); }

body.pd-stage .site-footer {
    border-top: 1px solid var(--line);
    background: var(--stage-lift);
}

/* The shared footer grid is drawn for the seven cell title block the homepage
   carries. A project page has five, so two empty tracks were pushing the links
   cell into a 6.5rem column and stacking it, and the 1080px rule that hides
   cells four and five was hiding this footer's Sheet number and its links
   rather than the homepage's spare cells.

   Bounded ABOVE 760px on purpose. Below that the shared two column rule is
   already right, and an unbounded override here reinstates a 44rem minimum
   that a 390px phone cannot hold, which is a horizontal scrollbar. */
@media (min-width: 761px) {
    body.pd-stage .site-footer {
        grid-template-columns:
            minmax(10rem, 1.6fr) repeat(3, minmax(5rem, 0.8fr)) minmax(10rem, 1.3fr);
    }
    body.pd-stage .tb-cell:nth-child(4),
    body.pd-stage .tb-cell:nth-child(5) { display: flex; }
}
body.pd-stage .tb-cell { border-right-color: var(--line); }

/* .project-detail-nav paints its two halves in --ink and --raspberry with
   white type, which on the stage would be cream-on-white and pink-on-white. */
body.pd-stage .project-detail-nav { border-top: 1px solid var(--line); }
body.pd-stage .project-detail-nav a {
    min-height: 6rem;
    padding: 1.7rem var(--gut);
    border-left: 1px solid var(--line);
    background: var(--stage-lift);
    color: var(--rope);
    font-weight: 400;
    letter-spacing: 0.12em;
}
body.pd-stage .project-detail-nav a:first-child { border-left: 0; }
body.pd-stage .project-detail-nav a:last-child { background: var(--stage-lift); color: var(--signal); }
body.pd-stage .project-detail-nav a:hover { color: var(--signal); }

/* --- Hero --------------------------------------------------------------- */

.pd-hero {
    position: relative;
    height: clamp(420px, 58vh, 620px);
    overflow: hidden;
    isolation: isolate;
    background: var(--stage-lift);
}
.pd-hero > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 44%;
}
.pd-hero::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
        rgba(12, 10, 9, 0.94) 0%, rgba(12, 10, 9, 0.7) 26%, rgba(12, 10, 9, 0.05) 62%);
    content: "";
}
.pd-hero-copy {
    position: absolute;
    z-index: 2;
    right: var(--gut);
    bottom: clamp(1.3rem, 3vh, 2.3rem);
    left: var(--gut);
    max-width: min(64rem, 100%);
    color: var(--on-photo);
}
.pd-hero-copy h1 {
    margin: 0;
    font-family: var(--display);
    /* The floor is 2.6rem, not the mockup's 3.6rem. At 3.6rem the single word
       DOWNLOADER measures about 400px, and a 390px phone leaves 353px inside
       the gutter, so the last letters were being clipped by body's
       overflow-x: hidden rather than wrapping. */
    font-size: clamp(2.6rem, 10vw, 9rem);
    font-weight: 900;
    line-height: 0.84;
    letter-spacing: -0.055em;
    text-transform: uppercase;
}
.pd-hero-copy h1 em { color: var(--on-photo-signal); }

/* styles.css sets h1 > em and h2 > em to Gadhen at text-transform: none, which
   is the homepage's accent device. The stage's accent is ONE WORD OF THE SAME
   HEADING in orange, so the word has to stay in the heading's own face, size
   and case; swapped to a script serif at 1.04em it reads as a pull quote
   dropped into the middle of a line. Scoped under body.pd-stage so the
   homepage keeps its own device. */
body.pd-stage :is(.pd-hero-copy h1, .pd-card h2) > em {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: normal;
    letter-spacing: inherit;
    text-transform: inherit;
}
.pd-eyebrow {
    margin: 0 0 0.8rem;
    color: var(--on-photo-dim);
    font: 600 0.64rem/1.35 var(--mono);
    letter-spacing: 0.26em;
    text-transform: uppercase;
}
.pd-eyebrow span + span::before {
    margin: 0 0.5rem;
    opacity: 0.6;
    content: "\00b7";
}
.pd-eyebrow b { color: var(--on-photo); font-weight: 600; }
.pd-deck {
    margin: 1rem 0 0;
    max-width: 44ch;
    color: var(--on-photo-dim);
    font-size: clamp(1rem, 1.35vw, 1.18rem);
    line-height: 1.45;
}

/* A hero that must not be cropped: a keyed-out render, a schematic, or a
   picture whose ratio is nowhere near the hero band's. It stops being a
   full-bleed photograph and becomes a picture ON the page, so the copy under
   it goes back to page ink in both themes. Grid rather than an absolutely
   positioned copy block, because a two-line H1 plus a three-line deck is
   taller than any reserved strip would have been. */
.pd-hero--fit {
    display: grid;
    /* An implicit auto column is floored at min-content, and one long word in
       the H1 is what that resolves to, so the column overflows the viewport
       unless it is pinned. */
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    height: auto;
    min-height: clamp(420px, 58vh, 620px);
}
.pd-hero--fit > img {
    box-sizing: border-box;
    padding: clamp(1.6rem, 4vh, 3rem) var(--gut) 0;
    object-fit: contain;
}
.pd-hero--fit::after,
.pd-hero--text::after { display: none; }

/* No photograph at all. Seven projects land here, so it is the second most
   common layout on the site, not an edge case: the copy IS the page and an
   empty dark band would read as a broken image. */
.pd-hero--text {
    display: block;
    height: auto;
    min-height: 0;
    background: var(--stage);
}

.pd-hero--fit > .pd-hero-copy,
.pd-hero--text > .pd-hero-copy {
    position: static;
    padding: clamp(1.4rem, 3vh, 2.2rem) var(--gut) clamp(1.7rem, 3.5vh, 2.6rem);
    color: var(--rope);
}
.pd-hero--text > .pd-hero-copy { padding-top: clamp(2.8rem, 8vh, 5.5rem); }
.pd-hero--fit .pd-eyebrow,
.pd-hero--text .pd-eyebrow { color: var(--dust); }
.pd-hero--fit .pd-eyebrow b,
.pd-hero--text .pd-eyebrow b { color: var(--rope); }
.pd-hero--fit .pd-deck,
.pd-hero--text .pd-deck { color: var(--rope-dim); }
.pd-hero--fit h1 em,
.pd-hero--text h1 em { color: var(--signal); }

/* --- The facts strip ---------------------------------------------------- */

/* One strip, once, in the site's schedule vocabulary: a mono micro label over
   its value, and the unrecorded row in raspberry the way .cs-facts .is-alert
   is. A grid rather than a flex row so ten facts wrap into a second rank
   instead of squeezing to four characters each; the 1px gaps ARE the rules. */
.pd-facts {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--stage-lift);
}

/* Two constructions, because neither is right at both sizes.

   Narrow: a wrapping FLEX row. Whatever is left over on the last rank grows to
   fill it, so a strip of five facts two across never draws an empty sixth cell,
   which reads as a fact that failed to load rather than as the end of a list.

   Wide: a GRID of --cols, written by the generator as the count that leaves the
   shortest tail, with the last fact spanning whatever tail is left. Nine facts
   run five and four rather than the seven and two an auto-fit grid gives. */
.pd-facts ul {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0 var(--gut);
    list-style: none;
}
.pd-facts li {
    flex: 1 1 11.5rem;
    min-width: 0;
    padding: 0.75rem 1rem 0.8rem;
    border-left: 1px solid var(--line);
}
.pd-facts li:first-child { border-left: 0; padding-left: 0; }

@media (min-width: 1081px) {
    /* The 1px gaps ARE the rules here, so the strip is inset by the gutter less
       the cell's own padding and the first value still lines up with the page. */
    .pd-facts { padding-inline: max(0px, calc(var(--gut) - 1rem)); }
    .pd-facts ul {
        display: grid;
        grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
        gap: 1px;
        padding: 0;
        background: var(--line);
    }
    .pd-facts li {
        padding-left: 1rem;
        border-left: 0;
        background: var(--stage-lift);
    }
}

.pd-facts b {
    display: block;
    color: var(--dust);
    font: 400 0.55rem/1.2 var(--mono);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.pd-facts span {
    display: block;
    margin-top: 0.3rem;
    font: 400 0.71rem/1.35 var(--mono);
}
.pd-facts li.is-alert b,
.pd-facts li.is-alert span { color: var(--stage-alert); }

/* --- Copy bands --------------------------------------------------------- */

/* A section of copy is a BAND, not a screen. The first pass gave each one a
   viewport of its own, which is the whole reason it ran to 6,130px. */
.pd-card {
    padding: clamp(1.6rem, 3.2vh, 2.4rem) var(--gut) clamp(1.7rem, 3.4vh, 2.6rem);
    border-top: 1px solid var(--line);
}
.pd-card-in {
    display: grid;
    grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    column-gap: clamp(1.6rem, 4.5vw, 5rem);
    align-items: start;
}

/* The site's sheet line, one line, no box. */
.pd-sheet {
    grid-column: 1 / -1;
    margin: 0 0 clamp(0.9rem, 2vh, 1.4rem);
    color: var(--dust);
    font: 400 0.6rem/1.4 var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.pd-sheet b { color: var(--rope); font-weight: 600; }
.pd-sheet i { margin: 0 0.5rem; font-style: normal; opacity: 0.5; }

.pd-card h2 {
    margin: 0;
    max-width: 16ch;
    font-family: var(--display);
    font-size: clamp(1.75rem, 3.1vw, 2.7rem);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}
/* The site's one heading trick: a single word in the accent, not italic. */
.pd-card h2 em { color: var(--signal); font-style: normal; }

.pd-say {
    margin: 0;
    max-width: 52ch;
    color: var(--rope-dim);
    font-size: clamp(1.05rem, 1.5vw, 1.32rem);
    line-height: 1.42;
}
.pd-say > * { margin: 0 0 0.85em; }
.pd-say > *:last-child { margin-bottom: 0; }
/* A subhead inside a section. It was set at 0.68rem mono, which computes to
   10.9px against 21px body copy: a heading SMALLER than the paragraph under it
   reads as a caption label, and the reader loses the hierarchy. It now sits
   above the body measure in the heading face, one clear tier under the h2. */
.pd-say h3 {
    margin: 1.7em 0 0.5em;
    color: var(--rope);
    font-family: var(--display);
    font-size: clamp(1.15rem, 1.55vw, 1.42rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}
.pd-say strong { color: var(--rope); font-weight: 700; }
.pd-say a { color: var(--stage-signal-tx); text-decoration-color: var(--line); }
.pd-say a:hover { color: var(--rope); }
.pd-say code {
    padding: 0.1em 0.35em;
    background: var(--stage-lift);
    color: var(--rope);
    font-family: var(--mono);
    font-size: 0.82em;
}
.pd-say ul { padding-left: 1.15em; list-style: none; }
.pd-say li { position: relative; margin-bottom: 0.45em; }
.pd-say li::before {
    position: absolute;
    top: 0.66em;
    left: -1.15em;
    width: 0.55em;
    height: 1px;
    background: var(--signal);
    content: "";
}
.pd-say .cs-pull {
    margin: 1.4em 0;
    padding-left: 1.1rem;
    border-left: 2px solid var(--signal);
    color: var(--rope);
}
.pd-card-in > .cs-links,
.pd-card-in > .cs-parts { margin: 0; }

/* A takeaways band (section id "takeaways") is the longest copy on its page,
   several paragraphs and a list, so it sets one step down: the heading at the
   card-title tier and the body at reading size instead of lede size. */
.pd-card#takeaways { padding-block: clamp(1.3rem, 2.6vh, 2rem); }
.pd-card#takeaways h2 { max-width: 20ch; font-size: var(--fs-block); }
.pd-card#takeaways .pd-say { max-width: 68ch; font-size: clamp(0.98rem, 1.12vw, 1.08rem); line-height: 1.55; }
.pd-card#takeaways .pd-say > :not(:last-child) { margin-bottom: 0.7em; }
.pd-card#takeaways .pd-say li { margin-bottom: 0.3em; }

/* --- The runs ----------------------------------------------------------- */

/* Photographs butted edge to edge on a hairline gutter. This is the whole
   point of the direction, and nothing is allowed to sit on top of them.
   --ar is set on the RUN, so every cell in a row is the same height and the
   captions line up; --ar-sm is set per frame and takes over below 760px, where
   the run is one column again and each picture gets its own ratio back. */
/* The runs and the hero used to touch the viewport edge. They now sit inside
   the same 10 percent gutter as the copy, so every band on the page lines up. */
body.pd-stage .pd-run,
body.pd-stage .pd-hero,
body.pd-stage .pd-curtain,
body.pd-stage .pd-facts { margin-inline: var(--gut); }
/* the facts strip already pads its own content, so it must not pad twice */
body.pd-stage .pd-facts { padding-inline: 0; }

.pd-run {
    display: grid;
    gap: 1px;
    background: var(--line);
}
.pd-run--1 { grid-template-columns: minmax(0, 1fr); }
.pd-run--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pd-run--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.pd-fr {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
    background: var(--stage);
}
.pd-fr-im {
    /* The cap is what stops a run of portraits becoming a wall: a 0.46 photo
       three up would otherwise stand 1,040px tall on a 1,440px page. It is a
       custom property because the width clamp below has to reuse the same
       number. */
    --cap: min(48vh, 540px);
    position: relative;
    max-height: var(--cap);
    overflow: hidden;
    aspect-ratio: var(--ar, 1.5);
    background: var(--stage-lift);
}

/* A LETTERBOXED picture on its own rank follows its picture, not the page.
   Once the cap bites, a contained frame keeps the full 1,440px row and paints
   the leftover as stage: custom-keyboard's two schematics drew 968px inside a
   1,440px field and left a third of the row empty, and a 1.41 render left 47%.
   min() means the clamp is inert until the cap actually bites, and it is held
   to single cell ranks on purpose, because narrowing a cell inside a two or
   three across rank would open gaps in the butted hairline grid. */
@media (min-width: 761px) {
    /* The width clamp is driven by --cap, so a low cap does not just make a
       letterboxed figure shorter, it makes it narrower too. A 1.1 schematic at
       the photo cap drew 477px inside a 1,440px row and read as stranded. A
       lone letterboxed figure therefore keeps a taller cap of its own. */
    .pd-run--1 .pd-fr--in .pd-fr-im {
        --cap: min(64vh, 720px);
        width: min(100%, calc(var(--cap) * var(--ar, 1.5)));
        margin-inline: auto;
    }
}
.pd-fr-im img,
.pd-fr-im video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--fit, cover);
}

/* The caption sits UNDER the frame, never over it. The first pass laid a dark
   scrim across the bottom third of every photograph to make its caption
   readable, which is a real cost on a page whose only job is the pictures. */
.pd-fr figcaption {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.5rem 0.75rem 0.6rem;
    color: var(--rope-dim);
    font: 400 0.66rem/1.4 var(--mono);
}
.pd-fr figcaption i {
    flex: none;
    color: var(--stage-signal-tx);
    font-style: normal;
    letter-spacing: 0.1em;
}

/* The mockup's small chip, rather than the full-field overlay the sheet
   layout used. app.js drives .pd-video / .pd-video-play, so the class names
   stay and only the paint changes. */
body.pd-stage .pd-video-play {
    inset: 0.7rem auto auto 0.7rem;
    display: block;
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(236, 231, 220, 0.35);
    background: rgba(10, 9, 8, 0.62);
    color: var(--on-photo);
    font: 400 0.6rem/1 var(--mono);
    letter-spacing: 0.16em;
}
body.pd-stage .pd-video-play span { padding: 0; box-shadow: none; background: none; }

/* Under reduced motion app.js swaps every clip for its poster and returns
   before it binds this button, so the chip was there and dead. Scoped under
   body.pd-stage to outrank the rule above it. */
@media (prefers-reduced-motion: reduce) {
    body.pd-stage .pd-video-play { display: none; }
}
body.pd-stage .pd-video-play:hover,
body.pd-stage .pd-video-play:focus-visible {
    border-color: var(--signal);
    background: rgba(10, 9, 8, 0.62);
    color: var(--signal);
}

/* --- The curtain -------------------------------------------------------- */

/* The last photograph carries the last card, which is how the page ends on the
   work rather than on a paragraph. The card STACKS instead of splitting: over
   two columns the sentence landed on the bright half of the photograph and
   vanished, and that is a light-theme bug as much as a dark one. */
.pd-curtain {
    position: relative;
    overflow: hidden;
    border-top: 1px solid var(--line);
    isolation: isolate;
}
.pd-curtain > img {
    position: absolute;
    z-index: -2;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pd-curtain::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    /* Two layers. The left-to-right scrim carries the card; the short bottom
       one carries the plate caption, which otherwise lands on whatever the
       brightest thing in the lower right of the photograph happens to be. */
    background:
        linear-gradient(to top, rgba(13, 11, 10, 0.7) 0%, rgba(13, 11, 10, 0) 14%),
        linear-gradient(to right,
            rgba(13, 11, 10, 0.92) 0%, rgba(13, 11, 10, 0.66) 48%, rgba(13, 11, 10, 0.28) 100%);
    content: "";
}
.pd-curtain .pd-card {
    padding-top: clamp(2.6rem, 6vh, 4.2rem);
    padding-bottom: clamp(2.6rem, 6vh, 4.2rem);
    border-top: 0;
    color: var(--on-photo);
}
.pd-curtain .pd-card-in {
    grid-template-columns: minmax(0, 44rem);
    row-gap: clamp(0.9rem, 2vh, 1.4rem);
}
.pd-curtain h2 { color: var(--on-photo); }
.pd-curtain h2 em { color: var(--on-photo-signal); }
.pd-curtain .pd-say { max-width: 40ch; color: var(--on-photo); }
.pd-curtain .pd-say strong { color: var(--on-photo); }
.pd-curtain .pd-sheet { color: var(--on-photo-dim); }
.pd-curtain .pd-sheet b { color: var(--on-photo); }
.pd-curtain-cap {
    margin: 0;
    padding: 0 var(--gut) 1.1rem;
    color: var(--on-photo-dim);
    font: 400 0.66rem/1.4 var(--mono);
}
.pd-curtain-cap i {
    margin-right: 0.6rem;
    color: var(--on-photo-signal);
    font-style: normal;
    letter-spacing: 0.1em;
}

/* --- Not issued --------------------------------------------------------- */

/* A DESIGNED unissued state, not a broken placeholder, and only ever one per
   page. Naming the expected file is what makes filling it cheap later: the
   page says exactly what to drop in. */
.pd-empty {
    display: grid;
    place-items: center;
    gap: 0.55rem;
    margin-top: clamp(1.4rem, 3vh, 2.2rem);
    min-height: clamp(200px, 30vh, 320px);
    padding: 2rem 1.5rem;
    border: 1px dashed var(--line);
    background-color: var(--stage-lift);
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 2.4rem 2.4rem;
    text-align: center;
}
.pd-empty b {
    color: var(--stage-signal-tx);
    font: 600 0.62rem/1 var(--mono);
    letter-spacing: 0.22em;
    text-transform: uppercase;
}
.pd-empty span {
    color: var(--rope-dim);
    font: 400 0.66rem/1.4 var(--mono);
    letter-spacing: 0.1em;
}
.pd-empty code {
    padding: 0.25rem 0.5rem;
    background: var(--stage);
    color: var(--dust);
    font: 400 0.62rem/1.4 var(--mono);
    word-break: break-all;
}
.pd-say > .pd-empty { margin-block: 1.4em; }

/* [[play:]]: the frame an interactive piece will land in. Deliberately
   plain: a dashed field and two lines of type, nothing that looks pressable. */
body.pd-stage .pd-play { margin-inline: var(--gut); }
.pd-play {
    display: grid;
    place-content: center;
    gap: 0.7rem;
    min-height: clamp(220px, 42vh, 440px);
    padding: 2rem 1.5rem;
    border: 1px dashed var(--stage-line);
    background: var(--stage-lift);
    text-align: center;
}
.pd-play b {
    color: var(--stage-signal-tx);
    font: 600 0.66rem/1 var(--mono);
    letter-spacing: 0.24em;
    text-transform: uppercase;
}
.pd-play span {
    color: var(--rope-dim);
    font: 400 0.72rem/1.4 var(--mono);
    letter-spacing: 0.06em;
}

/* --- Links and parts, on the stage -------------------------------------- */

body.pd-stage .cs-links { display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 0; list-style: none; }
body.pd-stage .cs-link {
    border: 1px solid var(--line);
    color: var(--rope);
    font: 400 0.62rem/1 var(--mono);
    letter-spacing: 0.12em;
}
body.pd-stage .cs-parts { display: grid; gap: 1px; padding: 0; background: var(--line); list-style: none; }
body.pd-stage .cs-part { border: 0; background: var(--stage-lift); }
body.pd-stage .cs-part h3 a { color: var(--rope); }

/* --- A page with no photographs ----------------------------------------- */

/* LAYOUT-SPEC section 3, rung 0: "cards, set wider (a single measure of about
   66ch rather than the two column split, since there is nothing to sit beside)".
   Seven projects land here. With the split, a card's left column held a two
   line heading and then several hundred pixels of nothing, on a page whose
   entire argument is that the copy IS the page. */
.pd-set--text .pd-card-in {
    grid-template-columns: minmax(0, 1fr);
    row-gap: clamp(0.9rem, 2vh, 1.4rem);
}
.pd-set--text .pd-card h2 { max-width: 24ch; }
.pd-set--text .pd-say { max-width: 66ch; }

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 1080px) {
    .pd-card-in { grid-template-columns: minmax(0, 1fr); row-gap: 1.2rem; }
    .pd-card h2 { max-width: 22ch; }
}

@media (max-width: 900px) {
    .pd-run--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* A stranded third cell would leave the run's hairline background showing
       as a block, so it takes the whole rank at twice the ratio and the row
       height does not change. */
    .pd-run--3 .pd-fr:nth-child(3):last-child { grid-column: 1 / -1; }
    .pd-run--3 .pd-fr:nth-child(3):last-child .pd-fr-im { aspect-ratio: calc(var(--ar, 1.5) * 2); }
}

@media (max-width: 760px) {
    .pd-run--2,
    .pd-run--3 { grid-template-columns: minmax(0, 1fr); }
    .pd-run--3 .pd-fr:nth-child(3):last-child .pd-fr-im { aspect-ratio: var(--ar-sm, var(--ar, 1.5)); }
    .pd-fr-im { aspect-ratio: var(--ar-sm, var(--ar, 1.5)); }
    /* Restated after the height change: .pd-hero--fit and .pd-hero--text have
       the same specificity as .pd-hero and are declared ABOVE it, so without
       this a zero-picture page gets a 620px empty band back at phone width. */
    .pd-hero { height: clamp(400px, 66vh, 620px); }
    .pd-hero--fit,
    .pd-hero--text { height: auto; }
    .pd-hero--text { min-height: 0; }
    /* The eyebrow wraps to two lines at this width, which is fine. It used to
       drop the drawing number instead, and since styles.css already hides
       .brand-meta and the footer Sheet cell under 1180px, that took the number
       off the phone page entirely: all three of the places that state it were
       gone at once. */
    .pd-eyebrow { letter-spacing: 0.2em; margin-bottom: 0.65rem; }
    /* One record per line, ruled horizontally. A vertical rule is what divides
       facts that sit side by side; at this width none of them do, and the
       border-left then reads as a stray tick down the left of the strip. */
    .pd-facts li {
        flex: 1 1 100%;
        padding-left: 0;
        border-left: 0;
    }
    .pd-facts li + li { border-top: 1px solid var(--line); }
    .pd-fr figcaption { font-size: 0.62rem; padding: 0.45rem 0.6rem 0.55rem; }
    body.pd-stage .project-detail-nav a { border-left: 0; border-top: 1px solid var(--line); }

    /* A picture that is mostly fine detail PANS here, it does not shrink. The
       repo already settled this for hand drawn plates and the reason is the
       same for a raster of one: an SVG or a screenshot scales uniformly, so a
       1500 by 95 browser bar becomes 25px tall at 390 and its labels land at
       two pixels. --pan is the picture's own width, capped by the generator,
       and the field scrolls inside itself so the page never does.
       The first selector restates the stranded third cell rule above it, which
       is one step more specific and would otherwise put the ratio back. */
    .pd-run--3 .pd-fr--pan:nth-child(3):last-child .pd-fr-im,
    .pd-fr--pan .pd-fr-im {
        width: auto;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        aspect-ratio: auto;
        overscroll-behavior-x: contain;
    }
    .pd-fr--pan .pd-fr-im img {
        width: var(--pan, 620px);
        max-width: none;
        height: auto;
    }
}

/* --- Sliders and the photo viewer --------------------------------------- */

/* app.js folds a section's runs of two or more pictures into one slider. Every
   slide gets the same stage, so a portrait and a wide render line up, and a
   picture is letterboxed onto --stage-lift rather than cropped. Without JS the
   runs stay the grid they were generated as. */
body.pd-stage .pd-slider { margin-inline: var(--gut); }
.pd-slider { position: relative; background: var(--stage); }
.pd-slider-track {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.pd-slider-track::-webkit-scrollbar { display: none; }
.pd-slider-track:focus-visible { outline: 2px solid var(--stage-signal); outline-offset: 2px; }
.pd-slider .pd-fr {
    flex: 0 0 100%;
    min-width: 0;
    scroll-snap-align: start;
}
.pd-slider .pd-fr-im,
.pd-slider .pd-fr--pan .pd-fr-im {
    width: 100%;
    height: min(64vh, 620px);
    max-height: none;
    aspect-ratio: auto;
    overflow: hidden;
    margin: 0;
}
.pd-slider .pd-fr-im img,
.pd-slider .pd-fr-im video,
.pd-slider .pd-fr--pan .pd-fr-im img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}
.pd-slider-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--stage-line);
}
.pd-slider-thumbs {
    display: flex;
    flex: 1 1 auto;
    gap: 0.45rem;
    min-width: 0;
    margin-right: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.pd-slider-thumbs::-webkit-scrollbar { display: none; }
.pd-slider-thumbs button {
    flex: 0 0 auto;
    width: 5.2rem;
    height: 3.6rem;
    padding: 0;
    border: 1px solid var(--stage-line);
    background: var(--stage-lift);
    color: var(--rope-dim);
    font: 400 0.66rem/1 var(--mono);
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 160ms ease, border-color 160ms ease;
}
.pd-slider-thumbs button img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pd-slider-thumbs button:hover { opacity: 0.85; }
.pd-slider-thumbs button[aria-current="true"] { opacity: 1; border-color: var(--stage-signal); box-shadow: inset 0 0 0 1px var(--stage-signal); }
.pd-slider-thumbs button:focus-visible { outline: 2px solid var(--stage-signal); outline-offset: 1px; opacity: 1; }
.pd-slider-count {
    margin-right: 0.4rem;
    color: var(--rope-dim);
    font: 400 0.66rem/1 var(--mono);
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
}
.pd-slider-btn,
.pd-viewer-btn,
.pd-viewer-close {
    min-width: 2.4rem;
    min-height: 2.2rem;
    border: 1px solid var(--stage-line);
    background: var(--stage);
    color: var(--rope);
    font: 400 0.9rem/1 var(--mono);
    cursor: pointer;
}
.pd-slider-btn:hover:not(:disabled),
.pd-slider-btn:focus-visible { border-color: var(--stage-signal); color: var(--stage-signal); }
.pd-slider-btn:disabled { opacity: 0.35; cursor: default; }
.pd-zoomable { cursor: zoom-in; }
/* In a slide a clip is letterboxed, so its play chip sits in the middle of
   the frame, on the clip, not out in the empty corner. */
body.pd-stage .pd-slider .pd-video-play { inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.pd-zoomable:focus-visible { outline: 2px solid var(--stage-signal); outline-offset: -2px; }

/* The viewer is always dark, whatever the page theme: it is a light box. */
html.pd-viewer-open { overflow: hidden; }
.pd-viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 0.6rem;
    padding: max(0.8rem, env(safe-area-inset-top, 0px)) clamp(0.8rem, 3vw, 2rem) max(0.8rem, env(safe-area-inset-bottom, 0px));
    background: #0e0c0b;
    color: #ece7dc;
    touch-action: pinch-zoom;
}
.pd-viewer[hidden] { display: none; }
.pd-viewer .pd-viewer-btn,
.pd-viewer .pd-viewer-close {
    border-color: rgba(236, 231, 220, 0.24);
    background: transparent;
    color: #ece7dc;
}
.pd-viewer .pd-viewer-btn:hover,
.pd-viewer .pd-viewer-btn:focus-visible,
.pd-viewer .pd-viewer-close:hover,
.pd-viewer .pd-viewer-close:focus-visible { border-color: #e06a12; color: #e06a12; outline: none; }
.pd-viewer-close {
    justify-self: end;
    padding: 0 0.8rem;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.pd-viewer-stage {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0.6rem;
    min-height: 0;
    margin: 0;
}
.pd-viewer-stage img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}
.pd-viewer-stage figcaption {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    max-width: 72ch;
    margin-inline: auto;
    color: #c6bfb2;
    font: 400 0.7rem/1.45 var(--mono);
    text-align: left;
}
.pd-viewer-stage figcaption i { flex: none; color: #e06a12; font-style: normal; letter-spacing: 0.1em; }
.pd-viewer-stage figcaption i:empty { display: none; }
.pd-viewer-bar { display: flex; align-items: center; justify-content: center; gap: 0.8rem; }
.pd-viewer-count {
    min-width: 5.5ch;
    color: #c6bfb2;
    font: 400 0.7rem/1 var(--mono);
    letter-spacing: 0.12em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .pd-slider .pd-fr-im,
    .pd-slider .pd-fr--pan .pd-fr-im { height: auto; max-height: 76svh; aspect-ratio: var(--slide-ar, 4 / 3); }
    .pd-slider-bar { flex-wrap: wrap; }
    .pd-slider-thumbs { flex-basis: 100%; margin-right: 0; }
    .pd-slider-thumbs button { width: 4.2rem; height: 3rem; }
    .pd-slider-count { margin-right: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .pd-slider-thumbs button { transition: none; }
}
