:root {
  --paper: #fbfaf7;
  --surface: #f4f2ed;
  --surface-blue: #edf1f4;
  --ink: #181817;
  --muted-strong: #4a4945;
  --muted: #6f6c66;
  --faint: #969189;
  --line: #d9d5cd;
  --line-strong: #aaa49a;
  --blue: #35567a;
  --blue-dark: #203e61;
  --mark: #f2e4a8;
  --good: #416b50;
  --warn: #8b651f;
  --bad: #8a3f3f;
  --shadow: rgb(28 25 20 / 14%);
  --shadow-soft: rgb(28 25 20 / 8%);
  --serif: Georgia, "Times New Roman", serif;
  --display: "Palatino Linotype", Palatino, "Book Antiqua", "P052", Georgia, serif;
  --ui: var(--serif);
  --sans: "Avenir Next", Avenir, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  /* Shared reading and interface scale. Dense plot labels remain local. */
  --text-body: 1rem;
  --text-ui: .875rem;
  --text-meta: .75rem;
  --control-size: 2.25rem;
  --page: 72rem;
  --measure: 43rem;
  --gutter: clamp(1rem, 4vw, 2.75rem);
  --site-frame-page: 74rem;
  --site-frame-gutter: max(2.5rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --site-frame-width: min(var(--site-frame-page), calc(100% - 2 * var(--site-frame-gutter)));
  --site-frame-top: max(1.5rem, env(safe-area-inset-top, 0px));
  --site-utility-clearance: calc(2 * var(--utility-size, 2.75rem) + var(--utility-gap, .375rem) + 1rem);
  --section-space: clamp(2rem, 5vw, 4rem);
  --tone-blue: #35567a;
  --tone-plum: #775466;
  --tone-teal: #3d6e6b;
  --tone-ochre: #836228;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #131412;
  --surface: #1b1c19;
  --surface-blue: #1c2730;
  --ink: #eeeae1;
  --muted-strong: #c7c1b7;
  --muted: #aaa49a;
  --faint: #817d76;
  --line: #32332f;
  --line-strong: #55564f;
  --blue: #98b9dc;
  --blue-dark: #c0d5ec;
  --mark: #594b20;
  --good: #88b797;
  --warn: #d4b46a;
  --bad: #d89393;
  --shadow: rgb(0 0 0 / 48%);
  --shadow-soft: rgb(0 0 0 / 30%);
  --tone-blue: #98b9dc;
  --tone-plum: #c2a6b8;
  --tone-teal: #9cc3bb;
  --tone-ochre: #d2b77c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body { min-width: 320px; margin: 0; background: var(--paper); color: var(--ink); font: var(--text-body)/1.62 var(--serif); font-kerning: normal; text-rendering: optimizeLegibility; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--ink); }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; }
h1 { font-size: clamp(1.65rem, 3vw, 2rem); line-height: 1.1; }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.62rem); line-height: 1.16; }
h3 { font-size: 1.05rem; line-height: 1.25; }
code, kbd, pre, samp { font-family: var(--mono); }
code { font-size: .86em; }
kbd { padding: .08em .32em; border: 1px solid var(--line-strong); background: var(--surface); font-size: .78em; }
mark { padding-inline: .08em; background: var(--mark); color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 0; left: 1rem; transform: translateY(-150%); z-index: 1000; padding: .35rem .55rem; border: 1px solid var(--ink); background: var(--paper); font: var(--text-ui)/1.4 var(--ui, var(--serif)); }
.skip-link:focus { top: .75rem; transform: none; }

/* One document-top frame, independent of each application's content measure.
   Utilities stay in authored markup and scroll with the masthead. Their reserved
   lane prevents title/navigation wrapping from changing cross-page coordinates. */
