@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f7f5fe;
  --surface: #ffffff;
  --surface-2: #f6f6fa;
  --border: #e5e3ef;
  --text: #121019;
  --text-2: #4b4a5a;
  --text-3: #6c6a7c;
  --accent: #8b6cf6;
  --accent-hover: #9d82f8;
  --accent-ink: #5b3fd0;
  --on-accent: #0e0a1c;
  --link: #5536c8;
  --teal: #0f8f8a;
  --code-bg: #0f1117;
  --code-text: #e6e4f0;
  --code-muted: #8d8aa0;
  --shadow: 0 1px 2px rgba(18, 16, 25, .04), 0 8px 24px rgba(18, 16, 25, .06);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0d14;
    --bg-soft: #12101b;
    --surface: #16141f;
    --surface-2: #1c1a27;
    --border: #2a2738;
    --text: #e9e7f2;
    --text-2: #b6b3c6;
    --text-3: #8f8ca2;
    --accent-ink: #b9a6ff;
    --link: #c0afff;
    --teal: #5fd6cf;
    --code-bg: #0a090f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0d14;
  --bg-soft: #12101b;
  --surface: #16141f;
  --surface-2: #1c1a27;
  --border: #2a2738;
  --text: #e9e7f2;
  --text-2: #b6b3c6;
  --text-3: #8f8ca2;
  --accent-ink: #b9a6ff;
  --link: #c0afff;
  --teal: #5fd6cf;
  --code-bg: #0a090f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }
code { font-family: var(--mono); font-size: .9em; }
p code, li code, td code, .pill code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .05em .35em;
}
h1, h2, h3 { font-family: var(--mono); letter-spacing: -.02em; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
img, svg { display: block; }
img { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } .pill { font-size: 12.5px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 15px/1 var(--sans); text-decoration: none;
  padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.gh { width: 16px; height: 16px; fill: currentColor; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: none; }
:root[data-theme="dark"] .icon-btn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 19px/1 var(--mono); }
.brand:hover { color: var(--text); }
.mark { width: 30px; height: 30px; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--text-2); text-decoration: none; font-size: 14.5px; padding: 8px 10px; border-radius: 8px; }
.nav-links a:hover, .nav-links a[aria-current] { color: var(--text); background: var(--surface-2); }
.nav nav { margin-right: auto; }
.nav-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
@media (max-width: 860px) { .nav-links { display: none; } }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 72px; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(55% 65% at 88% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(40% 50% at 70% 80%, color-mix(in srgb, var(--teal) 10%, transparent), transparent 70%),
    linear-gradient(var(--bg), var(--bg-soft));
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -2; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 60% at 50% 40%, #000 20%, transparent 75%);
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 800; }
.accent { color: var(--accent-ink); }
.lede { font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: var(--text-2); max-width: 46rem; margin: 24px 0 32px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--text-2); margin: 0 0 24px; text-decoration: none;
  background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px;
}
a.pill:hover { border-color: var(--accent); color: var(--text); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.install {
  display: flex; align-items: center; gap: 12px; max-width: 46rem;
  background: var(--code-bg); color: var(--code-text); border-radius: 12px; padding: 12px 12px 12px 18px;
  font-family: var(--mono); font-size: 14.5px; box-shadow: var(--shadow);
  border: 1px solid #25222f;
}
.install .prompt { color: #b9a6ff; user-select: none; }
.install code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.install code::-webkit-scrollbar { display: none; }
.install-note { color: var(--text-3); font-size: 14px; margin: 10px 2px 0; }
.copy {
  font: 600 12.5px/1 var(--sans); color: #d0cde0; background: #211f2b; border: 1px solid #35313f;
  padding: 7px 10px; border-radius: 7px; cursor: pointer; flex-shrink: 0;
}
.copy:hover { background: #2c2938; color: #fff; }
.copy.done { color: #7ee7c8; border-color: #2e9a85; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.cta.center { justify-content: center; }

.strip { border-block: 1px solid var(--border); background: var(--surface); }
.strip-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 28px; padding-block: 18px; font: 500 14px/1.2 var(--mono); color: var(--text-2); }
.strip-inner span::before { content: "✓ "; color: var(--accent); }
@media (max-width: 600px) { .strip-inner { justify-content: flex-start; } }

/* ---------- Sections ---------- */
.section { padding: 104px 0; }
@media (max-width: 600px) { .section { padding: 72px 0; } }
.section.soft { background: var(--bg-soft); border-block: 1px solid var(--border); }
.section-head { max-width: 46rem; margin-bottom: 44px; }
.section-head p:not(.eyebrow) { color: var(--text-2); font-size: 1.07rem; margin: 16px 0 0; }
.eyebrow { font: 600 13px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--accent-ink); margin: 0 0 14px; }
.fineprint { color: var(--text-3); font-size: 14px; margin-top: 24px; }

/* ---------- Two-column split ---------- */
.split { display: grid; grid-template-columns: 1fr 1.25fr; gap: 56px; align-items: center; }
.split > * { min-width: 0; }
.split > div > p:not(.eyebrow) { color: var(--text-2); margin: 16px 0 0; }
.split.flip > :first-child { order: 2; }
@media (max-width: 960px) { .split, .split.flip { grid-template-columns: 1fr; gap: 32px; } .split.flip > :first-child { order: 0; } }

.ticks { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 14px; }
.ticks li { padding-left: 28px; position: relative; color: var(--text-2); }
.ticks li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); font-weight: 700; }
.ticks b { color: var(--text); }

