/* mkfs.dev: one stylesheet for every section under the mkfs.dev origin (/, /labs, /acad, /conc,
   and git.mkfs.dev later). The base is the SGH theme (www.sgh.com geometry, type, gold primary
   accent and cut corner) on a dark ground. Each section blends one developer colour scheme into
   that base: the scheme supplies the grounds, the link, focus, flag, success and muted colours;
   SGH supplies the shapes, the type, the text colours, the gold and the orange.

   Pick a palette with data-theme on <html>: landing, labs, acad, conc, git, spare-rose,
   spare-monokai. With no data-theme the page gets labs, so pages built for labs.css render
   unchanged. data-theme also works on any element inside a page; the landing page's section
   tiles use that to show each section in its own colours.

   Sections differ only through the custom properties in the palette blocks below. Components
   read those properties and never name a section.

   This file replaces theme/labs.css and theme/labs-auth.css. The rules that only the account
   pages use are scoped to their fixed markup (.masthead, body > main, .window), because those
   pages and the content pages style h1, main, label, input and .errorlist differently.

   The page CSP is default-src 'none'; style-src 'self'; font-src 'self'; img-src 'self': no
   @import, no data: URIs, no external fonts. Font URLs are relative to this file. */

@font-face { font-family: "Labs Display"; font-weight: 200 1000; font-display: swap;
  src: local("Conneqt Bold"), url("fonts/NunitoSans-var.woff2") format("woff2"); }
@font-face { font-family: "Labs Condensed"; font-weight: 400; font-display: swap;
  src: local("Trade Gothic Next Condensed"), url("fonts/PragatiNarrow-400.woff2") format("woff2"); }
@font-face { font-family: "Labs Condensed"; font-weight: 700; font-display: swap;
  src: local("Trade Gothic Next Condensed Bold"), local("TradeGothicNextLTPro-BdCn"),
    url("fonts/PragatiNarrow-700.woff2") format("woff2"); }

/* ==== Base tokens: the same in every section ==== */
:root {
  /* SGH brand colours. Dark blue is too dark to be text on these grounds, so it is a fill. */
  --gold: #d29f1c;
  --dark-blue: #004860;
  --orange: #cf4520;      /* reserved for active and destructive states */
  --tan: #d6d2c4;
  /* Text: SGH white, light gray and tan. Every palette's grounds are chosen so these reach 7:1. */
  --text-strong: #ffffff;
  --text: #f1f1f1;        /* SGH light gray */
  --text-2: #d6d2c4;      /* SGH tan */
  /* Errors and destructive buttons: SGH orange lightened for text, darkened for the hover wipe. */
  --bad-text: #f2a184;
  --danger-wipe: #a8381a;
  --display: "Labs Display", "Helvetica Neue", Arial, sans-serif;
  --condensed: "Labs Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "segoe-ui", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
  --cut: polygon(100% 0, 100% calc(100% - 24px), calc(100% - 32px) 100%, 0 100%, 0 0);
  --cut-sm: polygon(100% 0, 100% calc(100% - 12px), calc(100% - 16px) 100%, 0 100%, 0 0);
  /* Type scale: 16 px body, each step 1.125 times the last, rounded to whole pixels:
     11, 13, 14, 16, 18, 20, 23, (26), 29. 11 px is the floor, used for badges and small labels. */
  /* --k enlarges type, the sidebar, the card grid and the page width on very wide screens, where
     16 px text is physically small: 1 up to 2200 px, 1.125 from there, 1.25 from 3200 px. */
  --k: 1;
  --t-3: calc(11px * var(--k)); --t-2: calc(13px * var(--k)); --t-1: calc(14px * var(--k)); --t0: calc(16px * var(--k));
  --t1: calc(18px * var(--k)); --t2: calc(20px * var(--k)); --t3: calc(23px * var(--k)); --t5: calc(29px * var(--k));
  /* The page card: 1180 px on a laptop, then 76% of the window, so the card fills the space beside
     the sidebar on a wide screen and the overview gains columns. Text lines stay capped in characters. */
  --page: clamp(1180px, 76vw, 2400px);
  /* Spacing: margins, padding and gaps are multiples of 4 px. The few odd values (17, 29) are a
     20 or 32 px inset less a 3 px border. */
  /* Dark form controls, scrollbars and autofill from the browser. */
  color-scheme: dark;
}

/* Very wide screens (a 4K panel at 150% is about 2560 px wide, at 100% it is 3840 px). */
@media (min-width: 2200px) { :root { --k: 1.125; } }
@media (min-width: 3200px) { :root { --k: 1.25; } }

/* ==== Palettes ====
   Every block sets the same 20 properties. The roles:
   --ground      page background, behind the sidebar and the card
   --panel       the page card; the scheme's own editor background where it has a usable one
   --inset       sidebar, section heads, posts, form fields: darker than the panel
   --raised      hover rows, project cards, total rows: lighter than the panel
   --rule        hairlines: SGH tan at 22% over the panel
   --field-line  the bottom edge of a form field
   --muted       secondary text: dates, owners, group labels (4.5:1 or more on every ground)
   --link, --link-line   link text and its underline (the link colour at 45%)
   --focus       the focus ring; kept apart from gold, which is the hover colour
   --code        inline code text
   --flag, --flag-bg     the dashed "inferred value" mark
   --ok          the "active" badge
   --comment     the scheme's comment colour: the h3 bar and the quote edge
   --grid        the faint graph-paper lines on the page ground
   --select      text-selection background
   --notice-bg, --bad-bg grounds for a notice (gold edge) and an error (orange edge)
   --accent      the section's colour on the landing page tiles. 4.5:1 or more as text on the
                 panel and as a fill under black text.
   Contrast figures for every pair are in NOTES.md (tools/palette.py computes them). */

/* Labs: SGH on Dracula. The Dracula background is the card; the page and the insets are darker
   shades of the same purple-leaning ink. These are the values theme/labs.css has today. */
:root, [data-theme="labs"] {
  --ground: #191a23;
  --panel: #282a36;
  --inset: #1e1f29;
  --raised: #343746;
  --rule: #4e4f58;
  --field-line: #878986;  /* SGH border gray; 4.0:1 on the panel (see NOTES.md) */
  --muted: #a4afd3;       /* Dracula comment #6272a4 lightened; the original is 3.0:1 */
  --link: #8be9fd;        /* Dracula cyan */
  --link-line: rgba(139, 233, 253, 0.45);
  --focus: #bd93f9;       /* Dracula purple */
  --code: #bd93f9;
  --flag: #ff79c6;        /* Dracula pink */
  --flag-bg: #3d2b41;
  --ok: #50fa7b;          /* Dracula green */
  --comment: #6272a4;     /* Dracula comment */
  --grid: rgba(98, 114, 164, 0.09);
  --select: #44475a;      /* Dracula current line */
  --notice-bg: #33301f;
  --bad-bg: #3b2529;
  --accent: #bd93f9;
}

