:root {
  --ink: #1a1a2e;
  --muted: #5b6472;
  --accent: #2f5d8a;
  --accent-soft: #e8f0f8;
  --line: #dfe3e8;
  --bg: #ffffff;
  --card: #f7f9fb;
  --chip-intro: #e3f0e6;
  --chip-intro-ink: #2c6b3f;
  --chip-req: #f0eadf;
  --chip-req-ink: #8a6d2f;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
a { color: var(--accent); }

/* ---- shared top nav ---- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--line);
}
.nav .brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.nav .links { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav .links a {
  padding: .35rem .75rem; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: .92rem; font-weight: 550;
}
.nav .links a:hover { background: var(--card); color: var(--ink); }
.nav .links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }

/* ---- landing / About page ---- */
.wrap { max-width: 820px; margin: 0 auto; padding: 2.25rem 1.25rem 4rem; }
.hero h1 { font-size: 2.1rem; margin: 0 0 .4rem; letter-spacing: -0.02em; }
.hero .lead { font-size: 1.1rem; color: #333b45; margin: 0 0 1.1rem; }
.hero .desc { margin: 0; color: #2a2f38; }
.section-title {
  font-size: .82rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); font-weight: 700; margin: 2.5rem 0 1.1rem;
}
.objectives { counter-reset: obj; list-style: none; padding: 0; margin: 0; }
.objectives li { position: relative; padding: 0 0 1.15rem 2.7rem; margin: 0; color: #2a2f38; }
.objectives li::before {
  counter-increment: obj; content: counter(obj);
  position: absolute; left: 0; top: .05rem;
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.cta { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 2.25rem; }
.cta a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.15rem; border-radius: 8px; text-decoration: none;
  font-weight: 600; font-size: .95rem;
}
.cta a.primary { background: var(--accent); color: #fff; }
.cta a.primary:hover { background: #24486b; }
.cta a.secondary { border: 1px solid var(--line); color: var(--ink); background: var(--card); }
.cta a.secondary:hover { border-color: var(--accent); }
.prereq { margin-top: 2.5rem; font-size: .92rem; color: var(--muted); }

/* ---- concept-map page ---- */
body.page-map { display: flex; flex-direction: column; height: 100vh; }
body.page-map main { flex: 1; display: flex; min-height: 0; }
/* position: relative is required — Cytoscape anchors its absolutely positioned
   canvas layers to the nearest positioned ancestor; without it the canvas
   offsets from the container and clicks land in the wrong spot. */
#graph {
  flex: 1 1 62%; min-width: 0; position: relative;
  background: radial-gradient(circle at 1px 1px, #eef1f5 1px, transparent 0) 0 0 / 22px 22px;
}
aside#panel {
  flex: 0 0 34%; max-width: 420px;
  border-left: 1px solid var(--line);
  padding: 1.4rem 1.4rem 2rem; overflow-y: auto; background: var(--bg);
}
@media (max-width: 780px) {
  body.page-map main { flex-direction: column; }
  #graph { flex: none; height: 56vh; }
  aside#panel { flex: none; max-width: none; border-left: none; border-top: 1px solid var(--line); }
}

.panel-hint { color: var(--muted); }
.panel-hint strong { color: var(--ink); }
.detail .order { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); font-weight: 700; }
.detail h2 { font-size: 1.3rem; margin: .25rem 0 .6rem; }
.detail .summary { color: #2a2f38; margin: 0 0 1.1rem; }
.detail h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font-size: .82rem; padding: .2rem .6rem; border-radius: 999px; }
.chip.intro { background: var(--chip-intro); color: var(--chip-intro-ink); }
.chip.req { background: var(--chip-req); color: var(--chip-req-ink); }
.chip.none { background: var(--card); color: var(--muted); }
.detail .read {
  display: inline-block; margin-top: 1.3rem;
  background: var(--accent); color: #fff; text-decoration: none;
  padding: .5rem 1rem; border-radius: 8px; font-weight: 600; font-size: .92rem;
}
.detail .read:hover { background: #24486b; }
.detail ul.videos { list-style: none; padding: 0; margin: .35rem 0 0; }
.detail ul.videos li { margin: 0 0 .4rem; }
.detail ul.videos a { display: inline-flex; align-items: baseline; gap: .5rem; text-decoration: none; font-size: .95rem; color: var(--accent); }
.detail ul.videos a::before { content: "\25B6"; color: #c4302b; font-size: .7rem; }
.detail ul.videos a:hover { text-decoration: underline; }

.loading, .error { padding: 1.4rem; color: var(--muted); }
.error { color: #a3402f; }
