/* The PAGE SYSTEM: the design language of the detail pages (Off-White and future briefs). Rules, block types and
   how to add a page: docs/page-system.md. Blocks are templates in src/blocks/ (each carries data-block="…"); pages
   hold content only, never layout CSS. Check a page with: python3 scripts/layout-check.py /work/<slug>/
   - ONE column (--col) for everything, centered on the page's center line; panels are the column + padding.
   - Every block is a direct child of the page (or of a panel body), centered with margin-inline: auto. No floats,
     offsets, negative margins or grid placement.
   - Height cap: no figure, card row or table is taller than --media-cap % of the window's visible content height
     (--view-h, measured by components/case-study.js; CSS fallback below).
   Semantic tokens only. Layout follows the WINDOW width (container queries on .os-browser__page). */

:root {
  --page-col: 1000px;   /* the one column, before --detail-scale */
  --media-cap: 70;      /* % of the visible content height a figure, card row or table may use */
  --detail-scale: 0.79; /* chosen by Nick with the Size tweaker: text, column and spacing, all at once */
  /* floating figures: the levitating shadow (colors: --float-shadow and --float-rim in styles/tokens.css) */
  --float-shadow-w: 68%;     /* of the image's rendered width, centered under it */
  --float-shadow-h: 14px;    /* x --detail-scale */
  --float-shadow-gap: 14px;  /* space between the image's bottom edge and the shadow, x --detail-scale */
  --float-shadow-blur: 10px;
  /* The WIDE column variant (data-column="wide" on the page; Content uses it) and the gallery-grid block. The names
     come from the Content page; values Nick chose. */
  --content-grid-max: 1078px; /* the wide column, used as-is (no --detail-scale) */
  --content-gap: 6%;          /* gallery grids: column gap, % of the grid's width */
  --content-row-gap: 6;       /* gallery grids: row gap, as % of the grid's width (a plain number) */
}

.site-page.pg {
  --col: calc(var(--page-col) * var(--detail-scale));
  /* the spacing scale: every gap, panel padding and card gap */
  --sp-1: calc(4px * var(--detail-scale));
  --sp-2: calc(8px * var(--detail-scale));
  --sp-3: calc(12px * var(--detail-scale));
  --sp-4: calc(20px * var(--detail-scale));
  --sp-5: calc(28px * var(--detail-scale));
  --sp-6: calc(44px * var(--detail-scale));
  --pg-pad: var(--sp-5);   /* panel padding, all four sides */
  --pg-frame: 3px;         /* panel border (1px) + panel body bevel (2px), each side */
  --panel-w: calc(var(--col) + 2 * (var(--pg-pad) + var(--pg-frame)));
  --wide-w: 1100px;        /* hero and the wide panel (the calendar); a wide panel may declare its own (wide-max) */
  --view-h: calc(100dvh - 180px); /* fallback until case-study.js sets the window's visible content height */
  --cap: calc(var(--view-h) * var(--media-cap) / 100);
  --frame-pad: calc(3px * var(--detail-scale)); /* framed: the thin space between the bevel and the image */
  --media-inset: calc(2 * (1px + var(--frame-pad))); /* framed: border + padding, both sides (0 when floating/bare) */
  --fs-h: calc(var(--float-shadow-h) * var(--detail-scale));     /* floating shadow, scaled */
  --fs-gap: calc(var(--float-shadow-gap) * var(--detail-scale));
  --pg-gap: var(--sp-6);   /* between the blocks on the page */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
}

/* The WIDE column variant: the column is --content-grid-max at scale 1, centered (Content) */
.site-page.pg[data-column="wide"] {
  --detail-scale: 1;
  --col: var(--content-grid-max);
}

/* ---- The column: every block sits in it, centered ---- */
.pg > [data-block] {
  width: min(100%, var(--col));
  min-width: 0;
  margin: 0 auto;
}
.pg > [data-block] + [data-block] { margin-top: var(--pg-gap); }
.pg > [data-block="heading"] + [data-block="text"] { margin-top: var(--sp-3); } /* a page-level heading hugs its text */
.pg > [data-block="section"] { width: min(100%, var(--panel-w)); }
.pg > [data-block="section"].pg-panel--wide,
.pg > [data-block="hero"] { width: min(100%, var(--wide-w)); }

