:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #5b6965;
  --line: #d9e1dd;
  --paper: #fbfcfa;
  --surface: #ffffff;
  --green: #1f7a5c;
  --amber: #b16b16;
  --red: #a13d3d;
  --teal: #236b78;
  --focus: #0b6fdb;
  --shadow: 0 18px 50px rgba(24, 33, 31, 0.08);
}

* {
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--teal);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: white;
}

.skip:focus {
  top: 1rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 250, 0.92);
  backdrop-filter: blur(12px);
}

.topbar nav {
  display: flex;
  gap: 0.3rem;
  justify-content: flex-end;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.topbar a {
  padding: 0.45rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}

.section,
.section-band {
  max-width: 1180px;
  margin: 0 auto;
  padding: 5rem 1rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  align-items: end;
  gap: 2rem;
  min-height: 76vh;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.13;
  letter-spacing: 0;
}

h1 {
  max-width: 980px;
  font-size: clamp(2.65rem, 8vw, 6.4rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 4rem);
}

h3 {
  font-size: 1.05rem;
}

p {
  color: var(--muted);
}

.lead {
  max-width: 760px;
  margin: 1.4rem 0 0;
  font-size: 1.22rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
}

.button.primary {
  background: var(--ink);
  color: white;
}

.button.secondary {
  background: transparent;
  color: var(--ink);
}

.metric-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.metric-panel div {
  min-height: 118px;
  padding: 1rem;
  background: var(--surface);
}

.metric-panel strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
}

.metric-panel span {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 2rem;
}

.article-section {
  max-width: 960px;
}

.longform-article {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 1.5rem 0 0;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.article-meta a {
  font-weight: 700;
}

.longform-article h3 {
  margin-top: 3rem;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.longform-article p,
.longform-article li,
.longform-article blockquote {
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 1.9;
}

.longform-article blockquote {
  margin: 0 0 2rem;
  border-left: 4px solid var(--green);
  padding: 0.6rem 0 0.6rem 1rem;
  color: var(--muted);
}

.longform-article ul {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.2rem;
}

.evidence-anchors {
  margin: 1.25rem 0 2.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.evidence-anchors strong {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  text-transform: uppercase;
  color: var(--green);
}

.evidence-anchors div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.evidence-anchors a,
.source-ref {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  background: #f7faf8;
  color: var(--teal);
  font-size: 0.84rem;
  line-height: 1.35;
  text-decoration: none;
}

.source-ref {
  vertical-align: baseline;
}

.thesis-grid,
.routes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

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

.thesis-grid article,
.routes article,
.argument-main,
.argument-points article,
.evidence,
.kb-grid,
.search-panel,
.ledger,
.export-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1.25rem;
}

.argument-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  gap: 1rem;
  align-items: stretch;
}

.writing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.34fr);
  gap: 1rem;
  align-items: stretch;
}

.writing-lead,
.export-list,
.synthesis-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1.25rem;
}

.export-list {
  display: grid;
  align-content: center;
  gap: 0.65rem;
}

.export-list a {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.export-list a:last-child {
  border-bottom: 0;
}

.synthesis-routes {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.synthesis-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
}

.route-number {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.synthesis-card ul {
  display: grid;
  gap: 0.45rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.synthesis-card li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
}

.synthesis-card li span {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.argument-main {
  display: grid;
  align-content: center;
  min-height: 320px;
}

.argument-main p {
  max-width: 820px;
  font-size: 1.08rem;
}

.argument-points {
  display: grid;
  gap: 1rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 2rem;
  align-items: center;
}

.graph-surface {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  box-shadow: var(--shadow);
}

#graphCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 38 / 23;
}

.legend {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.5rem;
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  vertical-align: -0.08rem;
}

.green {
  background: var(--green);
}

.amber {
  background: var(--amber);
}

.red {
  background: var(--red);
}

.palantir-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.62fr);
  gap: 1rem;
}

.flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: stretch;
}

.flow div {
  position: relative;
  min-height: 112px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 700;
}

.flow div:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -0.55rem;
  top: 50%;
  width: 0.75rem;
  height: 0.75rem;
  border-top: 2px solid var(--amber);
  border-right: 2px solid var(--amber);
  transform: translateY(-50%) rotate(45deg);
  background: var(--paper);
}

.source-strip,
.results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.source-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.source-card h3,
.result-card h3 {
  font-size: 1rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.8rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.source-table-wrap {
  overflow-x: auto;
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.narrow {
  max-width: 780px;
}

.method-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 0.55fr);
  gap: 1.5rem;
  align-items: start;
}

.ledger {
  display: grid;
  gap: 0.75rem;
}

.ledger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.ledger-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.ledger-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ledger-row strong {
  font-size: 1.1rem;
}

.search-panel {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.search-panel label {
  font-weight: 700;
}

input[type="search"] {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 0.9rem;
  color: var(--ink);
  font: inherit;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.export-card {
  display: grid;
  gap: 0.45rem;
  min-height: 120px;
  color: var(--ink);
  text-decoration: none;
}

.export-card span {
  color: var(--muted);
}

.filter {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0.35rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.filter.active {
  border-color: var(--green);
  background: #e8f3ef;
}

.kb-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
}

pre {
  overflow-x: auto;
  margin: 0;
  border-radius: 6px;
  background: #17211f;
  color: #eaf4ef;
  padding: 1rem;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .hero,
  .split,
  .palantir-layout,
  .argument-layout,
  .writing-layout,
  .method-layout,
  .kb-grid {
    grid-template-columns: 1fr;
  }

  .thesis-grid,
  .routes,
  .source-strip,
  .results,
  .export-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .flow div:not(:last-child)::after {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .section,
  .section-band {
    padding: 3.5rem 1rem;
  }

  .metric-panel,
  .thesis-grid,
  .routes,
  .source-strip,
  .results,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .synthesis-card,
  .synthesis-card li {
    grid-template-columns: 1fr;
  }

  .synthesis-card li span {
    white-space: normal;
  }

  h1 {
    font-size: clamp(2.2rem, 13vw, 3.8rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