/* Landing: SGH alone. Charcoal grounds from SGH's dark theme, SGH's light blue for links, its
   sea-green for success, tan grid lines. */
[data-theme="landing"] {
  --ground: #1a1b19;
  --panel: #2a2c29;       /* SGH charcoal darkened */
  --inset: #20211f;
  --raised: #373a36;      /* SGH charcoal */
  --rule: #50514b;
  --field-line: #959794;  /* SGH border gray lightened to 4.5:1 */
  --muted: #a9aba6;
  --link: #9fc3dd;        /* SGH light blue */
  --link-line: rgba(159, 195, 221, 0.45);
  --focus: #ffffff;
  --code: #a0d1ca;        /* SGH sea green */
  --flag: #ec8f6b;        /* SGH orange lightened */
  --flag-bg: #3d3630;
  --ok: #a0d1ca;
  --comment: #5f9bc6;     /* SGH map-pin blue */
  --grid: rgba(214, 210, 196, 0.05);
  --select: #004860;      /* SGH dark blue */
  --notice-bg: #373528;
  --bad-bg: #3e2f28;
  --accent: #d29f1c;      /* SGH gold */
}

/* AutoCAD standards: SGH on Solarized Dark. base03 is the card, base02 the raised rows; blue,
   cyan, violet and magenta are lightened until they pass on base03. */
[data-theme="acad"] {
  --ground: #001e26;
  --panel: #002b36;       /* Solarized base03 */
  --inset: #00242e;
  --raised: #073642;      /* Solarized base02 */
  --rule: #2f5055;
  --field-line: #7f9799;
  --muted: #93a1a1;       /* Solarized base1 */
  --link: #80c2f0;        /* Solarized blue #268bd2 lightened */
  --link-line: rgba(128, 194, 240, 0.45);
  --focus: #a3a7ea;       /* Solarized violet #6c71c4 lightened */
  --code: #62cfc4;        /* Solarized cyan #2aa198 lightened */
  --flag: #ec79b0;        /* Solarized magenta #d33682 lightened */
  --flag-bg: #183342;
  --ok: #b0c33a;          /* Solarized green #859900 lightened */
  --comment: #586e75;     /* Solarized base01 */
  --grid: rgba(88, 110, 117, 0.14);
  --select: #0d4a5a;
  --notice-bg: #113434;
  --bad-bg: #192e33;
  --accent: #4fa3e0;      /* Solarized blue lightened */
}

/* Concrete: SGH on Gruvbox Dark. The soft-contrast card (bg0_s), warmer than the landing charcoal,
   aqua links, orange accent. */
[data-theme="conc"] {
  --ground: #1f1d1c;
  --panel: #32302f;       /* Gruvbox bg0_s */
  --inset: #292726;
  --raised: #3c3836;      /* Gruvbox bg1 */
  --rule: #565450;
  --field-line: #a89984;  /* Gruvbox fg4 */
  --muted: #bdae93;       /* Gruvbox fg3 */
  --link: #9ccb8b;        /* Gruvbox aqua #8ec07c lightened to 7:1 on the warmer card */
  --link-line: rgba(156, 203, 139, 0.45);
  --focus: #e09cae;       /* Gruvbox purple #d3869b lightened */
  --code: #fabd2f;        /* Gruvbox yellow */
  --flag: #fc8f80;        /* Gruvbox red #fb4934 lightened */
  --flag-bg: #463735;
  --ok: #b8bb26;          /* Gruvbox green */
  --comment: #928374;     /* Gruvbox gray */
  --grid: rgba(146, 131, 116, 0.09);
  --select: #504945;      /* Gruvbox bg2 */
  --notice-bg: #3f392d;
  --bad-bg: #45332d;
  --accent: #fe8019;      /* Gruvbox orange */
}

/* Git (git.mkfs.dev, Forgejo): SGH on Everforest Dark. Green-gray grounds, blue-green links,
   moss-green accent. */
[data-theme="git"] {
  --ground: #232a2e;      /* Everforest bg_dim */
  --panel: #2d353b;       /* Everforest bg0 */
  --inset: #272e33;
  --raised: #343d43;
  --rule: #525859;
  --field-line: #a2ada5;
  --muted: #b2bdb5;       /* Everforest grey2 lightened */
  --link: #9dcfc8;        /* Everforest blue #7fbbb3 lightened */
  --link-line: rgba(157, 207, 200, 0.45);
  --focus: #e3a9c4;       /* Everforest purple #d699b6 lightened */
  --code: #dbbc7f;        /* Everforest yellow */
  --flag: #f0999b;        /* Everforest red #e67e80 lightened */
  --flag-bg: #403f45;
  --ok: #97cca3;          /* Everforest aqua #83c092 lightened */
  --comment: #859289;     /* Everforest grey1 */
  --grid: rgba(133, 146, 137, 0.09);
  --select: #475258;      /* Everforest bg3 */
  --notice-bg: #3a3d39;
  --bad-bg: #403738;
  --accent: #a7c080;      /* Everforest green */
}

/* Spare: SGH on Rosé Pine. The darkest card of the set, foam links, rose accent. */
[data-theme="spare-rose"] {
  --ground: #111019;
  --panel: #191724;       /* Rosé Pine base */
  --inset: #15131e;
  --raised: #26233a;      /* Rosé Pine overlay */
  --rule: #434047;
  --field-line: #908caa;  /* Rosé Pine subtle */
  --muted: #a6a2bf;       /* Rosé Pine subtle lightened */
  --link: #9ccfd8;        /* Rosé Pine foam */
  --link-line: rgba(156, 207, 216, 0.45);
  --focus: #c4a7e7;       /* Rosé Pine iris */
  --code: #f6c177;        /* Rosé Pine gold */
  --flag: #eb6f92;        /* Rosé Pine love */
  --flag-bg: #2e202f;
  --ok: #7fb8cc;          /* Rosé Pine pine #31748f lightened; the scheme has no green */
  --comment: #6e6a86;     /* Rosé Pine muted */
  --grid: rgba(110, 106, 134, 0.12);
  --select: #403d52;      /* Rosé Pine highlight med */
  --notice-bg: #282223;
  --bad-bg: #2f1d24;
  --accent: #ebbcba;      /* Rosé Pine rose */
}

