/* The wiki theme: a reference-wiki look in the spirit of the wikidot / MediaWiki pages the utilities data came from. Near-white page, sans-serif UI,
 * dense tables, infobox cards, obvious links, light and dark. Shared by every utilities section and, by default, the inventory (docs/spec/02 §4). */

:root {
  /* the contract every theme defines (shared/css/chrome.css) */
  --bg: #f8f9fa; --bg-alt: #ffffff; --text: #202122; --text-muted: #54595d; --accent: #0645ad; --accent-contrast: #ffffff;
  --border: #c8ccd1; --card-bg: #ffffff; --link: #0645ad;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Linux Libertine", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 3px; --max-width: 74rem;
  /* this theme's own */
  --visited: #5a3696; --stripe: #f1f3f5; --head-bg: #eaecf0; --infobox: #f8f9fa; --mark: #fef6c8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101418; --bg-alt: #161b21; --text: #e6e8eb; --text-muted: #a2a9b1; --accent: #7aa7e0; --accent-contrast: #0d1117;
    --border: #3a4350; --card-bg: #161b21; --link: #8ab4ee; --visited: #b79ae6; --stripe: #1a2027; --head-bg: #222a33; --infobox: #1b2129; --mark: #4a4217;
  }
}
:root[data-theme="dark"] {
  --bg: #101418; --bg-alt: #161b21; --text: #e6e8eb; --text-muted: #a2a9b1; --accent: #7aa7e0; --accent-contrast: #0d1117;
  --border: #3a4350; --card-bg: #161b21; --link: #8ab4ee; --visited: #b79ae6; --stripe: #1a2027; --head-bg: #222a33; --infobox: #1b2129; --mark: #4a4217;
}

body { font-size: 15.5px; line-height: 1.55; }
.site-nav { background: var(--bg-alt); }
.site-nav__brand { font-family: var(--font-body); }
a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:visited { color: var(--visited); }
.site-nav a:visited, .card:visited, .chip:visited, .button:visited { color: inherit; }
main { max-width: var(--max-width); }

.wiki h1, .wiki h2, .wiki h3 { font-family: var(--font-head); font-weight: 400; line-height: 1.25; }
.wiki h1 { margin: .2rem 0 .6rem; font-size: 2rem; border-bottom: 1px solid var(--border); padding-bottom: .15rem; }
.wiki h2 { margin: 1.6rem 0 .5rem; font-size: 1.45rem; border-bottom: 1px solid var(--border); padding-bottom: .1rem; }
.wiki h3 { margin: 1.1rem 0 .3rem; font-size: 1.2rem; font-weight: 700; font-family: var(--font-body); }
.wiki .lede { color: var(--text-muted); max-width: 52rem; }

/* dense tables, sticky head, zebra rows */
.wiki table, .prose table { border-collapse: collapse; font-size: .92rem; background: var(--bg-alt); }
.wiki th, .prose th { position: sticky; top: 0; background: var(--head-bg); text-align: left; font-weight: 600; padding: .3rem .55rem; border: 1px solid var(--border); }
.wiki td, .prose td { padding: .25rem .55rem; border: 1px solid var(--border); vertical-align: top; }
.wiki tbody tr:nth-child(even), .prose tbody tr:nth-child(even) { background: var(--stripe); }
.wiki .num, .wiki th.num, .wiki td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* infobox: a small summary card, floats right on wide screens */
.infobox { float: right; clear: right; width: 17rem; margin: 0 0 1rem 1.2rem; padding: 0; font-size: .88rem; background: var(--infobox); border: 1px solid var(--border); border-radius: var(--radius); }
.infobox__title { margin: 0; padding: .35rem .6rem; font-weight: 700; text-align: center; background: var(--head-bg); border-bottom: 1px solid var(--border); }
.infobox dl { margin: 0; padding: .3rem .6rem .5rem; display: grid; grid-template-columns: fit-content(8.5rem) minmax(0, 1fr); gap: .15rem .7rem; }
.infobox dt { color: var(--text-muted); } .infobox dd { margin: 0; overflow-wrap: break-word; }
/* wide: a full-width fact sheet above the text. A page with little prose (a background is a paragraph or two) looks wrong with a narrow box towering beside it, and
   long values (the equipment line) wrap into a tall sliver. Label and value share one row each. */
