:root {
  --color-bg: #ffffff;
  --color-text: #171717;
  --color-text-light: #737373;
  --color-text-lighter: #a3a3a3;
  --color-border: #e5e7eb;
  --color-accent: #ff6b35;
  --color-accent-light: #ff8c42;
  --color-code-bg: #f9fafb;
  --color-footer-bg: #fafbfc;
  --font-mono: "SF Mono", "Monaco", "Inconsolata", "Fira Code", "Courier New",
    monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0f172a;
    --color-text: #e2e8f0;
    --color-text-light: #cbd5e1;
    --color-text-lighter: #94a3b8;
    --color-border: #334155;
    --color-accent: #ff8c42;
    --color-accent-light: #ffb366;
    --color-code-bg: #1e293b;
    --color-footer-bg: #1e293b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  overflow-x: hidden;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity 0.2s var(--ease-out);
}

a:hover {
  opacity: 0.82;
}

.boot,
.site {
  width: min(100% - 48px, 900px);
  margin: 0 auto;
  padding: 40px 0 0;
}

.head {
  margin-bottom: 32px;
  text-align: center;
}

.mark {
  display: inline-block;
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
}

.map {
  margin-top: 0;
  padding: 24px 0 40px;
  text-align: center;
}

.map h1 {
  margin: 0 0 1.25rem;
  color: var(--color-text);
  font-size: clamp(3.1rem, 9vw, 5rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.map svg {
  display: block;
  width: 100%;
  height: auto;
  margin: 8px auto 0;
  overflow: hidden;
}

.stem {
  stroke: var(--color-text);
  stroke-width: 3.5;
  stroke-linecap: round;
  opacity: 0.9;
}

.home-trace {
  stroke: var(--color-text-lighter);
  stroke-width: 1;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
  opacity: 0.42;
}

.edge {
  stroke: var(--color-border);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.edge.hot {
  stroke: var(--color-accent);
  stroke-width: 2.2;
  opacity: 0.95;
}

.edge.focus {
  stroke: var(--color-accent-light);
  stroke-width: 1.8;
  opacity: 0.78;
}

.edge.dim {
  opacity: 0.22;
}

.node {
  fill: var(--color-accent);
  opacity: 0.72;
  transition: opacity 0.2s var(--ease-out);
}

.node-link {
  cursor: pointer;
  outline: none;
}

.home-node-link {
  cursor: pointer;
  outline: none;
}

.node-hit {
  fill: transparent;
  pointer-events: all;
}

.home-node-hit {
  fill: transparent;
  pointer-events: all;
}

.node-link:hover .node,
.node-link:focus .node,
.node-link:focus-visible .node {
  opacity: 1;
}

.home-node {
  fill: var(--color-text-lighter);
  opacity: 0.55;
  transition: opacity 0.2s var(--ease-out);
}

.home-node-link:hover .home-node,
.home-node-link:focus .home-node,
.home-node-link:focus-visible .home-node {
  opacity: 0.9;
}

.node.missing {
  fill: #dc2626;
}

.node.neighbor {
  fill: var(--color-accent-light);
  opacity: 0.95;
}

.node.current {
  fill: var(--color-accent-light);
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--color-accent))
    drop-shadow(0 0 12px var(--color-accent));
}

.node.match {
  fill: var(--color-accent-light);
  opacity: 1;
  filter: drop-shadow(0 0 4px var(--color-accent));
}

.node.dim {
  opacity: 0.2;
}

.spark {
  fill: var(--color-accent);
  opacity: 0.22;
}

.spark.hot {
  fill: var(--color-accent-light);
  opacity: 0.38;
}

.label {
  font-size: 13px;
  fill: var(--color-text-light);
  paint-order: stroke fill;
  stroke: var(--color-bg);
  stroke-linejoin: round;
  stroke-width: 4px;
  pointer-events: none;
}

.label.match {
  fill: var(--color-text);
}

.label.dim {
  opacity: 0.28;
}

.home-label {
  display: none;
  fill: var(--color-text-lighter);
  font-size: 12px;
  font-weight: 650;
  paint-order: stroke fill;
  pointer-events: none;
  stroke: var(--color-bg);
  stroke-linejoin: round;
  stroke-width: 4px;
}

.node-tip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s var(--ease-out);
}

.node-link:hover .node-tip,
.node-link:focus .node-tip,
.node-link:focus-visible .node-tip,
.home-node-link:hover .node-tip,
.home-node-link:focus .node-tip,
.home-node-link:focus-visible .node-tip {
  opacity: 1;
}

