:root {
  --bg: #ffffff;
  --surface: #f5f5f5;
  --ink: #0a0a0a;
  --link: #002f87;
  --focus: #b45309;
  --border: #262626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.125rem;
  line-height: 1.8;
  letter-spacing: 0.01em;
}

a { color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
  background: #fef3c7;
  color: #000000;
}

.skip-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #111111;
}
.skip-links a {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
}

.reader-banner, .reader-summary, .reader-toc, .reader-main, .reader-directory, .reader-footer {
  max-width: 72ch;
  margin: 0 auto;
  padding: 1.25rem 1.25rem;
}
.reader-banner {
  border-bottom: 2px solid var(--border);
}
.reader-brand { margin: 0 0 0.75rem; font-size: 1.1rem; font-weight: 800; }

.theme-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.95rem; }
.theme-switcher-label { font-weight: 700; }
.theme-list { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; margin: 0; padding: 0; }
.theme-list a, .xml-inspect-link {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  font-weight: 600;
}
.theme-list a.is-active {
  background: var(--ink);
  color: #ffffff;
}

.reader-summary {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-left: 8px solid var(--ink);
  border-radius: 4px;
}
.summary-kicker {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.page-title { margin: 0 0 0.65rem; font-size: 2.1rem; line-height: 1.25; }
.summary-description { font-size: 1.15rem; margin: 0 0 1rem; }
.summary-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
  margin: 0;
}
.summary-facts dt { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; }
.summary-facts dd { margin: 0; }

.reader-toc {
  margin-top: 1.25rem;
  border: 2px solid var(--border);
  border-radius: 4px;
}
.reader-toc h2 { margin-top: 0; font-size: 1.35rem; }
.reader-toc ol { margin-bottom: 0; padding-left: 1.5rem; }
.reader-toc li { margin-bottom: 0.35rem; }

.reader-main h2 { margin-top: 2.25rem; padding-top: 0.75rem; border-top: 2px solid var(--border); }
.reader-main code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: #e5e5e5;
  padding: 0.1rem 0.3rem;
}

.code-figure {
  margin: 1.5rem 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}
.code-figure figcaption {
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.45rem 0.9rem;
}
.code-figure pre.code-block {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.95rem;
  line-height: 1.55;
  background: #ffffff;
  color: #0a0a0a;
}
.code-figure pre.code-block code { background: transparent; padding: 0; }

.table-wrap { overflow-x: auto; margin: 1.5rem 0; border: 2px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--border); padding: 0.65rem 0.8rem; text-align: left; }
th { background: #e5e5e5; font-weight: 800; }

blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.1rem;
  border-left: 6px solid var(--ink);
  background: var(--surface);
}

.reader-main article { overflow-wrap: anywhere; }

.page-neighbors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--border);
}
.page-neighbors a {
  overflow-wrap: anywhere;
  display: block;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  background: var(--surface);
}
.neighbor-dir { display: block; font-size: 0.85rem; font-weight: 700; }

.reader-directory {
  margin-top: 1.5rem;
  border-top: 3px solid var(--border);
  background: var(--surface);
}
.site-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.nav-section-title { font-weight: 800; margin: 0 0 0.4rem; }
.site-nav ul { margin: 0; padding-left: 1.2rem; }
.site-nav li { margin-bottom: 0.35rem; }
.site-nav a.is-active { font-weight: 800; background: #fef3c7; }

.reader-footer {
  border-top: 2px solid var(--border);
  font-size: 0.95rem;
}
