:root {
  color-scheme: light;
  --ink: #171a1d;
  --ink-soft: #4e565b;
  --paper: #ffffff;
  --ground: #f3f5f2;
  --fog: #e9ede8;
  --line: #d4dad4;
  --line-dark: #aeb7af;
  --teal: #1f6f5f;
  --amber: #a86716;
  --rose: #9b3f67;
  --blue: #335fa8;
  --red: #a23f3f;
  --green: #23704e;
  --shadow: 0 12px 34px rgba(25, 31, 28, 0.08);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 280px;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--ground);
  background-size: 40px 40px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(243, 245, 242, 0.86);
  z-index: -1;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

svg {
  display: block;
}

.page-frame {
  width: min(1500px, calc(100% - 32px));
  min-height: 100vh;
  margin: 16px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 20;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  min-height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  font-size: 18px;
}

.brand small {
  align-self: flex-start;
  margin-top: 15px;
  color: var(--rose);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.brand-mark i {
  display: block;
  background: var(--teal);
}

.brand-mark i:nth-child(2) { background: var(--amber); }
.brand-mark i:nth-child(3) { background: var(--rose); }
.brand-mark i:nth-child(4) { background: var(--blue); }

.site-header nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 26px;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.site-header nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--teal);
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 0.75fr);
  gap: 54px;
  padding: 46px 44px 40px;
  border-bottom: 1px solid var(--line);
}

.illustrated-logo {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  padding: 12px 36px;
  background: #e9eee7;
}

.illustrated-logo img {
  width: min(100%, 980px);
  height: auto;
  display: block;
}

.artist-signature {
  position: absolute;
  right: 16px;
  bottom: 10px;
  color: #536158;
  font: italic 18px/1 "Snell Roundhand", "Bradley Hand", cursive;
  letter-spacing: 0;
  transform: rotate(-5deg);
  transform-origin: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.intro-band h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.03;
  font-weight: 720;
}

.intro-copy {
  max-width: 730px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 18px;
}

.graph-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: end;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--line);
}

.graph-stats div {
  min-height: 82px;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.graph-stats dt {
  color: var(--ink-soft);
  font-size: 12px;
}

.graph-stats dd {
  margin: 3px 0 0;
  font: 650 28px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.atlas-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 160px 42px;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fafbf9;
}

.search-field,
.select-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line-dark);
}

.search-field:focus-within,
.select-field:focus-within {
  outline: 2px solid color-mix(in srgb, var(--blue) 40%, transparent);
  outline-offset: 1px;
  border-color: var(--blue);
}

.search-field svg {
  width: 18px;
  height: 18px;
  margin-left: 13px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.8;
}

.search-field input,
.select-field select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-field input {
  padding: 9px 12px;
}

.select-field select {
  height: 40px;
  padding: 0 10px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-dark);
  background: var(--paper);
  color: var(--ink-soft);
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--red);
  border-color: var(--red);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.atlas-layout {
  display: grid;
  grid-template-columns: 210px minmax(390px, 1fr) minmax(370px, 0.82fr);
  min-height: 660px;
}

.filter-rail,
.evidence-register,
.map-rail {
  min-width: 0;
  padding: 26px 24px;
}

.filter-rail {
  border-right: 1px solid var(--line);
  background: #fafbf9;
}

.evidence-register {
  border-right: 1px solid var(--line);
}

.rail-heading,
.register-heading,
.map-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.rail-heading h2,
.register-heading h2,
.map-heading h2 {
  margin: 0;
  font-size: 19px;
}

.rail-heading span,
.register-heading p,
.map-caption {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.domain-filters {
  display: grid;
  gap: 2px;
}

.filter-option {
  min-height: 40px;
  display: grid;
  grid-template-columns: 16px 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--ink-soft);
}

.filter-option:hover {
  color: var(--ink);
}

.filter-option input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.filter-swatch {
  width: 8px;
  height: 8px;
  background: var(--domain-color, var(--teal));
}

.filter-option small {
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.alpha-note {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

.alpha-note strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.register-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}

.register-heading p strong {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.evidence-row {
  border-bottom: 1px solid var(--line);
}

.evidence-row[hidden] {
  display: none;
}

.evidence-row-link {
  position: relative;
  min-height: 126px;
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) 48px;
  gap: 16px;
  padding: 18px 4px 18px 0;
  text-decoration: none;
}

.evidence-row-link:hover,
.evidence-row-link:focus-visible {
  background: #f7f9f6;
  outline: 0;
}

.evidence-row-link:hover .row-claim,
.evidence-row-link:focus-visible .row-claim {
  color: var(--blue);
}

.domain-rule {
  width: 4px;
  height: 100%;
  background: var(--domain-color);
}

.evidence-row-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
}