.site-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; width: var(--site-frame-width); min-height: calc(var(--site-frame-top) + var(--utility-size, 2.75rem) + 1rem + 1px); margin: 0 auto; padding: var(--site-frame-top) var(--site-utility-clearance) 1rem 0; border-bottom: 1px solid var(--line); }
.site-header .site-utility-pair { position: absolute; top: var(--site-frame-top); right: 0; margin: 0; }
.site-header nav { position: static; min-height: var(--utility-size, 2.75rem); }
.site-header > .site-title { display: flex; align-items: center; min-height: var(--utility-size, 2.75rem); }
.site-title { color: var(--ink); font: 600 1.12rem/1.2 var(--display); font-variant: small-caps; letter-spacing: .025em; text-decoration: none; }
.site-header nav, .site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .85rem; font: var(--text-ui)/1.4 var(--ui, var(--serif)); }
.site-header nav a:not(.site-home), .site-nav a:not(.site-home) { color: var(--muted); }
.site-header nav a:not(.site-home):hover, .site-nav a:not(.site-home):hover, .site-header nav a:not(.site-home)[aria-current], .site-nav a:not(.site-home)[aria-current] { color: var(--blue-dark); }
/* Optional page identity: one subject mark; global return stays with header utilities. */
[data-site-tone] { --site-accent: var(--tone-blue); --site-accent-soft: color-mix(in srgb, var(--site-accent) 12%, var(--paper)); }
[data-site-tone="plum"] { --site-accent: var(--tone-plum); }
[data-site-tone="teal"] { --site-accent: var(--tone-teal); }
[data-site-tone="ochre"] { --site-accent: var(--tone-ochre); }
.site-header.site-header--identity { align-items: center; flex-flow: row wrap; gap: .8rem 1.5rem; }
.site-brand { display: flex; align-items: center; gap: .7rem; min-width: 0; min-height: var(--utility-size, 2.75rem); max-width: 100%; }
.site-mark { display: block; flex: none; width: 2rem; height: 2rem; object-fit: contain; }
:root[data-theme="dark"] .site-mark,
:root[data-theme="dark"] .site-divider > img { filter: invert(1); }
.site-header--identity .site-title { min-width: 0; margin: 0; font: 700 clamp(1.4rem, 2vw, 1.7rem)/1.18 var(--display); letter-spacing: -.015em; font-variant: normal; overflow-wrap: anywhere; }
.site-header.site-header--identity nav { width: auto; margin-left: auto; gap: .6rem 1rem; }
.site-header--identity nav a { text-decoration-color: transparent; }
.site-header--identity nav a:hover, .site-header--identity nav a[aria-current] { text-decoration-color: currentColor; }
.page-shell { width: min(var(--page), calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.prose { max-width: var(--measure); }
.prose p, .prose li { text-wrap: pretty; }
.prose p { margin: .7rem 0 1.1rem; }

.eyebrow, .section-kicker { margin: 0 0 .22rem; color: var(--muted); font: 600 var(--text-ui)/1.4 var(--ui, var(--serif)); font-variant: small-caps; letter-spacing: .065em; text-transform: lowercase; }
.data-label, .control-label { margin: 0 0 .22rem; color: var(--muted); font: 500 var(--text-ui)/1.4 var(--ui, var(--serif)); }
.lede { max-width: var(--measure); color: var(--muted-strong); font-size: 1.05rem; line-height: 1.6; }
.site-divider { display: grid; grid-template-columns: minmax(2rem, 1fr) auto minmax(2rem, 1fr); gap: clamp(.85rem, 2vw, 1.35rem); align-items: center; width: min(54rem, calc(100% - 2rem)); margin: clamp(2.4rem, 5vw, 4rem) auto; color: var(--line-strong); }
.site-divider::before, .site-divider::after { height: 1px; background: var(--line); content: ""; }
.site-divider > span { display: grid; min-width: 1.1rem; place-items: center; }
.site-divider > span::before { color: var(--muted); content: "✦"; font: 1.05rem/1 var(--display); }
.site-divider[data-ornament="asterism"] > span::before { content: "⁂"; font-size: .95rem; letter-spacing: .08em; }
.site-divider[data-ornament="diamond"] > span::before { content: "◆"; font-size: .62rem; }
.site-divider[data-ornament="helix"] > span::before { content: "⋈"; font-size: 1.12rem; }
.site-divider[data-ornament="folio"] > span::before { content: "§"; font-size: 1rem; }
.site-divider[data-ornament="constellation"] > span::before { content: "✣"; font-size: 1rem; }
.site-divider--wide { width: 100%; }

.section-index { position: sticky; top: 0; z-index: 40; display: flex; gap: .45rem 1.1rem; overflow-x: auto; padding: .65rem 0; border-bottom: 1px solid var(--line); background: var(--paper); font: 500 var(--text-ui)/1.4 var(--ui, var(--serif)); scrollbar-width: thin; }
.section-index a { flex: none; color: var(--muted); text-decoration-color: transparent; }
.section-index a:hover, .section-index a[aria-current] { color: var(--ink); text-decoration-color: currentColor; }
.section-block { scroll-margin-top: 3rem; padding: var(--section-space) 0; }
.section-block + .section-block { border-top: 1px solid var(--line-strong); }
.section-block:target { border-top-color: transparent; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.2rem; }
.section-heading h1, .section-heading h2, .section-heading h3 { margin: 0; font-weight: 700; }
.section-note, .result-status, .quiet { color: var(--muted); font-size: var(--text-ui); }

.data-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin: 0; border-block: 1px solid var(--line-strong); }
.data-strip > div { padding: .72rem .85rem; border-left: 1px solid var(--line); }
.data-strip > div:first-child { border-left: 0; }
.data-strip dt { color: var(--muted); font: 500 var(--text-ui)/1.4 var(--ui, var(--serif)); }
.data-strip dd { margin: .15rem 0 0; font: 600 1.05rem/1.25 var(--mono); }

button, input, select, textarea { border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper); }
button, select { min-height: var(--control-size); padding: .3rem .55rem; }
/* Styled native fallback; opt-in component enhancement also controls the menu. */
select { padding: .3125rem .5625rem; font: var(--text-ui)/1.4 var(--ui, var(--serif)); }
input, textarea { padding: .4rem .55rem; }
button { font-family: var(--ui, var(--serif)); font-size: var(--text-ui); }
button:hover:not(:disabled) { border-color: var(--ink); background: var(--surface); }
button[aria-pressed="true"] { border-color: var(--blue); background: var(--surface-blue); color: var(--blue-dark); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
/* Header utilities share one geometry, ink weight and interaction grammar.
   The compass, dial and slash are quiet punctuation inside equal hit targets. */
:root { --utility-size: 2.75rem; --utility-icon-size: 1.6rem; --utility-gap: .375rem; }
.site-utility-pair { display: inline-flex; align-items: center; flex: none; gap: var(--utility-gap, .375rem); }
.site-utilities { display: flex; justify-content: flex-end; width: var(--site-frame-width); margin: 0 auto; padding: var(--site-frame-top) 0 1rem; }
a.site-home,
[data-theme-toggle].theme-toggle,
button.site-search {
  position: relative;
  display: inline-grid;
  place-items: center;
  justify-content: center;
  flex: none;
  width: var(--utility-size, 2.75rem);
  height: var(--utility-size, 2.75rem);
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-strong);
  opacity: 1;
  font-size: 0;
  line-height: 0;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  transition: color .15s ease, border-color .15s ease;
}
/* Subpage headers have empty or text fallback labels. Keep every mask in one
   full-height track; zero-height fallback tracks cannot shift its visual center.
   The homepage utilities live outside a header and keep their approved layout. */