.node-tip-bg {
  fill: var(--color-text);
  stroke: var(--color-bg);
  stroke-width: 1;
}

.node-tip-text {
  fill: var(--color-bg);
  font-size: 11px;
  font-weight: 650;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: min(100%, 560px);
  margin: 18px auto 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-light);
  text-align: left;
}

.filter-label,
.filter-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-input {
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  outline: 0;
  color: var(--color-text);
  background: transparent;
  font: inherit;
}

.filter-input:focus {
  color: var(--color-accent);
}

.filter-results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.9rem;
  width: min(100%, 680px);
  margin: 12px auto 0;
  color: var(--color-text-light);
  font-size: 0.86rem;
}

.filter-results a {
  color: var(--color-text-light);
  text-decoration: none;
}

.filter-results a:hover,
.filter-results a.active {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.view-switch {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 18px 0 56px;
  font-size: 0.92rem;
}

.view-switch a {
  color: var(--color-text-light);
  text-decoration: none;
}

.view-switch a:hover,
.view-switch a.active {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.note {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 0 56px;
  border-top: 1px solid var(--color-border);
}

.note h1 {
  margin: 0 0 1.75rem;
  color: var(--color-text);
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.note h2 {
  margin: 3rem 0 1rem;
  color: var(--color-text);
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.note h1 + h2 {
  margin-top: 1rem;
}

.note h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.05rem;
}

.note p {
  margin: 1.1rem 0;
  color: var(--color-text-light);
}

.note ul {
  margin: 1.1rem 0;
  padding-left: 1.25rem;
  color: var(--color-text-light);
}

.note ol {
  margin: 1.1rem 0;
  padding-left: 1.35rem;
  color: var(--color-text-light);
}

.note li + li {
  margin-top: 0.22rem;
}

.note blockquote {
  margin: 1.4rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--color-border);
  color: var(--color-text-light);
}

.note blockquote p {
  margin: 0.65rem 0;
}

.note .callout {
  border-color: var(--color-accent);
}

.note code {
  padding: 0.08rem 0.24rem;
  border-radius: 3px;
  background: var(--color-code-bg);
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.note pre {
  margin: 1.5rem 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-code-bg);
}

.note pre code {
  padding: 0;
  background: transparent;
}

.note table {
  width: 100%;
  margin: 1.4rem 0;
  border-collapse: collapse;
  color: var(--color-text-light);
  font-size: 0.9rem;
}

.note th,
.note td {
  padding: 0.48rem 0.62rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.note th {
  color: var(--color-text);
  font-weight: 650;
}

.diagram {
  margin: 1.7rem 0;
  overflow-x: auto;
}

.diagram svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: auto;
}

.wiki,
.external {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.backlinks {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}

.backlinks h2 {
  margin: 0 0 0.75rem;
  color: var(--color-text-light);
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: lowercase;
}

.foot {
  margin: 0 calc(50% - 50vw);
  padding: 40px 24px 32px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-light);
  background: var(--color-footer-bg);
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 640px) {
  .boot,
  .site {
    width: min(100% - 32px, 900px);
    padding-top: 24px;
  }

  .head {
    margin-bottom: 20px;
  }

  .map {
    padding: 12px 0 24px;
  }

  .map h1 {
    margin-bottom: 0.9rem;
    font-size: clamp(2.6rem, 11vw, 3.8rem);
    letter-spacing: 0.05em;
  }

  .map svg {
    margin-top: 0;
  }

  .label {
    display: block;
    fill: var(--color-text);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.9;
    stroke-width: 5px;
  }

  .label.match {
    fill: var(--color-accent);
  }

  .label.dim {
    opacity: 0.18;
  }

  .home-label {
    display: block;
    font-size: 18px;
    letter-spacing: 0.04em;
    opacity: 0.68;
    stroke-width: 5px;
  }

  .filter {
    margin-top: 10px;
  }

  .view-switch {
    margin: 14px 0 32px;
  }

  .note {
    padding: 32px 0 56px;
  }

  .note h1 {
    margin-bottom: 1rem;
  }

  .note h2 {
    margin-top: 2.2rem;
  }

  .note h1 + h2 {
    margin-top: 0;
  }

  .filter {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .filter-count {
    display: none;
  }

  .stem {
    stroke-width: 3;
  }
}
