/* M D Morris — enamel
 *
 * Positioning: a collector-facing site for Mark's own watch brand. The job of
 * the design is to get out of the way of the photographs. Enamel is about
 * surface, depth and colour, so the page is quiet, generous with space, and
 * lets images run large. Dark ground behind dial and detail photography,
 * because that is how a dial is looked at.
 */

:root {
  --ink: #1a1a18;
  --ink-soft: #55534e;
  --paper: #faf9f7;
  --rule: #e2ded7;
  --dark: #15161a;
  --accent: #8a6a2f;          /* gilding, not gold-plate */
  --measure: 34rem;
  --wide: 76rem;
  /* The vertical rhythm between cards. Lives here rather than inline on
   * `.grid` because something OUTSIDE a grid needs to match it: the filtered
   * view's piece grid sits below the "Projects in <technique>" section and has
   * to be the same distance from the card above it as any two rows of cards
   * are from each other (Mark, 5 November). One value, so they cannot drift. */
  --grid-gap: clamp(.8rem, 2vw, 1.4rem);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

/* --- masthead ------------------------------------------------------- */

/* The old site's navbar-inverse background, on the whole header rather than
 * just the top bar — so the bar and the nav/menu below it read as one piece
 * instead of two different-coloured strips stacked on top of each other.
 * The logo and banner were both prepared against this dark ground, which is
 * the other reason it is matched exactly rather than approximated. */
.masthead { background: #00334d; }

.masthead-bar { display: flex; align-items: center; }

.wordmark {
  text-decoration: none; flex-shrink: 0; color: #f3f1ec;
  font-size: 1.05rem; letter-spacing: .34em; font-weight: 600; line-height: 1;
  padding: 1rem clamp(1rem, 4vw, 3rem);
}
.wordmark span { color: var(--accent); }

/* `--scale` is a plain multiplier (1 = 100%), set inline from
 * SiteBranding.logo_scale_factor / banner_scale_factor — Mark's "percentage"
 * knob in the admin. calc() can only multiply a length by a bare number, not
 * a percentage, which is why the model exposes it pre-divided rather than as
 * the raw 100/150/etc it's stored and entered as. */
.brand-logo {
  height: calc(64px * var(--scale, 1)); width: auto; max-width: 70vw;
  object-fit: contain;
}

/* Banner + toggle are grouped and pushed to the far right together, with NO
 * padding of their own — so the banner sits flush against the top and right
 * of the header with no gap, which is how the banner image was designed to
 * sit (compare the old site's background-position: right, no padding).
 * Stacking them in a column (rather than side by side) is what keeps the
 * toggle from landing on top of the banner once the banner is pushed all
 * the way to that same corner — see the breakpoints below for which widths
 * show which combination. */
.masthead-corner {
  display: flex; flex-direction: column; align-items: flex-end;
  margin-left: auto;
}
.brand-banner {
  height: calc(64px * var(--scale, 1)); width: auto; max-width: 60vw;
  object-fit: contain; object-position: right center;
  display: none;
}
@media (min-width: 40rem) {
  .brand-banner { display: block; }
  .brand-logo, .brand-banner { height: calc(84px * var(--scale, 1)); }
}
@media (min-width: 56rem) {
  .brand-logo, .brand-banner { height: calc(112px * var(--scale, 1)); }
  .brand-banner { max-width: 70vw; }
}

/* --- mobile nav toggle (3-bar button) -------------------------------- */

.nav-toggle {
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 2.2rem; height: 2.2rem;
  margin: .6rem clamp(1rem, 4vw, 3rem) .9rem 0;
  border: 0; background: none; padding: 0; cursor: pointer;
}
.nav-toggle span {
  display: block; height: 2px; width: 100%;
  background: #f3f1ec; border-radius: 1px;
}

.masthead nav {
  display: none; flex-direction: column; gap: 0;
  padding: 0 clamp(1rem, 4vw, 3rem) 1rem;
}
.masthead nav.open { display: flex; }
.masthead nav a {
  font: 500 .74rem/1 system-ui, sans-serif;
  letter-spacing: .16em; text-transform: uppercase;
  text-decoration: none; color: #999;
  padding: .8rem 0; border-bottom: 1px solid rgba(255, 255, 255, .15);
}
.masthead nav a:hover { color: #fff; }

@media (min-width: 56rem) {
  .nav-toggle { display: none; }
  .masthead nav {
    display: flex !important; flex-direction: row; flex-wrap: wrap;
    gap: clamp(.9rem, 2.5vw, 2rem); padding: 0 clamp(1rem, 4vw, 3rem) 1rem;
  }
  .masthead nav a { padding: 0 0 .2rem; border-bottom: 1px solid transparent; }
  .masthead nav a:hover { color: #fff; border-bottom-color: var(--accent); }
}

.preview-bar {
  background: #2d2a24; color: #e8dfc9;
  font: 500 .72rem/1 system-ui, sans-serif; letter-spacing: .1em;
  padding: .6rem;
  display: flex; flex-wrap: wrap; gap: .5rem 1rem;
  align-items: center; justify-content: center;
}
/* "As a visitor" is the mode you can forget you are in — a correctly hidden
 * piece reads as a missing one. So it does not look like the normal bar. */
.preview-bar.as-public { background: #6c4a12; color: #fdf3dd; }
.preview-bar form { margin: 0; }
.preview-bar button {
  font: inherit; letter-spacing: inherit; cursor: pointer;
  color: inherit; background: none;
  border: 1px solid currentColor; border-radius: 2rem;
  padding: .35rem .9rem;
  /* 44px minimum: the lightbox arrows taught this one. */
  min-height: 44px;
}
.preview-bar button:hover { background: rgba(255,255,255,.12); }

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

main { padding-bottom: 6rem; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem); }
.measure { max-width: var(--measure); }

.page-head { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.page-head h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 400; margin: 0 0 .6rem; }
.page-head .standfirst { color: var(--ink-soft); font-size: 1.07rem; margin: 0; }

/* A portrait beside the introduction — see Collection.portrait_image. Same
 * arrangement as .page-body.with-photo on the About page, at a narrower
 * column: 14rem is 224px, comfortably inside the native width of the scans
 * this exists for, so the photograph is sharp rather than merely smaller. */
.page-head.with-portrait { display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 50rem) {
  .page-head.with-portrait {
    grid-template-columns: 14rem minmax(0, var(--measure));
    align-items: start;
  }
}
.head-portrait { margin: 0; max-width: 14rem; }
.head-portrait img {
  width: 100%; height: auto; border-radius: 2px; background: #efece6;
}
.head-portrait figcaption {
  color: var(--ink-soft); font-size: .8rem; padding-top: .55rem;
}

.eyebrow {
  font: 500 .7rem/1 system-ui, sans-serif; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .9rem;
}
/* The project span inside an eyebrow — see Collection.years_display. Softer
 * than the accent so "PROJECT" still leads. Separated by a rule rather than
 * a "·" in generated content, which several screen readers announce: there
 * is nothing here to read but the two words and the years. */
.eyebrow-years {
  color: var(--ink-soft); margin-left: .5em;
  padding-left: .75em; border-left: 1px solid currentColor;
}

/* --- the hero ------------------------------------------------------- */

/* `--hero-max-h` is the single source of truth for the band's height: the
 * image is clamped to it below, and `.hero-tall` multiplies it by the
 * photograph's ratio to work out how wide the band should be. Changing it in
 * one place keeps those two in step — when they drift, the band is either
 * wider than the picture (curtains return) or narrower (the image stops
 * short of its own frame). */
.hero {
  --hero-max-h: 82vh;
  background: var(--dark); margin-bottom: clamp(2rem, 5vw, 3.5rem);
}

/* A taller-than-wide hero: the band hugs the photograph rather than running
 * full-bleed around it. Height is what constrains a portrait, so the width it
 * ends up occupying is `height × ratio` — and once the band is that wide there
 * is no side space left to fill with dark ground. Mark, 5 November: "there is
 * a lot of curtain side space that doesn't need to be there".
 *
 * Three candidates, smallest wins, and each one is a separate reason the band
 * must not be wider than it is:
 *   100%                       never exceed the viewport (narrow screens);
 *   --hero-w * 1px             never exceed the width of the rendition the
 *                              <img> is actually serving, or the picture would
 *                              overflow its own band. These two numbers must
 *                              keep coming from `hero.large` — the same
 *                              rendition the <img> is sized from — and NOT
 *                              from the stored original geometry. The two are
 *                              not always equal, and which is larger has
 *                              already flipped once this project: `ResizeToFit`
 *                              upscaled until 5 November and now does not. The
 *                              rule survives either way, a hardcoded number
 *                              would not;
 *   --hero-max-h * w / h       the width a height-clamped portrait actually
 *                              occupies, which is the curtain fix itself.
 *
 * Square heroes (28 of them) are height-clamped in exactly the same way and
 * get exactly the same curtains; they are excluded only because Mark asked
 * about portraits. Including them is `>` → `>=` in piece_detail.html. */
.hero-tall {
  width: min(100%, calc(var(--hero-w) * 1px),
             calc(var(--hero-max-h) * var(--hero-w) / var(--hero-h)));
  margin-inline: auto;
}
/* `width: auto` rather than `100%`, so the band never enlarges a photograph
 * past its own pixels: a 2560px master still fills it (auto exceeds the band,
 * max-width clamps it back), while a 356px legacy scan sits centred at native
 * size on the dark ground instead of being stretched across the viewport and
 * going soft. The whole Anthony Phillips collection is scans of that order —
 * median 500px wide — which is what surfaced this. */
/* `object-fit: contain` is belt-and-braces: with the band and the element both
 * taking the photograph's own ratio there is nothing left to fit, but it keeps
 * a hero honest if either ever stops matching. The hero no longer needs to
 * undo a card ratio — see `.grid figure img`, which is now scoped to gallery
 * tiles instead of every figure on the site. */
/* `width: auto` NOT `width: 100%`, and the difference is invisible until you
   look at a small photograph (3 November 2026). `100%` forced every image to
   the band's full width, so a 356px legacy scan was stretched roughly 4x and
   went soft — and the symptom reads as "too big", not "too low-resolution",
   which is why it survived so long. With `auto` a 2560px master still fills
   the band (auto exceeds it, max-width clamps it back) while anything smaller
   sits centred at its native size on the dark ground. Applies site-wide,
   piece pages included, so some legacy-scan heroes render deliberately
   smaller and sharper than they used to.

   This CSS alone did not achieve it: the rendition layer was upscaling too,
   and both ends looked correct in isolation. See works/models.py on
   `upscale=False` — the two have to agree or neither decision takes effect. */
.hero img {
  width: auto; max-width: 100%; max-height: var(--hero-max-h);
  object-fit: contain; margin: 0 auto; display: block;
}
.hero figcaption {
  color: #8d8a84; font-size: .82rem; text-align: center;
  padding: .9rem 1rem 1.3rem;
}

/* --- home page sections ---------------------------------------------
 * Composed from active HomeSection rows — see pages.models.HomeSection and
 * templates/pages/home.html. Each kind gets its own block below. */

.home-hero {
  position: relative; background: var(--dark); overflow: hidden;
  min-height: min(85vh, 50rem);
  display: flex; align-items: flex-end;
}
.home-hero-media {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
}
.home-hero-text {
  position: relative; z-index: 1; color: #f3f1ec;
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem);
  max-width: var(--measure);
  background: linear-gradient(0deg, rgba(0,0,0,.95), rgba(0,0,0,.55) 95%);
}
.home-hero-text h2 {
  font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 400; margin: 0 0 .7rem;
}
.home-hero-text p { margin: 0 0 1.2rem; color: #d8d4cb; }
.cta {
  display: inline-block; font: 500 .74rem/1 system-ui, sans-serif;
  letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  color: #f3f1ec; border: 1px solid #f3f1ec; border-radius: 2px;
  padding: .85rem 1.6rem;
}
.cta:hover { background: #f3f1ec; color: var(--dark); }

.home-links { margin-top: clamp(3rem, 7vw, 5rem); }

.home-text { padding: clamp(2.5rem, 6vw, 4rem) 0; text-align: center; }
.home-text h2 { font-weight: 400; margin: 0 0 1rem; }
.home-text p {
  font-size: 1.15rem; line-height: 1.7; color: var(--ink-soft);
  margin: 0 auto;
}

/* Text panel with an image beside it — position and width are per-section
 * admin fields (HomeSection.image_position / .image_width_percent), read
 * here via the --img-width custom property set inline on the section.
 * Mobile: plain stacked flow, image above text, same as every other
 * section — there's no "beside" on a phone. Desktop: a two-column row,
 * image width set by the admin field, text filling what's left; `order`
 * flips which side the image is on without needing two template branches. */
/* padding-top/bottom only — a shorthand "padding: ... 0" here would zero
   out the left/right padding .wrap already set, leaving text flush against
   the screen edge. */
.home-text-media {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
}
.home-text-media-img { margin: 0 0 1.5rem; }
.home-text-media-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.home-text-media-text h2 { font-weight: 400; margin: 0 0 1rem; }
.home-text-media-text p {
  font-size: 1.1rem; line-height: 1.7; color: var(--ink-soft); margin: 0;
}

@media (min-width: 56rem) {
  .home-text-media { display: flex; align-items: center; gap: clamp(2rem, 5vw, 4rem); }
  .home-text-media-img { flex: 0 0 var(--img-width); margin: 0; }
  .home-text-media-text { flex: 1 1 auto; }
  .home-text-media--left .home-text-media-img { order: -1; }
  .home-text-media--right .home-text-media-img { order: 1; }
}

/* --- piece page ----------------------------------------------------- */

.piece-body { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr; }
@media (min-width: 60rem) {
  .piece-body { grid-template-columns: minmax(0, 1fr) 17rem; align-items: start; }
}
.piece-body .story p:first-child { margin-top: 0; }

/* --- flat page with a photo (About) ---------------------------------- */

.page-body.with-photo {
  display: grid; gap: clamp(2rem, 5vw, 3.5rem); max-width: var(--wide);
}
@media (min-width: 50rem) {
  .page-body.with-photo {
    grid-template-columns: 18rem minmax(0, var(--measure));
    align-items: start;
  }
}
.page-photo { margin: 0; }
.page-photo img { border-radius: 2px; background: #efece6; }

.spec { border-top: 2px solid var(--ink); padding-top: 1rem; font-size: .9rem; }
.spec h2 {
  font: 500 .7rem/1 system-ui, sans-serif; letter-spacing: .18em;
  text-transform: uppercase; margin: 0 0 1rem;
}
.spec dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; }
.spec dt { color: var(--ink-soft); font-size: .8rem; }
.spec dd { margin: 0; }

/* --- image sections ------------------------------------------------- */

section.images { margin-top: clamp(3rem, 7vw, 5rem); }
/* `--grid-gap`, so the distance from the project card above to the first
 * piece card below is EXACTLY the distance between any two rows of cards
 * (Mark, 5 November: "I'm looking for the spacing to match the spacing given
 * by the rest of the cards on the work page").
 *
 * Three values were tried before this one, and the first two were wrong for
 * the same reason — they were chosen as spacing between SECTIONS. A full
 * `section.images` break gave 80px ("too much gap"); half of it gave 40px,
 * better but still arbitrary. The project card and the pieces are one grid of
 * results interrupted by a heading, so the row rhythm is the right unit and
 * there is nothing left to tune. No margin collapsing to reason about either:
 * a grid's `gap` is not a margin, so this value is simply reused, not matched.
 *
 * On technique pages with NO projects row the grid follows `.filters`, whose
 * 2.5rem bottom margin collapses with this smaller top margin and wins — so
 * those nine pages keep the 40px they had when this grid was an unwrapped
 * <div> with no margin at all. A full section rule would have widened them
 * all to 80px, which is a change nobody asked for. */
section.images.results { margin-top: var(--grid-gap); }
section.images > h2 {
  font: 500 .72rem/1 system-ui, sans-serif; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 1px solid var(--rule); padding-bottom: .7rem; margin: 0 0 1.6rem;
}
section.images .note { color: var(--ink-soft); font-size: .88rem; margin: -1rem 0 1.6rem; }

.show-all {
  display: block; margin: 1.4rem 0 0; cursor: pointer;
  font: 500 .76rem/1 system-ui, sans-serif; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft);
  background: none; border: 0; border-bottom: 1px solid var(--rule);
  padding: 0 0 .3rem;
}
.show-all:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* `--card-min` is a property rather than a literal because the lone-card rule
 * below reads it, and two copies of 17rem is how that rule silently stops
 * matching the grid it is correcting. */
.grid { display: grid; gap: var(--grid-gap); }
.grid.large   { --card-min: 26rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr)); }
.grid.medium  { --card-min: 17rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr)); }
.grid.small   { grid-template-columns: repeat(auto-fill, minmax(min(45%, 11rem), 1fr)); }