/* Spare: SGH on Monokai. Olive-black grounds, cyan links, Monokai Pro pink accent. */
[data-theme="spare-monokai"] {
  --ground: #1c1d18;
  --panel: #272822;       /* Monokai background */
  --inset: #21221c;
  --raised: #3e3d32;      /* Monokai line highlight */
  --rule: #4e4d46;
  --field-line: #97968a;
  --muted: #b4b2a2;
  --link: #66d9ef;        /* Monokai cyan */
  --link-line: rgba(102, 217, 239, 0.45);
  --focus: #ae81ff;       /* Monokai purple */
  --code: #e6db74;        /* Monokai yellow */
  --flag: #fd971f;        /* Monokai orange */
  --flag-bg: #3c3322;
  --ok: #a6e22e;          /* Monokai green */
  --comment: #75715e;     /* Monokai comment */
  --grid: rgba(117, 113, 94, 0.1);
  --select: #49483e;
  --notice-bg: #353222;
  --bad-bg: #3b2b22;
  --accent: #ff6188;      /* Monokai Pro pink */
}

/* ==== Page ==== */
* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh;
  color: var(--text);
  font: var(--t0)/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  /* A faint 24 px graph-paper grid in the scheme's comment colour. A gradient is drawn by the
     browser, so img-src does not apply to it. */
  background-color: var(--ground);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

::selection { background: var(--select); color: #fff; }

/* One focus ring everywhere, in the scheme's focus colour, so it stays distinct from the gold hover. */
a:focus-visible, button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---- Shell: sidebar and page column ---- */
/* Off-screen until a keyboard user tabs to it. */
.skip { position: absolute; left: 8px; top: -60px; z-index: 2; padding: 8px 16px; background: var(--gold); color: #000; font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; }
/* The sidebar is 240 px up to a 1920 px window and grows to 360 px on a 4K one. */
.shell { display: grid; grid-template-columns: clamp(240px, 12.5vw, 360px) minmax(0, 1fr); min-height: 100vh; }
/* The sidebar stays put while the page scrolls, and scrolls by itself when the list is long. */
.side {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
  padding: 24px 0 32px;
  background: var(--inset); border-right: 1px solid var(--rule);
}
/* The wordmark stays text here: the SGH logo is approved for /brand/ only. */
.side .mark { display: inline-flex; margin: 0 20px 8px; padding: 8px 0; color: var(--text-strong); text-decoration: none; }
/* The wordmark holds its weight as the window grows: 22 px to 1600, 29 px at 2560, 39 px at 3840. */
.side .wm { font-size: clamp(22px, 0.75vw + 10px, 40px); }
/* build.py writes the links twice; this copy is the phone menu and is hidden on wide screens. */
.nav-m { display: none; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li { margin: 0; }
/* Every group has the same label and the same 24 px above it; whitespace separates the groups,
   so there are no rules to read as a break in the list. */
.nav .grp {
  margin: 24px 0 4px; padding: 0 20px;
  font: 700 var(--t-3)/1.5 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 8px 20px 8px 17px; border-left: 3px solid transparent;
  font-size: var(--t-1); line-height: calc(20px * var(--k)); color: var(--text-2); text-decoration: none;
  transition: background 0.3s, color 0.3s;
}
.nav a:hover { background: var(--raised); color: var(--text-strong); }
/* The current page: gold edge and a lighter ground, so it does not rest on colour alone. */
.nav a[aria-current] { border-left-color: var(--gold); background: var(--panel); color: var(--text-strong); font-weight: 600; }
/* Inside the edge, because the sidebar clips what overflows it. */
.nav a:focus-visible { outline-offset: -2px; }
.col { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; padding: 0 24px; }
/* main takes focus from the skip link; it is not a control, so it shows no ring. */
main:focus { outline: none; }

/* ---- Wordmark ---- */
/* A name as a character block: one grid cell per letter so the letters stand in columns
   (D/L, E/A, V/B). Cells centre their letter, so a wide glyph spills evenly both ways.
   build.py writes the column count as a class (c3 for DEV/LAB); c3 is the default. */
.wm {
  display: inline-grid; grid-template-columns: repeat(3, 0.86em); row-gap: 0.14em; justify-items: center;
  font: 900 15px/1 var(--display); text-transform: uppercase; /* a logo size, outside the type scale */
  color: var(--text-strong);
}
.wm.c2 { grid-template-columns: repeat(2, 0.86em); }
.wm.c4 { grid-template-columns: repeat(4, 0.86em); }
.wm .lo { color: var(--gold); } /* second row; 6.7:1 or more on every inset */
/* Read by screen readers in place of the letters, which are aria-hidden. */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- Page card: square, with the SGH cut bottom-right corner ---- */
.pg {
  width: 100%; max-width: var(--page); margin: 32px auto;
  padding: 40px 40px 56px;
  background: var(--panel);
  clip-path: var(--cut);
}

h1 {
  margin: 0 0 24px;
  font: 900 var(--t5)/1.2 var(--display); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--text-strong);
}
/* A short gold bar under the title: the page's one fixed piece of SGH gold. */
h1::after { content: ""; display: block; width: 56px; height: 3px; margin-top: 16px; background: var(--gold); }

/* ---- Sections ---- */
/* A long page is a stack of bordered sections (build.py wraps each h2 and what follows it). The h2 is
   a band across the top of its section with a gold edge, heavier than anything inside it; a leading
   section number is set off in gold. */
h2 {
  display: flex; align-items: baseline; gap: 12px;
  margin: 0; padding: 12px 16px 12px 13px;
  font: 700 var(--t3)/1.2 var(--condensed);
  color: var(--text-strong); background: var(--inset);
  border-left: 3px solid var(--gold);
  scroll-margin-top: 16px;
}
h2 .no { flex: none; font: 700 var(--t1)/1 var(--mono); color: var(--gold); }
.sec { margin-top: 48px; border: 1px solid var(--rule); border-top: 0; }
.sec-body { padding: 16px 16px 24px; }
.sec-body > :first-child { margin-top: 0; }
.sec-body > :last-child { margin-bottom: 0; }
/* A sub-section inside a section: a rule across the section and a short bar in the scheme's comment
   colour before the title, lighter than the h2 band. */
.sec-body > h3 { margin: 32px 0 12px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: var(--t1); scroll-margin-top: 16px; }
.sec-body > h3::before { content: ""; display: inline-block; width: 3px; height: 0.9em; margin-right: 12px; background: var(--comment); vertical-align: -0.1em; }
.sec-body > h3:first-child { padding-top: 0; border-top: 0; }
/* A table belongs to the heading or sentence directly above it, so it sits close under it. */
.sec-body > h3 + .table, .sec-body > p + .table { margin-top: 8px; }
/* "On this page": the h2 sections of a long document, in columns when there is room. */
.toc { margin: 24px 0 0; padding: 12px 16px 16px; background: var(--inset); border-left: 3px solid var(--rule); }
.toc .grp { margin: 0 0 8px; font: 700 var(--t-3)/1.5 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.toc ul { margin: 0; padding: 0; list-style: none; columns: 18em; column-gap: 32px; font-size: var(--t-1); }
.toc li { margin: 0 0 4px; break-inside: avoid; }

p { margin: 0 0 12px; }
/* Keeps long prose lines readable inside the wide card that the tables need. */
.pg > p, .pg > ul, .sec-body > p, .sec-body > ul { max-width: 72ch; }

a {
  color: var(--link);
  text-decoration: underline; text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px; text-underline-offset: 0.25em;
  transition: text-decoration-color 0.3s;
}
a:hover { text-decoration-color: currentColor; }

strong { color: var(--text-strong); }

/* Command blocks in the guide pages scroll inside their own box; a long line never widens the page. */
pre { margin: 12px 0; padding: 12px; overflow: auto; background: var(--inset); border: 1px solid var(--rule); line-height: 1.5; }
pre code { padding: 0; background: none; border: 0; color: var(--text); overflow-wrap: normal; white-space: pre; }

code {
  font: 0.88em var(--mono);
  padding: 1px 4px;
  background: var(--inset); border: 1px solid var(--rule);
  color: var(--code);
  overflow-wrap: anywhere; /* part numbers and paths must not widen a phone page */
}

/* em marks "(inferred)" quantities: values the notes do not state. Flag-coloured text in a dashed
   box, so the mark does not depend on colour alone. The clone setting keeps the box closed
   on each line when a long note wraps. */
em {
  font-style: normal; font-size: 0.88em;
  padding: 0 4px;
  color: var(--flag); background: var(--flag-bg);
  border: 1px dashed var(--flag);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

ul { padding-left: 24px; }
li { margin: 4px 0; }
li::marker { color: var(--gold); }

/* ---- Tables ---- */
/* The wrapper scrolls sideways on a phone; min-width on the table stops the columns crushing. */
.table { overflow-x: auto; margin: 12px 0 8px; border-top: 2px solid var(--gold); }
/* The scroller takes keyboard focus (tabindex in build.py) so arrow keys can scroll it. */
.table:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* 640 px is what a five-column table needs; it also fits beside the sidebar on a 1024 px tablet. */
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: var(--t-1); }
/* Header band in SGH dark blue: the brand colour as a fill, since it fails as text on dark. */
th {
  padding: 8px 12px 8px;
  text-align: left; white-space: nowrap;
  font: 700 var(--t-2)/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text); background: var(--dark-blue); /* 8.9:1 */
}
td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--text-2); }
tbody tr:hover td { background: var(--raised); }
td:first-child { font-weight: 600; color: var(--text-strong); }
/* The rig BOM's five-column tables (Item, Spec, Qty, Cost, Status); its other tables keep the defaults. */
.bom table:has(th:nth-child(5)) td:nth-child(2) { min-width: 16em; }
/* Quantity and cost read like instrument values: fixed-width digits that line up. */
.bom table:has(th:nth-child(5)) td:nth-child(3), .bom table:has(th:nth-child(5)) td:nth-child(4) { font-family: var(--mono); font-size: var(--t-2); color: var(--text); }
.bom table:has(th:nth-child(5)) td:nth-child(3) { min-width: 5em; }
/* Tables of up to three columns fit a phone without scrolling (build.py marks them). */
.narrow table { min-width: 0; }
.narrow th { white-space: normal; }

