/* The studio components use tokens.css. Bounded thumbnails support scanning; inspection
   canvases use the available window, and main is the container for layout decisions. */

/* base */
*, *::before, *::after { box-sizing: border-box; }
/* the underline sits below the descenders, so it never hides the underscores in an id */
a { color: var(--accent); text-underline-offset: 0.3em; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* the browser's own rule hides neither SVG nor an element this sheet gives a display */
[hidden] { display: none !important; }
.icon { width: var(--icon); height: var(--icon); flex: none; }
.unit { font-size: var(--fs-1); color: var(--text-3); }
.count { color: var(--text-3); font-weight: 400; }
.sev--warn, .sev--warning { color: var(--warn); } .sev--error { color: var(--error); } .sev--note, .sev--notice { color: var(--info); }
input[type="checkbox"], input[type="radio"] { width: calc(14px * var(--scale)); height: calc(14px * var(--scale)); margin: 0; vertical-align: middle; accent-color: var(--accent); }
/* the cut lines a page draws, each defined once and drawn by reference from every thumbnail */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* A stable navigation rail surrounds independent library and inspection workspaces. */
.shell { display: grid; height: 100dvh; grid-template: "rail top top" var(--topbar) "rail strip strip" auto "rail main inspector" minmax(0, 1fr) "rail status status" auto / var(--rail) minmax(0, 1fr) auto; }
.shell--guest { grid-template: "top" var(--topbar) "strip" auto "main" minmax(0, 1fr) / minmax(0, 1fr); }
.sidebar { overflow-y: auto; overscroll-behavior: contain; grid-area: rail; display: flex; flex-direction: column; min-height: 0; padding: var(--sp-6) var(--sp-3) var(--sp-3); background: var(--bg-panel); border-right: 1px solid var(--border-2); z-index: 5; }
.sidebar > .brand { padding: 0 var(--sp-2); margin-bottom: calc(44px * var(--scale)); }
.sidebar__label { display: block; margin: 0 var(--sp-3) var(--sp-2); color: var(--text-3); font-size: var(--fs-1); font-weight: 500; }
.sidebar__nav { display: grid; gap: var(--sp-1); }
.sidebar__nav a { display: flex; align-items: center; gap: var(--sp-3); min-height: calc(42px * var(--scale)); padding: var(--sp-2) var(--sp-3); border-radius: 0; color: var(--text-2); text-decoration: none; font-size: var(--fs-2); font-weight: 500; }
.sidebar__nav a:hover { background: var(--bg-hover); color: var(--text-1); }
.sidebar__nav a[aria-current] { color: var(--text-1); font-weight: 700; }
.sidebar__nav a[aria-current]::after { content: ""; width: 5px; height: 5px; margin-left: auto; background: var(--accent); }
.sidebar__nav .icon { opacity: .85; }
.sidebar__bottom { margin-top: auto; padding-top: var(--sp-8); }
.workspace-link { display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-3) var(--sp-2); margin-bottom: var(--sp-3); border-top: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); text-decoration: none; color: var(--text-1); font-size: var(--fs-2); }
.workspace-link > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.workspace-link .sidebar__label { margin: 0; font-size: calc(10px * var(--scale)); }
.workspace-link strong { font-weight: 550; }
.workspace-link__mark { display: grid; place-items: center; flex: none; width: 32px; height: 32px; background: var(--bg-inset); border-radius: 6px; }
.topbar { grid-area: top; display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-8); background: var(--bg-app); border-bottom: 1px solid var(--border-2); }
.topbar__context { font-size: var(--fs-1); color: var(--text-2); }
.topbar__context > span { padding: 0 var(--sp-2); color: var(--border-1); }
.topbar__workspace { margin-left: auto; font-size: var(--fs-1); color: var(--text-3); }
.topbar__end { margin-left: auto; }
.btn.navigation-toggle, .btn.navigation-close { display: none; }
.shell > .strip { grid-area: strip; }
/* Anchor absolute descendants, including hidden labels, inside this scrolling workspace. */
.main { position: relative; grid-area: main; overflow: auto; overscroll-behavior: contain; padding: 0 var(--sp-8) var(--sp-8); min-width: 0; container: main / inline-size; }
.inspector { grid-area: inspector; width: var(--inspector); overflow: auto; background: var(--bg-panel); border-left: 1px solid var(--border-2); padding: var(--sp-6); }
.statusbar { grid-area: status; min-height: var(--statusbar); display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-1) var(--sp-4); background: var(--bg-panel); border-top: 1px solid var(--border-2); font-size: var(--fs-1); color: var(--text-3); }
.statusbar__end { margin-left: auto; }
.btn.details-toggle { display: inline-flex; }
@media (max-width: 1439px) {
  .inspector { position: fixed; right: 0; top: var(--topbar); bottom: 0; z-index: 7; box-shadow: var(--shadow-pop); }
  .has-js .inspector:not(.is-open) { display: none; }
}
@media (max-width: 1099px) {
  .shell { grid-template: "top top" var(--topbar) "strip strip" auto "main inspector" minmax(0, 1fr) "status status" auto / minmax(0, 1fr) auto; }
  .has-js .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, calc(100vw - 24px)); box-shadow: 0 0 0 100vmax rgb(0 0 0 / .35); z-index: 10; }
  .has-js .sidebar:not(.is-open) { display: none; }
  .has-js .btn.navigation-toggle, .has-js .btn.navigation-close { display: inline-flex; }
  .navigation-close { position: absolute; top: 24px; right: 16px; }
  html:not(.has-js) .shell { height: auto; display: block; }
  html:not(.has-js) .sidebar { position: static; }
  html:not(.has-js) .sidebar__nav { display: flex; flex-wrap: wrap; }
}
@media print {
  .shell { display: block; height: auto; }
  .main { overflow: visible; }
  .sidebar, .topbar, .statusbar, .filterbar, .segmented, .details-toggle, .inspector { display: none; }
}

/* Page titles establish the task; related actions stay alongside. */
.page-header { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); padding: var(--sp-6) 0; }
.page-header h1 { margin: 0; font-size: var(--fs-6); line-height: var(--lh-6); font-weight: 650; letter-spacing: -.04em; overflow-wrap: anywhere; }
.page-header h1.mono { font-size: var(--fs-6); }
/* A view switch sits beside the title, where it keeps its place whichever view is shown: the
   header aligns to the top, so an action beside it cannot pull the title to its baseline. */
.page-header:has(.page-header__title) { align-items: flex-start; }
.page-header__title { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.page-header__meta { color: var(--text-2); font-size: var(--fs-3); margin: var(--sp-2) 0 0; max-width: 72ch; }
.breadcrumb a { font-weight: 400; color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.page-header__actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.git-summary { margin: 0; }

/* sections: 32 px apart, each named by a 14 px title in the text colour, which no column
   header shares; groups inside a section are 16 px apart under a 12 px label */
.section { margin-top: var(--sp-8); }
.section-title { margin: 0 0 var(--sp-2); font-size: var(--fs-4); line-height: var(--lh-4); font-weight: 600; color: var(--text-1); }
.group + .group { margin-top: var(--sp-4); }
.group-title { margin: 0 0 var(--sp-2); font-size: var(--fs-2); line-height: var(--lh-2); font-weight: 600; color: var(--text-2); }
.notes p, .account p { max-width: 72ch; margin: 0 0 var(--sp-1); }
.empty { margin: var(--sp-2) 0; color: var(--text-2); }
/* sections side by side where main is wide enough: a table sized to its content, then the rest */
.sections { display: grid; gap: var(--sp-8); align-items: start; margin-top: var(--sp-8); }
.sections .sections { margin-top: 0; }
@container main (min-width: 1500px) {
  .sections--beside { grid-template-columns: max-content minmax(calc(360px * var(--scale)), 1fr); }
  .sections--beside > .section { margin-top: 0; }
}

/* filter bar: one row above a list, on the app ground, staying at the top as the list scrolls */
.filterbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
             min-height: var(--filterbar); padding: var(--sp-1) 0; background: var(--bg-app); }
.filterbar__filter { display: flex; align-items: center; gap: var(--sp-1); }
.filterbar .field { width: calc(280px * var(--scale)); }
.filterbar__die { display: flex; align-items: center; gap: var(--sp-1); }
.filterbar__end { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.filterbar [role="status"] { min-width: 12ch; }

/* a segmented control: a view switch, or the size of the tiles; the current segment is marked
   like a current tab, with a border so the mark survives forced colours */
.segmented { display: inline-flex; border: 1px solid var(--border-1); border-radius: var(--radius); overflow: hidden; background: var(--bg-panel); }
.segmented a, .segmented button { display: flex; align-items: center; height: var(--ctl); padding: 0 var(--sp-2); border: 0; border-right: 1px solid var(--border-2); border-bottom: 2px solid transparent;
               background: none; color: var(--text-2); font: var(--fs-2)/1 var(--font-ui); text-decoration: none; cursor: pointer; }
.segmented > :last-child { border-right: 0; }
.segmented a:hover, .segmented button:hover { background: var(--bg-hover); color: var(--text-1); }
.segmented a[aria-current="page"], .segmented button[aria-pressed="true"] { background: var(--bg-selected); color: var(--text-1); border-bottom-color: var(--accent); }
.segmented kbd { margin-left: var(--sp-1); }

/* panel: one 360 px column of fields, centred in main */
.panel { display: grid; gap: var(--sp-4); width: var(--sheet); max-width: 100%; margin: 10vh auto 0; padding: var(--sp-8);
         background: var(--bg-panel); border: 1px solid var(--border-1); border-radius: var(--radius-panel); }
.panel__title { margin: 0; font-size: var(--fs-6); line-height: var(--lh-6); font-weight: 600; }
.panel p { margin: 0; }
.form-row { display: grid; gap: var(--sp-1); }
.form-row label, .form-row legend { font-size: var(--fs-2); line-height: var(--lh-2); color: var(--text-2); }
.form-row .helptext { font-size: var(--fs-1); line-height: var(--lh-1); color: var(--text-2); }
.form-row .helptext ul { margin: 0; padding-left: var(--sp-4); }
.errorlist { margin: 0; padding: 0; list-style: none; font-size: var(--fs-1); line-height: var(--lh-1); color: var(--error); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.form-actions--start { justify-content: flex-start; margin-top: var(--sp-2); }
.form-actions__aside { margin-right: auto; font-size: var(--fs-2); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

/* table: as wide as its content, unless one column is the filler, which takes the rest */
.table { border-collapse: collapse; width: auto; max-width: 100%; }
.table--fill { width: 100%; }
.table .fill { width: 100%; }
.table th, .table td { height: var(--row); padding: var(--sp-1) var(--sp-2); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border-2); }
.table th { position: sticky; top: 0; z-index: 1; height: var(--row); background: var(--bg-inset); color: var(--text-2);
            font-size: var(--fs-2); font-weight: 600; border-bottom: 1px solid var(--border-1); }
/* under a sticky filter bar, the header sticks below it */
.table--under-filter th { top: var(--filterbar); }
.table--compact td { height: var(--row-compact); }
.table tr:has(.thumb--row) td { height: var(--row-thumb); }
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:focus-visible { outline-offset: -2px; }
.table td.id { font-family: var(--font-mono); font-size: var(--fs-3m); }
.table .num { text-align: right; }
/* an id is text, accent only when pointed at; the whole row already opens it */
.table a { color: inherit; text-decoration: none; } .table a:hover { color: var(--accent); text-decoration: underline; }
.table th button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.table th[aria-sort="ascending"] button::after { content: " ⌄"; }
.table th[aria-sort="descending"] button::after { content: " ⌃"; }
.table .thumb-cell { width: calc(var(--thumb-row) + var(--sp-2)); padding: var(--sp-1) 0 var(--sp-1) var(--sp-2); }
/* a list of ids wraps rather than widen the table past main */
.table td.wrap { white-space: normal; }
.table .table__group th { position: static; height: auto; padding: var(--sp-2); background: none; border-bottom: 1px solid var(--border-2); color: var(--text-1); font-size: var(--fs-3); font-weight: 400; }
.table .table__group .thumb { display: inline-block; vertical-align: middle; margin-right: var(--sp-2); }
.table .subject { max-width: 60ch; overflow: hidden; text-overflow: ellipsis; }
/* below 1280 px the catalogue's table drops its authors, so it fits the tablet's width */
@media (max-width: 1279px) { .table .narrow-drop { display: none; } }
.table .choice { width: var(--ctl); padding-right: 0; }
.table form { margin: 0; }

/* thumbnails: a patch's preview and the die's cut line, layers of one paper-white box, 2 px
   inside its edge, both fitted to the box alike so the line lies on the picture */
/* Image overlays stay inside the thumbnail's stacking context, below sticky controls. */
.thumb { position: relative; isolation: isolate; display: block; background: var(--paper); border: 1px solid var(--border-1); overflow: hidden; }
.thumb > img, .thumb > svg { position: absolute; top: 2px; left: 2px; display: block; width: calc(100% - 4px); height: calc(100% - 4px); object-fit: contain; }
.thumb > svg { overflow: visible; pointer-events: none; }
.thumb--row { width: var(--thumb-row); height: var(--thumb-row); }
.thumb--28 { width: calc(28px * var(--scale)); height: calc(28px * var(--scale)); }
.thumb--48 { width: calc(48px * var(--scale)); height: calc(48px * var(--scale)); }
.thumb--missing { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border-1); background: transparent; color: var(--text-3); font-size: var(--fs-1); }
.thumb--error { border: 1px dashed var(--error); background: transparent; }
.thumb__error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
                font: var(--fs-1)/var(--lh-1) var(--font-mono); color: var(--error); white-space: nowrap; }
.thumb .ov-cut .halo { display: none; } .thumb .ov-cut .core { stroke-width: 1; }

/* tiles: a grid whose columns are at least a tile wide and grow to fill the row, each tile a
   square picture with a two-line caption */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile)), 1fr)); gap: var(--sp-6); margin: 0; padding: 0; list-style: none; }