/* ---- section: a title-barred panel; its body is one column of blocks ---- */
.pg-panel {
  scroll-margin-top: var(--sp-4); /* the jump-row keeps the title bar in view */
}
.pg-panel:focus { outline: none; }

/* A section without a label: its title is the heading in the title bar (h3; Content's panels) */
.pg-panel--bar .titlebar-grad { min-height: 30px; padding-block: 4px; }
.pg-bar-title {
  font-family: var(--font-heading);
  font-size: calc(1.0625rem * var(--heading-scale));
  font-weight: var(--heading-weight);
  font-synthesis: none;
  letter-spacing: var(--heading-tracking);
  line-height: 1.375rem; /* fixed: same bar height in both heading modes */
  text-transform: none;
} /* focused by the jump-row for screen readers; no ring needed */

.pg-panel__body.tbox__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: var(--sp-4);
  padding: var(--pg-pad);
  background: var(--surface);
  color: var(--text);
  font-size: inherit;
  line-height: inherit;
}
.pg-panel__body > [data-block] {
  width: 100%;
  min-width: 0;
  margin: 0 auto;
}

/* ---- Text blocks: left-aligned, filling the column ---- */
.pg-header {
  display: grid;
  gap: var(--sp-3);
}
.pg-header > * { margin: 0; }

.pg-title {
  max-width: 100%;
  color: var(--heading);
  font-size: calc(clamp(2rem, 1.3rem + 2.4cqi, 3.25rem) * var(--heading-scale));
  letter-spacing: var(--heading-tracking);
  line-height: var(--heading-leading);
  text-wrap: balance;
}
.pg-header > .pg-title { margin-top: var(--sp-2); }

.pg-sub {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: calc(1.125rem * var(--detail-scale));
  line-height: 1.5;
}

.pg-note.os-alert { width: 100%; margin-top: var(--sp-2); }
.pg-note p {
  font-family: var(--font-body);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.6;
}

.pg-headline {
  margin: 0;
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: calc(clamp(1.5rem, 1.1rem + 1.6cqi, 2.25rem) * var(--heading-scale));
  font-weight: var(--heading-weight);
  font-synthesis: none;
  letter-spacing: var(--heading-tracking);
  line-height: var(--heading-leading);
  text-wrap: balance;
}

.pg-h2 {
  margin: 0;
  color: var(--text);
  font-size: calc(clamp(1.5rem, 1.25rem + 0.9cqi, 1.875rem) * var(--heading-scale));
  letter-spacing: var(--heading-tracking);
  line-height: var(--heading-leading);
}

.pg-h3 {
  margin: 0;
  color: var(--text);
  font-size: calc(1.125rem * var(--heading-scale));
  letter-spacing: var(--heading-tracking);
  line-height: 1.5rem; /* fixed: same height in both heading modes */
}

.pg-text,
.pg-list,
.pg-item > p {
  font-family: var(--font-body);
  font-size: calc(1.0625rem * var(--detail-scale));
  line-height: 1.7;
}
.pg-text > p { margin: 0 0 1em; }
.pg-text > :last-child { margin-bottom: 0; }

.pg-text--footnote {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--os-lo-soft);
  color: var(--text-muted);
  font-size: calc(1rem * var(--detail-scale));
  font-style: italic;
  line-height: 1.55;
}

.pg-text--muted {
  color: var(--text-muted);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.5;
}

/* caption variant: a small muted italic line, centered like a figure caption (e.g. a closing credit line) */
.pg-text--caption {
  color: var(--text-muted);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.5;
  text-align: center;
}

/* page-header byline: a bold credit line under the subtitle */
.pg-byline {
  color: var(--text);
  font-family: var(--font-body);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.5;
}