/* ---- Shared page furniture (project pages and the forum) ---- */
.breadcrumbs { display: flex; flex-wrap: wrap; margin: 0 0 24px; font-size: var(--t-2); color: var(--muted); }
/* inline-block keeps the link underline off the separator. */
.breadcrumbs > * + *::before { content: "/"; display: inline-block; margin: 0 8px; color: var(--muted); }
.page-header { margin: 0 0 24px; }
.page-header h1 { margin-bottom: 0; }
/* Small labels are all the display face, bold, uppercase and tracked: 13 px for eyebrows, table
   heads and form labels, 11 px for badges, group labels and fact labels. The condensed face is
   kept for h2 and h3. */
.eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 8px;
  font: 700 var(--t-2)/1.2 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold);
}
.dek { max-width: 66ch; margin: 16px 0 0; font-size: var(--t1); line-height: 1.45; color: var(--text-2); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.actions form { margin: 0; }
.panel { margin: 0 0 24px; padding: 20px 24px 24px; background: var(--inset); border-top: 2px solid var(--rule); }
.panel > :last-child { margin-bottom: 0; }
.empty { color: var(--muted); }

/* ---- Buttons: SGH pills with the gold hover wipe ---- */
/* button covers the account pages' bare <button>; the content pages use .button. */
button, .button {
  position: relative; z-index: 0; overflow: hidden; isolation: isolate;
  display: inline-block; min-height: 44px; padding: 12px 24px 12px;
  font: 700 var(--t-1)/1.2 var(--display); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--panel); background: var(--text); /* 11:1 or more */
  border: 1px solid var(--text); border-radius: 999px;
  text-decoration: none; cursor: pointer;
  transition: color 0.5s, border-color 0.5s;
}
/* The wipe: a gold sheet twice the button's width, parked rotated out of view below the
   left corner, that swings level on hover. Same transform as www.sgh.com. */
