/* VXStudio — minimal, monochrome, easy to read */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f5;
  --fg: #0b0b0b;
  --muted: #6b6b6b;
  --line: #e8e8e6;
  --line-strong: #d4d4d1;
  --invert-bg: #0b0b0b;
  --invert-fg: #ffffff;
  --ok: #1a7f4b;
  --bad: #c2362f;
  --radius: 14px;
  --wrap: 1120px;
  --read: 700px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0c;
    --bg-soft: #161616;
    --fg: #f2f2f0;
    --muted: #9a9a96;
    --line: #242423;
    --line-strong: #353533;
    --invert-bg: #f2f2f0;
    --invert-fg: #0c0c0c;
    --ok: #4cc38a;
    --bad: #ff6b61;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0c;
  --bg-soft: #161616;
  --fg: #f2f2f0;
  --muted: #9a9a96;
  --line: #242423;
  --line-strong: #353533;
  --invert-bg: #f2f2f0;
  --invert-fg: #0c0c0c;
  --ok: #4cc38a;
  --bad: #ff6b61;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3, h4 { margin: 0; line-height: 1.12; letter-spacing: -0.025em; font-weight: 650; }
h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.015em; }
p { margin: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.read { max-width: var(--read); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em; }
.label {
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -0.02em; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--fg); color: var(--bg);
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: 999px; text-decoration: none;
  font-size: 0.92rem; color: var(--muted); transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--fg); background: var(--bg-soft); }
.nav-links a[aria-current="page"] { color: var(--fg); background: var(--bg-soft); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--line); color: var(--fg);
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer; place-items: center;
}
@media (max-width: 760px) {
  .nav-toggle { display: grid; }
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 1rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 999px; font: inherit; font-size: 0.95rem; font-weight: 550; text-decoration: none;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--fg); cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
  will-change: transform;
}
.btn:hover { border-color: var(--fg); }
.btn-dark { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.btn-dark:hover { opacity: .88; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Icons (iconoir style) ---------- */
.ico { width: 24px; height: 24px; flex: none; }
.ico-box {
  width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line);
  display: grid; place-items: center; background: var(--bg);
}

/* ---------- Sections ---------- */
section { padding: 96px 0; }
.section-sm { padding: 64px 0; }
.section-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; max-width: 640px; }
.section-head p { color: var(--muted); font-size: 1.05rem; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- Hero ---------- */
.hero { padding: 104px 0 72px; text-align: center; }
.hero .wrap { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.hero h1 { max-width: 900px; }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 560px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 0.85rem; color: var(--muted);
  text-decoration: none;
}
.pill b {
  background: var(--fg); color: var(--bg); font-weight: 600; font-size: 0.75rem;
  padding: 3px 9px; border-radius: 999px;
}
.shiny {
  background: linear-gradient(110deg, var(--muted) 35%, var(--fg) 50%, var(--muted) 65%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 4s linear infinite;
}
@keyframes shine { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* Split text (react-bits style) */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.split .w > span { display: inline-block; will-change: transform; }

/* ---------- Marquee ---------- */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; padding: 18px 0; white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: inline-flex; gap: 40px; will-change: transform; }
.marquee-track span { font-family: var(--mono); font-size: 0.9rem; color: var(--muted); display: inline-flex; align-items: center; gap: 40px; }
.marquee-track span::after { content: "/"; color: var(--line-strong); }

/* ---------- Guide list (home + footer of guides) ---------- */
.guide-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.guide-row {
  display: grid; grid-template-columns: 56px 48px 1fr auto; align-items: center; gap: 20px;
  padding: 22px 8px; border-bottom: 1px solid var(--line); text-decoration: none;
  transition: background .2s, padding .25s;
}
.guide-row:hover { background: var(--bg-soft); padding-left: 16px; padding-right: 16px; }
.guide-row .num { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; }
.guide-row h3 { font-size: 1.2rem; }
.guide-row p { color: var(--muted); font-size: 0.95rem; margin-top: 2px; }
.guide-row .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 12px; }
.guide-row .arrow { transition: transform .2s; }
.guide-row:hover .arrow { transform: translateX(4px); }
@media (max-width: 640px) {
  .guide-row { grid-template-columns: 40px 1fr auto; gap: 14px; }
  .guide-row .ico-box { display: none; }
  .guide-row .meta .time { display: none; }
}

/* ---------- Cards ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.card {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; background: var(--bg); display: flex; flex-direction: column; gap: 12px;
  text-decoration: none; overflow: hidden;
}
.card p { color: var(--muted); font-size: 0.97rem; }
a.card { transition: border-color .2s; }
a.card:hover { border-color: var(--line-strong); }
/* Spotlight card (react-bits style) */
.spot::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--fg) 7%, transparent), transparent 60%);
}
.spot:hover::before { opacity: 1; }
.step-n { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

/* ---------- CTA band ---------- */
.cta {
  background: var(--invert-bg); color: var(--invert-fg); border-radius: 24px;
  padding: 64px 32px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.cta p { opacity: .7; max-width: 480px; }
.cta .btn { background: var(--invert-fg); color: var(--invert-bg); border-color: var(--invert-fg); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 40px; margin-top: 40px; font-size: 0.92rem; }
.foot { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.foot-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.foot-cols ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.foot-cols a { color: var(--muted); text-decoration: none; }
.foot-cols a:hover { color: var(--fg); }
.foot-bottom { margin-top: 40px; color: var(--muted); font-size: 0.85rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 0.82rem; cursor: pointer; }
.theme-btn:hover { color: var(--fg); border-color: var(--line-strong); }

/* ---------- Guide page ---------- */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--fg); transform-origin: 0 50%; transform: scaleX(0); z-index: 60; }
.guide-hero { padding: 72px 0 40px; }
.guide-hero .wrap { display: flex; flex-direction: column; gap: 20px; }
.crumb { display: flex; gap: 10px; align-items: center; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--fg); }
.guide-hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.8rem); max-width: 820px; }
.guide-hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--mono); font-size: 0.75rem; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); }

