:root {
  /* Base color: calm medium green */
  --green: #3E7C61;
  --green-dark: #33684F;
  --green-tint: #E6F0EA;

  --bg: #F3F7F4;
  --panel: #ffffff;
  /* Logo colors */
  --navy: #14213D;
  --navy-2: #2A3D63;
  --mint: #7CC4B2;

  --ink: var(--navy);
  --muted: #6b7280;
  --line: #E1E7E3;
  --accent: var(--green);

  /* Graph circle colors, one per kind of item */
  --c-institution: #14213D;
  --c-field: #7c3aed;
  --c-author: #0891b2;
  --c-topic: #d97706;
  --c-work: #2563eb;
  --c-book: #db2777;
  --c-textbook: #16a34a;

  --radius: 10px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

button { font: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }

.brand h1 { margin: 0; line-height: 0; }
.logo { height: 34px; width: auto; display: block; }

.tagline {
  margin: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.search { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 640px; min-width: 280px; }

.modes {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.mode {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}

.mode.active { background: var(--green); color: #fff; }

.search-box { position: relative; flex: 1; display: flex; }

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--panel);
}

.search-box input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.go {
  border: 0;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
}

.candidates {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  margin: 0; padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  z-index: 20;
  max-height: 60vh;
  overflow-y: auto;
}

.candidates li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.candidates li:hover, .candidates li.focus { background: var(--bg); }
.candidates .name { font-size: 14px; font-weight: 600; }
.candidates .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.candidates .none { color: var(--muted); cursor: default; }

/* ---------- Welcome section ---------- */

.hero {
  max-width: 1160px;
  margin: 0 auto;
  padding: 72px 24px 56px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
}

.hero h2 {
  margin: 0;
  font-size: clamp(32px, 4.4vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--navy);
}

.lede {
  margin: 18px 0 28px;
  max-width: 520px;
  font-size: 17px;
  line-height: 1.6;
  color: #3f4756;
}

.cta { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.go:hover { background: var(--green-dark); }
.btn.ghost { background: var(--panel); border-color: var(--line); color: var(--navy); }
.btn.ghost:hover { border-color: var(--green); color: var(--green); }

.powered { margin: 22px 0 0; font-size: 13px; color: var(--muted); }
.powered a { color: var(--green); }

.hero-art {
  margin: 0;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(20, 33, 61, 0.08);
}

.hero-art svg { display: block; width: 100%; height: auto; }
.hero-art .branches { stroke: #c9d1de; }
.hero-art text { font-size: 13px; fill: #3f4756; font-family: inherit; }
.hero-art text.small { font-size: 11px; fill: var(--muted); font-style: italic; }
.hero-art .n-work { fill: var(--c-work); }
.hero-art .n-book { fill: var(--c-book); }
.hero-art .n-textbook { fill: var(--c-textbook); }

.steps {
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px 24px 64px;
}

.steps-title {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.steps li {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.steps .num {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green);
  font-weight: 700;
  font-size: 14px;
}

.steps h3 { margin: 12px 0 6px; font-size: 17px; color: var(--navy); }
.steps p { margin: 0; font-size: 14px; line-height: 1.55; color: #3f4756; }

/* ---------- Explorer ---------- */

.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh - 69px);
  min-height: 520px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 69px;
}

.graph-wrap { position: relative; min-height: 0; }

#graph { position: absolute; inset: 0; }

.empty {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px));
  text-align: center;
  color: var(--muted);
}

.empty h2 { color: var(--ink); margin: 0 0 8px; font-size: 20px; }
.empty p { line-height: 1.55; font-size: 14px; }

.examples button {
  margin: 4px 2px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
}

.examples button:hover { border-color: var(--accent); color: var(--accent); }

.legend {
  position: absolute;
  left: 16px; bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  max-width: calc(100% - 140px);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--muted);
}

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

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.institution { background: var(--c-institution); }
.dot.field { background: var(--c-field); }
.dot.author { background: var(--c-author); }
.dot.topic { background: var(--c-topic); }
.dot.work { background: var(--c-work); }
.dot.book { background: var(--c-book); }
.dot.textbook { background: var(--c-textbook); border-radius: 3px; }
.dot.dashed { background: transparent; border: 2px dashed var(--muted); }

.graph-tools {
  position: absolute;
  right: 16px; bottom: 16px;
  display: flex; gap: 6px;
}

.graph-tools button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 13px;
}

.status {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.status.error { background: #b91c1c; }

/* ---------- Details panel ---------- */

.details {
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 20px 22px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
}

.details h2 { font-size: 17px; margin: 6px 0 10px; line-height: 1.35; }

.kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}

.kind.institution { background: var(--c-institution); }
.kind.field { background: var(--c-field); }
.kind.author { background: var(--c-author); }
.kind.topic { background: var(--c-topic); }
.kind.work { background: var(--c-work); }
.kind.book { background: var(--c-book); }
.kind.textbook { background: var(--c-textbook); }

.facts { margin: 12px 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.path {
  margin: 14px 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
}

.path ol { margin: 6px 0 0; padding-left: 18px; }
.path li { margin: 2px 0; }

.abstract { color: #374151; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.links a {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.links a:hover { border-color: var(--accent); }

.hint { margin-top: 16px; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 40px 16px 32px; gap: 28px; }
  .steps { padding: 0 16px 40px; }
  .steps ol { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 70vh auto; height: auto; }
  .details { border-left: 0; border-top: 1px solid var(--line); }
  .topbar { padding: 12px 16px; position: static; }
  .tagline { display: none; }
  .topbar { gap: 12px; }
  .search { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; max-width: none; }
  .search-box { width: 100%; }
  .legend { display: none; }
}

/* Clickable steps in "How you got here" */
.crumb {
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.crumb:hover { color: var(--green-dark); }
/* Graph cursor: open hand on the background, closed hand while dragging */
#graph { cursor: grab; }
#graph.dragging { cursor: grabbing; }

.graph-tools button { min-width: 34px; transition: border-color 0.2s, color 0.2s; }
.graph-tools button:hover { border-color: var(--green); color: var(--green); }