button::before, .button::before {
  content: ""; position: absolute; left: 0; top: 0; z-index: -1;
  width: 200%; height: 100%;
  background: var(--gold);
  transform-origin: 0 bottom; transform: translate3d(-50%, 0, 0) rotate(-50deg);
  transition: transform 0.5s;
}
button:hover, .button:hover { color: #000; border-color: var(--gold); } /* black on gold, 8.7:1 */
button:hover::before, .button:hover::before { transform: rotate(0deg); }
button.secondary, .button.secondary { color: var(--text); background: transparent; border-color: var(--field-line); }
button.secondary:hover, .button.secondary:hover { color: #000; border-color: var(--gold); }
/* Destructive actions are the one use of SGH orange on a button. White on it is 4.6:1; the
   darker wipe (6.5:1 with white) replaces the gold one so the button never reads as "go". */
.button.forum-danger { color: #fff; background: var(--orange); border-color: var(--orange); }
.button.forum-danger::before { background: var(--danger-wipe); }
.button.forum-danger:hover { color: #fff; border-color: var(--danger-wipe); }
.button.secondary.forum-danger { color: var(--bad-text); background: transparent; }
.button.secondary.forum-danger:hover { color: #fff; }

/* Status and thread badges: a word in an outline, coloured as a second cue. */
.badge, .forum-badge, .tag {
  display: inline-block; padding: 1px 8px; white-space: nowrap;
  font: 700 var(--t-3)/1.6 var(--display); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2); border: 1px solid currentColor;
}
.badge.active { color: var(--ok); }
.badge.maintenance { color: var(--gold); }
.badge.closed { color: var(--muted); }
.forum-badge.is-new, .tag { color: var(--gold); }
/* Lifts a badge onto the midline of the thread title beside it. */
.forum-badge { vertical-align: 2px; }
.tag { margin-left: 8px; vertical-align: 2px; }

/* ---- Project overview and project pages ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(280px * var(--k)), 1fr)); gap: 16px; margin: 0 0 8px; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 20px 20px 24px;
  background: var(--raised); color: var(--text-strong);
  border-left: 3px solid var(--gold);
  text-decoration: none;
  clip-path: var(--cut-sm);
  transition: background 0.3s, color 0.3s;
}
.card b { font: 700 var(--t1)/1.2 var(--display); letter-spacing: 0.02em; text-transform: uppercase; overflow-wrap: break-word; }
.card .who { font-size: var(--t-2); color: var(--muted); }
.card .sum { font-size: var(--t-1); color: var(--text-2); }
/* Owner and status sit on the card's bottom edge, so they line up across a row whatever the summary length. */
.card .meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rule); }
/* SGH tile hover: gold fill with everything on it in black (8.7:1). */
.card:hover { background: var(--gold); }
.card:hover .meta { border-top-color: rgba(0, 0, 0, 0.4); }
.card:hover, .card:hover .who, .card:hover .sum, .card:hover .badge { color: #000; }
/* clip-path would cut an outer ring off, so the ring sits inside the edge. */
.card:focus-visible { outline: 2px solid var(--text-strong); outline-offset: -5px; }
/* A project page is a text column with a 320 px rail for facts, repository and links, so the
   description keeps a readable measure and the reference data stays in view beside it. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) calc(320px * var(--k)); gap: 48px; align-items: start; }
.split .prose p { max-width: 72ch; }
.rail h2 { display: block; margin: 0 0 8px; padding: 0; border: 0; background: none; font: 700 var(--t-3)/1.5 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rail > * + h2 { margin-top: 32px; }
.rail p, .rail ul { margin: 0; font-size: var(--t-1); }
.rail ul { padding-left: 20px; }
/* Label over value, under the same gold rule as the tables. */
.facts { margin: 0; border-top: 2px solid var(--gold); }
.facts dt { padding: 8px 0 0; font: 700 var(--t-3)/1.5 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; padding: 0 0 8px; border-bottom: 1px solid var(--rule); font-size: var(--t-1); color: var(--text); overflow-wrap: anywhere; }
/* One click selects the whole address, ready to copy; there is no script to do it. */
code.copy { display: block; padding: 8px 12px; font-size: var(--t-2); white-space: nowrap; overflow-x: auto; overflow-wrap: normal; -webkit-user-select: all; user-select: all; cursor: copy; }
/* A long web address breaks between characters so it stays inside the rail. */
.url { overflow-wrap: anywhere; }

/* ---- Forum ---- */
/* These classes come from the forum app's templates. */
.table-wrap { overflow-x: auto; margin: 12px 0 20px; border-top: 2px solid var(--gold); }
.forum-table { min-width: 560px; }
.forum-table td { padding: 12px; vertical-align: middle; }
.forum-table td:first-child { font-weight: 400; }
.num { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.forum-table .num { width: 7em; }
/* Number columns set their figures in the fixed-width face; their headings stay in the heading face. */
th.num { font-family: var(--display); }
td.num { font-size: var(--t-2); color: var(--text); }
/* Subtotal and total rows (build.py marks them): a firmer rule above and a raised ground. */
tr.total td { background: var(--raised); border-top: 1px solid var(--field-line); }
.forum-title { font-size: var(--t0); font-weight: 600; }
.forum-desc, .forum-meta { display: block; margin-top: 2px; font-size: var(--t-2); font-weight: 400; color: var(--muted); }
/* Pinned threads: a gold edge and the darker ground. */
.forum-table tr.is-sticky td { background: var(--inset); }
.forum-table tr.is-sticky td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
/* minmax(0, 1fr) lets the column shrink below a long code line, which then scrolls inside its own box. */
.forum-posts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 0 24px; }
.forum-post { margin: 0 0 12px; padding: 0 20px 16px; background: var(--inset); border-top: 2px solid var(--rule); scroll-margin-top: 16px; }
.forum-posts .forum-post { margin: 0; }
/* The post a link points at. */
.forum-post:target { border-top-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.forum-post-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0 -20px 16px; padding: 8px 20px; border-bottom: 1px solid var(--rule); }
.forum-post-head strong { font: 700 var(--t-1)/1.4 var(--display); letter-spacing: 0.02em; }
.forum-post-head .forum-meta { display: inline; margin: 0; }
/* Post text is BBCode rendered to plain tags: p, blockquote, pre, code, lists, links, strong, em. */
.forum-body, .forum-report-reason { max-width: 76ch; line-height: 1.65; overflow-wrap: anywhere; }
.forum-body blockquote { margin: 12px 0; padding: 8px 16px; background: var(--panel); border-left: 3px solid var(--comment); color: var(--text-2); }
.forum-body blockquote > :last-child { margin-bottom: 0; }
.forum-body cite { display: block; margin: 0 0 4px; font: 700 var(--t-2)/1.5 var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.forum-body pre { margin: 12px 0; padding: 12px 12px; overflow: auto; background: var(--ground); border: 1px solid var(--rule); }
.forum-body pre code { padding: 0; background: none; border: 0; color: var(--text); overflow-wrap: normal; }
.forum-body ul, .forum-body ol { margin: 8px 0; padding-left: 24px; }
/* In posts em is ordinary emphasis; the dashed "inferred" box belongs to the BOM. */
.forum-body em { padding: 0; font-style: italic; font-size: inherit; color: inherit; background: none; border: 0; }
.forum-removed { margin: 0; font-style: italic; color: var(--muted); }
.forum-reported { padding: 12px 12px; border: 1px dashed var(--rule); }
.forum-post-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: var(--t-2); }
.forum-post-actions form { margin: 0; }
.forum-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; font-size: var(--t-2); color: var(--muted); }
.forum-pages a { display: inline-flex; align-items: center; min-height: 36px; padding: 2px 16px; border: 1px solid var(--field-line); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; transition: border-color 0.3s; }
.forum-pages a:hover { border-color: var(--gold); }
/* Forms: SGH's bottom-rule fields on the page ground, as on the account pages. */
.forum-compose label, .forum-mod-actions label { display: block; margin: 16px 0 8px; font: 700 var(--t-2)/1.2 var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.panel input[type="text"], .panel textarea, .panel select {
  display: block; width: 100%; min-height: 44px; padding: 12px 12px;
  font: var(--t0)/1.4 var(--body); /* 16 px stops iOS zooming the page on focus */
  color: var(--text-strong); background: var(--ground);
  border: 1px solid var(--rule); border-bottom: 2px solid var(--field-line); border-radius: 0;
  transition: border-color 0.3s;
}
.panel textarea { min-height: 12em; resize: vertical; font: var(--t-1)/1.55 var(--mono); }
.panel input[type="text"]:focus, .panel textarea:focus, .panel select:focus { border-bottom-color: var(--gold); outline: 2px solid var(--focus); outline-offset: 2px; }
.forum-compose .actions { margin-top: 16px; }
/* Form errors: SGH orange edge, lightened text. */
.errorlist { margin: 8px 0 0; padding: 8px 12px; list-style: none; background: var(--bad-bg); border-left: 3px solid var(--orange); color: var(--bad-text); font-size: var(--t-1); }
.errorlist li { margin: 0; }
/* A notice asks for attention without being an error: gold edge on a gold-tinted ground. */
.forum-notice { margin: 0 0 16px; padding: 12px 16px; background: var(--notice-bg); border: 1px solid var(--gold); color: var(--text); }
.forum-help { margin-top: 20px; font-size: var(--t-1); }
.forum-help summary, .forum-mod summary { cursor: pointer; font-weight: 600; }
.forum-help summary { color: var(--link); }
summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.forum-help dl { margin: 8px 0 0; }
.forum-help dt { margin-top: 8px; font: var(--t-2)/1.5 var(--mono); color: var(--text); overflow-wrap: anywhere; }
.forum-help dd { margin: 0 0 0 12px; color: var(--muted); }
.forum-mod-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.forum-mod-actions form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0; }
.forum-mod-actions label { margin: 0; }
.forum-mod select { width: auto; margin-top: 4px; }
.fine a { color: var(--muted); }

/* ---- Comments (every content page) ---- */
/* The server inserts this section at the end of the page card. Its markup is fixed by the server's
   template. A gold rule and a wide gap set it apart from the page above, which can be a long table. */
.jump { float: right; margin: 0 0 8px 16px; font-size: var(--t-2); }
.jump .ic { margin-right: 4px; }
.comments { clear: both; max-width: calc(840px * var(--k)); margin-top: 64px; padding-top: 32px; border-top: 2px solid var(--gold); scroll-margin-top: 16px; }
.comments h2 { margin-bottom: 16px; }
/* The count reads as a figure beside the heading. */
.comments .count { margin-left: 4px; padding: 0 8px; font: var(--t-2)/1.6 var(--mono); color: var(--muted); border: 1px solid var(--rule); vertical-align: 3px; }
/* One entry per comment, set like a log: who and when on one line, the Delete control at its end, text below. */
.comment { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; margin: 0 0 8px; padding: 8px 16px 12px; background: var(--inset); border-left: 3px solid var(--rule); scroll-margin-top: 16px; }
.comment:target { border-left-color: var(--gold); }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 4px 0; }
.comment-author { font: 700 var(--t-1)/1.4 var(--display); letter-spacing: 0.02em; }
.comment-head time { font: var(--t-2)/1.4 var(--mono); color: var(--muted); }
.comment-actions { grid-column: 2; grid-row: 1; margin: 0; }
.comment-body { grid-column: 1 / -1; max-width: 76ch; overflow-wrap: anywhere; }
.comment-body p { margin: 4px 0 0; }
.comments-empty { margin: 0 0 8px; padding: 12px 16px; background: var(--inset); border-left: 3px solid var(--rule); color: var(--muted); }
.comment-form { margin-top: 24px; }
.comment-form label { display: block; margin: 0 0 8px; font: 700 var(--t-2)/1.2 var(--display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.comment-form textarea {
  display: block; width: 100%; min-height: 8em; padding: 12px; resize: vertical;
  font: var(--t0)/1.5 var(--body); /* 16 px stops iOS zooming the page on focus */
  color: var(--text-strong); background: var(--ground);
  border: 1px solid var(--rule); border-bottom: 2px solid var(--field-line); border-radius: 0;
  transition: border-color 0.3s;
}
.comment-form textarea:focus { border-bottom-color: var(--gold); outline: 2px solid var(--focus); outline-offset: 2px; }
.comment-help { margin: 8px 0 16px; font-size: var(--t-2); color: var(--muted); }
/* A compact button for a control that sits inside a line of text, such as Delete on a comment. */
.button.small { min-height: 28px; padding: 4px 12px; font-size: var(--t-3); letter-spacing: 0.06em; }

/* ---- Icons ---- */
/* Inline SVG from build.py: 16 px grid, square-ended 1.5 px stroke, drawn in the text colour. */
.ic { flex: none; width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; vertical-align: -0.2em; }
.nav .ic { color: var(--muted); transition: color 0.3s; }
.nav a:hover .ic, .nav a[aria-current] .ic { color: var(--gold); }
.card .head { display: flex; align-items: flex-start; gap: 12px; }
.card .head .ic { width: 20px; height: 20px; margin-top: 1px; color: var(--gold); }
.card:hover .head .ic { color: #000; }
.badge .ic, .forum-badge .ic { width: 10px; height: 10px; margin-right: 4px; stroke-width: 2; vertical-align: -1px; }
.button .ic { margin-right: 8px; }
.eyebrow > .ic { width: 16px; height: 16px; }
/* .actions is also used as a paragraph under a page title (the budget's download link). */
p.actions { margin: 0 0 24px; }

/* ---- Naming page (/brand/) ---- */
h3 { margin: 0 0 12px; font: 700 var(--t2)/1.2 var(--condensed); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-strong); }
.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(300px * var(--k)), 1fr)); gap: 16px; margin: 16px 0 8px; }
.bcard { padding: 20px 20px 28px; background: var(--inset); border-top: 2px solid var(--rule); clip-path: var(--cut-sm); }
.bcard.pick { border-top-color: var(--gold); }
.bcard p { margin: 0 0 8px; font-size: var(--t-1); color: var(--text-2); }
/* The specimen area: each name shown at size on the page ground. */
.stage {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 24px;
  min-height: 110px; margin-bottom: 16px; padding: 24px 20px;
  background: var(--ground); border: 1px solid var(--rule);
}
/* Logo and name side by side. SGH's rule is clear space equal to the width of the gold
   slash, about 7.5% of the logo width (6 px here); the 16 px gap is more than twice that.
   88 px is also above the 0.375 in (36 px) minimum width. */