.gallery--fixed { grid-template-columns: repeat(auto-fill, var(--tile)); }
.tile { display: block; color: inherit; text-decoration: none; border-radius: var(--radius-panel); }
.tile .thumb { width: 100%; aspect-ratio: 1; border-radius: var(--radius-panel); border-color: var(--border-2); transition: border-color 160ms, box-shadow 160ms; }
.tile:hover .thumb { border-color: var(--accent); }
.tile:hover .tile__title { color: var(--accent); text-decoration: underline; }
.tile:hover .thumb { box-shadow: 0 4px 16px rgb(25 45 30 / .08); }
.tile__caption { display: block; margin-top: var(--sp-3); font-size: var(--fs-2); line-height: var(--lh-2); }
.tile__title { font-size: var(--fs-3); font-weight: 600; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.tile__detail { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* an id wraps rather than lose its end, which is the word that tells a die apart */
.tile__detail.mono { white-space: normal; overflow-wrap: anywhere; }
.tile__detail .t3 { color: var(--text-3); }
/* the smallest tiles are for scanning pictures: their captions keep only the first line */
:root[data-tile="s"] .tile__detail { display: none; }
:root[data-tile="s"] .tile__title { -webkit-line-clamp: 1; }
.tile--current .thumb { outline: 2px solid var(--accent); outline-offset: 1px; }
.tile--current .tile__title { font-weight: 600; }
/* a die drawn alone: its pieces in the text colour, holes and slits lighter, on paper */
.die-outline { display: block; }
.die-outline path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.die-outline .piece { stroke: #1b1b1f; stroke-width: 1.5; }
.die-outline .hole, .die-outline .slit { stroke: #74747f; stroke-width: 1; }
.tile__meta { display: block; color: var(--text-3); font-size: var(--fs-1); line-height: var(--lh-1); }
/* families of dies flow across the width, each a block of its own tiles at the chosen size */
.families { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(var(--tile) * 2.2)), 1fr)); gap: var(--sp-8); align-items: start; }
.families > .group, .families > .group + .group { margin: 0; }
.families .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(var(--tile) * .65)), 1fr)); gap: var(--sp-3); }
.families .gallery > li { width: auto; }
.tile .chip { height: calc(18px * var(--scale)); margin-top: var(--sp-1); font-size: var(--fs-1); }
/* small tiles in a row, as a commit's touched designs */
.tiles-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.tiles-row .tile { width: calc(64px * var(--scale)); }
.tiles-row .tile__caption { font-size: var(--fs-1); line-height: var(--lh-1); }
.tiles-row details { display: contents; }
.tiles-row summary { align-self: center; color: var(--text-2); cursor: pointer; }
.tiles-row summary:hover { color: var(--accent); }
.tiles-row details[open] summary { display: none; }

/* inspector readouts */
.readout { display: grid; grid-template-columns: minmax(70px, 0.8fr) minmax(0, 1.4fr) auto; align-items: center; min-height: var(--ctl); column-gap: var(--sp-2); }
.readout > .label { font-size: var(--fs-2); color: var(--text-2); }
.readout > .value { text-align: right; font-family: var(--font-mono); font-size: var(--fs-3m); overflow-wrap: anywhere; }
.readout > .value--text { font-family: var(--font-ui); font-size: var(--fs-3); }
.readout > .unit  { font-size: var(--fs-1); color: var(--text-3); }
.readout__note { grid-column: 2 / -1; text-align: right; font-size: var(--fs-1); line-height: var(--lh-1); }
.inspector h2 { font-size: var(--fs-2); font-weight: 600; color: var(--text-2); margin: var(--sp-2) 0 var(--sp-1); padding-top: var(--sp-2); border-top: 1px solid var(--border-2); }
.inspector h2:first-of-type { border-top: 0; padding-top: 0; }
.inspector .note { margin: 0 0 var(--sp-1); font-size: var(--fs-2); line-height: var(--lh-2); }
.inspector__close { float: right; }
/* the declaration and cuts beside a die's drawing */
.facts { display: grid; gap: var(--sp-2); align-content: start; }
.facts h2 { margin: 0 0 var(--sp-1); font-size: var(--fs-2); line-height: var(--lh-2); font-weight: 600; color: var(--text-2); }
.facts > .table { justify-self: start; }
.facts--declaration { width: calc(320px * var(--scale)); max-width: 100%; }

/* preview and overlays: layers of one box filling what main leaves. The picture is contained
   and the SVGs meet the same viewBox, so both centre the page alike; the frame is the page on
   paper white, there before the picture arrives. The layers fit the page 16 px inside the box,
   and the box is a window onto the die: a mark reaching past the page, such as an artwork's
   extent, shows up to the box's edge on every side. */
.main--preview { display: grid; grid-template: "header" auto "tools" auto "preview" minmax(calc(240px * var(--scale)), 1fr) "caption" auto "strip" auto / minmax(0, 1fr); }
.main--preview > .page-header { grid-area: header; }
.preview { grid-area: preview; position: relative; overflow: hidden; }
.preview > img, .preview > svg { position: absolute; inset: var(--sp-4); width: calc(100% - 2 * var(--sp-4)); height: calc(100% - 2 * var(--sp-4)); }
.preview > img { object-fit: contain; }
.preview > svg { overflow: visible; pointer-events: none; }
.preview__frame path { fill: var(--paper); stroke: var(--border-2); vector-effect: non-scaling-stroke; }
.preview-caption { grid-area: caption; margin: var(--sp-2) 0 0; font-size: var(--fs-1); line-height: var(--lh-1); color: var(--text-3); }
/* the filmstrip of the design's patches: a row under the preview, or a column beside it
   where the window is wide, each a fixed-width tile; the current patch is marked */
.filmstrip { grid-area: strip; display: flex; gap: var(--sp-2); margin: var(--sp-3) 0 0; padding: 0 0 var(--sp-1); list-style: none; overflow-x: auto; }
.filmstrip > li { flex: none; width: calc(88px * var(--scale)); }
.filmstrip .tile__caption { font-size: var(--fs-1); line-height: var(--lh-1); }
/* main is the size container, so its own layout follows the window: with the details panel
   at its widest, 1600 px leaves main about 1100 px */
@media (min-width: 1600px) {
  .main--preview { grid-template: "header header" auto "tools tools" auto "preview strip" minmax(calc(240px * var(--scale)), 1fr) "caption strip" auto / minmax(0, 1fr) var(--strip); column-gap: var(--sp-4); }
  .filmstrip { flex-direction: column; margin: 0; padding: 0 var(--sp-1) 0 0; overflow: auto; }
  .filmstrip > li { width: 100%; }
}
/* a die's drawing has no picture: the frame is its canvas on paper white, about 360 px high
   and taller on a tall window, beside its declaration, its cuts and its history, which take
   the rest of the row; a narrower main lays them out two by two */
.die-top { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--sp-6) var(--sp-8); align-items: start; }
.die-top > .section { margin-top: 0; min-width: 0; }
.die-top .table { max-width: 100%; }
@container main (min-width: 1500px) { .die-top { grid-template-columns: max-content max-content max-content minmax(0, 1fr); } }
/* a die's drawing is as wide as its paper and no wider, whatever sits beneath it, so that its
   marks, which fill it, lie on the paper */