/* A technique section is now a STACK OF GRIDS, one per row, so each row can
 * measure its own slot ratio — see works/views.py `_rows`. `gap` only works
 * between a grid's own children, so the vertical rhythm between those rows
 * has to be supplied here or consecutive rows butt together.
 *
 * `--grid-gap`, the same variable `.grid` uses for its own gap, so a reader
 * cannot tell where one row's grid ends and the next begins. Hard-coding a
 * value here is how the horizontal and vertical gaps drift apart — the same
 * trap recorded above for `--card-min`. */
.grid-rows { display: grid; gap: var(--grid-gap); }

/* A LONE CARD IS NO LONGER CENTRED — reversed by Mark, 5 November: "I have
 * previously said that if a piece is on its own (like the enamel cross) then
 * put it in the centre but this doesn't look right so let's drop that
 * requirement and have them cards displayed starting on the left - as we had
 * before I asked for the centering."
 *
 * So every card in every grid now starts at the left, and a section holding
 * one piece leaves the rest of its row blank. Recorded here rather than left
 * as an absence because the rule it replaces was built deliberately on
 * 28 October, argued for at length in README, and marked closed — a later
 * session finding no centring could easily "restore" it. It was asked for,
 * built, lived with, and dropped on the evidence of looking at it.
 *
 * The `centre-last` class is gone from piece_list.html with it. Nothing else
 * referenced either. */