.grade-badge {
  padding: 2px 5px;
  color: var(--ink);
  background: var(--fog);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-weight: 650;
}

.state::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
}

.state--refuted { color: var(--red); }
.state--contested { color: var(--amber); }

.row-claim {
  margin-top: 9px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 640;
  line-height: 1.35;
}

.row-quantities {
  margin-top: 8px;
  color: var(--ink-soft);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.row-relations {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--ink-soft);
}

.row-relations b {
  color: var(--ink);
  font: 650 19px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.row-relations small {
  margin-top: 4px;
  font-size: 10px;
}

.empty-state {
  padding: 36px 0;
  color: var(--ink-soft);
  text-align: center;
}

.map-rail {
  position: relative;
  align-self: start;
  position: sticky;
  top: 0;
  min-height: 620px;
}

.map-legend {
  display: flex;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 10px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-node {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

.legend-node--refuted {
  background: white;
  border: 2px solid var(--red);
}

.evidence-map {
  width: 100%;
  aspect-ratio: 760 / 500;
  overflow: visible;
}

.graph-edge {
  fill: none;
  stroke: #c8cfca;
  stroke-width: 1.25;
}

.graph-edge--refutes {
  stroke: var(--red);
  stroke-dasharray: 4 4;
}

.graph-edge.is-filtered {
  opacity: 0.08;
}

.graph-label {
  fill: var(--node-color);
  stroke: var(--paper);
  stroke-width: 4px;
  paint-order: stroke fill;
  font: 650 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.graph-node circle:first-child {
  fill: var(--node-color);
  stroke: var(--paper);
  stroke-width: 2;
  transition: r 140ms ease, opacity 140ms ease;
}

.graph-node-ring {
  fill: none;
  stroke: transparent;
  stroke-width: 2;
}

.graph-node:hover circle:first-child,
.graph-node:focus-visible circle:first-child {
  r: 12;
}

.graph-node:focus-visible {
  outline: none;
}

.graph-node:focus-visible .graph-node-ring {
  stroke: var(--blue);
}

.graph-node--refuted circle:first-child {
  fill: var(--paper);
  stroke: var(--red);
  stroke-width: 3;
}

.graph-node.is-filtered {
  opacity: 0.12;
  pointer-events: none;
}

.map-caption {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.site-footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
}

.site-footer a {
  color: var(--ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  padding: 22px 34px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

.breadcrumb a {
  color: var(--ink);
}

.block-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 56px;
  padding: 46px 44px 68px;
}

.claim-column {
  min-width: 0;
  max-width: 920px;
}

.claim-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ink-soft);
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.claim-column h1 {
  margin: 22px 0 28px;
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.08;
  font-weight: 690;
}

.status-banner {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 18px;
  border-top: 2px solid var(--green);
  background: #edf6f1;
}

.status-banner strong {
  color: var(--green);
}

.status-banner--refuted {
  border-color: var(--red);
  background: #f9eeee;
}

.status-banner--refuted strong {
  color: var(--red);
}

.status-banner--contested {
  border-color: var(--amber);
  background: #fbf4e9;
}

.status-banner--contested strong {
  color: var(--amber);
}

.quantity-band {
  margin: 34px 0 0;
  padding: 22px 24px;
  border-left: 4px solid var(--blue);
  background: #f0f3f9;
}

.quantity-band p:last-child {
  margin: 0;
  font: 600 17px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.record-section {
  margin-top: 52px;
  padding-top: 24px;
  border-top: 1px solid var(--ink);
}

.record-section > header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}

.record-section h2 {
  margin: 0;
  font-size: 21px;
}

.section-number {
  margin: 0;
  color: var(--ink-soft);
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.source-list {
  margin: 0 0 0 56px;
  padding: 0;
}

.source-list li {
  padding: 7px 0;
}

.source-list a {
  color: var(--blue);
}

.declared-loss {
  border-top-color: var(--amber);
}

.declared-loss > p {
  margin: 0 0 0 56px;
  max-width: 760px;
  color: var(--ink-soft);
}

.connection-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
  margin-left: 56px;
}

.connection-columns h3 {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 12px;
  text-transform: uppercase;
}

.connection-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.connection-list li {
  border-top: 1px solid var(--line);
}

.connection-list a {
  display: grid;
  gap: 6px;
  padding: 14px 0;
  text-decoration: none;
}

.connection-list a:hover .connection-claim,
.connection-list a:focus-visible .connection-claim {
  color: var(--blue);
}

.connection-rel {
  color: var(--rose);
  font: 700 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.connection-claim {
  font-weight: 620;
  line-height: 1.35;
}

.connection-note {
  color: var(--ink-soft);
  font-size: 12px;
}

.muted {
  color: var(--ink-soft);
}

.evidence-rail {
  align-self: start;
  position: sticky;
  top: 24px;
  padding: 22px;
  border-top: 3px solid var(--ink);
  background: #f7f9f6;
}

.evidence-rail dl {
  margin: 18px 0 0;
}

.evidence-rail dl div {
  min-height: 44px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.evidence-rail dt {
  color: var(--ink-soft);
  font-size: 11px;
}

.evidence-rail dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.verification-note {
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 12px;
}

.verification-note strong {
  color: var(--ink);
}

.verification-note p {
  margin: 5px 0 0;
}

.machine-link {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 10px;
  border: 1px solid var(--line-dark);
  background: var(--paper);
  text-decoration: none;
}

.machine-link > span:first-child {
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--blue);
}

.machine-link strong,
.machine-link small {
  display: block;
}

.machine-link small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 10px;
}

.machine-link:hover,
.machine-link:focus-visible {
  border-color: var(--blue);
}

@media (max-width: 1180px) {
  .intro-band {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 32px;
  }

  .atlas-layout {
    grid-template-columns: 190px minmax(380px, 1fr);
  }

  .map-rail {
    grid-column: 1 / -1;
    position: static;
    min-height: 0;
    border-top: 1px solid var(--line);
  }

  .evidence-map {
    max-height: 520px;
  }
}

@media (max-width: 820px) {
  .page-frame {
    width: 100%;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .site-header {
    padding: 0 18px;
  }

  .site-header nav {
    gap: 16px;
  }

  .intro-band {
    grid-template-columns: 1fr;
    padding: 32px 22px;
  }

  .graph-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .graph-stats div {
    min-height: 70px;
    padding: 10px;
  }

  .graph-stats dd {
    font-size: 22px;
  }

  .atlas-toolbar {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .select-field {
    grid-row: 2;
  }

  .atlas-toolbar .select-field:nth-of-type(2) {
    grid-column: 1;
  }

  .atlas-toolbar .select-field:nth-of-type(3) {
    grid-column: 2;
  }

  .atlas-layout {
    grid-template-columns: 1fr;
  }

  .filter-rail,
  .evidence-register {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .domain-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alpha-note {
    display: none;
  }

  .block-layout {
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 32px 22px 52px;
  }

  .evidence-rail {
    position: static;
  }

  .claim-column h1 {
    font-size: clamp(29px, 8vw, 46px);
  }
}

@media (max-width: 560px) {
  html {
    font-size: 15px;
  }

  .site-header {
    min-height: 58px;
  }

  .brand small,
  .site-header nav a:nth-child(3) {
    display: none;
  }

  .site-header nav {
    gap: 12px;
  }

  .intro-band h1 {
    font-size: 35px;
  }

  .illustrated-logo {
    padding: 8px 12px;
  }

  .illustrated-logo img {
    width: 100%;
  }

  .artist-signature {
    right: 8px;
    bottom: 5px;
    font-size: 12px;
  }

  .intro-copy {
    font-size: 16px;
  }

  .graph-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .atlas-toolbar {
    padding: 12px;
  }

  .atlas-toolbar .select-field {
    grid-column: 1 / -1;
  }

  .atlas-toolbar .select-field:nth-of-type(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .atlas-toolbar .select-field:nth-of-type(3) {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .atlas-toolbar .icon-button {
    grid-column: 2;
    grid-row: 1;
  }

  .filter-rail,
  .evidence-register,
  .map-rail {
    padding: 22px 16px;
  }

  .domain-filters {
    grid-template-columns: 1fr;
  }

  .evidence-row-link {
    grid-template-columns: 4px minmax(0, 1fr);
  }

  .row-relations {
    display: none;
  }

  .evidence-map {
    aspect-ratio: 1 / 0.82;
  }

  .site-footer {
    padding: 16px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .breadcrumb {
    padding: 16px 18px;
  }

  .block-layout {
    padding: 28px 18px 44px;
  }

  .status-banner {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .source-list,
  .declared-loss > p,
  .connection-columns {
    margin-left: 0;
  }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