.drawing { position: relative; width: fit-content; max-width: 100%; }
.drawing > .preview__frame { position: static; display: block; height: clamp(calc(360px * var(--scale)), 32vh, calc(520px * var(--scale))); width: auto; max-width: 100%; }
.drawing > svg:not(.preview__frame) { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
/* a die's cut ids on its drawing: dark on paper, with a paper edge that keeps them clear of the
   lines they sit on; a slit's label sits beside its line */
.cut-label { font-family: var(--font-mono); fill: var(--ov-halo); stroke: var(--paper); stroke-width: 0.3; paint-order: stroke;
             text-anchor: middle; dominant-baseline: central; }
.cut-label--slit { text-anchor: start; dominant-baseline: auto; transform: translate(0.6em, -0.3em); transform-box: fill-box; }
.ov path, .ov use { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: butt; }
.ov .halo { stroke: var(--ov-halo); }
/* the knife lines wear a paper halo outside the dark one, so they read on magenta art too */
.ov .halo--paper { stroke: var(--paper); }
/* dash patterns go on both halo and core, so a dashed guide never sits on a solid dark line */
.ov-cut    .halo { stroke-width: calc(var(--ov-w-cut) + 2); }    .ov-cut    .halo--paper { stroke-width: calc(var(--ov-w-cut) + 4); }    .ov-cut    .core { stroke: var(--ov-cut);    stroke-width: var(--ov-w-cut); }
.ov-hole   .halo { stroke-width: calc(var(--ov-w-hole) + 2); }   .ov-hole   .halo--paper { stroke-width: calc(var(--ov-w-hole) + 4); }   .ov-hole   .core { stroke: var(--ov-hole);   stroke-width: var(--ov-w-hole); }
.ov-bleed  .halo { stroke-width: calc(var(--ov-w-bleed) + 2); }  .ov-bleed  .core { stroke: var(--ov-bleed);  stroke-width: var(--ov-w-bleed); }
.ov-cell   .halo { stroke-width: calc(var(--ov-w-cell) + 2); }   .ov-cell   .core { stroke: var(--ov-cell);   stroke-width: var(--ov-w-cell); }
.ov-extent .halo { stroke-width: calc(var(--ov-w-extent) + 2); } .ov-extent .core { stroke: var(--ov-extent); stroke-width: var(--ov-w-extent); }
/* a die's text boxes lie on its waste, which is paper: mid-tones that read on white, a tint
   through which whatever a box wrongly lies over still shows, and a number set as a sheet might */
.text-box { fill-opacity: .22; stroke-width: var(--ov-w-text); stroke-linejoin: miter; }
.text-box--left { fill: var(--ov-text-left); stroke: var(--ov-text-left); }
.text-box--right { fill: var(--ov-text-right); stroke: var(--ov-text-right); }
.text-box__number { font-family: var(--font-ui); font-weight: 700; fill: var(--ov-text-ink); text-anchor: middle; }
.swatch--text .text-box { fill-opacity: 1; stroke: none; }
.text-swatch { display: inline-block; width: .7em; height: .7em; margin-right: var(--sp-1); border-radius: 1px; }
.text-swatch--left { background: var(--ov-text-left); }
.text-swatch--right { background: var(--ov-text-right); }
.text-boxes td, .text-boxes th { font-variant-numeric: tabular-nums; }
.drawing-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
/* a die's text boxes read out beneath its drawing, no wider than a line of text reads well */
.drawing-text-boxes { margin-top: var(--sp-6); max-width: 44ch; }
.drawing-text-boxes h2 { margin: 0 0 var(--sp-2); font-size: var(--fs-2); }
.drawing-text-boxes .note { margin-top: var(--sp-2); }
.ov-bleed  use { stroke-dasharray: 6 3; }
.ov-cell   use { stroke-dasharray: 10 4; }
.ov-extent use { stroke-dasharray: 2 3 6 3; }

/* matrix: a row per design, a column per device or shape, opening into a column per die; the
   table takes the width main has, so a wide window gets wider cells rather than a gap */
.matrix { border-collapse: collapse; width: 100%; font-size: var(--fs-1); }
.matrix th, .matrix td { padding: 0; border-bottom: 1px solid var(--border-2); }
.matrix td { width: calc(40px * var(--scale)); min-width: calc(40px * var(--scale)); height: calc(40px * var(--scale)); text-align: center; vertical-align: middle; }
.matrix td.die { width: calc(24px * var(--scale)); min-width: calc(24px * var(--scale)); }
.matrix thead th { position: sticky; z-index: 2; background: var(--bg-inset); }
.matrix thead tr:first-child th { top: 0; height: calc(72px * var(--scale)); border-bottom: 1px solid var(--border-1); vertical-align: middle; }
.matrix thead tr:first-child th button { display: block; min-width: calc(112px * var(--scale)); width: 100%; height: calc(72px * var(--scale)); padding: var(--sp-2); border: 0; background: none; color: var(--text-1); font: 600 var(--fs-1)/1.4 var(--font-ui); cursor: pointer; text-align: center; }
.matrix thead tr:first-child th button:hover, .matrix thead tr:first-child th button[aria-expanded="true"] { background: var(--bg-selected); }
.matrix thead tr:last-child th { top: calc(72px * var(--scale)); height: calc(32px * var(--scale)); font-weight: 400; white-space: nowrap; }
.matrix thead tr:last-child th a { color: inherit; text-decoration: none; }
.matrix tbody th { position: sticky; left: 0; z-index: 1; width: calc(200px * var(--scale)); max-width: calc(200px * var(--scale)); background: var(--bg-panel); text-align: left; padding: 0 var(--sp-3); font-family: var(--font-ui); font-weight: 500; }
.matrix tbody th .row-head { display: flex; align-items: center; gap: var(--sp-2); }
.matrix tbody th .row-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix tbody th a { color: inherit; text-decoration: none; }
.matrix tbody th a:hover { color: var(--accent); }
.matrix tfoot th, .matrix tfoot td { position: sticky; bottom: 0; z-index: 2; height: calc(32px * var(--scale)); background: var(--bg-inset); border-top: 1px solid var(--border-1); border-bottom: 0; color: var(--text-2); font-weight: 600; }
.matrix tfoot th { left: 0; z-index: 3; text-align: left; padding: 0 var(--sp-2); }
.matrix col.family { border-left: 1px solid var(--border-1); }
.matrix col.is-col { background: var(--bg-selected); }
.matrix tbody tr.is-row { background: var(--bg-selected); }
.matrix tbody tr.is-row th { background: var(--bg-selected); }
/* a mark is a box filled by its own border, not a background, so forced colours keep it */
.matrix .mark, .legend-has { display: inline-block; width: calc(10px * var(--scale)); height: calc(10px * var(--scale)); border: calc(5px * var(--scale)) solid var(--accent); vertical-align: middle; }
.matrix .mark--variant { width: calc(5px * var(--scale)); height: calc(5px * var(--scale)); border-width: calc(2.5px * var(--scale)); margin-left: 2px; }
.matrix .cell:empty::after, .legend-none { content: ""; display: inline-block; width: 4px; height: 4px; border: 2px solid var(--border-1); border-radius: 50%; vertical-align: middle; }
.matrix .cell a { display: block; height: 100%; line-height: calc(40px * var(--scale)); color: var(--accent); text-decoration: none; }
.matrix .cell a .num { text-align: center; }
.matrix .shaped a { font-weight: 600; }
.matrix thead .matrix__corner { left: 0; z-index: 3; text-align: left; vertical-align: bottom; padding: 0 var(--sp-2); font-weight: 600; color: var(--text-2); }
.matrix th.error, .matrix .error { color: var(--error); }
.matrix td[aria-current="true"], .matrix th[aria-current="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
.matrix-legend { display: flex; gap: var(--sp-3); align-items: center; }
/* the panel beside the matrix shows the patch under the cursor */
.matrix-panel { display: grid; align-content: start; gap: var(--sp-2); }
.matrix-panel .thumb { width: 100%; aspect-ratio: 1; }
.matrix-panel .thumb--empty { border-style: dashed; background: transparent; }
.matrix-panel h2 { margin: 0; font-size: var(--fs-3); font-weight: 600; }
.matrix-panel p { margin: 0; color: var(--text-2); }

/* buttons: a variant keeps its own background on hover and press */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: var(--ctl); padding: 0 var(--sp-2);
       font: var(--fs-2)/1 var(--font-ui); white-space: nowrap; text-decoration: none; border: 1px solid var(--border-1); border-radius: var(--radius);
       background: var(--bg-panel); color: var(--text-1); cursor: pointer; }
.btn:hover { background: var(--bg-hover); } .btn:active { background: var(--bg-inset); } .btn:disabled { opacity: .4; pointer-events: none; }
.btn--md { height: var(--ctl-md); padding: 0 var(--sp-3); font-size: var(--fs-3); }
.btn--primary, .btn--primary:hover, .btn--primary:active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--primary:hover { filter: brightness(.92); } .btn--primary:active { filter: brightness(.84); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); } .btn--ghost:hover { color: var(--text-1); }
/* the gap and the margin make the two spaces between a label and its key */
.btn kbd { margin-left: var(--sp-1); }
.btn--primary kbd { color: inherit; border-color: currentColor; }
kbd { display: inline-block; height: var(--icon); font: var(--fs-1)/calc(14px * var(--scale)) var(--font-mono); color: var(--text-3); border: 1px solid var(--border-2); border-radius: 2px; padding: 0 3px; }

/* fields: a form row's text input is a medium field, as in a dialog */
.field, .select, .form-row input:not([type="checkbox"], [type="radio"]) {
  height: var(--ctl); padding: 0 var(--sp-2); border: 1px solid var(--border-1); border-radius: var(--radius); background: var(--bg-panel); color: var(--text-1); font: inherit; }
.select { max-width: 24ch; font-size: var(--fs-2); }
.field::placeholder, .form-row input::placeholder { color: var(--text-3); }
.field:disabled, .form-row input:disabled { color: var(--text-3); background: var(--bg-inset); }
.field--md, .form-row input:not([type="checkbox"], [type="radio"]) { height: var(--ctl-md); }
.form-row input:not([type="checkbox"], [type="radio"]) { width: 100%; }
.field[aria-invalid="true"], .form-row input[aria-invalid="true"] { border-color: var(--error); }

/* chips */
.chip { display: inline-flex; align-items: center; height: var(--ctl); padding: 0 var(--sp-2); gap: var(--sp-1); border-radius: var(--radius);
        background: var(--bg-inset); font: var(--fs-2)/1 var(--font-mono); color: var(--text-2); }
a.chip { text-decoration: none; } a.chip:hover { background: var(--bg-hover); color: var(--text-1); }
.chip--warn { color: var(--warn); background: var(--warn-bg); }

/* strips: an error at the top of the region it affects, in words first, the code after */
.strip { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2); font-size: var(--fs-2); line-height: var(--lh-2); }
.strip--error { background: var(--error-bg); color: var(--error); }
.strip a { color: inherit; }
.strip .code { opacity: .8; font-size: var(--fs-1); }
/* an error page: what happened in words, the code small, and a way back */
.error-page { max-width: 64ch; margin-top: var(--sp-8); }
.error-page h1 { margin: 0 0 var(--sp-2); font-size: var(--fs-6); line-height: var(--lh-6); font-weight: 600; }
.error-page p { margin: 0 0 var(--sp-2); }

/* toasts: bottom left, gone after 4 s unless hovered */
.toasts { position: fixed; left: var(--sp-2); bottom: var(--sp-2); z-index: 3; display: grid; gap: var(--sp-2); }
.toast { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--ctl-md); padding: var(--sp-1) var(--sp-2);
         background: var(--bg-panel); border: 1px solid var(--border-1); border-radius: var(--radius-panel); box-shadow: var(--shadow-pop);
         font-size: var(--fs-3); animation: toast-enter 100ms ease-out, toast-leave 0s 4s forwards; }
.toast:hover { animation-play-state: paused; }
@keyframes toast-enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-leave { to { visibility: hidden; } }

/* dialogs */
.dialog { width: calc(480px * var(--scale)); max-width: calc(100vw - 2 * var(--sp-6)); padding: var(--sp-6); border: 1px solid var(--border-1); border-radius: var(--radius-panel);
          background: var(--bg-panel); color: var(--text-1); box-shadow: var(--shadow-pop); }
