:root {
  color-scheme: light;
  --page: #f4f0e8;
  --page-rgb: 244, 240, 232;
  --text: #20201e;
  --muted: #6d6b65;
  --faint: #aaa69c;
  --line: #d7d1c5;
  --line-strong: #b8b1a5;
  --control: #fbf8f1;
  --accent: #994d34;
  --danger: #a12f34;
  --success: #35694f;
  --code: #ebe5da;
  --selection: #e2c9b7;
  --sidebar: 304px;
  --reading: 820px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #171715;
  --page-rgb: 23, 23, 21;
  --text: #e6e2d9;
  --muted: #a5a097;
  --faint: #716d66;
  --line: #35332f;
  --line-strong: #555149;
  --control: #1d1d1a;
  --accent: #d58a68;
  --danger: #eb8384;
  --success: #88b89b;
  --code: #21211e;
  --selection: #583d32;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 17px;
  line-height: 1.65;
  transition: background-color .15s ease, color .15s ease;
}
::selection { background: var(--selection); }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
.hidden { display: none !important; }
.error { min-height: 1.65em; color: var(--danger); font-size: 13px; }
.wordmark { color: var(--text); font-weight: 700; letter-spacing: -.04em; text-decoration: none; }
.primary { border: 1px solid var(--text); border-radius: 0; background: var(--text); color: var(--page); font-weight: 700; }
.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--control); }