.lockup { display: flex; align-items: center; }
.lockup svg { flex: none; width: 88px; height: auto; margin-right: 16px; color: var(--text-strong); }
.lockup span {
  padding: 8px 0 8px 16px; border-left: 1px solid var(--tan);
  font: 700 var(--t1)/1.15 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text);
}
/* How the name reads in use: a small label over the example. */
.bcard .use { margin-bottom: 12px; font-size: var(--t-1); color: var(--text); }
.use span { display: block; font: 700 var(--t-3)/1.6 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
/* The notes table is prose in every column, so it drops the BOM's fixed-width columns. */
.notes td:nth-child(3), .notes td:nth-child(4) { font-family: var(--body); font-size: var(--t-1); color: var(--text-2); }
.notes td:first-child { font-family: var(--mono); font-weight: 400; color: var(--muted); }
.notes td:nth-child(2) { min-width: 14em; font-weight: 600; color: var(--text-strong); }
.notes td:nth-child(3) { min-width: 22em; }
.notes td:nth-child(4) { min-width: 12em; }

/* The footer sits at the bottom of the column on short pages and lines up with the card's text edge. */
.fine { width: 100%; max-width: var(--page); margin: auto auto 24px; padding: 0 40px; font-size: var(--t-2); color: var(--muted); }

/* ==== Account pages and the landing page ====
   The account templates are shared with another site and their markup is fixed: a .masthead bar,
   then body > main holding one .window card. The landing page uses the same frame. These rules are
   scoped to that frame because the content pages style h1, main, label and input differently. */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 0 24px;
  background: var(--inset);
  border-bottom: 1px solid var(--rule);
}
.masthead a { display: inline-flex; padding: 8px 0; color: var(--text-strong); text-decoration: none; }
.masthead .wm { font-size: clamp(15px, 0.4vw + 9px, 24px); }
.masthead > span {
  font: 700 var(--t-2)/1.2 var(--display); letter-spacing: 0.04em;
  color: var(--muted); white-space: nowrap;
}