.dialog[open] { animation: dialog-appear 80ms linear; }
.dialog::backdrop { background: var(--backdrop); }
.dialog__title { margin: 0 0 var(--sp-4); font-size: var(--fs-4); line-height: var(--lh-4); font-weight: 600; }
.dialog__footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-6); }
@keyframes dialog-appear { from { opacity: 0; } }
.shortcuts { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: var(--sp-2) var(--sp-3); align-items: center; margin: 0; }
.shortcuts dt { justify-self: end; } .shortcuts dd { margin: 0; color: var(--text-2); }

/* overlay toggles */
.ovtoggle { display: inline-flex; border: 1px solid var(--border-1); border-radius: var(--radius); overflow: hidden; }
.ovtoggle button { display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--ctl); padding: 0 var(--sp-1); border: 0; border-right: 1px solid var(--border-2); border-bottom: 2px solid transparent; background: none; color: var(--text-2); font: var(--fs-2)/1 var(--font-ui); }
.swatch { width: var(--icon); height: calc(var(--icon) / 2); flex: none; }
.ovtoggle button:last-child { border-right: 0; }
.ovtoggle button[aria-pressed="true"] { background: var(--bg-selected); color: var(--text-1); border-bottom-color: var(--accent); }
.ovtoggle button[aria-pressed="false"] .swatch { opacity: .4; }

/* compare: the versions before and after and the difference, as three panes side by side or
   one large pane (swipe, flip, changes). Each pane's picture is a stage of layers, as a preview
   is, and every stage takes one transform from the panes, so zoom and pan move them together
   and the layers of each stay aligned. */
.main--compare { display: grid; grid-template: "header" auto "headline" auto "panes" minmax(calc(240px * var(--scale)), 1fr) "caption" auto / minmax(0, 1fr); }
.main--compare > .page-header { grid-area: header; }
.main--compare > .preview-caption { grid-area: caption; }
.compare-headline { grid-area: headline; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-2); margin: 0 0 var(--sp-2); }
.panes { grid-area: panes; position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "before after changes";
         gap: var(--sp-3); min-height: 0; --zoom: 1; --pan-x: 0px; --pan-y: 0px; --swipe: 50%; }
.panes--single { grid-template-columns: minmax(0, 1fr); grid-template-areas: "only"; }
.pane { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--sp-1); margin: 0; min-width: 0; min-height: 0; }
.pane--before { grid-area: before; } .pane--after { grid-area: after; } .pane--changes { grid-area: changes; }
.pane__label { display: flex; align-items: baseline; gap: var(--sp-1); min-width: 0; font-size: var(--fs-2); line-height: var(--lh-2); white-space: nowrap; }
.pane__role { font-weight: 600; }
.pane__subject { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* a pane's picture is its own grid's second row, not the preview area of the patch page */
.pane .preview { grid-area: auto; position: relative; overflow: hidden; touch-action: none; }
.panes--single .pane .preview > img { position: absolute; inset: var(--sp-4); width: calc(100% - 2 * var(--sp-4)); height: calc(100% - 2 * var(--sp-4)); object-fit: contain; }
.stage { position: absolute; inset: 0; transform-origin: 0 0; transform: translate(var(--pan-x), var(--pan-y)) scale(var(--zoom)); }
.stage > img, .stage > svg { position: absolute; inset: var(--sp-4); width: calc(100% - 2 * var(--sp-4)); height: calc(100% - 2 * var(--sp-4)); }
.stage > img { object-fit: contain; }
.stage > svg { overflow: visible; pointer-events: none; }
/* a patch shown turned, as a sheet may print it: the picture's box is the stage's with its sides
   exchanged, turned a quarter clockwise about the stage's centre, so the picture lies where the
   marks, whose own frame is turned, are drawn */
[data-turned] .stage { container-type: size; }
[data-turned] .stage > img { inset: auto; left: 50%; top: 50%; width: calc(100cqh - 2 * var(--sp-4)); height: calc(100cqw - 2 * var(--sp-4));
                             transform: translate(-50%, -50%) rotate(90deg); }
.pane__message { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: var(--sp-6);
                 text-align: center; color: var(--text-2); font-size: var(--fs-3); }
/* the difference lies over the version after in grey, at 30 %, the only colour in the pane */
.ground--faded { filter: grayscale(1); opacity: .3; }
.is-strong .difference { filter: url(#strong-only); }
.ov-was .halo { stroke-width: calc(var(--ov-w-cut) + 2); } .ov-was .core { stroke: var(--ov-cut); stroke-width: var(--ov-w-cut); }
.ov-was use { stroke-dasharray: 4 3; }
/* swipe: the version after over the version before, revealed right of the divider */
.panes[data-view="swipe"], .panes[data-view="flip"], .panes[data-view="changes"] { grid-template-columns: minmax(0, 1fr); grid-template-areas: "stack"; }
.panes[data-view="swipe"] .pane--before, .panes[data-view="swipe"] .pane--after,
.panes[data-view="flip"] .pane--before, .panes[data-view="flip"] .pane--after, .panes[data-view="changes"] .pane--changes { grid-area: stack; }
.panes[data-view="swipe"] .pane--changes, .panes[data-view="flip"] .pane--changes,
.panes[data-view="changes"] .pane--before, .panes[data-view="changes"] .pane--after { display: none; }
.panes[data-view="swipe"] .pane--after .pane__label { justify-content: flex-end; }
.panes[data-view="swipe"] .pane--after .preview { clip-path: inset(0 0 0 var(--swipe)); }
.panes[data-view="swipe"] .pane--after .preview__frame { display: none; }
.panes[data-view="swipe"]::after { content: ""; position: absolute; top: calc(var(--lh-2) + 3 * var(--sp-1)); bottom: 0; left: var(--swipe); width: 2px; margin-left: -1px;
                                   background: var(--accent); pointer-events: none; }
.swipe { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; width: 100%; margin: 0; accent-color: var(--accent); }
/* flip: the version after, or the version before while it is held; the label says which */
.panes[data-view="flip"]:not(.is-before) .pane--before, .panes[data-view="flip"].is-before .pane--after { visibility: hidden; }
.flip { position: absolute; left: 50%; bottom: var(--sp-2); z-index: 2; transform: translateX(-50%); box-shadow: var(--shadow-pop); }

/* the versions to compare: a row each, a radio for before and after, the chosen rows marked
   at their edge, the version after in the accent */
.versions__table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.versions__table th { padding: 0 0 var(--sp-1); font-size: var(--fs-1); font-weight: 400; color: var(--text-3); text-align: left; }
.versions__table th:first-child { width: auto; }
.versions__table .versions__pick { width: calc(48px * var(--scale)); text-align: center; }
.versions__row td { padding: var(--sp-1) 0; border-top: 1px solid var(--border-2); vertical-align: middle; }
.versions__row.is-before td:first-child { box-shadow: inset 3px 0 0 var(--text-3); }
.versions__row.is-after td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.versions__version { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.versions__row td.versions__version { padding-left: var(--sp-2); }
.versions__thumb { flex: none; }
.versions__row--absent .versions__thumb, .versions__row--unreadable .versions__thumb { border-style: dashed; background: transparent; }
.versions__text { display: grid; min-width: 0; font-size: var(--fs-2); line-height: var(--lh-2); }
.versions__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.versions__subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.versions__note { font-size: var(--fs-1); line-height: var(--lh-1); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.versions__actions { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }
.versions.is-live [data-versions-submit] { display: none; }
.inspector--compare { width: calc(var(--inspector) + 40px * var(--scale)); }

/* what changed, in words and measured */
.changes-said { margin: 0; padding-left: 1.2em; font-size: var(--fs-2); line-height: var(--lh-2); }
.changes-said li + li { margin-top: var(--sp-1); }
.where__headline { margin: 0 0 var(--sp-1); font-size: var(--fs-2); line-height: var(--lh-2); }
.where__zones { width: 100%; }
.regions { display: grid; gap: 2px; margin: var(--sp-1) 0 0; padding: 0; list-style: none; }
.region { display: flex; align-items: center; gap: var(--sp-1); width: 100%; padding: 2px var(--sp-1); border: 0; border-radius: var(--radius);
          background: none; color: var(--text-1); font: var(--fs-2)/var(--lh-2) var(--font-ui); text-align: left; }
.region:hover, .region[aria-current="true"] { background: var(--bg-selected); }
.region__number { min-width: 1.6em; font-family: var(--font-mono); color: var(--text-2); }
/* a zone's colour: a box filled by its own border, so forced colours keep it */
.zone { display: inline-block; width: calc(10px * var(--scale)); height: calc(10px * var(--scale)); margin-right: var(--sp-1); border: calc(5px * var(--scale)) solid; border-radius: 2px; vertical-align: middle; }
.zone--on_patch { border-color: var(--diff-patch); } .zone--on_cut { border-color: var(--diff-cut); }
.zone--cut_away { border-color: var(--diff-cutaway); } .zone--not_printed { border-color: var(--diff-outside); }
.zone--beyond_original { border: 1px solid var(--diff-outside); background: repeating-linear-gradient(135deg, var(--diff-outside) 0 1px, transparent 1px 4px); }
.legend { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-2); line-height: var(--lh-2); }
.legend__controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-1); }
.check { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--fs-2); }
/* a design's comparison: each tile the patch after, greyed under its difference where it changed */
.thumb--compare > .difference { z-index: 1; }

/* Navigation and page hierarchy */
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 20; padding: 12px; background: var(--bg-panel); }
.skip-link:focus { top: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text-1); text-decoration: none; font-weight: 650; white-space: nowrap; line-height: 1.15; }
.brand__mark { display: block; flex: none; width: calc(40px * var(--scale)); height: calc(40px * var(--scale)); }
.brand__byline { display: block; margin-top: 5px; font-size: 8px; font-weight: 600; letter-spacing: .16em; color: var(--text-3); }
.eyebrow { margin: 0 0 var(--sp-1); font-size: var(--fs-1); line-height: var(--lh-1); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.account-menu { position: relative; }
.account-menu > summary { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--ctl-md); cursor: pointer; list-style: none; font-size: var(--fs-2); }
.account-menu > summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-inset); color: var(--text-2); font-weight: 650; }
.account-menu__panel { position: absolute; z-index: 10; bottom: calc(100% + 10px); left: 0; width: 250px; display: grid; padding: var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--radius-panel); background: var(--bg-panel); box-shadow: var(--shadow-pop); }
.account-menu__panel > a, .account-menu__panel .btn { padding: var(--sp-2); color: var(--text-1); text-decoration: none; justify-content: flex-start; font-size: var(--fs-2); border-radius: var(--radius); }
.account-menu__panel a:hover { background: var(--bg-hover); }
.view-tabs, .page-tabs { display: flex; gap: var(--sp-1); }
.view-tabs { padding: 0; border-bottom: 1px solid var(--border-1); background: transparent; }
.view-tabs a, .view-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: 8px 12px; border-radius: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; font-family: inherit; color: var(--text-2); text-decoration: none; font-size: var(--fs-2); font-weight: 550; }
.view-tabs a[aria-current], .view-tabs button[aria-pressed="true"] { border-bottom-color: var(--accent); color: var(--text-1); font-weight: 650; }
.page-tabs { margin: 0 0 var(--sp-4); border-bottom: 1px solid var(--border-2); gap: var(--sp-6); }
.page-tabs a { padding: var(--sp-3) 0; text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; font-weight: 550; }
.page-tabs a[aria-current] { color: var(--text-1); border-color: var(--accent); }
.page-tabs .count { margin-left: 6px; font-size: var(--fs-2); }
.breadcrumbs { display: flex; gap: var(--sp-2); align-items: center; font-size: var(--fs-2); margin-bottom: var(--sp-2); color: var(--text-3); }
.breadcrumbs a { color: var(--text-2); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.entity-id { display: block; margin-top: var(--sp-1); color: var(--text-3); font-family: var(--font-mono); font-size: var(--fs-1); font-weight: 400; }
/* Search belongs ahead of sorting and presentation controls. */
.browse-form { gap: var(--sp-3); padding: var(--sp-2) 0; min-height: 0; align-items: center; border-bottom: 1px solid var(--border-2); }
.search-field { display: flex; align-items: center; gap: var(--sp-2); flex: 1 1 240px; max-width: 520px; min-width: 160px; background: var(--bg-panel); padding: 0 var(--sp-3); border: 1px solid var(--border-1); border-radius: var(--radius); }
.search-field > span[aria-hidden] { font-size: 24px; color: var(--text-3); }
.search-field .field { width: 100%; min-width: 0; border: 0; padding: 0; background: transparent; height: var(--ctl-md); }
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-field .field:focus-visible { outline: none; }
.filterbar__die { flex-wrap: wrap; }
.filterbar__die .select { max-width: 28ch; }
.results-bar { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) 0; font-size: var(--fs-2); color: var(--text-2); }
.results-bar__end { margin-left: auto; }
.active-filters { display: flex; align-items: center; gap: var(--sp-2); padding-top: var(--sp-3); font-size: var(--fs-2); color: var(--text-2); }
.active-filters .eyebrow { margin: 0; }
.active-filters { flex-wrap: wrap; }
.filter-chip { display: inline-flex; align-items: center; gap: var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--radius); padding: var(--sp-1) var(--sp-2); text-decoration: none; color: var(--text-2); background: var(--bg-panel); }
.filter-chip:hover { color: var(--accent); border-color: var(--accent); }
.empty--search { padding: var(--sp-8); text-align: center; border: 1px dashed var(--border-1); border-radius: var(--radius-panel); }
.gallery > li { min-width: 0; }
.tile__more { display: inline-flex; gap: var(--sp-2); margin-top: var(--sp-1); font-size: var(--fs-1); text-decoration: none; }
.design-name > a { font-weight: 550; }
.matrix-scroll, .table-scroll { overflow: auto; max-width: 100%; }
.matrix-scroll { border: 1px solid var(--border-2); border-radius: var(--radius); }
/* the matrix fills what the window leaves below the library's heading and filters */
.main--matrix { display: flex; flex-direction: column; }
.main--matrix > * { flex: none; }
.main--matrix > .matrix-scroll { flex: 1 1 0; min-height: calc(240px * var(--scale)); }
.missing-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.missing-list a { display: inline-block; padding: var(--sp-2) var(--sp-3); border: 1px dashed var(--border-1); border-radius: var(--radius); text-decoration: none; color: var(--text-2); font-size: var(--fs-2); }
/* The canvas is a working surface, with its tools in reach. */
.canvas-tools { grid-area: tools; display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-2) 0 var(--sp-3); }
.canvas-tools__end { margin-left: auto; display: flex; align-items: center; gap: var(--sp-1); }
.main--preview > .preview { border: 1px solid var(--border-2); border-radius: var(--radius-panel); background: var(--bg-canvas); }
.main--preview .page-header h1 { font-size: var(--fs-5); line-height: var(--lh-5); letter-spacing: -.02em; }
.main--preview .page-header { align-items: center; }
.main--preview .filmstrip { padding: var(--sp-2) 2px; }
.details-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-4); }
.details-heading h2 { margin: 0; font-size: var(--fs-4); color: var(--text-1); border: 0; }
.disclosure { border-top: 1px solid var(--border-2); margin-top: var(--sp-4); padding-top: var(--sp-3); }
.disclosure > summary { cursor: pointer; font-size: var(--fs-2); font-weight: 600; padding: var(--sp-1) 0; }
.disclosure[open] > summary { margin-bottom: var(--sp-2); }
.inspector .disclosure .readout { min-height: 30px; }
/* Tables and smaller screens keep information inside their own region. */
@media (max-width: 1100px) { .page-header__actions { flex-wrap: wrap; } }
@media (max-width: 767px) {
  .topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .main { padding: 0 var(--sp-3) var(--sp-4); }
  .page-header { padding-top: var(--sp-4); }
  .page-header__actions { margin-left: 0; }
  .page-header h1 { font-size: 24px; }
  .browse-form { position: relative; }
  .search-field { flex-basis: 100%; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tile)), 1fr)); }
  .die-top { grid-template-columns: minmax(0, 1fr); }
  .inspector { width: min(100vw, 380px); }
  .statusbar { overflow: auto; white-space: nowrap; }
}
@media (pointer: coarse) {
  :root { --ctl: 44px; --ctl-md: 44px; }
  .view-tabs a, .ovtoggle button, .segmented button, .segmented a { min-height: 44px; }
}

