:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --paper: #ffffff;
  --ink: #17211c;
  --muted: #65706a;
  --line: #dbe1db;
  --soft: #eef2ee;
  --green: #1f7a52;
  --blue: #2d679b;
  --amber: #9a6a16;
  --red: #9b3f35;
  --shadow: 0 18px 48px rgba(23, 33, 28, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 72px);
  background: rgba(247, 248, 245, 0.92);
  border-bottom: 1px solid rgba(219, 225, 219, 0.85);
  backdrop-filter: blur(18px);
}

.brand,
.site-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  text-decoration: none;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--ink);
  color: white;
  border-radius: 7px;
  font-size: 0.8rem;
  letter-spacing: 0;
}

.site-header nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.93rem;
}

.site-header nav a {
  padding: 8px 0;
  text-decoration: none;
}

.site-header nav a.active {
  color: var(--ink);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
  gap: 42px;
  align-items: center;
  min-height: 620px;
}

.hero-lab {
  display: grid;
  grid-template-columns: minmax(320px, 0.62fr) minmax(520px, 1fr);
  gap: clamp(28px, 5vw, 74px);
  align-items: center;
  min-height: 640px;
}

.hero-copy-block h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(3.4rem, 7.2vw, 7.4rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(3rem, 6vw, 6.2rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1.65;
}

.hero-actions,
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: white;
  text-decoration: none;
  font-weight: 720;
}

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

.preview-panel,
.reader-panel,
.ledger-card,
.learn-card,
.json-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.preview-panel {
  padding: 22px;
}

.workbench-card {
  min-height: 430px;
}

.empty-workbench {
  display: grid;
  gap: 26px;
}

.panel-top,
.section-head,
.card-head,
.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-title,
.small-label,
.row-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-top h2,
.section-head h2,
.detail-top h1 {
  margin: 6px 0 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.08;
}

.hash {
  padding: 8px 10px;
  background: var(--soft);
  border-radius: 7px;
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.84rem;
}

.handoff-lines {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.handoff-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
}

.handoff-row strong {
  display: block;
  margin-bottom: 4px;
}

.handoff-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.journey-map {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.journey-step {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8faf8 100%);
}

.journey-step span,
.anatomy-cell span,
.ledger-row small,
.filter-result {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.journey-step strong {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.15;
}

.status {
  color: var(--green);
  font-weight: 760;
}

.status.challenged,
.status.disputed,
.status.neutral {
  color: var(--amber);
}

.status.negative,
.status.deprecated,
.status.superseded {
  color: var(--red);
}

.section {
  padding: 64px 0 0;
}

.section-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.ledger-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 0.36fr) minmax(0, 0.64fr);
  gap: 16px;
  margin-top: 26px;
}

.ledger-workbench.compact {
  grid-template-columns: minmax(320px, 0.44fr) minmax(0, 0.56fr);
}

.ledger-rail,
.ledger-inspector,
.trust-anatomy {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ledger-rail {
  padding: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.filter-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 720;
  cursor: pointer;
}

.filter-button.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.filter-result {
  margin: 12px 2px;
}

.ledger-list {
  display: grid;
  gap: 8px;
}

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  text-decoration: none;
}

.ledger-row.selected,
.ledger-row:hover {
  border-color: rgba(31, 122, 82, 0.46);
  background: #f4faf6;
}

.ledger-row strong {
  display: block;
  line-height: 1.25;
}

.row-counts {
  flex: 0 0 auto;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.ledger-inspector,
.trust-anatomy {
  padding: 22px;
}

.anatomy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.anatomy-grid.vertical {
  grid-template-columns: 1fr;
}

.anatomy-cell {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.anatomy-cell strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.ledger-card,
.learn-card {
  min-height: 220px;
  padding: 18px;
  box-shadow: none;
}

.ledger-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-decoration: none;
}

.ledger-card h3,
.learn-card h3 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.card-meta,
.metric-row,
.empty-state,
.learn-card p {
  color: var(--muted);
  line-height: 1.55;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: auto;
}

.metric-row span {
  padding: 9px;
  background: var(--soft);
  border-radius: 7px;
  text-align: center;
  font-size: 0.88rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(360px, 0.28fr);
  gap: 22px;
  align-items: start;
}

.detail-workbench {
  display: grid;
  grid-template-columns: minmax(0, 0.68fr) minmax(360px, 0.32fr);
  gap: 18px;
  align-items: start;
}

.inspector-stack {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 14px;
}

.reader-panel,
.json-panel {
  padding: 24px;
}

.reader-section {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.reader-section:first-of-type {
  border-top: 0;
}

.reader-section h2 {
  margin: 0 0 14px;
}

.data-list {
  display: grid;
  gap: 10px;
}

.data-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
}

.data-item p,
.data-item code {
  margin: 6px 0 0;
}

.data-item code,
.json-panel pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
}

.json-panel {
  position: sticky;
  top: 92px;
}

.inspector-stack .json-panel {
  position: static;
}

.json-panel summary {
  cursor: pointer;
  font-weight: 760;
}

.json-panel pre {
  max-height: 560px;
  overflow: auto;
  padding: 14px;
  background: #111914;
  border-radius: 7px;
  color: #eaf3ec;
}

.story-rail {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.story-step {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.story-step h2 {
  margin: 0 0 8px;
}

.story-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(20px, 5vw, 72px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .site-header,
  .site-footer,
  .panel-top,
  .section-head,
  .detail-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .hero-lab,
  .detail-layout,
  .detail-workbench,
  .ledger-workbench,
  .ledger-workbench.compact,
  .ledger-grid,
  .learn-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .hero-lab {
    min-height: auto;
  }

  .hero-copy-block h1 {
    font-size: clamp(3rem, 15vw, 4.4rem);
  }

  .handoff-row,
  .story-step {
    grid-template-columns: 1fr;
  }

  .journey-map,
  .filter-bar,
  .anatomy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .json-panel,
  .inspector-stack {
    position: static;
  }
}

@media (max-width: 520px) {
  .journey-map,
  .filter-bar,
  .anatomy-grid {
    grid-template-columns: 1fr;
  }

  .ledger-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