body > main { display: flex; justify-content: center; padding: 48px 16px 32px; }

/* The card: square, with the SGH cut bottom-right corner. */
.window { width: 100%; max-width: calc(520px * var(--k)); background: var(--panel); clip-path: var(--cut); }
/* The title strip and the status strip belong to another site's window look. They repeat the
   heading and the host name, and the content pages have nothing like them, so they are hidden. */
.titlebar, .statusbar { display: none; }
.workspace { padding: 40px 32px 48px; }
.window h1 { margin: 0 0 16px; font-size: var(--t3); }
.window h1::after { margin-top: 12px; }
.intro { margin: 0 0 24px; font-size: var(--t0); line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.window .actions { margin-top: 0; }

/* Fields: SGH's bottom-rule inputs on the inset. */
.field { margin: 20px 0; }
.window label {
  display: block; margin: 0 0 8px;
  font: 700 var(--t-2)/1.2 var(--display); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-2);
}
.window input:not([type="hidden"]) {
  display: block; width: 100%; min-height: 44px; /* 44 px: a comfortable touch target */
  padding: 12px 12px;
  font: var(--t0)/1.3 var(--body); /* 16 px stops iOS zooming the page on focus */
  color: var(--text-strong); background: var(--inset);
  border: 1px solid var(--rule); border-bottom: 2px solid var(--field-line);
  border-radius: 0;
  transition: border-color 0.3s;
}
.window input:not([type="hidden"]):hover { border-bottom-color: var(--text-2); }
/* Gold bottom rule plus the focus ring, so focus shows in two ways. */
.window input:not([type="hidden"]):focus { border-bottom-color: var(--gold); outline: 2px solid var(--focus); outline-offset: 2px; }
.help { margin-top: 8px; font-size: var(--t-2); line-height: 1.5; color: var(--muted); }

.links {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 28px; padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: var(--t-1);
}
/* Taller link boxes: easier to hit on a phone without changing the look. */
.links a { padding: 4px 0; }
/* A form in the link row (the navigator's Log out) sits at the far end of the row. */
.links { align-items: center; }
.links form { margin: 0 0 0 auto; }

/* The account pages' error box is a bulleted list above the fields. */
.window .errorlist {
  margin: 0 0 20px; padding: 12px 16px 12px 32px; list-style: disc;
  line-height: 1.45;
}
.window .errorlist li::marker { color: inherit; }

.page-footer { padding: 0 20px 32px; text-align: center; font-size: var(--t-2); color: var(--muted); }

/* ==== Section navigator (landing page, signed in) ====
   A grid of section tiles. Each tile carries data-theme with its section's palette, so it shows
   that section's card colour, links and accent without a rule per section. */
/* Wider than the 1180 px laptop card so four tiles sit in one row; auto-fit stretches the tiles
   across the row on a wide screen instead of leaving empty columns. */
.hub { width: 100%; max-width: calc(1400px * var(--k)); }
.hub > header { margin: 0 0 32px; }
.hub .dek { margin-top: 0; }
.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(260px * var(--k)), 1fr)); gap: 16px;
  margin: 0; padding: 0; list-style: none;
}
.tiles > li { display: flex; margin: 0; }
.tile {
  display: flex; flex-direction: column; gap: 12px; width: 100%;
  min-height: calc(240px * var(--k)); padding: 24px 24px 28px;
  background: var(--panel); color: var(--text);
  border-top: 4px solid var(--accent);
  text-decoration: none;
  clip-path: var(--cut-sm);
  transition: background 0.3s, color 0.3s;
}
/* The mark row is the same height on every tile, with or without a two-row wordmark. */
.tile-mark { display: flex; align-items: flex-end; min-height: calc(2.14em + 4px); font-size: calc(26px * var(--k)); }
.tile-mark .wm { font-size: inherit; }
/* A section without its own block wordmark shows the app-icon block: six squares on the wordmark's
   grid, three light over three in the section's accent (the labs icon is light over gold). */
.pmark { display: inline-grid; grid-template-columns: repeat(3, 0.7em); gap: 0.16em; }
.pmark i { display: block; height: 0.7em; background: var(--text); }
.pmark i:nth-child(n+4) { background: var(--accent); }
.tile-name { font: 700 var(--t1)/1.2 var(--display); letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-strong); }
.tile-desc { font-size: var(--t-1); line-height: 1.5; color: var(--text-2); }
.tile-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--rule);
}
.tile-path { font: var(--t-2)/1.4 var(--mono); color: var(--accent); }
/* SGH tile hover in the section's accent: the accent fills the tile and everything on it is black. */
a.tile:hover { background: var(--accent); }
a.tile:hover, a.tile:hover .tile-name, a.tile:hover .tile-desc, a.tile:hover .tile-path,
a.tile:hover .wm, a.tile:hover .wm .lo, a.tile:hover .badge { color: #000; }
a.tile:hover .pmark i { background: #000; }
a.tile:hover .tile-foot { border-top-color: rgba(0, 0, 0, 0.4); }
a.tile:focus-visible { outline: 2px solid var(--text-strong); outline-offset: -6px; }
/* A section that is not open yet: no link, no hover, the accent bar dimmed. */
.tile.is-soon { border-top-style: dashed; }
.tile.is-soon .tile-mark, .tile.is-soon .tile-name { opacity: 0.75; }
.hub .links { margin-top: 32px; }

@media (max-width: 860px) {
  .tile { min-height: 0; }
}

/* Narrow screens: the sidebar becomes a top bar, and the links move into a "Menu" disclosure
   (a <details>, so it opens without JavaScript). */
@media (max-width: 860px) {
  .shell { display: block; }
  .side {
    position: relative; height: auto; overflow: visible;
    display: flex; flex-wrap: wrap; align-items: center;
    padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--rule);
  }
  .side .mark { margin: 0; }
  .side .wm { font-size: 15px; }
  .nav-d { display: none; }
  .nav-m { display: block; flex-basis: 100%; }
  .nav-m summary {
    position: absolute; top: 12px; right: 16px;
    min-height: 36px; padding: 8px 20px 8px;
    font: 700 var(--t-2)/1.3 var(--display); letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text); border: 1px solid var(--field-line); border-radius: 999px;
    list-style: none; cursor: pointer;
  }
  .nav-m summary::-webkit-details-marker { display: none; }
  .nav-m[open] summary { color: var(--gold); border-color: var(--gold); }
  .nav-m .nav { margin: 8px -16px 0; padding: 8px 0 4px; border-top: 1px solid var(--rule); }
  .nav a { padding-top: 12px; padding-bottom: 12px; } /* 44 px rows for thumbs */
  .col { padding: 0 16px; min-height: 0; } /* a tablet keeps a margin beside the card */
}

