/* Substrate Net docs
   Minimal, quiet, graph-native. OS-driven theme. */

:root {
  --bg: #d4cec0;
  --bg-deep: #c4bcaa;
  --panel: #f0ebe0;
  --panel-solid: #f0ebe0;
  --ink: #0a0a08;
  --mute: #45483f;
  --faint: #6f7368;
  --rule: #b8b29f;
  --code-bg: #ddd7c6;
  --accent: #7a3f28;
  --accent-2: #264a42;
  --accent-soft: rgba(122, 63, 40, 0.24);
  --node: rgba(38, 74, 66, 0.28);
  --node-strong: rgba(38, 74, 66, 0.46);
  --max: 1040px;
  --measure: 760px;

  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Inter", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070807;
    --bg-deep: #030403;
    --panel: #101311;
    --panel-solid: #101311;
    --ink: #f2f0e7;
    --mute: #adb1a7;
    --faint: #72776f;
    --rule: #2f352f;
    --code-bg: #121614;
    --accent: #d88f63;
    --accent-2: #7ab8a4;
    --accent-soft: rgba(216, 143, 99, 0.24);
    --node: rgba(122, 184, 164, 0.18);
    --node-strong: rgba(122, 184, 164, 0.32);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
  background: transparent;
}

/* Canvas node field (substrate-bg.js) — dots only, no edges. */
.substrate-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.55;
}

/* Solid depth wash — no wireframe, no grid. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 42%, var(--bg) 100%),
    radial-gradient(900px 620px at 88% 8%, color-mix(in srgb, var(--accent-2) 10%, var(--bg)), transparent 68%),
    radial-gradient(760px 540px at 10% 22%, color-mix(in srgb, var(--accent) 8%, var(--bg)), transparent 72%);
  will-change: opacity;
}

@media (prefers-reduced-motion: no-preference) {
  body::before {
    animation: depthPulse 48s ease-in-out infinite alternate;
  }
}

@keyframes depthPulse {
  from { opacity: 1; }
  to   { opacity: 0.88; }
}

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px 28px 96px;
  position: relative;
}

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

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0 22px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  backdrop-filter: blur(12px);
}

.brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}

nav.site-nav {
  font-family: var(--font-mono);
  font-size: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

nav.site-nav a {
  color: var(--mute);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 2px 0 4px;
}
nav.site-nav a:hover { color: var(--ink); }
nav.site-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ─── Typography ─────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 2.2em 0 0.6em;
}
h1 { font-size: clamp(34px, 7vw, 72px); margin-top: 0; line-height: 0.98; }
h2 { font-size: 23px; padding-top: 28px; border-top: 1px solid var(--rule); }
h3 { font-size: 17px; color: var(--ink); }
h4 { font-size: 15px; color: var(--mute); text-transform: uppercase; letter-spacing: 0.05em; }

h1 + .lede,
h1 + p.lede {
  color: var(--mute);
  font-size: 18px;
  margin-top: -0.4em;
  margin-bottom: 2em;
  max-width: var(--measure);
}

p { margin: 1em 0; max-width: var(--measure); }

strong { font-weight: 600; }
em { font-style: italic; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--accent); }

hr {
  border: none;
  height: 1px;
  background: var(--rule);
  margin: 3em 0;
}

/* ─── Code ───────────────────────────────────────────────────── */

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

p code, li code, td code, h3 code, h4 code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.55;
  background: color-mix(in srgb, var(--code-bg) 88%, transparent);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent-2);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.4em 0;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.04);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

/* shell-prompt prefix decoration when class is set */
pre.shell code::before { content: ""; }

/* ─── Lists ──────────────────────────────────────────────────── */

ul, ol { padding-left: 1.4em; }
li { margin: 0.35em 0; }

/* ─── Tables ─────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.92em;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  display: block;
  max-width: 100%;
}
tbody { display: table; width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85em;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--ink);
}
tr:hover td { background: var(--code-bg); }

/* ─── Blockquotes ────────────────────────────────────────────── */

