@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
}

:root {
  --bg: #0a0a0f;
  --bg-raised: #12131a;
  --bg-inline: #1a1b24;
  --border: #22232e;
  --border-soft: #1a1b24;
  --text: #e8e8ef;
  --text-dim: #8a8b99;
  --text-faint: #5a5b68;
  --accent: #7c6cff;
  --accent-glow: rgba(124, 108, 255, 0.25);
  --accent-2: #00d9c4;

  --type-audio: #7c6cff;
  --type-control: #00d9c4;
  --type-midi: #ff6ca8;
  --type-gate: #ffb86c;
  --type-voct: #a6e22e;
  --type-data: #88aaff;
  --type-image: #ff8a3d;
  --type-spectral: #c792ea;
  --type-sink: #6a6b78;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body.docs {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────── */

.docs-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0a0a0f;
  font-size: 0.9rem;
}

.docs-nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
}

/* ── Layout ─────────────────────────────────────────────────── */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  gap: 2rem;
  padding: 2rem 1.5rem 4rem;
}

.docs-sidebar {
  position: sticky;
  top: 5rem;
  align-self: start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  font-size: 0.9rem;
}

.docs-sidebar::-webkit-scrollbar {
  width: 6px;
}
.docs-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.docs-main {
  min-width: 0;
}

.docs-intro {
  margin-bottom: 3rem;
}

.docs-intro h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  background: linear-gradient(180deg, #ffffff 0%, #a8a8b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.docs-intro p {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 720px;
}

/* ── Sidebar ────────────────────────────────────────────────── */

.sidebar-search {
  margin-bottom: 1.25rem;
}

.sidebar-search input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.sidebar-search input:focus {
  border-color: var(--accent);
}

.sidebar-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
  padding-left: 0.2rem;
}

.toc {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.toc a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.toc a:hover {
  color: var(--text);
  background: var(--bg-raised);
}

.toc-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
}

.toc-h1 { font-weight: 600; color: var(--text); margin-top: 0.75rem; }
.toc-h2 { font-weight: 500; }
.toc-h3 { padding-left: 1.2rem; font-size: 0.85rem; }

/* ── Node cards ─────────────────────────────────────────────── */

.category {
  margin-bottom: 3rem;
}

.category-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.node {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  scroll-margin-top: 5rem;
  overflow: hidden;
}

.node-preview {
  float: right;
  width: 220px;
  max-width: 100%;
  margin: 0 0 1rem 1.5rem;
  height: auto;
  display: block;
}

@media (max-width: 720px) {
  .node-preview {
    float: none;
    margin: 0 auto 1rem;
  }
}

.node-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.node-title a {
  color: var(--text);
  text-decoration: none;
}

.node-title a:hover {
  color: var(--accent);
}

.node-desc {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
}

.node-help {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-top: 0.5rem;
}

.section-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Properties table */

.props {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.props thead {
  background: var(--bg-inline);
}

.props th {
  text-align: left;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.props td {
  padding: 0.5rem 0.75rem;
  color: var(--text-dim);
  vertical-align: top;
  border-bottom: 1px solid var(--border-soft);
}

.props tr:last-child td {
  border-bottom: none;
}

.props code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
  color: var(--text);
  background: transparent;
  padding: 0;
}

.prop-group {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-left: 0.4rem;
}

/* Ports */

.ports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .ports {
    grid-template-columns: 1fr;
  }
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-sidebar {
    position: static;
    max-height: none;
  }
}

.port-group .section-label {
  margin-top: 0.25rem;
}

.port {
  font-size: 0.85rem;
  padding: 0.35rem 0;
  color: var(--text-dim);
  line-height: 1.5;
}

.port-name {
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
  font-size: 0.8rem;
}

.port-type {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--bg-inline);
  color: var(--text);
  margin-left: 0.25rem;
}

.port-type.type-audio { color: var(--type-audio); }
.port-type.type-control { color: var(--type-control); }
.port-type.type-midi { color: var(--type-midi); }
.port-type.type-gate { color: var(--type-gate); }
.port-type.type-voct { color: var(--type-voct); }
.port-type.type-data { color: var(--type-data); }
.port-type.type-image { color: var(--type-image); }
.port-type.type-spectral { color: var(--type-spectral); }
.port-type.type-sink { color: var(--type-sink); }

.port-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-left: 0.25rem;
}

/* ── Prose (scripting guide) ────────────────────────────────── */

.prose {
  max-width: 820px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.prose h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1rem 0 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #a8a8b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.prose h2 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 5rem;
}

.prose h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  scroll-margin-top: 5rem;
}

.prose h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.prose p {
  color: var(--text-dim);
  margin: 0.75rem 0;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose em {
  color: var(--text);
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}

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

.prose ul,
.prose ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
  color: var(--text-dim);
}

.prose li {
  margin: 0.3rem 0;
}

.prose code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85em;
  background: var(--bg-inline);
  color: var(--text);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.prose pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.prose pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: var(--text);
}

/* Rhai syntax highlighting - palette mirrors
   libs/platform-bevy/src/renderers/rhai_highlight.rs so the docs match the
   in-editor console and script editor exactly. */
.code-rhai code {
  color: rgb(171, 178, 191);
}
.code-rhai .rhai-kw { color: rgb(198, 120, 221); }
.code-rhai .rhai-bi { color: rgb(97, 175, 239); }
.code-rhai .rhai-str { color: rgb(152, 195, 121); }
.code-rhai .rhai-num { color: rgb(209, 154, 102); }
.code-rhai .rhai-com { color: rgb(92, 99, 112); font-style: italic; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1rem;
  margin: 1rem 0;
  color: var(--text-dim);
  font-style: italic;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.prose th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg-inline);
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.prose td {
  padding: 0.5rem 0.75rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-soft);
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