/* Wide column: paragraphs stop at 75 characters (they keep the column's LEFT edge) */
.pg[data-column="wide"] :is(.pg-text, .pg-note) p { max-width: 75ch; }

.pg-list { margin: 0; padding-left: 1.25em; }
.pg-list li + li { margin-top: 0.4em; }

/* labeled-item: a small label, then text (and optionally a tag row) */
.pg-item {
  display: grid;
  gap: var(--sp-2);
}
.pg-item > * { margin: 0; }
.pg-item > .pg-tags { margin-top: var(--sp-1); }

/* tags: start at the column's left edge and wrap */
.pg-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Small beveled tag (not a control: no hover/press state) */
.cs-tag {
  padding: 4px 10px;
  background: var(--os-btn-face);
  color: var(--os-text);
  border: 1px solid var(--os-outline);
  border-radius: var(--os-radius-btn);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo);
  font-family: var(--font-chrome);
  font-size: var(--os-size);
  line-height: 1.2;
}

/* callout: a label and a quote */
.pg-callout {
  display: grid;
  gap: var(--sp-2);
}
.pg-quote {
  margin: 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-alt);
  color: var(--text);
  border-left: 4px solid var(--accent);
  font-family: var(--font-body);
  font-size: calc(1.0625rem * var(--detail-scale));
  line-height: 1.6;
}
.pg-quote p { margin: 0; font-weight: 700; }

/* jump-row: in-page anchors (site-nav.js scrolls the window's content area, never the whole browser) */
.pg-jump ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pg-jump .os-btn { min-height: 26px; }

/* keep-exploring: "Keep exploring" (h2 at the column's left edge) + a row of three link cards filling the column (the
   card-row grid: equal widths, --sp-4 gaps; phones: one column). Cards are explore-card blocks (LINK CARDS below, 4:3
   thumbnails). Placed right before the closing block on detail pages; on autohide-dock pages, scrolling it into view
   peeks the dock once (components/case-study.js + dock-float.js). */
.pg-explore {
  display: grid;
  gap: var(--sp-4);
}

/* closing: back button, next-up row (only when it has links), disclaimer */
.pg-closing {
  display: grid;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
}
.pg-closing > * { margin: 0; }

/* ---- Figures (figure, hero, table-scroller, gallery cards): every image opens in the lightbox ----
   Each figure carries a TREATMENT, chosen by the page source (data-treatment, set by the block's treatment="…";
   default framed). Pages never write treatment CSS.
   - framed:   the beveled Platinum frame, image flush inside it (thin --frame-pad, no mat band). Flat artwork.
   - floating: no frame or box; the image alone with a detached LEVITATING SHADOW (a blurred flat ellipse) under
               it. Needs an image with real transparency (docs/page-system.md). No animation.
   - bare:     the image alone, nothing around it (images with their own full-bleed design). */
.pg-frame {
  display: block;
  cursor: zoom-in;
}
.pg-frame picture,
.pg-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.pg-frame:focus-visible {
  outline: 2px solid var(--os-focus);
  outline-offset: 3px;
}

[data-treatment="framed"] .pg-frame {
  padding: var(--frame-pad);
  background: var(--os-face);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo), var(--os-win-shadow);
}
[data-treatment="framed"] .pg-frame img {
  background: var(--surface-sunken); /* behind any see-through pixels */
}

[data-treatment="floating"],
[data-treatment="bare"] { --media-inset: 0px; }

[data-treatment="floating"] .pg-media {
  position: relative;
  margin-bottom: calc(var(--fs-h) + var(--fs-gap) + var(--sp-2));
}
[data-treatment="floating"] .pg-media::after {
  content: "";
  position: absolute;
  top: calc(100% + var(--fs-gap));
  left: calc((100% - var(--float-shadow-w)) / 2);
  width: var(--float-shadow-w);
  height: var(--fs-h);
  border-radius: 50%;
  background: var(--float-shadow);
  filter: blur(var(--float-shadow-blur));
  pointer-events: none;
}
[data-treatment="floating"] .pg-media img {
  filter: drop-shadow(0 0 1px var(--float-rim)); /* dark theme only: keeps a black bezel visible */
}