figure { margin: 0; }
/* The fixed ratio is what lines a row up: a portrait source stretched to the
 * same 100% width as a landscape one comes out far taller, and the two never
 * align. That is the ratio's job, and it is unchanged here.
 *
 * The FIT is `contain`, same as the piece cards (.card img), and for the same
 * reason — a photograph must not lose any of the work. `cover` was used here
 * on the argument that a gallery is a wall of even tiles and a sliver off each
 * edge is invisible. True while a photograph is near the slot's shape, and the
 * slot is chosen from the majority (works/aspect.py), so the majority never
 * noticed either way. It is false for the minority: a 2/3 portrait in a 3/2
 * slot renders 44% visible, 28% cropped off the top and 28% off the bottom.
 * That was 63 of 813 images losing more than half the photograph, among them
 * the doorknobs, the cross and the elliptical plaque process shots.
 *
 * So the minority now letterboxes against the ground colour instead of being
 * cropped in half. Note the slot ratio is NOT the thing to fix when a grid
 * genuinely holds both orientations — see aspect.py on why the tie-break is
 * left alone. */
/* `.grid figure img`, NOT `figure img` (5 November). This rule used to match
 * every <figure> on the site, with a comment saying the 4/3 "fallback keeps
 * the old 4/3 for any figure that is not inside a .grid". That fallback was
 * the bug: a figure outside a grid is a SINGLE photograph with nothing to
 * line up against, so a card ratio could only letterbox it — and because the
 * rule also set `background: #efece6`, the letterbox showed as light-grey
 * curtains either side of the picture.
 *
 * Four of the five figure contexts on the site were outside grids and all
 * four were wrong, which is what makes the default wrong rather than each
 * site: `.hero` (piece, collection and exhibition pages), `.entry-lead`
 * (every journal post's lead image), `.head-portrait` (the portrait of Tony
 * on the tribute collection, reported by Mark) and `.page-photo` (the
 * photograph of Mark on About). Each overrode width or background and none
 * overrode `aspect-ratio`, so each inherited a card slot it had no use for.
 *
 * The distinction is structural, not a list to maintain: a BARE <figure>
 * inside `.grid` is a gallery tile, and tiles need a shared ratio or rows
 * never align. A CLASSED <figure> outside a grid is one photograph. Checked
 * every grid in the templates — the only one that sets no `--card-ratio` is
 * the home page links grid, which holds `.card`/`.thumb` markup rather than
 * figures, so the fallback below is now belt-and-braces for a grid of figures
 * that forgets to set one. */