/* Login mirrors findings.er3bus.top: quiet, centered, monospaced, no card chrome. */
.login { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 0; }
.login-card .wordmark { display: inline-block; margin-bottom: 54px; }
.login-card h1 { margin: 0 0 9px; font-size: 29px; line-height: 1.2; letter-spacing: -.04em; }
.login-card > p { margin: 0 0 30px; color: var(--muted); }
.login-card label, dialog label { display: grid; gap: 7px; margin: 0 0 16px; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.login-card input, dialog input { width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 0; outline: 0; background: var(--control); }
.login-card input:focus, dialog input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.login-card .primary { width: auto; margin-top: 37px; padding: 10px 14px; }

/* Documentation keeps a navigator while adopting the findings site's flat page language. */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; display: flex; width: var(--sidebar); flex-direction: column; border-right: 1px solid var(--line); background: var(--page); }
.side-head { padding: 31px 25px 17px; }
.docs-wordmark { font-size: 21px; }
.side-head p { margin: 8px 0 0; color: var(--faint); font-size: 10px; line-height: 1.45; }
.search-wrap { position: relative; display: flex; align-items: center; margin: 0 18px 17px; }
.search-wrap > span { position: absolute; left: 10px; color: var(--muted); }
.search-wrap input { width: 100%; padding: 8px 35px 8px 30px; border: 1px solid var(--line-strong); border-radius: 0; outline: 0; background: var(--control); font-size: 13px; }
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
kbd { position: absolute; right: 8px; color: var(--faint); font: 10px ui-monospace, monospace; }
.search-results { position: absolute; z-index: 20; top: 119px; left: 18px; width: calc(100% - 36px); max-height: min(620px, calc(100vh - 150px)); overflow: auto; border: 1px solid var(--line-strong); background: var(--page); box-shadow: 0 12px 35px rgba(0, 0, 0, .18); }
.search-results a { display: grid; gap: 3px; padding: 11px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.search-results a:hover { background: var(--control); }
.search-results strong { font-size: 12px; }
.search-results span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.search-results .empty { padding: 13px; color: var(--muted); font-size: 12px; }
#navigation { flex: 1; overflow: auto; padding: 0 13px 25px; scrollbar-color: var(--line-strong) transparent; }
.nav-group { margin: 20px 0 5px; }
.nav-group h2 { margin: 0 10px 7px; color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.nav-group a { display: block; overflow: hidden; padding: 6px 10px; border-left: 2px solid transparent; color: var(--muted); font-size: 12px; line-height: 1.35; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.nav-group a:hover { color: var(--text); background: var(--control); }
.nav-group a.active { border-left-color: var(--accent); color: var(--text); background: var(--control); }
.side-foot { display: flex; gap: 14px; padding: 13px 23px; border-top: 1px solid var(--line); }
.quiet-button { padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }

.main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; z-index: 5; top: 0; display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(25px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(var(--page-rgb), .94); backdrop-filter: blur(9px); }
.breadcrumbs { display: flex; min-width: 0; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.breadcrumbs strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 10px; }
.live-dot { width: 6px; height: 6px; background: var(--success); }
.reading-grid { display: grid; grid-template-columns: minmax(0, var(--reading)) 195px; justify-content: center; gap: clamp(35px, 5vw, 70px); padding: 54px clamp(25px, 5vw, 70px) 90px; }
.article { min-width: 0; color: var(--text); font-size: 16px; line-height: 1.72; overflow-wrap: anywhere; }
.article-head { margin-bottom: 43px; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.article-head span { color: var(--accent); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.article-head p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.article h1, .article h2, .article h3, .article h4 { color: var(--text); line-height: 1.25; letter-spacing: -.04em; scroll-margin-top: 80px; }
.article h1 { margin: 0 0 27px; font-size: clamp(30px, 4vw, 38px); }
.article h2 { margin: 2.25em 0 .75em; padding-bottom: .34em; border-bottom: 1px solid var(--line); font-size: 25px; }
.article h3 { margin: 1.8em 0 .58em; font-size: 20px; }
.article h4 { margin: 1.55em 0 .5em; font-size: 17px; }
.article p { margin: 0 0 1.08em; }
.article a { color: var(--accent); }
.article code { padding: .12em .35em; border: 1px solid var(--line); border-radius: 0; background: var(--code); color: var(--accent); font: .88em ui-monospace, monospace; }
.article pre { overflow: auto; margin: 1.3em 0 1.7em; padding: 17px 18px; border: 1px solid var(--line); border-radius: 0; background: var(--code); line-height: 1.55; }
.article pre code { padding: 0; border: 0; background: transparent; color: var(--text); }
.article ul, .article ol { margin: 0 0 1.25em; padding-left: 1.5em; }
.article li { margin: .38em 0; padding-left: .22em; }
.article li::marker { color: var(--accent); }
.article blockquote { margin: 1.45em 0; padding: 11px 17px; border-left: 3px solid var(--accent); background: var(--control); color: var(--muted); }
.article blockquote p { margin: 0; }
.table-wrap { overflow-x: auto; margin: 1.35em 0 1.9em; border: 1px solid var(--line); }
.article table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; }
.article th, .article td { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article th:last-child, .article td:last-child { border-right: 0; }
.article th:first-child, .article td:first-child { white-space: nowrap; }
.article tr:last-child td { border-bottom: 0; }
.article th { background: var(--control); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.article tbody tr:nth-child(even) { background: color-mix(in srgb, var(--control) 62%, transparent); }
.toc { position: sticky; top: 91px; align-self: start; max-height: calc(100vh - 115px); overflow: auto; padding-left: 16px; border-left: 1px solid var(--line); }
.toc h2 { margin: 0 0 11px; color: var(--text); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.toc a { display: block; margin: 7px 0; color: var(--muted); font-size: 10px; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }
.toc .toc-3 { padding-left: 11px; }
.page-foot { display: flex; justify-content: space-between; gap: 20px; padding: 21px clamp(25px, 5vw, 70px); border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.loader { padding: 70px 0; color: var(--muted); }
.icon { border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.mobile-only { display: none; }

dialog { width: min(470px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 0; background: var(--page); color: var(--text); box-shadow: 0 16px 55px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(23, 22, 19, .58); }
dialog form { padding: 27px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 13px; }
.dialog-head small { color: var(--accent); font-size: 9px; letter-spacing: .08em; }
.dialog-head h2 { margin: 4px 0 0; font-size: 24px; }
dialog p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.dialog-actions button { padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--control); }
.dialog-actions .primary { border-color: var(--text); background: var(--text); }
.scrim { position: fixed; z-index: 8; inset: 0; background: rgba(23, 22, 19, .55); }

@media (max-width: 1090px) {
  .reading-grid { grid-template-columns: minmax(0, var(--reading)); }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid; place-items: center; }
  .app { grid-template-columns: 1fr; }
  .sidebar { width: min(88vw, 335px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 12px 35px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .side-head { position: relative; }
  #mobile-close { position: absolute; top: 26px; right: 17px; }
  .main { grid-column: 1; }
  .topbar { padding: 0 17px; }
  .breadcrumbs span, .breadcrumbs b { display: none; }
  .reading-grid { padding: 35px 20px 65px; }
  .article { font-size: 15px; }
  .article h1 { font-size: 31px; }
  .article h2 { font-size: 23px; }
  .page-foot { display: grid; padding: 18px 20px; }
}
@media print {
  .sidebar, .topbar, .toc, .page-foot { display: none; }
  .app, .main, .reading-grid { display: block; }
  .reading-grid { padding: 0; }
  .article { max-width: none; color: #111; }
}