.pg-figure {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  margin: 0;
}

/* The frame's width comes from the image's own size (--w/--h, set by the block template), so it is right before
   the image loads: as wide as the column allows, but never taller than the cap and never larger than the file. */
.pg-media {
  --fit: min(calc((var(--cap) - var(--media-inset)) * var(--w) / var(--h)), calc(var(--w) * 1px));
  width: min(100%, calc(var(--fit) + var(--media-inset)));
  margin: 0 auto;
}
.pg-media img {
  max-height: calc(var(--cap) - var(--media-inset));
  object-fit: contain;
}

.pg-cap {
  width: 100%;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.5;
  text-align: center;
}

/* ---- card-row + stat-row: equal columns filling the column ---- */
.pg-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-card {
  display: grid;
  align-content: start;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--os-face);
  color: var(--os-text);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo), 2px 2px 0 var(--os-lo);
}
.cs-card > * { margin: 0; }
.cs-card p:not(.cs-card__label) {
  font-family: var(--font-body);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.55;
}

.cs-card__label {
  color: var(--os-text);
  font-family: var(--font-heading);
  font-size: calc(1.0625rem * var(--heading-scale));
  font-weight: var(--heading-weight);
  font-synthesis: none;
  letter-spacing: var(--heading-tracking);
  line-height: 1.5rem; /* fixed: same height in both heading modes */
}

.pg-stat {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-body);
  font-size: calc(1rem * var(--detail-scale));
  line-height: 1.45;
}
.pg-stat li { padding: 6px 0; }
.pg-stat li + li { border-top: 1px dotted var(--os-lo); }

/* ---- gallery-grid: three columns of gallery cards, centered; card width = the base width (three columns filling
   the grid: (100% - 2 gaps) / 3) x the grid's scale (--s, named per grid by the page: scale="--content-scale-45").
   layout="row": every card in ONE row of equal columns, card width = (grid width - gaps) / number of cards, gap from
   the grid's gap="--…" variable (Community: --community-gap); windows under 1100px: one column of full-width cards.
   Cards are never height-capped: the layout check warns when one is over the cap. ---- */
