:root {
  --bg: #f6f8fb;
  --paper: #ffffff;
  --surface: rgba(255, 255, 255, 0.96);
  --line: rgba(100, 116, 139, 0.18);
  --line-strong: rgba(100, 116, 139, 0.3);
  --text: #151a22;
  --muted: #667085;
  --accent: #3559d8;
  --accent-soft: rgba(53, 89, 216, 0.1);
  --chip: rgba(248, 250, 252, 0.96);
  --radius-lg: 18px;
  --radius-md: 14px;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(109, 167, 255, 0.08), transparent 0 18%),
    radial-gradient(circle at 10% 20%, rgba(193, 127, 242, 0.06), transparent 0 16%),
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1040px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 64px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 0.98rem;
}

.brand-copy span,
.topnav,
.hero-text,
.focus-copy,
.compact-item p,
.resource-row p,
.pretext-result p,
.active-filter,
.muted-row,
.focus-note,
.accordion-meta {
  color: var(--muted);
}

.topnav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
}

.stack {
  padding-top: 22px;
}

.hero {
  padding: 6px 4px 0;
}

.eyebrow,
.panel-label,
.subhead,
.compact-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.hero-text,
.focus-copy,
.compact-item p,
.resource-row p,
.pretext-result p,
.accordion-inner p {
  line-height: 1.65;
}

.hero-text {
  max-width: 58ch;
  margin: 12px 0 0;
}

.measured-title {
  display: grid;
  gap: 8px;
  width: min(100%, var(--title-max-width, 100%));
  margin-top: 10px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.05em;
}

.measured-title-hero {
  font-size: var(--title-font-size, 52px);
}

.measured-title-focus {
  font-size: var(--title-font-size, 42px);
}

.measured-line {
  display: block;
  width: min(100%, var(--line-width));
  padding: 0.02em 0.14em 0.07em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 255, 0.96));
  box-shadow: 0 0 0 1px rgba(109, 125, 153, 0.12);
}

.stats-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.stats-line span,
.rail-pill,
.tag,
.focus-count,
.pretext-row button {
  border-radius: 999px;
}

.stats-line span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--chip);
}

.controls,
.map-section,
.focus-sheet,
.library,
.intake {
  margin-top: 22px;
}

.search-box {
  display: grid;
  gap: 8px;
}

.search-box label,
.pretext-form label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.search-box input,
.pretext-row input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font: inherit;
}

.lane-rail,
.inline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lane-rail {
  margin-top: 14px;
}

.rail-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.rail-pill strong {
  color: var(--accent);
  font-size: 0.86rem;
}

.rail-pill.active {
  border-color: rgba(53, 89, 216, 0.28);
  background: rgba(232, 239, 255, 0.98);
}

.map-section,
.focus-sheet,
.library,
.intake {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.focus-header,
.section-row,
.resource-row,
.resource-head,
.pretext-row,
.accordion-trigger {
  display: flex;
  gap: 14px;
}

.focus-header,
.section-row,
.resource-head,
.accordion-trigger {
  align-items: start;
  justify-content: space-between;
}

.focus-count {
  padding: 8px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  white-space: nowrap;
}

.focus-copy {
  max-width: 64ch;
  margin: 12px 0 0;
}

.focus-note {
  margin-top: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.graph-wrap {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(109, 125, 153, 0.16);
  border-radius: calc(var(--radius-lg) - 2px);
  background:
    radial-gradient(circle at top left, rgba(141, 211, 247, 0.08), transparent 0 24%),
    radial-gradient(circle at 80% 18%, rgba(193, 127, 242, 0.08), transparent 0 22%),
    linear-gradient(180deg, #ffffff 0%, #f7f9fd 100%);
}

#graph-stage {
  width: 100%;
  display: block;
  overflow: visible;
}

.graph-label {
  fill: rgba(102, 112, 133, 0.9);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-hub {
  transition: transform 180ms ease;
}

.graph-hub:hover,
.graph-hub.active {
  transform: translateY(-1px);
}

.focus-accordion {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.accordion-item {
  border-bottom: 1px solid var(--line);
}

.accordion-trigger {
  width: 100%;
  padding: 14px 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.accordion-title {
  font-weight: 600;
  font-size: 1rem;
}

.accordion-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  margin-left: auto;
  white-space: nowrap;
}

.accordion-caret {
  width: 18px;
  text-align: right;
  font-size: 1.1rem;
  color: var(--accent);
}

.accordion-body {
  overflow: hidden;
  transition: max-height 220ms ease;
}

.accordion-inner {
  padding: 0 0 16px;
}

.accordion-inner p {
  margin: 0;
}

.accordion-links {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.accordion-links a {
  width: fit-content;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(53, 89, 216, 0.24);
}

.section-row h2 {
  margin: 8px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.active-filter {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.resource-list {
  display: grid;
}

.resource-row {
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.resource-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.resource-main {
  min-width: 0;
  flex: 1;
}

.resource-title,
.bridge-line {
  font-weight: 600;
}

.resource-head {
  margin-bottom: 4px;
}

.resource-row p {
  margin: 0;
}

.resource-side {
  min-width: 110px;
  display: grid;
  gap: 6px;
  justify-items: end;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
}

.tag.muted {
  background: transparent;
}

.pretext-form {
  display: grid;
  gap: 10px;
}

.pretext-row {
  margin-top: 2px;
}

.pretext-row input {
  flex: 1;
}

.pretext-row button {
  padding: 0 16px;
  border: 0;
  background: var(--text);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.pretext-result {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.muted-row {
  padding: 12px 0;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 480ms ease forwards;
}

.reveal:nth-child(2) { animation-delay: 70ms; }
.reveal:nth-child(3) { animation-delay: 120ms; }
.reveal:nth-child(4) { animation-delay: 170ms; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 14px;
  }

  .topbar,
  .focus-header,
  .section-row,
  .resource-row,
  .resource-head,
  .pretext-row,
  .accordion-trigger {
    flex-direction: column;
  }

  .accordion-meta {
    margin-left: 0;
    white-space: normal;
  }

  .resource-side {
    justify-items: start;
    min-width: 0;
  }

  .topnav {
    gap: 12px;
  }
}