.browse-form.is-live .browse-submit { display: none; }
.preview-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg-inset); color: var(--text-2); font-size: var(--fs-2); z-index: 2; }
[data-preview-state="loading"] > svg { visibility: hidden; }
.thumb__error { padding: var(--sp-3); text-align: center; white-space: normal; }
.preview-die { font-size: var(--fs-1); }

.die-picker { position: relative; z-index: 3; }
.die-picker summary { list-style: none; cursor: pointer; }
.die-picker__list { position: absolute; top: calc(100% + 6px); left: 0; display: grid; min-width: 280px; max-width: 85vw; max-height: 50vh; overflow: auto; padding: var(--sp-2); background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius-panel); box-shadow: var(--shadow-pop); }
.die-picker__list a { display: block; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-2); color: var(--text-1); text-decoration: none; border-radius: var(--radius); }
.die-picker__list a:hover, .die-picker__list a[aria-current] { background: var(--bg-selected); }
.zoom-level { color: var(--text-2); font-size: var(--fs-2); min-width: 4ch; }
[data-viewer] { --zoom: 1; --pan-x: 0px; --pan-y: 0px; touch-action: none; }
.canvas-notice { position: absolute; z-index: 2; inset: auto 12px 12px; display: flex; align-items: center; justify-content: center; gap: var(--sp-3); padding: var(--sp-2); background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius); color: var(--text-2); font-size: var(--fs-2); }
[data-stage-box][data-preview-state="loading"] .stage > svg, [data-stage-box][data-preview-state="failed"] .stage > svg { visibility: hidden; }
.detail-link { display: block; margin-bottom: var(--sp-3); font-size: var(--fs-2); text-decoration: none; }
.is-details-hidden > .inspector { display: none; }
@media (max-width: 1439px) {
  html:not(.has-js) .shell { height: auto; grid-template: "rail top" auto "rail strip" auto "rail main" auto "rail inspector" auto "rail status" auto / var(--rail) minmax(0, 1fr); }
  html:not(.has-js) .inspector { position: static; width: 100%; }
  html:not(.has-js) .main--preview { min-height: 80vh; }
  .inspector[aria-modal] { box-shadow: -24px 0 80px rgb(0 0 0 / .2); }
}

/* Version selection stays beside the pictures it controls. */
.main--compare { grid-template: "header" auto "revisions" auto "headline" auto "tools" auto "panes" minmax(260px, 1fr) "caption" auto / minmax(0, 1fr); }
.revision-pair { grid-area: revisions; display: flex; align-items: end; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.revision-pair label { flex: 1; min-width: 0; display: grid; gap: var(--sp-1); font-weight: 600; font-size: var(--fs-2); }
.revision-pair select { width: 100%; font-weight: 400; }
.revision-swap { flex: none; font-size: var(--fs-4); }
.main--compare > .canvas-tools { grid-area: tools; }
.panes[data-view="sbs"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "before after"; }
.panes[data-view="sbs"]:not(.has-difference) .pane--changes { display: none; }
.panes[data-view="sbs"].has-difference { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "before after changes"; }
.compare-headline { font-size: var(--fs-2); color: var(--text-2); }
.difference-toggle { margin-left: auto; font-size: var(--fs-2); }

/* Supporting pages share the same reading order: subject, context, then technical detail. */
.settings-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--sp-8); max-width: 1100px; }
.backend-options { display: grid; gap: var(--sp-3); }
.backend-card, .account-card, .change-card { background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius-panel); padding: var(--sp-4); }
.backend-card:has(input:checked) { border-color: var(--accent); background: var(--bg-selected); }
.backend-card__heading { display: flex; align-items: center; gap: var(--sp-3); }
.backend-card__heading label { flex: 1; font-weight: 600; }
.connection-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); font-size: var(--fs-2); }
.connection-facts dt { color: var(--text-2); }
.connection-facts dd { margin: 0; overflow-wrap: anywhere; }
.account-card { align-self: start; }
.account-links { display: grid; gap: var(--sp-3); margin-top: var(--sp-6); }
.panel__intro { margin-bottom: var(--sp-6); }
.change-list { display: grid; gap: var(--sp-3); }
.change-card__heading { display: flex; align-items: center; gap: var(--sp-3); }
.change-card__heading > div { flex: 1; display: grid; gap: var(--sp-1); }
.change-card a, .activity-entry h3 a { color: inherit; text-decoration: none; }
.change-card a:hover, .activity-entry h3 a:hover { color: var(--accent); }
.changed-files { display: grid; gap: var(--sp-2); padding: 0; list-style: none; font-size: var(--fs-2); }
.changed-files li { display: flex; align-items: start; gap: var(--sp-2); }
.changed-files .mono { overflow-wrap: anywhere; min-width: 0; }
.activity-feed { list-style: none; margin: 0; padding: 0; }
.activity-entry { padding: var(--sp-6); background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius-panel); margin-bottom: var(--sp-3); }
.activity-entry__heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); }
.activity-entry__heading h3 { font-size: var(--fs-4); margin: 0; font-weight: 600; }
.activity-entry__heading time, .activity-entry__meta { color: var(--text-2); font-size: var(--fs-2); }
.activity-entry__heading time { white-space: nowrap; }
.activity-entry__meta { margin: var(--sp-1) 0 var(--sp-4); }
.activity-entry .tiles-row { gap: var(--sp-3); }
.activity-entry .tiles-row > li { width: calc(96px * var(--scale)); }
.activity-feed--compact .activity-entry { padding: var(--sp-4); }
.activity-feed--compact .activity-entry__meta { margin-bottom: 0; }
.branch-details { min-width: 0; }
.die-top .facts { background: var(--bg-panel); border-radius: var(--radius-panel); border: 1px solid var(--border-2); padding: var(--sp-4); }
@media (max-width: 1000px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
}
.activity-design { padding: var(--sp-4); background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius); min-width: 0; }
.activity-design__name { font-weight: 600; text-decoration: none; color: var(--text-1); }
.activity-context { font-size: var(--fs-1); }
.activity-designs { display: grid; gap: var(--sp-3); }
.activity-impact { font-size: var(--fs-2); margin-top: var(--sp-3); }
.activity-impact[aria-busy] { opacity: .65; }
.impact-summary { font-weight: 600; margin: 0 0 var(--sp-2); }
.patch-impacts { padding: 0; list-style: none; margin: 0; }
.patch-impacts li { border-top: 1px solid var(--border-2); padding: var(--sp-3) 0; }
.patch-impacts a { font-weight: 600; text-decoration: none; }
.patch-impacts p { margin: var(--sp-1) 0 0; color: var(--text-2); }
.impact-state { margin-left: var(--sp-2); font-size: var(--fs-1); }
.activity-detail { max-width: 850px; }