.guide-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 64px; padding-bottom: 48px; }
.toc { position: sticky; top: 96px; align-self: start; display: grid; gap: 2px; }
.toc a {
  font-size: 0.88rem; text-decoration: none; color: var(--muted); padding: 6px 0 6px 14px;
  border-left: 1px solid var(--line); transition: color .15s, border-color .15s;
}
.toc a.active, .toc a:hover { color: var(--fg); border-left-color: var(--fg); }
@media (max-width: 900px) {
  .guide-body { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
}

.prose { max-width: var(--read); }
.prose > section { padding: 0 0 56px; scroll-margin-top: 90px; }
.prose h2 { font-size: 1.6rem; margin-bottom: 18px; display: flex; gap: 14px; align-items: baseline; }
.prose h2 .n { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.prose p { margin: 0 0 16px; }
.prose ul { margin: 0 0 16px; padding-left: 20px; }
.prose li { margin-bottom: 8px; }
.prose strong { font-weight: 600; }
.prose code, .code-inline {
  font-family: var(--mono); font-size: 0.86em; background: var(--bg-soft);
  border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px;
}
.prose pre {
  font-family: var(--mono); font-size: 0.85rem; line-height: 1.6; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; overflow-x: auto; margin: 0 0 16px;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }

.tldr {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px;
  display: flex; gap: 16px; align-items: flex-start; background: var(--bg-soft); margin-bottom: 56px;
}
.tldr p { margin: 0; font-size: 1.1rem; }
.analogy {
  border-left: 2px solid var(--fg); padding: 4px 0 4px 20px; margin: 0 0 18px; font-size: 1.08rem;
}

/* numbered steps */
.steps { list-style: none; padding: 0; margin: 0 0 16px; counter-reset: s; display: grid; gap: 0; }
.steps li {
  counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line); margin: 0;
}
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before {
  content: counter(s, decimal-leading-zero); font-family: var(--mono); font-size: 0.82rem;
  color: var(--muted); padding-top: 3px;
}
.steps b { display: block; font-weight: 600; }
.steps span { color: var(--muted); font-size: 0.97rem; }

/* key terms */
.terms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 640px) { .terms { grid-template-columns: 1fr; } }
.term { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.term b { display: block; font-family: var(--mono); font-size: 0.85rem; margin-bottom: 4px; }
.term span { color: var(--muted); font-size: 0.95rem; }

/* compare table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--bg-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 550; white-space: nowrap; }

/* interactive flow */
.flow { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.flow-nodes { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.flow-nodes::-webkit-scrollbar { display: none; }
.flow-node {
  flex: 1 0 auto; min-width: 92px; padding: 16px 12px; background: none; border: 0; border-right: 1px solid var(--line);
  font: inherit; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: color .15s, background .15s;
}
.flow-node:last-child { border-right: 0; }
.flow-node .ico { width: 22px; height: 22px; }
.flow-node small { font-size: 0.8rem; font-weight: 550; }
.flow-node:hover { color: var(--fg); }
.flow-node.on { color: var(--bg); background: var(--fg); }
.flow-text { padding: 22px 24px; min-height: 112px; }
.flow-text b { display: block; margin-bottom: 4px; }
.flow-text p { color: var(--muted); margin: 0; }
.flow-bar { height: 2px; background: var(--line); }
.flow-bar i { display: block; height: 100%; background: var(--fg); width: 0; transition: width .4s ease; }
.flow-ctrl { display: flex; gap: 8px; padding: 0 24px 20px; }
.flow-ctrl button {
  border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 999px;
  height: 36px; padding: 0 14px; font: inherit; font-size: 0.88rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.flow-ctrl button:hover { border-color: var(--fg); }
.flow-ctrl .ico { width: 16px; height: 16px; }

/* quiz */
.quiz { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.quiz + .quiz { margin-top: 12px; }
.quiz .q { font-weight: 600; margin-bottom: 14px; }
.quiz .opts { display: grid; gap: 8px; }
.quiz button {
  text-align: left; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 0.95rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.quiz button:hover:not(:disabled) { border-color: var(--fg); }
.quiz button:disabled { cursor: default; }
.quiz button.right { border-color: var(--ok); color: var(--ok); }
.quiz button.wrong { border-color: var(--bad); color: var(--bad); }
.quiz .why { margin-top: 14px; color: var(--muted); font-size: 0.95rem; display: none; }
.quiz.done .why { display: block; }

/* prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 24px 0 48px; }
.pager a { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; text-decoration: none; display: grid; gap: 4px; transition: border-color .2s; }
.pager a:hover { border-color: var(--fg); }
.pager .next { text-align: right; grid-column: 2; }
.pager span { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pager b { font-weight: 600; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

/* ---------- Tools ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; margin-bottom: 24px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.92rem; padding: 8px 16px;
  border-radius: 999px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.panel[hidden] { display: none; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; font-weight: 550; }
input[type="text"], input[type="search"], textarea, select {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 14px;
}
textarea { font-family: var(--mono); font-size: 0.85rem; min-height: 220px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--fg); }
.out {
  font-family: var(--mono); font-size: 0.85rem; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; min-height: 48px;
}
.out.err { color: var(--bad); }
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv div { background: var(--bg); padding: 14px 16px; }
.kv small { display: block; color: var(--muted); font-size: 0.78rem; }
.kv b { font-family: var(--mono); font-weight: 500; font-size: 0.95rem; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } }
.status-list { display: grid; gap: 8px; }
.status-item { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.status-item b { font-family: var(--mono); }
.status-item p { color: var(--muted); font-size: 0.93rem; }
.status-item strong { font-weight: 600; display: block; }

/* ---------- Glossary ---------- */
.gloss { display: grid; gap: 0; border-top: 1px solid var(--line); }
.gloss-item { display: grid; grid-template-columns: 180px 1fr; gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.gloss-item dt { font-weight: 600; font-family: var(--mono); font-size: 0.95rem; }
.gloss-item dd { margin: 0; }
.gloss-item dd p { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
.gloss-item dd a { font-size: 0.85rem; color: var(--muted); }
@media (max-width: 640px) { .gloss-item { grid-template-columns: 1fr; gap: 6px; } }
.search-row { display: flex; gap: 12px; margin-bottom: 24px; align-items: center; }
.search-row input { max-width: 420px; }
.empty { color: var(--muted); padding: 24px 0; }

/* ---------- Reveal ---------- */
.js [data-reveal] { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1 !important; }
}