blockquote {
  margin: 1.6em 0;
  padding: 8px 18px;
  border-left: 2px solid var(--accent);
  color: var(--mute);
  font-style: italic;
}

/* ─── Landing-specific ───────────────────────────────────────── */

.hero {
  margin: 18px 0 44px;
  max-width: var(--measure);
  padding: 0;
}
.hero h1 {
  max-width: var(--measure);
}
.hero .tagline {
  font-size: 18px;
  color: var(--mute);
  max-width: var(--measure);
  margin: 0.6em 0 1.6em;
}
.eyebrow {
  font-family: var(--font-mono);
  color: var(--accent-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 16px;
}
.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 24px;
}
.hero-actions a {
  text-decoration: none;
  padding: 9px 15px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel);
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.hero-actions a:hover { transform: translateY(-1px); }
.hero-actions a.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.hero-actions a:hover {
  border-color: var(--accent);
}

/* layer stack — ASCII-ish */
.layers {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  background: color-mix(in srgb, var(--code-bg) 82%, transparent);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px 22px;
  margin: 28px 0;
  white-space: pre;
  overflow-x: auto;
  color: var(--mute);
}
.layers .lname { color: var(--accent); }
.layers .ldesc { color: var(--ink); }

/* features grid */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 34px 0;
  font-size: 15px;
}
.features.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0 44px;
}
.feature,
.guide-card,
.stat {
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--panel);
  padding: 18px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.feature:hover,
.guide-card:hover,
.stat:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
}
.feature h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--accent-2);
}
.feature p {
  margin: 0;
  max-width: none;
  color: var(--mute);
}

/* page footer */
.site-footer {
  margin-top: 88px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  color: var(--mute);
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--mute); }
.site-footer a:hover { color: var(--ink); }

/* in-page TOC */
.toc {
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--rule);
  padding: 14px 18px;
  border-radius: 12px;
  margin: 0 0 32px;
  color: var(--mute);
  background: var(--panel);
  max-width: var(--measure);
}
.toc h4 {
  margin: 0 0 8px;
  font-size: 11px;
}
.toc ul { padding-left: 16px; margin: 0; }
.toc a { color: var(--mute); text-decoration: none; }
.toc a:hover { color: var(--ink); }

/* Mermaid wrapper */
.mermaid {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 18px;
  margin: 1.6em 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-x: auto;
}

/* callout */
.callout {
  margin: 1.6em 0;
  padding: 14px 18px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.94em;
  max-width: var(--measure);
}
.callout strong { color: var(--accent); }

/* Landing modules */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 24px 0 36px;
}
.stat .num {
  font-family: var(--font-mono);
  font-size: 24px;
  color: var(--accent);
}
.stat .label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 20px 0 40px;
}
.guide-card {
  text-decoration: none;
  color: var(--ink);
  display: block;
  min-height: 150px;
}
.guide-card:hover { border-color: var(--accent); }
.guide-card .kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.guide-card h3 { margin: 10px 0 8px; }
.guide-card p { color: var(--mute); margin: 0; max-width: none; font-size: 14px; }

/* screenshots / figures */
.shot {
  margin: 22px 0 28px;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #0a0c10;
}
.shot figcaption {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  margin-top: 8px;
}
.shot.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.shot.duo figcaption { grid-column: auto; }
@media (max-width: 720px) { .shot.duo { grid-template-columns: 1fr; } }

/* small */
.small { font-size: 0.88em; color: var(--mute); }
.kbd-like {
  font-family: var(--font-mono);
  background: var(--code-bg);
  border: 1px solid var(--rule);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 0.88em;
}

@media (max-width: 540px) {
  html { font-size: 16px; }
  .shell { padding: 32px 18px 64px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .features.compact { grid-template-columns: 1fr; }
}