.infobox--wide { float: none; clear: both; width: auto; margin: .2rem 0 1rem; }
.infobox--wide dl { grid-template-columns: fit-content(11rem) minmax(0, 1fr); gap: .25rem 1.2rem; padding: .45rem .8rem .6rem; }
@media (max-width: 700px) { .infobox { float: none; width: auto; margin: 0 0 1rem; } }

.wiki mark { background: var(--mark); color: inherit; }
.wiki code { background: var(--stripe); padding: 0 .25em; border-radius: 2px; }
.card, .search-drop { border-radius: var(--radius); }
.chip { background: var(--bg-alt); }
.chip[aria-pressed="true"], .chip--on { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.chip:focus-visible, .button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.callout { border-radius: var(--radius); background: var(--stripe); }

/* ---- data tables (tables.js): text box, facet chips, column chooser, sortable head ------------------------------------------------------------------ */
.dt-controls { display: grid; gap: .5rem; margin: .6rem 0 .8rem; }
.dt-controls .search-input { width: 100%; max-width: 32rem; }
.dt-facets { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: flex-start; }
.dt-facet { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: .2rem .55rem; max-width: 100%; }
.dt-facet > summary { cursor: pointer; font-size: .9rem; font-weight: 600; list-style-position: inside; }
.dt-facet[open] { flex: 1 1 100%; }
.dt-facet .chips { display: flex; flex-wrap: wrap; gap: .3rem; padding: .4rem 0 .3rem; }
.dt-badge { display: inline-block; min-width: 1.2em; padding: 0 .35em; border-radius: 1em; background: var(--accent); color: var(--accent-contrast); font-size: .75rem; text-align: center; }
.dt-collist { display: flex; flex-wrap: wrap; gap: .3rem 1rem; padding: .4rem 0 .3rem; }
.dt-collist label { font-size: .9rem; white-space: nowrap; }
.dt-status { margin: 0; color: var(--text-muted); font-size: .9rem; }
.chip__n { opacity: .7; font-size: .8em; }
.dt-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); max-width: 100%; }
.dt-scroll table { width: 100%; margin: 0; border: 0; }
.dt-scroll th, .dt-scroll td { border-left: 0; border-right: 0; }
.dt-sort { all: unset; cursor: pointer; font-weight: 600; display: block; width: 100%; }
.dt-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th[aria-sort="ascending"] .dt-sort::after { content: " \25B2"; font-size: .7em; }
th[aria-sort="descending"] .dt-sort::after { content: " \25BC"; font-size: .7em; }
.dt-scroll td[hidden], .dt-scroll th[hidden] { display: none; }

/* ---- detail pages ------------------------------------------------------------------------------------------------------------------------------- */
.wiki .crumb { margin: 0 0 .2rem; font-size: .88rem; color: var(--text-muted); }
.wiki .back { margin-top: 1.6rem; clear: both; }
.wiki .infobox dd a { text-decoration: underline; }
.wiki .prose, .wiki.prose { max-width: 60rem; }
.wiki.prose p, .wiki .prose p { margin: .5rem 0; }
.wiki.prose h4 { margin: 1rem 0 .2rem; font-size: 1.05rem; }
.wiki.prose table { margin: .8rem 0; max-width: 100%; }
@media (max-width: 700px) { .wiki.prose table { display: block; overflow-x: auto; } }

/* ---- filter bars and card grids shared by the links page and the inventory catalogs ----------------------------------------------------------------- */
.filters { display: grid; gap: .55rem; margin: 0 0 1rem; padding: .8rem; background: var(--stripe); border: 1px solid var(--border); border-radius: var(--radius); }
.filters .search-input { max-width: 28rem; }
.filter { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .75rem; }
.filter__label { min-width: 3.4rem; font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.filters__status { margin: 0; font-size: .88rem; color: var(--text-muted); }
.filters__reset { justify-self: start; }
.empty { padding: 1rem; color: var(--text-muted); }
.link-grid { list-style: none; margin: 0; padding: 0; }
.link-grid > li { margin: 0; min-width: 0; }
.link-grid .card { height: 100%; box-sizing: border-box; }