header a.site-home,
header [data-theme-toggle].theme-toggle {
  grid-template-rows: minmax(0, 1fr);
  grid-auto-rows: 0;
}
.site-utility-pair .theme-toggle { margin-left: 0; }
a.site-home > span, button.site-search > span { font-size: 0; }
a.site-home::before,
[data-theme-toggle].theme-toggle::before,
button.site-search::before {
  content: "";
  grid-area: 1 / 1;
  width: var(--utility-icon-size, 1.6rem);
  height: var(--utility-icon-size, 1.6rem);
  background: currentColor;
  -webkit-mask: url("icons/theme-dial-dark.svg") center / contain no-repeat;
  mask: url("icons/theme-dial-dark.svg") center / contain no-repeat;
}
a.site-home::before {
  -webkit-mask-image: url("icons/home-compass.svg");
  mask-image: url("icons/home-compass.svg");
}
button.site-search::before {
  -webkit-mask-image: url("icons/search-slash.svg");
  mask-image: url("icons/search-slash.svg");
}
[data-theme-toggle][data-theme-target="light"].theme-toggle::before {
  -webkit-mask-image: url("icons/theme-dial-light.svg");
  mask-image: url("icons/theme-dial-light.svg");
}
[data-theme-toggle].theme-toggle[aria-pressed="true"] { border-color: transparent; background: transparent; color: var(--muted-strong); }
a.site-home:hover,
[data-theme-toggle].theme-toggle:hover:not(:disabled),
button.site-search:hover:not(:disabled),
button.site-search[aria-expanded="true"] {
  border-color: transparent;
  border-bottom-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}
