:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --bg-2: #101720;
  --surface: #141c25;
  --surface-2: #192530;
  --surface-3: #22313d;
  --ink: #eef4f8;
  --muted: #9fb0bd;
  --line: #2a3946;
  --line-strong: #3b5362;
  --accent: #55d6c2;
  --accent-2: #f1b84b;
  --accent-3: #8fb7ff;
  --good: #6bd48a;
  --warn: #f1b84b;
  --risk: #ff7777;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.58;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, #000, transparent 520px);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

code,
pre {
  font-family: var(--mono);
}

code {
  color: #c8fff6;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 20, 0.96);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(85, 214, 194, 0.42);
  border-radius: 8px;
  background: #101821;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: 0;
}

.brand-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-link,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 12px;
  background: rgba(20, 28, 37, 0.86);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
}

.top-link:hover,
.button-link:hover {
  border-color: rgba(85, 214, 194, 0.6);
  color: var(--accent);
}

.button-link.primary {
  border-color: rgba(85, 214, 194, 0.62);
  background: var(--accent);
  color: #07100f;
}

.site-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f151c;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
}

input::placeholder {
  color: #718391;
}

.site-search input {
  width: min(36vw, 430px);
}

.search-results {
  position: absolute;
  right: 0;
  top: 46px;
  width: min(500px, 86vw);
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101821;
  box-shadow: var(--shadow);
  padding: 8px;
}

.search-results a,
.search-results p {
  display: block;
  margin: 0;
  padding: 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
}

.search-results a:hover {
  background: var(--surface-2);
}

.search-results span,
.search-results em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 18px 16px 28px;
  background: rgba(10, 13, 19, 0.9);
}

.nav-group {
  margin-bottom: 18px;
}