/* ---------- Mockup figures ---------- */
.shot { margin: 0; }
.shot img {
  border-radius: 12px; border: 1px solid #25222f; box-shadow: var(--shadow); background: #0f1117;
}
.shot figcaption { color: var(--text-3); font-size: 13.5px; margin-top: 10px; }

/* ---------- Systems ---------- */
.systems { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 48px; }
.systems > div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.systems .tag { font: 600 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); }
.systems .tag.teal { color: var(--teal); }
.systems h3 { margin: 10px 0 0; }
.systems p { color: var(--text-2); font-size: 15px; margin: 10px 0 0; }
@media (max-width: 760px) { .systems { grid-template-columns: 1fr; } }

/* ---------- Feature grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.feature p { color: var(--text-2); font-size: 15px; margin: 0; }
.feature .cmds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.feature .cmds code { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }

/* ---------- Code ---------- */
.code {
  background: var(--code-bg); color: var(--code-text); border-radius: 12px; overflow: hidden;
  border: 1px solid #25222f; box-shadow: var(--shadow); min-width: 0;
}
.code + .code { margin-top: 12px; }
.code-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px;
  padding: 6px 10px 6px 16px; border-bottom: 1px solid #211f2b;
  font: 500 12.5px/1.4 var(--mono); color: var(--code-muted);
}
pre { margin: 0; padding: 18px; overflow-x: auto; font: 13.5px/1.65 var(--mono); tab-size: 4; }
pre code { font-size: inherit; }
.t-com { color: #8d8aa0; font-style: italic; }
.t-cmd { color: #b9a6ff; }
.t-flag { color: #7ee7c8; }

/* ---------- Surfaces table ---------- */
.table-scroll { overflow-x: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-2); }
td:first-child { white-space: nowrap; }
td:last-child { color: var(--text-2); }

/* ---------- Status ---------- */
.stack { display: grid; gap: 16px; }
.stack > * { min-width: 0; }
.status { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.status > div { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.status p, .status li { color: var(--text-2); font-size: 15px; }
.status ul { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 6px; }
@media (max-width: 760px) { .status { grid-template-columns: 1fr; } }

/* ---------- Update lists ---------- */
.posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.posts li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; transition: border-color .2s ease; }
.posts li:hover { border-color: var(--accent); }
.posts a { display: grid; grid-template-columns: 9.5rem 1fr; gap: 4px 20px; padding: 18px 22px; text-decoration: none; color: inherit; }
.posts time { font: 500 13.5px/1.6 var(--mono); color: var(--text-3); grid-row: span 2; }
.posts .t { font: 700 1.05rem/1.4 var(--mono); color: var(--text); }
.posts .d { color: var(--text-2); font-size: 15px; }
@media (max-width: 600px) { .posts a { grid-template-columns: 1fr; } .posts time { grid-row: auto; } }
.more { margin-top: 20px; display: flex; gap: 20px; flex-wrap: wrap; font-size: 15px; }

/* ---------- Post pages ---------- */
.page-head { padding: 72px 0 8px; }
.page-head h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; }
.page-head .meta { font: 500 14px/1.4 var(--mono); color: var(--text-3); margin: 0 0 16px; }
.page-head .meta a { color: var(--text-3); }
.prose { max-width: 46rem; padding-bottom: 96px; }
.prose p, .prose li { color: var(--text-2); font-size: 1.05rem; }
.prose h2 { font-size: 1.45rem; margin: 48px 0 0; }
.prose h3 { margin: 32px 0 0; }
.prose ul, .prose ol { padding-left: 22px; display: grid; gap: 6px; }
.prose strong { color: var(--text); }
.prose .code, .prose .shot { margin: 24px 0; }
.prose .lead { font-size: 1.2rem; color: var(--text); }
.back { display: inline-block; margin-top: 40px; font: 500 14px var(--mono); }

/* ---------- Final ---------- */
.final { text-align: center; position: relative; overflow: hidden; isolation: isolate; }
.final::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(560px 240px at 50% 40%, color-mix(in srgb, var(--accent) 18%, transparent), transparent);
}
.final-inner { display: flex; flex-direction: column; align-items: center; }
.final p { color: var(--text-2); max-width: 38rem; margin: 16px 0 8px; font-size: 1.07rem; }
.mark.big { width: 72px; height: 72px; margin-bottom: 24px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 40px 0; }
.footer-inner { display: grid; grid-template-columns: auto 1fr; gap: 16px 32px; align-items: center; }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: flex-end; }
.footer nav a { color: var(--text-2); text-decoration: none; font-size: 14px; }
.footer nav a:hover { color: var(--text); }
.footer .fineprint { grid-column: 1 / -1; margin: 8px 0 0; }
.brand.small { font-size: 16px; }
.brand.small .mark { width: 24px; height: 24px; }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } .footer nav { justify-content: flex-start; } }

@media (max-width: 600px) {
  .install { align-items: flex-start; }
  .install code { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 64px 16px; }
.notfound p { color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