.pg-gallery { container: gallery / inline-size; }
.pg-gallery__grid {
  --card-w: calc((100% - 2 * var(--content-gap)) / 3 * var(--s, 1));
  display: grid;
  grid-template-columns: repeat(3, var(--card-w));
  justify-content: center;
  align-items: start;
  column-gap: var(--content-gap);
  row-gap: calc(100cqi * var(--content-row-gap) / 100); /* a % row gap would follow the grid's HEIGHT */
  margin: 0;
  padding: 0;
  list-style: none;
}
.pg-gallery--row .pg-gallery__grid {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  column-gap: var(--g, var(--content-gap));
}
@media (max-width: 1099.98px) {
  .pg-gallery--row .pg-gallery__grid { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
}

/* gallery-card: a framed thumbnail linking to the large image (lightbox), caption underneath */
.pg-card {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
}
.pg-card .pg-frame {
  min-height: 44px;
  color: inherit;
  text-decoration: none;
}
[data-treatment="framed"] a.pg-frame:hover {
  background: var(--os-face-pressed);
  border-color: var(--os-select-bg);
}
[data-treatment="framed"] a.pg-frame:active {
  box-shadow: inset 1px 1px 0 var(--os-lo), inset -1px -1px 0 var(--os-hi);
  transform: translate(1px, 1px);
}

/* LINK CARDS: the WHOLE card (thumbnail + caption) is ONE link that opens a page (home Selected work, keep-exploring).
   <li class="pg-card" data-treatment="framed"><a class="pg-card__link" href="…"><span class="pg-frame"><img class="pg-thumb" …>
   </span><span class="pg-card__cap">…</span></a></li>. Hover / pressed act on the frame; the focus ring is on the link. */
.pg-card__link {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.pg-card__link .pg-frame { cursor: pointer; }
.pg-card__link:focus-visible {
  outline: 2px solid var(--os-focus);
  outline-offset: 3px;
}
[data-treatment="framed"] .pg-card__link:hover .pg-frame {
  background: var(--os-face-pressed);
  border-color: var(--os-select-bg);
}
[data-treatment="framed"] .pg-card__link:active .pg-frame {
  box-shadow: inset 1px 1px 0 var(--os-lo), inset -1px -1px 0 var(--os-hi);
  transform: translate(1px, 1px);
}
/* Fixed-ratio thumbnails (--thumb-ratio, default 4 / 5): cover crops (--pos = object-position); --panel puts see-through
   pixels on the panel color; --contain centers the whole image on the panel color at --fit (0-1) of the area. */
.pg-thumb {
  aspect-ratio: var(--thumb-ratio, 4 / 5);
  object-fit: cover;
  object-position: var(--pos, 50% 50%);
}
.pg-frame .pg-thumb.pg-thumb--panel { background: var(--surface); }
.pg-frame .pg-thumb.pg-thumb--contain {
  box-sizing: border-box;
  padding: calc((1 - var(--fit, 0.8)) / 2 * 100% / (var(--thumb-ratio, 4 / 5))) calc((1 - var(--fit, 0.8)) / 2 * 100%);
  object-fit: contain;
  background: var(--surface);
}

/* A card whose image is still missing: a labeled frame at the right proportions */
.pg-card__missing { cursor: default; }
.pg-card__missing > span {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: var(--sp-3);
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, var(--surface-alt) 10px 20px),
    var(--surface-sunken);
  color: var(--text-muted);
  border: 1px dashed var(--os-lo);
  font-family: var(--font-chrome-text);
  font-size: var(--os-size);
  text-align: center;
}

.pg-card__cap {
  display: grid;
  gap: 2px;
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.4;
}
.pg-card__cap strong { font-size: calc(1rem * var(--detail-scale)); font-weight: 700; color: var(--text); }
.pg-card__cap span { font-size: calc(0.9375rem * var(--detail-scale)); color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  [data-treatment="framed"] a.pg-frame:active,
  [data-treatment="framed"] .pg-card__link:active .pg-frame { transform: none; }
}

/* ---- table-scroller: scrolls sideways inside its own height-capped box when the window is narrow ---- */
.pg-scroller {
  container: scroller / inline-size;
  margin: 0;
}
.pg-scroller__view { position: relative; }
.pg-scroller__box {
  max-height: var(--cap);
  overflow: auto;
  overscroll-behavior-x: contain;
}
.pg-scroller__box .pg-frame { min-width: 54rem; } /* keeps the table text legible */

/* Fade on the right edge while there is more to scroll (hidden at the end by case-study.js) */
.pg-scroller__view::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 48px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.pg-scroller__hint {
  margin-top: var(--sp-2);
  color: var(--text-muted);
  font-family: var(--font-chrome-text);
  font-size: var(--os-size);
  line-height: 1.4;
}
.pg-scroller__swipe { display: none; margin-right: var(--sp-2); color: var(--text); font-weight: 700; }

@container scroller (max-width: 54rem) {
  .pg-scroller__view::after { opacity: 1; }
  .pg-scroller__view.is-end::after { opacity: 0; }
  .pg-scroller__swipe { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-scroller__view::after { transition: none; }
}

/* ---- Desktop minimum: portrait images never shorter than 360px ---- */
@container window (min-width: 43.8125rem) {
  .pg-figure--portrait .pg-media { width: min(100%, calc(max(var(--fit), 360px * var(--w) / var(--h)) + var(--media-inset))); }
  .pg-figure--portrait .pg-media img { max-height: max(calc(var(--cap) - var(--media-inset)), 360px); }
}

/* ---- Phones: the column is the window minus the panel padding; rows stack; panels fill the width ---- */
@container window (max-width: 43.75rem) {
  .site-page.pg,
  .site-page.pg[data-column="wide"] {
    --col: calc(100% - 2 * (var(--pg-pad) + var(--pg-frame)));
    --pg-gap: var(--sp-5);
  }
  .pg > [data-block="section"] { width: 100%; }
  .pg-cards { grid-template-columns: minmax(0, 1fr); }
  .pg-stat li { padding-block: var(--sp-1); } /* stacked stat boxes stay under the height cap */
  /* gallery grids: 2 columns (a lone last card centers) with phone-cols="2", else 1 */
  .pg-gallery__grid { column-gap: 5%; row-gap: calc(100cqi * 0.05); }
  .pg-gallery .pg-gallery__grid { grid-template-columns: minmax(0, 1fr); }
  .pg-gallery .pg-card:nth-child(n) { grid-column: auto; }
  .pg-gallery--phone-2 .pg-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-gallery--phone-2 .pg-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: 47.5%; /* one column: (100% - 5%) / 2 */
  }
  .pg .os-btn { min-height: 44px; padding-inline: 16px; }
}

@media (pointer: coarse) {
  .pg .os-btn { min-height: 44px; }
}

/* ---- Shared nav rows, also used by About and Content (kept exactly as they were in case-study.css) ---- */
.case-jump ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.case-jump .os-btn { min-height: 26px; }

.case-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.case-next__label {
  font-family: var(--font-chrome);
  font-size: var(--os-size);
}

.case-disclaimer {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-chrome-text);
  font-size: var(--os-size);
  line-height: 1.5;
}