.notice { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: baseline; padding: var(--sp-4); margin-bottom: var(--sp-6); border-left: 3px solid var(--warn); background: var(--warn-bg); font-size: var(--fs-2); }
.notice a { margin-left: auto; }
.page-footnote { color: var(--text-3); font-size: var(--fs-1); margin: var(--sp-8) 0 0; }
.tile__availability { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); font-size: var(--fs-1); color: var(--text-3); }
.tile__availability > span:last-child { margin-left: auto; }
.tile__detail-on-hover { display: none; }
.account-menu { margin-top: var(--sp-3); border-top: 1px solid var(--border-2); padding: var(--sp-3) var(--sp-2) 0; }
.account-menu__arrow { margin-left: auto; }
.sort-field { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.sort-field__label { white-space: nowrap; color: var(--text-3); font-size: var(--fs-1); }
.sort-field .select { border-color: transparent; background-color: transparent; color: var(--text-2); }
.sort-field .select:hover { border-color: var(--border-1); background-color: var(--bg-panel); }
.filter-chip { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 4px 9px; color: var(--accent); background: var(--bg-selected); border: 1px solid var(--border-2); border-radius: var(--radius); text-decoration: none; }
.empty-state { padding: var(--sp-8); border: 1px dashed var(--border-1); border-radius: var(--radius); text-align: center; color: var(--text-2); }
.empty-state h2 { color: var(--text-1); font-size: var(--fs-4); font-weight: 550; }

/* The native select remains the complete no-script device chooser. */
[data-die-chooser].is-enhanced .native-die { display: none; }
.die-chooser-trigger { justify-content: space-between; min-width: 160px; max-width: 300px; }
[data-die-label] { overflow: hidden; text-overflow: ellipsis; }
.die-dialog { width: min(560px, calc(100vw - 32px)); max-height: min(720px, calc(100dvh - 48px)); padding: var(--sp-6); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); }
.dialog-heading h2 { margin: 0; font-size: var(--fs-5); letter-spacing: -.025em; }
.die-dialog > .search-field { max-width: none; }
.die-dialog .view-tabs { margin: var(--sp-4) 0; width: fit-content; }
.die-dialog__options { display: grid; max-height: 360px; overflow: auto; gap: 2px; }
.die-dialog__options button { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: center; min-height: var(--ctl-md); padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--radius); text-align: left; background: transparent; color: var(--text-1); font: var(--fs-2)/1.5 var(--font-ui); cursor: pointer; }
.die-dialog__options button:hover, .die-dialog__options button[aria-pressed="true"] { background: var(--bg-selected); color: var(--accent); }
.die-dialog__options small { color: var(--text-3); font-size: var(--fs-1); }
.matrix-panel__actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.matrix-panel__state { padding: var(--sp-3); background: var(--bg-inset); border-radius: var(--radius); font-size: var(--fs-2); }
.matrix .cell-unknown { color: var(--warn); }
.matrix .cell-absent { color: var(--text-3); font-size: var(--fs-2); }
@media (max-width: 767px) {
  .coverage-intro { display: grid; gap: var(--sp-1); }
  .sort-field { margin-left: 0; }
  .die-chooser-trigger { max-width: 55vw; min-width: 0; }
}

/* A design's range is visible before any individual patch is inspected. */
.range-summary { padding: 0 var(--sp-4); margin-bottom: var(--sp-6); border: 1px solid var(--border-2); border-radius: var(--radius-panel); background: var(--bg-panel); }
.range-summary[open] { padding-bottom: var(--sp-4); }
.range-summary__heading { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); min-height: 60px; padding-block: var(--sp-3); list-style: none; cursor: pointer; }
.range-summary__heading::-webkit-details-marker { display: none; }
.range-summary__counts { color: var(--text-2); font-size: var(--fs-1); }
.range-summary__toggle { margin-left: auto; font-size: var(--fs-5); color: var(--accent); }
.range-summary[open] .range-summary__toggle { transform: rotate(45deg); }
.range-summary h2 { margin: 0; font-size: var(--fs-2); font-weight: 600; }
.range-summary p { margin: 0; font-size: var(--fs-1); color: var(--text-3); }
.range-availability { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 0; margin: 0; list-style: none; }
.range-availability a { display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 5px 10px; border: 1px solid var(--border-2); border-radius: var(--radius); color: var(--text-2); text-decoration: none; font-size: var(--fs-1); background: var(--bg-panel); }
.range-availability [data-availability="present"] a > span:first-child { color: var(--accent); }
.range-availability [data-availability="absent"] a { border-style: dashed; background: transparent; }
.range-availability a:hover { color: var(--accent); border-color: var(--accent); }
#patches-title + .group .section-title { font-size: var(--fs-4); }
.group + .group { margin-top: var(--sp-8); }
@media (max-width: 767px) { .range-summary__heading { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-1); } .range-summary__counts { grid-column: 1; } .range-summary__toggle { grid-column: 2; grid-row: 1 / 3; } }

/* checks: the rules the library breaks, each with its counts and its worst cases pictured */
.chip--error { color: var(--error); background: var(--error-bg); }
.chip--warning, .chip--graded { color: var(--warn); background: var(--warn-bg); }
.chip--notice { color: var(--info); background: var(--info-bg); }
.chip--ok { color: var(--ok); background: var(--ok-bg); }
.checks__loading { margin: var(--sp-6) 0; }
.check-category + .check-category { margin-top: var(--sp-8); }
.check-rules { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-6); margin: 0; padding: 0; list-style: none; }
.check-rule { padding: var(--sp-4) 0 var(--sp-6); border-bottom: 1px solid var(--border-2); }
.check-rule__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); }
.check-rule__title { font-size: var(--fs-4); line-height: var(--lh-4); font-weight: 600; color: var(--text-1); text-decoration: none; }
.check-rule__title:hover { color: var(--accent); text-decoration: underline; }
.check-rule__counts { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1); }
.check-rule__counts .chip { height: calc(22px * var(--scale)); font-size: var(--fs-1); }
.check-rule__reach { font-size: var(--fs-2); }
.check-rule__all { margin-left: auto; font-size: var(--fs-2); color: var(--accent); text-decoration: none; white-space: nowrap; }
.check-rule__all:hover { text-decoration: underline; }
.checks-unchecked { columns: calc(320px * var(--scale)); margin: 0 0 var(--sp-3); padding-left: var(--sp-4); font-size: var(--fs-2); line-height: var(--lh-2); }
.check-filter { min-height: 0; padding-block: var(--sp-2); margin-bottom: var(--sp-4); }
.check-list { margin-top: var(--sp-6); }
.check-tile .tile__meta { margin-top: var(--sp-h); color: var(--text-2); font-size: var(--fs-2); line-height: var(--lh-2); }
.check-panel__text { margin: 0 0 var(--sp-3); font-size: var(--fs-3); line-height: var(--lh-3); }
/* a finding drawn as patch-server draws one on a patch: an area at fault filled, an image's
   extent only outlined, in its severity's colour */
.problem { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.problem.problem--error { stroke: var(--problem-error); fill: var(--problem-error); }
.problem.problem--warning { stroke: var(--problem-warning); fill: var(--problem-warning); }
.problem.problem--notice { stroke: var(--problem-notice); fill: var(--problem-notice); }
.problem.problem--area { fill-opacity: .45; fill-rule: evenodd; }
.problem.problem--extent { fill: none; }
/* Representative cases scroll in one row; the rule's page holds every finding. */
.check-rule__samples { grid-template-columns: none; grid-template-rows: auto; grid-auto-flow: column; grid-auto-columns: calc(var(--tile) * .8); gap: var(--sp-4); overflow-x: auto; overflow-y: hidden; padding-bottom: var(--sp-2); scroll-snap-type: x proximity; }
.check-rule__samples > li { scroll-snap-align: start; }
/* a patch's problems, heading its details: each a place to zoom to, its whole message shown once
   it is chosen; its mark on the preview drawn heavier than the rest */
.problems { margin-bottom: var(--sp-4); }
.problem-list { display: grid; gap: 2px; margin: var(--sp-1) 0 0; padding: 0; list-style: none; }
.problem-row { display: flex; align-items: baseline; gap: var(--sp-2); width: 100%; padding: var(--sp-1) var(--sp-2); border: 0; border-radius: var(--radius);
               background: none; color: var(--text-1); font: inherit; text-align: left; }
button.problem-row { cursor: pointer; }
button.problem-row:hover, .problem-row[aria-current="true"] { background: var(--bg-selected); }
.problem-row__text { display: grid; min-width: 0; font-size: var(--fs-2); line-height: var(--lh-2); }
.problem-row__title { font-weight: 550; overflow-wrap: anywhere; }
.problem-row__measure { color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-1); }
.problem-row__message { display: none; margin-top: var(--sp-h); color: var(--text-2); font-size: var(--fs-1); line-height: var(--lh-1); }
.problem-row[aria-current="true"] .problem-row__message, div.problem-row .problem-row__message { display: block; }
.problems__notices { margin-top: var(--sp-2); }
.ov-problem use { stroke-width: 2; }
.ov-problem use.is-current { stroke-width: 4; }
.ov-problem use.problem--area.is-current { fill-opacity: .6; }
.swatch.ov-problem .halo { display: none; }
.swatch.ov-problem .core { stroke: var(--problem-error); stroke-width: 2; }
/* a patch's tile says what the checks find with it, under its caption */
.tile .tile__badge { margin-top: var(--sp-1); }
/* a design's checks: each rule it breaks, its patches pictured, its files' and artworks' findings
   in words */
.check-group + .check-group { margin-top: var(--sp-8); }
.check-group .section-title a { color: inherit; text-decoration: none; }
.check-group .section-title a:hover { color: var(--accent); text-decoration: underline; }
.check-messages { margin: var(--sp-2) 0 0; padding: 0; list-style: none; font-size: var(--fs-2); line-height: var(--lh-2); }
.check-messages li + li { margin-top: var(--sp-1); }