a.site-home:active,
[data-theme-toggle].theme-toggle:active:not(:disabled),
button.site-search:active:not(:disabled) { color: var(--muted); }
a.site-home:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[data-theme-toggle].theme-toggle--floating { position: fixed; top: .75rem; right: 1rem; z-index: 100; background: var(--paper); }
[data-theme-toggle].theme-toggle--floating:hover:not(:disabled),
[data-theme-toggle].theme-toggle--floating[aria-pressed="true"] { background: var(--paper); }
@media (forced-colors: active) {
  a.site-home::before { background: LinkText; forced-color-adjust: none; }
  [data-theme-toggle].theme-toggle::before,
  button.site-search::before { background: ButtonText; forced-color-adjust: none; }
}

details { border-top: 1px solid var(--line); }
summary { padding: .55rem 0; color: var(--ink); cursor: pointer; font-size: var(--text-ui); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .48rem .58rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted-strong); font: 600 var(--text-ui)/1.4 var(--ui, var(--serif)); }
.table-scroll { overflow: auto; border-bottom: 1px solid var(--line-strong); }
.table-scroll th { position: sticky; top: 0; z-index: 2; background: var(--paper); }
.site-footer { width: min(var(--page), calc(100% - 2 * var(--gutter))); margin-inline: auto; padding: 1.2rem 0 2rem; color: var(--muted); font: var(--text-meta)/1.5 var(--ui, var(--serif)); }

@media (max-width: 60rem) {
  :root { --site-frame-page: 48rem; --site-frame-gutter: max(1.5rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }
}
@media (max-width: 38rem) {
  :root { --site-frame-gutter: max(1rem, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); --site-frame-top: max(.75rem, env(safe-area-inset-top, 0px)); }
}
@media (max-width: 42rem) {
  :root { --gutter: .85rem; --section-space: 2.1rem; }
  /* Match the identity selectors so their desktop row/wrap rules cannot win.
     Give mobile an intentional title row and a compact, full-width control row. */
  .site-header, .site-header.site-header--identity { align-items: stretch; flex-flow: column nowrap; gap: .375rem; }
  .site-header, .site-header.site-header--identity { padding-inline-end: 0; padding-bottom: .5rem; }
  .site-header > .site-brand, .site-header > .site-title { padding-inline-end: var(--site-utility-clearance); }
  .site-header nav { min-height: 0; }
  .site-header nav:has(> .site-utility-pair:only-child) { height: 0; }
  .site-header nav, .site-header.site-header--identity nav { width: 100%; margin-left: 0; flex-wrap: wrap; justify-content: flex-start; gap: .25rem .7rem; }
  .site-header nav > a:not(.site-home) { display: inline-flex; align-items: center; min-width: 2.75rem; min-height: 2.75rem; }
  .site-header nav > .site-utility-pair { margin: 0; }
  .site-header nav .site-utility-pair .theme-toggle { margin-left: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: .5rem; }
  .data-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-strip > div:nth-child(odd) { border-left: 0; }
}

/* Scope touch sizing to ordinary navigation, never the already-44px utility grid.
   Switching Home alone to flex shifts its mask relative to the theme dial. */
@media (pointer: coarse) {
  :root { --control-size: 2.75rem; }
  .site-header nav a:not(.site-home), .site-nav a:not(.site-home), .section-index a { display: inline-flex; align-items: center; min-height: 2.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.site-home, button.site-search,
  [data-theme-toggle].theme-toggle,
  [data-theme-toggle].theme-toggle::before { transition: none; }
}
@media print {
  :root[data-theme="dark"] .site-mark,
  :root[data-theme="dark"] .site-divider > img { filter: none; }
  :root, :root[data-theme="dark"] {
    --paper: #fff; --surface: #fff; --surface-blue: #f1f1f1;
    --ink: #000; --muted-strong: #333; --muted: #444; --faint: #555;
    --line: #bbb; --line-strong: #777; --blue: #000; --blue-dark: #000;
    --tone-blue: #333; --tone-plum: #333; --tone-teal: #333; --tone-ochre: #333;
    color-scheme: light !important;
  }
  body { background: #fff !important; color: #000 !important; }
  .site-home, .site-utility-pair, .site-utilities, .theme-toggle, .section-index, .site-divider { display: none !important; }
  a { color: inherit; }
}