@container (max-width: 43.75rem) {
  .case-jump .os-btn { min-height: 44px; padding-inline: 16px; }
}
@media (pointer: coarse) {
  .case-jump .os-btn { min-height: 44px; }
}

/* ==========================================================================
   Blocks added for Tokyo Bold (2026-11-08), reusable on any detail page (docs/page-system.md)
   ========================================================================== */

/* figure button: a small button under a figure that opens the same image in the lightbox (a real link to the image) */
.pg-figbtn { margin: 0; text-align: center; }

/* persona-cards: two equal cards filling the column (equal gap); each card: a header (bold name line + a small
   beveled persona tag), then its paragraph. Reuses the card look (.cs-card). One column on phones. */
.pg-cards.pg-personas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg-persona__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}
.pg-persona__name {
  margin: 0;
  color: var(--os-text);
  font-family: var(--font-body);
  font-size: calc(1.0625rem * var(--detail-scale));
  font-weight: 700;
  line-height: 1.35;
}
.pg-persona__tag { display: inline-block; }

/* stat: one big number (heading font) with a small label under it, centered in the column in a beveled box.
   Number and label come from the page source ({{>stat number="…" label="…"}}). */
.pg > .pg-statbox,
.pg-panel__body > .pg-statbox {
  width: fit-content;
  max-width: 100%;
  min-width: min(100%, 16rem);
}
.pg-statbox {
  display: grid;
  justify-items: center;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-5);
  background: var(--os-face);
  color: var(--os-text);
  border: 1px solid var(--os-outline);
  box-shadow: inset 1px 1px 0 var(--os-hi), inset -1px -1px 0 var(--os-lo), 2px 2px 0 var(--os-lo);
  text-align: center;
}
.pg-statbox > p { margin: 0; }
.pg-statbox__num {
  color: var(--heading);
  font-family: var(--font-heading);
  font-size: calc(2.75rem * var(--heading-scale));
  font-weight: var(--heading-weight);
  font-synthesis: none;
  letter-spacing: var(--heading-tracking);
  line-height: 1;
}
.pg-statbox__label {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: calc(0.9375rem * var(--detail-scale));
  line-height: 1.4;
}

/* figure-row (two-up): two figures side by side at equal width in the column (gap --sp-4), each keeping its own
   aspect ratio, treatment and the height cap, centered; ONE shared caption centered below. Stacks on phones. */
.pg-figrow {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  margin: 0;
}
.pg-figrow__items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--sp-4);
  width: 100%;
}
.pg-figrow__items > .pg-figure { min-width: 0; }

@container window (max-width: 43.75rem) {
  .pg-cards.pg-personas,
  .pg-figrow__items { grid-template-columns: minmax(0, 1fr); }
}