.nav-heading {
  margin: 0 0 7px;
  padding: 0 10px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar a {
  display: block;
  padding: 8px 10px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 720;
}

.sidebar a:hover,
.sidebar a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar a[aria-current="page"] {
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

main {
  width: min(1400px, 100%);
  padding: 34px 36px 76px;
}

.site-footer {
  margin-left: 292px;
  border-top: 1px solid rgba(85, 214, 194, 0.14);
  padding: 18px 36px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(10, 13, 19, 0.66);
}

.hero {
  position: relative;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.hero-copy {
  max-width: 910px;
  padding: 4px 0 26px;
}

.home-page .hero-copy {
  padding: 6px 0 28px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 12px;
  font-size: 25px;
  line-height: 1.16;
}

h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.2;
}

h4 {
  margin: 20px 0 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--accent-2);
}

p {
  margin: 0 0 14px;
}

section {
  margin: 0 0 30px;
  min-width: 0;
}

.hero p {
  max-width: 760px;
  color: #c3d0d9;
  font-size: clamp(17px, 2vw, 21px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.lead {
  max-width: 840px;
  color: #c3d0d9;
  font-size: 18px;
}

.section-kicker {
  margin-bottom: 8px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 34px;
  align-items: start;
}

.article-content {
  min-width: 0;
}

.page-toc {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 7px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
  color: var(--muted);
  font-size: 13px;
}

.page-toc strong {
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
}

.page-toc a {
  color: var(--muted);
  text-decoration: none;
}

.page-toc a:hover {
  color: var(--accent);
}

.toc-empty {
  color: var(--muted);
}

.heading-anchor {
  margin-left: 8px;
  color: var(--muted);
  opacity: 0;
  text-decoration: none;
  font-size: 0.8em;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.home-stats p {
  flex: 1 1 220px;
  margin: 0;
  border-right: 1px solid var(--line);
  padding: 13px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.home-stats strong {
  display: inline;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1.2;
}

.home-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.compare,
.steps,
.issue-list,
.glossary {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.action-card,
.layout-card,
.source-card,
.issue,
.compare article,
.steps article,
.glossary article {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 16px 4px;
}

.action-card {
  position: relative;
  min-height: 132px;
  color: var(--ink);
  text-decoration: none;
}

.action-card.primary {
  border-color: rgba(85, 214, 194, 0.58);
  background:
    linear-gradient(135deg, rgba(85, 214, 194, 0.17), rgba(241, 184, 75, 0.08)),
    var(--surface);
}

.action-card:hover {
  border-color: rgba(85, 214, 194, 0.68);
  transform: translateY(-1px);
}

.action-card em {
  display: block;
  margin-bottom: 14px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.action-card strong,
.action-card span {
  display: block;
}

.action-card strong {
  font-size: 20px;
  line-height: 1.14;
}

.action-card span {
  color: var(--muted);
  margin-top: 8px;
}

.architecture-panel {
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.map-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.map-strip article {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 16px;
}

.map-strip strong {
  display: block;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
}

.map-strip span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.callout {
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  background: rgba(20, 28, 37, 0.36);
  box-shadow: none;
  padding: 16px 18px;
}

.callout.warning {
  border-left-color: var(--warn);
}

.callout.legal {
  border-left-color: var(--risk);
}

.tool-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 28, 37, 0.78);
  padding: 12px;
}

.filters label {
  display: grid;
  gap: 5px;
  flex: 1 1 180px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.filters input {
  min-width: 0;
  width: 100%;
}

.filters select {
  min-width: 0;
  width: 100%;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 28, 37, 0.78);
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: min(960px, 100%);
  table-layout: auto;
}

table.wide-table {
  min-width: 1180px;
}

th,
td {
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  background: #18232c;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(85, 214, 194, 0.04);
}

.layout-card h3,
.source-card h3,
.issue h3 {
  line-height: 1.2;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.compact {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  margin: 12px 0;
}

.compact dt {
  color: var(--muted);
  font-weight: 850;
}

.compact dd {
  margin: 0;
}

.badge,
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 3px 2px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #101821;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.badge.high {
  border-color: rgba(107, 212, 138, 0.36);
  color: var(--good);
}

.badge.medium {
  border-color: rgba(241, 184, 75, 0.38);
  color: var(--warn);
}

.badge.low,
.badge.risk {
  border-color: rgba(255, 119, 119, 0.4);
  color: var(--risk);
}

pre {
  position: relative;
  margin: 12px 0;
  overflow: auto;
  border: 1px solid #344b5a;
  border-radius: 6px;
  background: #070b10;
  color: #edf6ff;
  padding: 16px;
  line-height: 1.48;
}

.inline-pre {
  margin: 0;
  max-width: 520px;
  white-space: pre-wrap;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

.compact-list li {
  margin: 3px 0;
}

.copy-button {
  position: absolute;
  right: 8px;
  top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.checklist li,
li {
  margin: 7px 0;
}

.archive-doc {
  max-width: 960px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 24px;
  box-shadow: none;
}

.archive-doc h2,
.archive-doc h3,
.archive-doc h4,
.archive-doc h5 {
  margin-top: 24px;
}

.archive-doc h2:first-child,
.archive-doc h3:first-child {
  margin-top: 0;
}

.search-page {
  max-width: 980px;
}

.big-search {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
}

.big-search input {
  min-height: 56px;
  border-radius: 8px;
  font-size: 20px;
  padding: 12px 14px;
}

.page-search-results {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.result-card {
  display: grid;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 14px 2px;
  text-decoration: none;
  box-shadow: none;
}

.decision-panel {
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 18px 0 22px 16px;
  background: transparent;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.decision-grid a {
  display: grid;
  gap: 6px;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #101821;
  color: var(--ink);
  text-decoration: none;
}

.decision-grid strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 18px;
}

.decision-grid span {
  color: var(--muted);
}

.chapter-table {
  display: grid;
  border-top: 1px solid var(--line);
}

.chapter-table a {
  display: grid;
  grid-template-columns: 72px minmax(180px, 0.55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding: 16px 4px;
  color: var(--ink);
  text-decoration: none;
}

.chapter-table a:hover {
  background: rgba(85, 214, 194, 0.05);
}

.chapter-table span {
  color: var(--accent-2);
  font-family: var(--mono);
  font-weight: 900;
}

.chapter-table strong {
  font-size: 18px;
}

.chapter-table em {
  color: var(--muted);
  font-style: normal;
}

.result-card:hover {
  border-color: rgba(85, 214, 194, 0.55);
}

.result-card .badge {
  width: fit-content;
}

.result-card span:last-child,
.muted {
  color: var(--muted);
}

.sources {
  margin-top: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .site-search,
  .site-search input {
    width: 100%;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: 320px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px 18px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-group {
    margin-bottom: 0;
  }

  main {
    padding: 24px 16px 56px;
  }

  .site-footer {
    margin-left: 0;
    padding: 16px;
  }

  .hero-copy,
  .home-page .hero-copy {
    padding: 10px 0 24px;
  }

  .content-layout {
    display: block;
  }

  .page-toc {
    position: static;
    margin: 0 0 24px;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
  }

  h1 {
    font-size: 42px;
  }

  .home-stats,
  .evidence-grid,
  .decision-grid {
    grid-template-columns: 1fr;
  }

  .chapter-table a {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .chapter-table em {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .brand {
    width: 100%;
  }

  .top-link,
  .button-link {
    flex: 1 1 auto;
  }

  .sidebar {
    max-height: 260px;
    padding: 14px 12px 16px;
  }

  .nav-heading {
    padding: 0 8px;
    font-size: 10px;
  }

  .sidebar a {
    padding: 6px 8px;
    font-size: 13px;
  }

  h1 {
    font-size: 36px;
  }

  .home-grid,
  .compare,
  .steps,
  .grid,
  .decision-grid,
  .map-strip {
    grid-template-columns: 1fr;
  }

  .compact {
    grid-template-columns: 1fr;
  }
}
