:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #172033;
  --muted: #667085;
  --border: #d9dee8;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --line: #344054;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }

.page-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.hero {
  padding: 8px 0 24px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 8px 0 12px;
  font-size: clamp(32px, 5vw, 64px);
  line-height: .98;
  letter-spacing: -0.04em;
}

.hero p,
.methodology p {
  max-width: 900px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
}

.filter {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: .18s ease;
}

.filter:hover,
.filter:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.filter.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #1746a2;
}

.notice,
.details,
.methodology {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  padding: 16px 18px;
}

.notice {
  color: var(--muted);
  font-size: 14px;
}

.notice strong { color: var(--text); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 13px;
}

.legend > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.line {
  width: 42px;
  height: 0;
  border-top: 2px solid var(--line);
}

.line-dashed { border-top-style: dashed; }
.line-dotted { border-top-style: dotted; }

.graph-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  overflow: hidden;
}

.graph-scroll {
  overflow-x: auto;
  padding: 10px;
}

svg {
  width: 100%;
  min-width: 1180px;
  height: auto;
  display: block;
}

.section-labels {
  font-size: 15px;
  font-weight: 700;
  fill: var(--muted);
}

.edge-group {
  fill: none;
  stroke-width: 1.6;
  opacity: .7;
}

.edge-group.branch {
  stroke: var(--line);
  marker-end: url(#arrowSolid);
}

.edge-group.influence {
  stroke: var(--muted);
  stroke-dasharray: 7 6;
  marker-end: url(#arrowMuted);
}

.edge-group.parallel {
  stroke: var(--muted);
  stroke-dasharray: 2 7;
  opacity: .5;
}

.arrow-solid { fill: var(--line); }
.arrow-muted { fill: var(--muted); }

.node {
  cursor: pointer;
}

.node rect {
  fill: #ffffff;
  stroke: var(--border);
  stroke-width: 1;
  transition: .16s ease;
}

.major .node rect {
  fill: #f5f7fb;
}

.node text {
  fill: var(--text);
  font-size: 12.5px;
  text-anchor: middle;
  pointer-events: none;
}

.node .node-date {
  fill: var(--muted);
  font-size: 11.5px;
}

.node:hover rect,
.node:focus-visible rect,
.node.is-active rect {
  stroke: var(--accent);
  stroke-width: 3;
}

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

.details {
  margin-top: 16px;
}

.details h2,
.methodology h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.details p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.details .date {
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 700;
}

.methodology {
  margin-top: 16px;
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 20px, 1500px);
    padding-top: 24px;
  }

  h1 { font-size: 38px; }

  .hero p { font-size: 15px; }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filter { width: 100%; text-align: left; }

  .legend {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

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