/* Below 1280 px the sidebar leaves too little room for a text column beside the rail. */
@media (max-width: 1279px) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

@media (max-width: 640px) {
  .col { padding: 0; }
  .pg { width: auto; margin: 16px 8px; padding: 24px 20px 40px; }
  .fine { padding: 0 28px; }
  h1 { font-size: var(--t3); }
  h2 { font-size: var(--t2); padding: 8px 12px 8px 9px; }
  .sec { margin-top: 32px; }
  .sec-body { padding: 12px 12px 16px; }
  .sec-body > h3 { margin-top: 24px; }
  /* Tables that are mostly numbers (build.py marks them "stack") become one block per row: the first
     cell is the row's title and each value sits beside its column heading, so nothing scrolls sideways. */
  .stack table { min-width: 0; }
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  .stack td { display: flex; justify-content: space-between; gap: 16px; padding: 4px 12px; border: 0; text-align: right; }
  .stack td::before { content: attr(data-label); flex: none; font: 700 var(--t-3)/1.9 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  .stack td:first-child:not(.num) { display: block; text-align: left; font-size: var(--t0); }
  .stack td:first-child:not(.num)::before { content: none; }
  .stack tr.total { background: var(--raised); border-top: 1px solid var(--field-line); }
  .stack tr.total td { background: none; border: 0; }
  .stack td:empty { display: none; } /* a total row has no number, quantity or unit price */
  .panel { padding: 16px 16px 20px; }
  .forum-post { padding: 0 16px 16px; }
  .forum-post-head { margin: 0 -16px 12px; padding: 8px 16px; }
  .forum-table .num { width: auto; }
}

/* The account pages' phone layout (labs-auth.css used 540 px). */
@media (max-width: 540px) {
  body > main { padding: 24px 8px 24px; }
  .masthead { padding: 0 16px; }
  .workspace { padding: 24px 20px 28px; }
  .window h1 { font-size: var(--t2); }
  .tile { padding: 20px 20px 24px; }
  /* The hub's heading and links sit on the page ground, so they keep a margin from the screen edge. */
  .hub > header, .hub > .links { margin-left: 12px; margin-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Print: dark on white, no fills, and the whole table on paper instead of in a scroller. */
@media print {
  :root { color-scheme: light; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .side, .skip, .fine, .jump, .comment-form, .comment-actions, .actions, .forum-post-actions, .forum-pages, .forum-help, .forum-mod, .breadcrumbs { display: none; }
  .shell, .col, .split { display: block; }
  .col { padding: 0; min-height: 0; }
  .pg { width: auto; }
  .pg { max-width: none; margin: 0; padding: 0; background: none; clip-path: none; }
  h1, h2, strong, td, td:first-child, td:nth-child(3), td:nth-child(4), th, code, a { color: #000; }
  h1::after { background: #000; }
  h2 { background: none; border-left-color: #000; break-after: avoid; }
  h2 .no { color: #000; }
  .sec { border-color: #999; }
  .toc { display: none; }
  .sec-body > h3 { border-top-color: #999; break-after: avoid; }
  a { text-decoration-color: #000; }
  code { background: none; border-color: #999; }
  em { color: #000; background: none; border-color: #000; }
  li::marker { color: #000; }
  .table { overflow: visible; border-top-color: #000; }
  table { min-width: 0; font-size: 9pt; }
  th { background: none; border-bottom: 1px solid #000; white-space: normal; }
  td { border-bottom-color: #999; }
  td:nth-child(2) { min-width: 0; }
  tr { break-inside: avoid; }
  .pg > p, .pg > ul, .sec-body > p, .sec-body > ul { max-width: none; }
  h3, .wm, .wm .lo, .use, .use span, .lockup span, .lockup svg, .bcard p, .tag { color: #000; }
  .bcard, .stage { background: none; clip-path: none; border-color: #999; }
  .bcard { break-inside: avoid; }
  .tag, .lockup span { border-color: #000; }
  .card { background: none; color: #000; border: 1px solid #000; clip-path: none; break-inside: avoid; }
  .card .who, .card .sum, .badge, .forum-badge, .eyebrow, .dek, .facts dt, .facts dd, .forum-meta, .forum-desc, .forum-body blockquote, .forum-body cite { color: #000; }
  .facts, .table-wrap { border-top-color: #000; }
  .table-wrap { overflow: visible; }
  .forum-post, .panel, .forum-body blockquote, .forum-body pre, .forum-table tr.is-sticky td { background: none; }
  .forum-post { border: 1px solid #999; break-inside: avoid; }
  .comments { border-top-color: #000; }
  .comment, .comments-empty { background: none; border-left-color: #999; break-inside: avoid; }
  .comment-head time, .comments .count, .comments-empty { color: #000; }
  /* Account pages and the landing page. */
  .masthead, .page-footer { display: none; }
  body > main { padding: 0; }
  .window { max-width: none; background: none; clip-path: none; }
  .workspace { padding: 12pt 0; }
  .intro, .window label, .help { color: #000; }
  .links { border-color: #000; }
  .window input:not([type="hidden"]) { background: none; color: #000; border-color: #000; }
  .window button, .window .button { background: none; color: #000; border-color: #000; }
  .window button::before, .window .button::before { display: none; }
  .window .errorlist { background: none; color: #000; border-left-color: #000; }
  /* Section tiles: outlined, black text, no fills. */
  .tile { background: none; color: #000; border: 1px solid #000; clip-path: none; break-inside: avoid; }
  .tile-name, .tile-desc, .tile-path { color: #000; }
  .pmark i, .pmark i:nth-child(n+4) { background: none; border: 1px solid #000; }
}