.grid figure img {
  width: 100%; aspect-ratio: var(--card-ratio, 4 / 3);
  object-fit: contain; background: #efece6;
}
figure figcaption { font-size: .82rem; color: var(--ink-soft); padding-top: .5rem; }

/* Detail macros get the dark ground — this is the enamel surface itself. */
.grid.detail figure { background: var(--dark); padding: .7rem; }
.grid.detail figcaption { color: #8d8a84; padding: .6rem .2rem 0; }

details.process > summary {
  cursor: pointer; font: 500 .72rem/1 system-ui, sans-serif;
  letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 1px solid var(--rule); padding-bottom: .7rem; margin-bottom: 1.6rem;
}

/* --- listing -------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2.5rem; }
.filters a {
  font: 500 .72rem/1 system-ui, sans-serif; letter-spacing: .1em;
  text-decoration: none; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: 2rem; padding: .45rem .9rem;
}
.filters a.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Card slot shape. One ratio per grid, set inline by the template from the
 * majority of the photographs that grid is showing (works/aspect.py) — 3/2
 * for camera-native work, 1/1 for the square-cropped doorknobs.
 *
 * The ratio must stay IDENTICAL for every card in a grid: that is what keeps
 * a row aligned top and bottom. Per-card sizing would give a ragged edge.
 * The fallback here is what an unmeasured grid gets. */
.grid { --card-ratio: 3 / 2; }

.card { text-decoration: none; display: block; }
.card img { width: 100%; aspect-ratio: var(--card-ratio); object-fit: contain; }

/* A click-through thumbnail magnifies a few percent on hover — .thumb is the
 * clipping frame (an element can't clip its own transform, only a parent
 * can), the <img> inside is what actually scales. */
.thumb { display: block; overflow: hidden; background: #000000;}
.thumb img { transition: transform .5s ease; }
.card:hover .thumb img, .entry-card:hover .thumb img { transform: scale(1.05); }
.card h2 { font-size: 1.05rem; font-weight: 400; margin: .7rem 0 .15rem; }
.card .meta { font-size: .82rem; color: var(--ink-soft); }
/* Matched to the photo slot so "no photograph yet" cards are the same height
 * as their neighbours — must track --card-ratio, not a fixed 3/2. */
.card .placeholder {
  aspect-ratio: var(--card-ratio); background: #eceae4;
  display: grid; place-items: center;
  color: #a9a49a; font: .78rem system-ui, sans-serif;
}

.unpublished { outline: 2px dashed #b9892a; outline-offset: 3px; }

/* --- exhibitions ---------------------------------------------------- *
 * A record, not a gallery: ruled rows in the same idiom as .spec, so the
 * section reads as evidence rather than competing with the piece cards. */

.exhibition-list { list-style: none; margin: 0; padding: 0; }
.exhibition-list > li {
  border-top: 1px solid var(--rule); padding: 1rem 0;
}
.exhibition-list > li:first-child { border-top: 2px solid var(--ink); }
.exhibition-list h3 { font-size: 1.05rem; font-weight: 400; margin: 0 0 .2rem; }
.exhibition-list .meta { font-size: .82rem; color: var(--ink-soft); margin: 0; }
.exhibition-pieces { font-size: .9rem; margin: .5rem 0 0; }
.exhibition-pieces em { color: var(--ink-soft); font-style: normal; }

/* An award is a claim worth setting apart from the techniques-and-year meta
 * line it sits under, on a card and in the piece page's "Exhibited" list. */
.award {
  font: 500 .74rem/1.4 system-ui, sans-serif;
  letter-spacing: .08em; text-transform: uppercase;
  color: #b9892a; margin: .3rem 0 0;
}

/* --- composed narrative sections ------------------------------------ *
 * The exhibition page is built from ExhibitionSection records, the same
 * shape as the home page's HomeSection but a separate model (see the
 * model's docstring for why) — hence separate class names rather than
 * reusing .home-text-media, which would tie the two pages' layouts
 * together through the stylesheet after deliberately keeping their data
 * apart.
 *
 * `measure` already caps the line length on the text-only variant, so
 * .narrative only needs its rhythm. */

.narrative { padding: clamp(1.5rem, 4vw, 2.5rem) 0; }
.narrative h2 { font-weight: 400; margin: 0 0 1rem; }
.narrative p { font-size: 1.1rem; line-height: 1.7; margin: 0; }

/* A photograph on its own between passages. Full column width, not
 * full-bleed — the hero above already does full-bleed, and a second one
 * mid-page competes with it. */
.narrative-figure { margin: clamp(1.5rem, 4vw, 2.5rem) 0; }
.narrative-figure img { width: 100%; }

/* Text with a photograph beside it. Mobile: stacked, image above text —
 * there is no "beside" on a phone. Desktop: a two-column row whose image
 * width comes from --img-width, set inline per section from the admin
 * field; `order` flips the side without a second template branch.
 * padding-top/bottom only, never the shorthand — "padding: x 0" would zero
 * the left/right padding .wrap set and leave text on the screen edge. */
.text-media {
  padding-top: clamp(2rem, 5vw, 3.5rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}
.text-media-img { margin: 0 0 1.5rem; }
.text-media-img img { width: 100%; }
.text-media-text h2 { font-weight: 400; margin: 0 0 1rem; }
.text-media-text p { font-size: 1.1rem; line-height: 1.7; margin: 0; }

@media (min-width: 56rem) {
  .text-media { display: flex; align-items: center; gap: clamp(2rem, 5vw, 4rem); }
  .text-media-img { flex: 0 0 var(--img-width); margin: 0; }
  .text-media-text { flex: 1 1 auto; }
  .text-media--left .text-media-img { order: -1; }
  .text-media--right .text-media-img { order: 1; }
}

/* --- footer --------------------------------------------------------- */

footer {
  border-top: 1px solid var(--rule);
  padding: 2.5rem clamp(1rem, 4vw, 3rem);
  color: var(--ink-soft);
}
footer .credential { margin: 0 0 .3rem; }
footer .small { font-size: .84rem; margin: 0; }
footer .copyright { font-size: .78rem; margin: 1rem 0 0; }
/* Below the copyright line, and quieter than it: a privacy notice has to be
 * easy to FIND, which is not the same as prominent. `.small` already sets the
 * size, so this only has to place it and keep the link legible against
 * --ink-soft. */
footer .footer-links { margin: .5rem 0 0; font-size: .78rem; }
footer .footer-links a { color: var(--ink-soft); text-underline-offset: .2em; }
footer .footer-links a:hover { color: var(--ink); }

@media (prefers-color-scheme: dark) {
  :root { --paper: #141412; --ink: #ece9e3; --ink-soft: #a29d93; --rule: #302d28; }
  figure img { background: #22211d; }
  .card .placeholder, .thumb { background: #22211d; color: #5d584f; }
}

/* --- journal ------------------------------------------------------- */

/* The lead photograph sits in the text column, not across the page. A journal
 * entry is a piece of writing with an illustration, not a gallery — running it
 * full width overhangs the 34rem measure and swamps the prose. */
.entry-lead { margin: 0 0 2rem; max-width: var(--measure); }
.entry-lead img { width: 100%; background: #efece6; }
.entry-lead figcaption { font-size: .85rem; color: var(--ink-soft); padding-top: .5rem; }
.entry-body img { margin: 1.6rem 0 .4rem; background: #efece6; }
/* Clips in a post, inserted by the body picker as of 6 November. A <video>
 * needs this spelled out where an <img> does not: the global rule at the top
 * of this file is `img { max-width: 100%; height: auto; display: block }` and
 * it does not apply to video, so without this a 1920px clip overhangs the
 * 34rem measure. Matches `.entry-body img` above on margin and placeholder
 * colour so a clip and a still sit in the prose identically — the poster
 * frame IS a still, and a reader should not be able to tell which is which
 * until they press play. */
.entry-body video {
  max-width: 100%; height: auto; display: block;
  margin: 1.6rem 0 .4rem; background: #efece6;
}
.entry-body h2, .entry-body h3 { font-weight: 400; margin-top: 2rem; }
.series-list { padding-left: 1.2rem; }
.series-list li { margin-bottom: .45rem; }
.series-list .meta, .meta { color: var(--ink-soft); font-size: .85rem; }
.seriesnav { display: flex; justify-content: space-between; gap: 2rem;
  border-top: 1px solid var(--rule); margin-top: 3rem; padding-top: 1.2rem;
  font-size: .9rem; }

/* Journal listing cards -------------------------------------------- */

.entry-cards { display: grid; gap: clamp(1rem, 2.5vw, 1.8rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.entry-card { text-decoration: none; display: grid; grid-template-rows: auto 1fr; }
.entry-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: #efece6; }
.entry-card .placeholder { aspect-ratio: 3 / 2; background: #eceae4;
  display: grid; place-items: center; color: #a9a49a;
  font: .78rem system-ui, sans-serif; }
.entry-card h3 {
  font-size: 1.02rem; font-weight: 400; margin: .7rem 0 .2rem;
  display: inline-block; border-bottom: 1px solid transparent;
}
.entry-card .meta { margin: 0 0 .4rem; }
.entry-card .teaser { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.entry-card:hover h3 { border-bottom-color: var(--accent); }
.more { margin-top: 1.2rem; font-size: .9rem; }

/* Enquiry form ------------------------------------------------------ */

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; }
.enquiry .field { display: grid; gap: .35rem; margin: 0 0 1.3rem; }
.enquiry label { font: 500 .72rem/1 system-ui, sans-serif;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.enquiry input, .enquiry textarea, .enquiry select {
  font: inherit; padding: .65rem .75rem; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); border-radius: 2px; width: 100%; }
.enquiry input:focus, .enquiry textarea:focus, .enquiry select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; }
/* The consent tick. Every rule here is undoing something above that is right
 * for a text input and wrong for a checkbox: the grid stacks children, so the
 * box would sit on its own line above the sentence; `width: 100%` would
 * stretch the box across the whole form; and the uppercase letter-spaced label
 * is a FIELD NAME treatment, unreadable on a sentence the visitor has to
 * actually read before agreeing to it. */
.enquiry .field.tick {
  display: flex; align-items: flex-start; gap: .6rem;
}
.enquiry .field.tick input {
  width: auto; flex: none; margin: .15rem 0 0; padding: 0;
  accent-color: var(--accent);
}
/* Longhand, NOT the `font` shorthand. `font: 400 .85rem/1.5 inherit` looks
 * right and is invalid — `inherit` is not allowed as the family inside the
 * shorthand — so the whole declaration is dropped and the label silently
 * keeps the 0.72rem uppercase field-name styling. Measured at 11.52px when it
 * should have been 13.6px, which is exactly the sort of thing that reads as
 * "the CSS didn't load" rather than as a typo. */
.enquiry .field.tick label {
  font-family: inherit; font-size: .85rem; font-weight: 400; line-height: 1.5;
  letter-spacing: normal; text-transform: none;
  color: var(--ink); cursor: pointer;
}
.enquiry .field.tick label a { color: var(--ink-soft); }
.enquiry button { font: 500 .78rem/1 system-ui, sans-serif; letter-spacing: .16em;
  text-transform: uppercase; background: var(--ink); color: var(--paper);
  border: 0; padding: .9rem 2rem; cursor: pointer; border-radius: 2px; }
.error { color: #b02a2a; font-size: .85rem; }
.notice { border-left: 3px solid var(--accent); padding-left: 1rem; }

/* An aside inside a journal entry.
 *
 * Mark used a <pre> for a "side note" in Cloisonné Amazon Frog (Part 3) — one
 * 506-character paragraph. <pre> preserves whitespace and does not wrap, so it
 * ran off the page unreadably. Keep the monospace (it reads as a note, which
 * is the point) but let it wrap like ordinary prose.
 *
 * This is the only <pre> in the journal. If code listings are added later they
 * want the opposite treatment — overflow-x: auto, no wrapping — so check
 * before generalising this rule.
 */
.entry-body pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font: .92rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #f1efe9;
  border-left: 3px solid var(--accent);
  padding: 1rem 1.1rem;
  margin: 1.8rem 0;
  border-radius: 2px;
}
.entry-body pre u { text-decoration: none; font-weight: 600; letter-spacing: .04em; }

/* Long URLs and unbroken strings must not push the column wider. */
.entry-body, .story { overflow-wrap: break-word; }

@media (prefers-color-scheme: dark) {
  .entry-body pre { background: #1e1d19; }
}

/* Code listings — the opposite treatment to the prose aside above.
 *
 * G-code must NOT wrap: a line broken mid-expression
 * (`O<do_elipse_fn> call [#<param_a>]...`) is unreadable. It scrolls inside
 * its own box instead, so a 137-line program never widens the page.
 *
 * Capped in height so one listing cannot push the rest of the entry below the
 * fold; it scrolls vertically too.
 */
.entry-body pre.code {
  white-space: pre;
  overflow: auto;
  max-height: 32rem;
  font: .78rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #15161a;
  color: #d8d4cb;
  border-left: 3px solid var(--accent);
  padding: 1rem 1.2rem;
  margin: 1.8rem 0;
  border-radius: 3px;
  tab-size: 4;
}
.entry-body pre.code::-webkit-scrollbar { height: 9px; width: 9px; }
.entry-body pre.code::-webkit-scrollbar-thumb { background: #44474f; border-radius: 5px; }

/* --- "how it was made" lightbox -------------------------------------
 * A native <dialog>, not a hand-rolled overlay: Escape-to-close, focus
 * trapping and the backdrop all come for free. The fade/scale is a manual
 * class toggle rather than @starting-style, which is too new to rely on yet.
 */
.lightbox {
  border: 0; padding: 0; background: transparent; color: inherit;
  max-width: 94vw; max-height: 94vh;
  /* No transform/opacity here: either one on the dialog itself turns it
     into the containing block for its position:fixed children, so the
     arrows would move with the image's box instead of staying put on
     screen. The open/close animation lives on .lightbox-content instead. */
}
.lightbox::backdrop {
  background: rgba(10, 9, 8, 0);
  transition: background .22s ease;
}
.lightbox.show::backdrop { background: rgba(10, 9, 8, .92); }

.lightbox-content {
  opacity: 0; transform: scale(.97);
  transition: opacity .22s ease, transform .22s ease;
}
.lightbox.show .lightbox-content { opacity: 1; transform: scale(1); }

.lightbox-img {
  display: block; margin: 0 auto;
  max-width: 94vw; max-height: 78vh; width: auto; height: auto;
  object-fit: contain; background: transparent;
}
/* Matches .lightbox-img so swapping one for the other does not resize the
 * overlay. 78vh leaves the caption room below on a landscape screen. */
.lightbox-video {
  display: block; margin: 0 auto;
  max-width: 94vw; max-height: 78vh; width: auto; height: auto;
  background: #000;
}
.lightbox-video[hidden], .lightbox-img[hidden] { display: none; }

.lightbox-caption {
  max-width: 44rem; margin: 1.1rem auto 0; padding: 0 1rem;
  color: #d8d4cb; text-align: center; font-size: .92rem; line-height: 1.6;
}

/* The object's real size, deliberately quieter and smaller than the caption:
 * the caption is Mark's writing about the photograph and leads, this is a
 * measurement that should be findable without competing with it. Tighter
 * margin than the caption's so the two read as one block rather than two
 * separate notes.
 *
 * Deliberately NOT added to the .fading rule below that crossfades the image
 * and caption on prev/next. Every trigger on a piece page carries the same
 * piece's dimensions, so the text never changes between slides — fading a
 * constant value out and back in would read as a flicker. If this line ever
 * becomes per-image, it needs to join that rule.
 *
 * The [hidden] rule is belt-and-braces: the UA stylesheet already hides it
 * and nothing here sets `display` on these paragraphs, but a later
 * `.lightbox-content p { display: … }` would silently reveal an empty line
 * on every unmeasured piece. */
.lightbox-dimensions {
  max-width: 44rem; margin: .4rem auto 0; padding: 0 1rem;
  color: #9b9589; text-align: center; font-size: .82rem; line-height: 1.5;
  letter-spacing: .01em;
}
.lightbox-dimensions[hidden] { display: none; }

/* A clip's grid card is its poster frame, which is indistinguishable from a
 * photograph — so it needs saying. Driven off the attribute with :has()
 * rather than a marker element, so no template carries a badge it would then
 * have to keep in sync with the data. Where :has() is unsupported the badge
 * is simply absent and the clip still plays. */
figure:has(.lightbox-trigger[data-video]) { position: relative; }
figure:has(.lightbox-trigger[data-video])::after {
  content: "▶";
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3.2rem; height: 3.2rem;
  display: grid; place-items: center;
  box-sizing: border-box; padding-left: .18em;   /* optical centring */
  border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85);
  background: rgba(10, 9, 8, .45);
  color: #fff; font-size: 1.1rem; line-height: 1;
  pointer-events: none;                 /* the <img> underneath takes clicks */
  transition: background .18s ease;
}
figure:has(.lightbox-trigger[data-video]):hover::after {
  background: rgba(10, 9, 8, .7);
}
/* Prev/next crossfade — half the total --fade-ms (SiteSettings.lightbox_
 * fade_ms, set inline on .lightbox) for the fade out, matched by the same
 * duration back in once the JS swaps the src while .fading is still on. */
.lightbox-img, .lightbox-caption {
  opacity: 1;
  transition: opacity calc(var(--fade-ms, 500) * .5ms) ease;
}
.lightbox-img.fading, .lightbox-caption.fading { opacity: 0; }

/* z-index is load-bearing, not decoration: .lightbox-content carries a
 * transform for the open animation, which makes it a stacking context
 * painted as if z-index:0. These buttons are z-index:auto, so they land in
 * the same bucket and lose on DOM order — .lightbox-content comes after
 * them in the markup. On a narrow viewport the content box grows to nearly
 * the full width and covers the arrows entirely, so taps on them hit the
 * content instead and nothing happens. Desktop hides the bug: the content
 * box is narrower there and the arrows sit clear of it.
 * The padding is the other half — the unpadded glyph box is ~27x31px,
 * under the ~44x44px minimum touch target. */
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: fixed; z-index: 2; border: 0; background: none; cursor: pointer;
  color: #f3f1ec; opacity: .75;
  font: 300 1.8rem/1 system-ui, sans-serif;
  padding: .55rem; min-width: 44px; min-height: 44px;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { opacity: 1; }
.lightbox-close { top: 1.2rem; right: 1.5rem; font-size: 2.2rem; }
.lightbox-prev { top: 50%; left: 1.2rem; transform: translateY(-50%); }
.lightbox-next { top: 50%; right: 1.2rem; transform: translateY(-50%); }
.lightbox-prev[hidden], .lightbox-next[hidden] {display: none; }

@media (max-width: 40rem) {
  .lightbox-close { top: .6rem; right: .8rem; }
  .lightbox-prev { left: .4rem; }
  .lightbox-next { right: .4rem; }