/* The selected library is persistent context, visible outside the navigation drawer. */
.topbar--non-main { background: var(--warn-bg); border-bottom-color: var(--warn); }
.source-selector { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.source-selector__choice { min-width: 0; display: flex; align-items: center; gap: var(--sp-2); }
.source-selector__choice label { display: flex; align-items: center; color: var(--text-3); }
.source-selector__choice select { width: clamp(140px, 14vw, 240px); max-width: 100%; min-width: 0; height: var(--ctl); font-size: var(--fs-2); }
.source-selector__status { font-size: var(--fs-1); color: var(--text-2); white-space: nowrap; }
.source-selector__connection { color: var(--text-3); }
@media (max-width: 1099px) {
  .topbar__context { display: none; }
  .source-selector { flex: 1; }
  .source-selector__choice { flex: 1; }
  .source-selector__choice select { width: 100%; }
}
@media (max-width: 599px) {
  .topbar { padding-inline: var(--sp-3); gap: var(--sp-2); }
  .source-selector { gap: var(--sp-2); flex-wrap: wrap; align-content: center; }
  .source-selector__choice { flex: 1 1 140px; }
  .source-selector__status { order: 3; flex-basis: 100%; }
  .source-selector__connection { display: none; }
  .shell { --topbar: 88px; }
}

/* Paper, dark ink and a restrained green accent frame the library's own artwork. */
.sidebar { background: var(--bg-panel); padding-inline: var(--sp-4); }
.sidebar > .brand { margin-bottom: calc(48px * var(--scale)); }
.sidebar__label { font-size: calc(10px * var(--scale)); letter-spacing: .08em; text-transform: uppercase; }
.sidebar__nav a { min-height: calc(48px * var(--scale)); font-size: var(--fs-2); border-radius: var(--radius); }
.sidebar__nav a[aria-current] { background: var(--bg-selected); color: var(--accent); }
.sidebar__nav a[aria-current]::after { border-radius: 50%; }
.sidebar__nav a[aria-current] .icon { color: var(--accent); opacity: 1; }
.brand { font-size: calc(17px * var(--scale)); letter-spacing: -.03em; }
.brand__byline { font-size: 9px; letter-spacing: .12em; font-weight: 500; }
.workspace-link { border-bottom: 0; padding-block: var(--sp-4); }
.workspace-link__mark { background: transparent; }
.topbar__context { font-size: var(--fs-2); }
.topbar__mobile-brand { display: none; color: var(--text-1); text-decoration: none; font-size: var(--fs-2); font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.source-selector { position: relative; }
.has-js .source-selector > button { display: none; }
.source-selector__status { display: inline-flex; align-items: center; gap: var(--sp-2); }
.topbar:not(.topbar--non-main) .source-selector__status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* Artwork is a specimen on paper; the caption belongs to the same link without a card. */
.gallery .tile .thumb { border-radius: var(--radius-panel); border-color: var(--border-2); }
.gallery .tile .thumb > img, .gallery .tile .thumb > svg { inset: var(--sp-3); width: calc(100% - 2 * var(--sp-3)); height: calc(100% - 2 * var(--sp-3)); }
.tile__availability { color: var(--text-2); margin-top: var(--sp-1); }
.tile__availability > span:last-child { color: var(--text-3); }
.tile:hover .tile__availability > span:last-child { color: var(--accent); }
.view-tabs .icon { width: 15px; height: 15px; }
.view-tabs a[aria-current] { color: var(--accent); }
.page-tabs a[aria-current] { color: var(--accent); }
.page-tabs .count { font-family: var(--font-mono); }
.eyebrow { font-size: calc(11px * var(--scale)); letter-spacing: .12em; margin-bottom: var(--sp-2); }
.browse-form { padding: var(--sp-4) 0; border-top: 1px solid var(--border-2); }
.browse-form .search-field { background: var(--bg-panel); }
.results-bar { min-width: 0; flex-wrap: wrap; padding-block: var(--sp-4); }
.results-bar [role="status"] { white-space: nowrap; }
.results-bar__end { min-width: 0; display: flex; align-items: center; gap: var(--sp-4); }
.matrix-legend { flex-wrap: wrap; font-size: var(--fs-1); }
.matrix-legend > span { white-space: nowrap; }
.matrix tbody th, .matrix .matrix__corner { min-width: calc(200px * var(--scale)); }
.matrix .row-head > .thumb { flex: none; }
.matrix .row-head > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tbody td { font-size: var(--fs-2); }
.catalogue-table { border: 1px solid var(--border-2); border-radius: var(--radius-panel); background: var(--bg-panel); }
.catalogue-table th { top: 0; }

/* Checks lead with severity, then offer a direct route to each group of rules. */
.check-summary { padding: var(--sp-6); border: 1px solid var(--border-2); border-radius: var(--radius-panel); background: var(--bg-panel); margin-bottom: var(--sp-6); }
.check-summary > .eyebrow { margin: 0 0 var(--sp-4); }
.checks-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.check-stat { display: flex; flex-direction: column-reverse; gap: var(--sp-1); padding-inline: var(--sp-6); border-left: 1px solid var(--border-2); }
.check-stat:first-child { padding-left: 0; border: 0; }
.check-stat--error dd { color: var(--error); }
.check-stat--warning dd { color: var(--warn); }
.check-stat--notice dd { color: var(--info); }
.check-stat dd { margin: 0; font-size: var(--fs-6); line-height: var(--lh-6); font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.check-stat dt { font-size: var(--fs-2); display: flex; align-items: center; gap: var(--sp-2); color: var(--text-2); }
.check-stat--error dt > span { color: var(--error); }
.check-stat--warning dt > span { color: var(--warn); }
.check-stat--notice dt > span { color: var(--info); }
.check-navigation { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--border-2); }
.check-navigation .eyebrow { margin: 0 var(--sp-2) 0 0; }
.check-navigation a { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2); color: var(--text-2); font-size: var(--fs-2); text-decoration: underline; text-decoration-color: var(--border-1); }
.check-navigation a:hover { text-decoration-color: currentColor; color: var(--accent); }
.check-navigation a > span { color: var(--text-3); font-size: var(--fs-1); }
.check-category .section-title { scroll-margin-top: var(--sp-6); margin-bottom: var(--sp-4); }
.check-category .section-title .count { margin-left: var(--sp-2); font-size: var(--fs-2); }
.check-rule__head { align-items: center; }
.check-rule__metrics { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
.check-rule__title { flex: 1 1 35%; font-size: var(--fs-3); }
.check-rule__all { font-weight: 550; }
.check-rule__samples .tile__title { font-size: var(--fs-2); }
.check-rule__samples .tile__detail, .check-rule__samples .tile__meta { font-size: var(--fs-1); line-height: var(--lh-1); }
.checks__loading { padding-block: var(--sp-4); border-top: 1px solid var(--border-2); }

/* Inspection keeps space for the artwork, with unambiguous version captions. */
.main--preview .page-header, .main--compare .page-header { padding-block: var(--sp-4); }
.main--compare .page-header h1 { font-size: var(--fs-5); line-height: var(--lh-5); }
.breadcrumbs { flex-wrap: wrap; }
.breadcrumbs > a, .breadcrumbs > span { min-width: 0; }
.filmstrip .tile__title { font-size: var(--fs-1); line-height: var(--lh-1); font-weight: 500; }
.inspector { overscroll-behavior: contain; }
.inspector .details-heading { margin-bottom: var(--sp-6); }
.panes .preview { border: 1px solid var(--border-2); border-radius: var(--radius-panel); background: var(--bg-canvas); }
.panes[data-view="swipe"] .pane--after .preview { background: transparent; }
.pane__label { padding-block: var(--sp-1); overflow: hidden; }
.pane__role, .pane__label > .mono { flex: none; }
.panes[data-view="swipe"] .pane--before .pane__label { width: calc(50% - var(--sp-2)); }
.panes[data-view="swipe"] .pane--after .pane__label { width: calc(50% - var(--sp-2)); margin-left: auto; }
.where__table { max-width: 100%; overflow: auto; }
.where__zones { font-size: var(--fs-1); }
.where__zones th, .where__zones td { padding-inline: var(--sp-1); font-size: var(--fs-1); }
.where__zones td:first-child { white-space: normal; }

@media (max-width: 767px) {
  .main { padding-inline: var(--sp-4); }
  .page-header { padding-block: var(--sp-6) var(--sp-4); }
  .page-header h1 { font-size: 28px; line-height: 36px; }
  .page-header__meta { font-size: var(--fs-2); margin-top: var(--sp-1); }
  .page-header__actions { flex-wrap: wrap; margin-left: 0; }
  .page-header__title { gap: var(--sp-3); }
  .browse-form { gap: var(--sp-2); padding-block: var(--sp-3); }
  .browse-form .search-field { max-width: none; }
  .gallery { gap: var(--sp-3); }
  :root:not([data-tile="s"]):not([data-tile="l"]):not([data-tile="xl"]) { --tile: 140px; }
  .tile__title { font-size: var(--fs-2); }
  .tile__caption { margin-top: var(--sp-2); }
  .tile__availability { flex-wrap: wrap; }
  .results-bar { gap: var(--sp-2); }
  .main--matrix .results-bar__end { flex-basis: 100%; margin: 0; }
  .main--matrix .results-bar__end .view-tabs { width: fit-content; max-width: 100%; }
  .matrix-legend { gap: var(--sp-2); }
  .matrix tbody th, .matrix .matrix__corner { min-width: 144px; max-width: 144px; }
  .matrix tbody th a { max-width: 92px; }
  .ovtoggle { flex-wrap: wrap; max-width: 100%; overflow: visible; gap: 3px; border: 0; }
  .ovtoggle button { border: 1px solid var(--border-1); border-radius: var(--radius); padding-inline: var(--sp-2); min-height: 40px; }
  .ovtoggle button:last-child { border-right: 1px solid var(--border-1); }
  .ovtoggle button[aria-pressed="true"] { border-color: var(--accent); }
  .main--compare .page-header__actions .btn, .main--preview .page-header__actions .btn { font-size: var(--fs-2); }
  .page-header__actions .btn kbd { display: none; }
  .main--compare .canvas-tools { gap: var(--sp-2); }
  .main--compare .segmented { max-width: 100%; }
  .main--compare .segmented kbd { display: none; }
  .pane__label { flex-wrap: wrap; gap: 0 var(--sp-1); }
  .pane__label .pane__subject { flex-basis: 100%; }
  .panes[data-view="swipe"]::after { top: calc(2 * var(--lh-2) + 3 * var(--sp-1)); }
  .check-summary { padding-block: var(--sp-4); }
  .check-stat { padding-inline: var(--sp-3); }
  .check-stat dd { font-size: 28px; line-height: 36px; }
  .check-stat dt { gap: var(--sp-1); font-size: var(--fs-1); }
  .check-rule { padding: var(--sp-3) 0 var(--sp-4); }
  .check-rule__head { gap: var(--sp-2); }
  .check-rule__title { flex-basis: 100%; }
  .check-rule__all { margin-left: auto; }
  .check-rule__samples { grid-auto-columns: 150px; }
  .check-navigation { gap: var(--sp-2); }
  .check-navigation a { padding: var(--sp-2); }
  .statusbar { gap: var(--sp-3); }
}
@media (max-width: 599px) {
  .has-js .shell { --topbar: 64px; }
  .source-selector { column-gap: var(--sp-2); row-gap: 0; }
  .source-selector__choice { flex: 1; }
  .has-js .source-selector__status { flex-basis: auto; order: 0; }
  .source-selector__status { font-size: 11px; }
  .topbar--non-main .source-selector__status { flex-basis: 100%; order: 3; padding-left: 26px; }
  .has-js .topbar--non-main { align-content: center; }
  .source-selector__choice select { height: 36px; }
  .view-tabs a { padding-inline: 10px; }
  .view-tabs .icon { display: none; }
  .panel { padding: var(--sp-6); margin-top: var(--sp-6); }
  .panel__title { line-height: 1.25; }
  .shortcuts { grid-template-columns: auto 1fr; }
}

/* Content workspaces keep navigation and presentation controls close to their subject. */
.sidebar__label--group { margin-top: var(--sp-6); margin-bottom: var(--sp-1); }
.workspace-heading { display: flex; align-items: center; gap: var(--sp-8); min-width: 0; }
.workspace-heading h1 { margin: 0; font-size: var(--fs-5); line-height: var(--lh-5); font-weight: 650; letter-spacing: -.03em; }
.workspace-heading > a { text-decoration: none; font-weight: 600; }
.workspace-heading > a:hover { text-decoration: underline; }
.workspace-heading--breadcrumb { gap: var(--sp-3); }
.main--check .page-header { padding-block: var(--sp-4); align-items: center; }
.main--check .page-header h1 { font-size: var(--fs-5); line-height: var(--lh-5); }
.check-entries .tile .thumb > img, .check-entries .tile .thumb > svg { inset: var(--sp-2); width: calc(100% - 2 * var(--sp-2)); height: calc(100% - 2 * var(--sp-2)); }
.compare-step__arrow { display: none; }
.checks { padding-top: var(--sp-6); }
.workspace-tabs { margin-top: var(--sp-2); }
.settings-layout { padding-top: var(--sp-6); }
.dies-filters { border-top: 0; }
.dies-filters .search-field { order: -1; }
.workspace-heading__views .view-tabs { border: 0; gap: var(--sp-1); }
.workspace-heading__views .view-tabs a { height: var(--topbar); min-width: 80px; padding-inline: var(--sp-3); }
.library-viewbar { display: none; }
.library-filters { border: 0; gap: var(--sp-3); padding-block: var(--sp-4) var(--sp-2); }
.library-filters .search-field { max-width: 640px; flex-basis: 260px; }
.library-filters .search-field .field { height: var(--ctl-md); }
.filter-options { flex: none; }
.filter-options > summary, .size-options > summary { list-style: none; cursor: pointer; }
.filter-options > summary::-webkit-details-marker, .size-options > summary::-webkit-details-marker { display: none; }
.filter-options__body { display: flex; align-items: center; gap: var(--sp-2); }
.filter-options__active { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.library-filters .filterbar__die { flex-wrap: nowrap; gap: var(--sp-2); }
.library-filters .filterbar__die > .select, .library-filters .die-chooser-trigger { height: var(--ctl-md); }
.library-filters + .active-filters { padding-top: var(--sp-1); padding-bottom: var(--sp-2); }
.results-bar > [role="status"] { font-weight: 550; color: var(--text-1); }
.results-bar .segmented { border-color: var(--border-2); }
.results-bar .segmented button { min-width: calc(32px * var(--scale)); }
.library-filters ~ .results-bar { padding-top: var(--sp-1); padding-bottom: var(--sp-4); }
.library-filters ~ .results-bar .segmented { margin-left: var(--sp-2); }
.btn { transition: background-color 140ms, border-color 140ms; }
.btn--primary { font-weight: 550; }
.view-tabs a:hover, .page-tabs a:hover { color: var(--accent); background: var(--bg-hover); }
.view-tabs a[aria-current]:hover, .page-tabs a[aria-current]:hover { background: transparent; }
.table th { color: var(--text-2); }
.table tbody tr:hover { background: var(--bg-hover); }
.families { padding-top: var(--sp-4); }
.families .group-title { font-size: var(--fs-3); margin-bottom: var(--sp-3); }
.canvas-tools .btn { min-width: var(--ctl); }
.canvas-tools .ovtoggle { margin-inline: var(--sp-1); }
.inspector .detail-link { font-weight: 550; }
.inspector .readout { border-bottom: 1px solid var(--border-2); }
.inspector .disclosure { padding-block: var(--sp-3); }
.page-tabs { gap: var(--sp-6); }
.page-tabs a { min-height: 44px; }
.preview-caption { color: var(--text-3); }
.page-header h1 { font-size: calc(30px * var(--scale)); line-height: calc(38px * var(--scale)); }
@media (min-width: 768px) {
  .has-js .filter-options > summary, .has-js .size-options > summary { display: none; }
}
@media (max-width: 1099px) {
  .topbar__mobile-brand { display: block; }
  .source-selector { flex: 0 1 auto; }
  .source-selector__choice { flex: 0 1 auto; }
  .source-selector__choice select { width: clamp(108px, 20vw, 200px); }
  .sidebar__bottom { padding-top: var(--sp-6); }
}
@media (max-width: 767px) {
  .statusbar > span:not(.statusbar__end) { display: none; }
  .statusbar:not(:has(.statusbar__end:not(:empty))) { display: none; }
  .main--compare .page-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); }
  .main--compare .page-header > div:first-child { display: contents; }
  .main--compare .page-header .breadcrumbs { grid-column: 1 / -1; margin-bottom: 0; }
  .main--compare .page-header h1 { font-size: 18px; }
  .main--compare .page-header__actions { flex-wrap: nowrap; gap: var(--sp-1); }
  .main--compare .page-header__actions .btn { padding-inline: var(--sp-2); }
  .compare-step__label { display: none; }
  .compare-step__arrow { display: inline; font-size: 18px; }
  .compare-step { min-width: 44px; }
  .workspace-heading__views { display: none; }
  .workspace-heading h1 { font-size: 20px; }
  .workspace-heading { gap: var(--sp-3); }
  .dies-filters { gap: var(--sp-2); }
  .dies-filters .search-field { flex-basis: 100%; max-width: none; }
  .library-viewbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); border-bottom: 1px solid var(--border-2); }
  .library-viewbar .view-tabs { border: 0; gap: var(--sp-4); }
  .library-viewbar .view-tabs a { min-height: 44px; padding-inline: var(--sp-1); }
  .library-viewbar .view-tabs a:first-child { padding-left: 0; }
  .library-viewbar .details-toggle { padding-inline: var(--sp-1); font-size: var(--fs-1); }
  .library-filters { display: flex; flex-wrap: nowrap; padding-block: var(--sp-3) var(--sp-2); }
  .library-filters .search-field { min-width: 0; flex: 1; }
  .library-filters .filterbar__die { min-width: 0; display: flex; flex: 1; }
  .library-filters .filterbar__die > .select { max-width: 100%; }
  .library-filters .filterbar__die .die-chooser-trigger { flex: 1; min-width: 0; max-width: none; }
  .library-filters .search-field kbd { display: none; }
  .filter-options__body { position: absolute; top: 100%; left: 0; right: 0; z-index: 4; flex-wrap: wrap; padding: var(--sp-3); background: var(--bg-panel); border: 1px solid var(--border-1); border-radius: var(--radius-panel); box-shadow: var(--shadow-pop); }
  .filter-options[open] > summary { border-color: var(--accent); background: var(--bg-selected); }
  html:not(.has-js) .library-filters { flex-wrap: wrap; }
  html:not(.has-js) .filter-options__body { position: static; }
  html:not(.has-js) .filter-options[open] { flex-basis: 100%; }
  .library-filters ~ .results-bar { padding-bottom: var(--sp-3); gap: var(--sp-2); }
  .results-bar__end { gap: var(--sp-2); }
  .sort-field__label { display: none; }
  .results-bar .sort-field .select { padding-inline: 0; font-size: var(--fs-1); max-width: 138px; }
  .size-options { position: relative; z-index: 2; }
  .size-options > summary { padding-inline: var(--sp-1); color: var(--text-2); font-size: var(--fs-1); }
  .size-options > summary::after { content: "⌄"; }
  .size-options__body { position: absolute; right: 0; top: calc(100% + 4px); padding: var(--sp-2); background: var(--bg-panel); border: 1px solid var(--border-2); border-radius: var(--radius-panel); box-shadow: var(--shadow-pop); }
  .library-filters ~ .results-bar .size-options .segmented { margin: 0; }
  .size-options .segmented button { min-width: 40px; }
  .gallery .tile .thumb > img, .gallery .tile .thumb > svg { inset: var(--sp-2); width: calc(100% - 2 * var(--sp-2)); height: calc(100% - 2 * var(--sp-2)); }
  .tile__title { line-height: var(--lh-2); }
  .tile__availability { font-size: 11px; gap: 2px; }
  .tile__availability > span:last-child { display: none; }
  .range-summary { padding-inline: var(--sp-3); }
  .range-summary h2 { font-size: var(--fs-2); }
  .range-availability { gap: var(--sp-1); }
  .range-availability a { min-height: 44px; }
  .page-tabs { gap: var(--sp-4); }
  .check-summary { padding: var(--sp-4); }
  .check-stat { padding-inline: var(--sp-2); }
  .check-stat dt { flex-wrap: wrap; }
  .canvas-tools .ovtoggle { margin-inline: 0; }
  .main--preview .page-header__actions { gap: var(--sp-2); }
  .btn, .field, .select { min-height: 44px; }
  .segmented button, .segmented a { min-height: 44px; }
  .account-menu > summary { min-height: 44px; }
  .source-selector__choice select { min-height: 40px; }
  .results-bar .matrix-selection-toggle { display: none; }
}
@media (max-width: 599px) {
  .workspace-heading--breadcrumb > span { display: none; }
  .source-selector { margin-left: auto; }
  .source-selector__choice { flex: 1; }
  .topbar:not(.topbar--non-main) .source-selector__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .topbar--non-main .source-selector { max-width: 180px; }
  .topbar--non-main .source-selector__status { font-size: 10px; }
  .topbar--non-main .source-selector__choice select { min-height: 32px; }
  .library-viewbar .view-tabs { gap: var(--sp-3); }
  .library-viewbar .view-tabs a { font-size: var(--fs-2); }
  .library-viewbar .details-toggle { max-width: 82px; white-space: normal; line-height: 1.2; }
}
@media (max-width: 359px) {
  .main { padding-inline: var(--sp-3); }
  .library-filters .filterbar__die { gap: var(--sp-1); }
  .library-filters .filterbar__die > .select { padding-inline: var(--sp-1); font-size: var(--fs-1); }
  .die-chooser-trigger { font-size: var(--fs-1); padding-inline: var(--sp-1); }
  .topbar__mobile-brand { font-size: 13px; }
  .source-selector__choice { gap: var(--sp-1); }
  .source-selector__choice select { width: 100px; }
}

/* The way from one app to the other: the site's tabs, at the head of the rail. Each app's own
   destinations follow beneath. */
.sidebar > .brand { margin-bottom: var(--sp-6); }
.app-switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 0 var(--sp-6); border-bottom: 1px solid var(--border-1); }
.app-switch a { display: flex; align-items: center; justify-content: center; min-height: var(--ctl); margin-bottom: -1px; padding: 0 var(--sp-2); border-bottom: 2px solid transparent; color: var(--text-2); text-decoration: none; font-size: var(--fs-2); font-weight: 550; white-space: nowrap; }
.app-switch a:hover { color: var(--text-1); }
.app-switch a[aria-current] { border-bottom-color: var(--accent); color: var(--text-1); font-weight: 650; }
.app-switch + .sidebar__nav { margin-top: calc(-1 * var(--sp-2)); }
@media (pointer: coarse) { .app-switch a { min-height: 44px; } }
