/* Verve docs — clean modern dark theme. Content-first, restrained. */

:root {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --bg-inset: #010409;
  --border: #30363d;
  --border-soft: #21262d;
  --fg: #e6edf3;
  --fg-muted: #8b949e;
  --accent: #58a6ff;
  --accent-strong: #1f6feb;
  --green: #10b981;
  --amber: #f59e0b;
  --radius: 8px;
  --max-w: 1200px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.65 var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.4rem; margin: 2.25rem 0 0.5rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.4rem; }
p { margin: 0.6rem 0; }

code {
  font: 0.875em var(--mono);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; border: 0; padding: 0; font-size: 0.85rem; }

blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--accent-strong);
  background: var(--bg-raised);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--fg-muted);
}

table { border-collapse: collapse; margin: 1rem 0; width: 100%; }
th, td { border: 1px solid var(--border-soft); padding: 0.45rem 0.75rem; text-align: left; }
th { background: var(--bg-raised); font-weight: 600; }

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

img { max-width: 100%; }

button {
  font: inherit;
  padding: 0.5rem 1rem;
  background: var(--accent-strong);
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { background: #388bfd; }

input[type="text"], textarea, select {
  font: inherit;
  padding: 0.5rem 0.7rem;
  background: var(--bg-inset);
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
}
input[type="text"]:focus, textarea:focus { outline: 2px solid var(--accent-strong); border-color: transparent; }

/* ---- layout shell ------------------------------------------------------ */

.shell-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }

.logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; color: var(--fg); }
.logo:hover { text-decoration: none; }
.logo-mark { display: block; flex: none; transition: transform 0.2s ease; }
.logo:hover .logo-mark { transform: rotate(-6deg) scale(1.05); }
.logo-version {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--fg-muted);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.top-nav { display: flex; gap: 0.25rem; align-items: center; }
.header-search input { padding: 0.3rem 0.7rem; font-size: 0.85rem; width: 11rem; max-width: 32vw; }
@media (max-width: 640px) { .header-search { display: none; } }

/* search page */
.search-page { max-width: 46rem; }
.search-box { display: flex; gap: 0.5rem; margin: 1rem 0 0.5rem; }
.search-box input { flex: 1; }
.search-results { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.search-hit { display: block; padding: 0.75rem 1rem; background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--radius); color: var(--fg); }
.search-hit:hover { border-color: var(--accent-strong); text-decoration: none; }
.search-hit.is-hidden { display: none; }
.search-hit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.search-hit-title { font-weight: 600; color: var(--accent); }
.search-hit-sec { font-size: 0.72rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.search-hit-snippet { display: block; margin-top: 0.25rem; color: var(--fg-muted); font-size: 0.875rem; }
.top-link { padding: 0.35rem 0.75rem; border-radius: 6px; color: var(--fg-muted); font-size: 0.925rem; }
.top-link:hover { color: var(--fg); background: var(--bg-raised); text-decoration: none; }
.top-link.active { color: var(--fg); }

.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 4rem;
  padding: 1.5rem 0 2rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
}
.site-footer .shell-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

/* ---- docs layout ------------------------------------------------------- */

.docs-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 2.5rem; padding-top: 1.5rem; }

.side-nav {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  padding-bottom: 2rem;
  font-size: 0.9rem;
}
.side-filter { width: 100%; margin-bottom: 0.75rem; padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.side-group { margin-bottom: 1.25rem; }
.side-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
}
.side-link {
  display: block;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  color: var(--fg-muted);
  border-left: 2px solid transparent;
}
.side-link:hover { color: var(--fg); background: var(--bg-raised); text-decoration: none; }
.side-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--bg-raised); }

.docs-main { min-width: 0; padding-bottom: 3rem; }
.doc-article { max-width: 46rem; }

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 1.25rem;
}
.pn-link { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.9rem; border: 1px solid var(--border-soft); border-radius: var(--radius); min-width: 10rem; }
.pn-link:hover { border-color: var(--accent-strong); text-decoration: none; }
.pn-next { text-align: right; margin-left: auto; }
.pn-dir { font-size: 0.75rem; color: var(--fg-muted); }
.pn-title { font-weight: 600; }

.docs-index { display: grid; gap: 1rem; margin-top: 1.5rem; }

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

/* ---- cards & code ------------------------------------------------------ */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}
.card h2 { margin-top: 0; }

.code-card { margin: 1rem 0; border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.code-card pre { margin: 0; border: 0; border-radius: 0; }
.code-card-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.75rem;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-soft);
}
.code-lang { font: 0.72rem var(--mono); color: var(--fg-muted); text-transform: lowercase; }
.code-copy { background: none; border: 1px solid var(--border-soft); color: var(--fg-muted); font-size: 0.72rem; padding: 0.15rem 0.6rem; border-radius: 5px; }
.code-copy:hover { color: var(--fg); border-color: var(--border); background: var(--bg-inset); }

.hint { color: var(--fg-muted); font-size: 0.85rem; margin: 0.25rem 0 0.75rem; }

/* ---- landing ------------------------------------------------------------ */

.hero { border-bottom: 1px solid var(--border-soft); background: radial-gradient(ellipse 80% 60% at 50% -10%, #16233a 0, transparent 70%); }
.hero-inner { padding-top: 5rem; padding-bottom: 4.5rem; max-width: 820px; text-align: center; }
.hero-title { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 0 0 1rem; letter-spacing: -0.02em; }
.hero-sub { font-size: 1.15rem; color: var(--fg-muted); max-width: 38rem; margin: 0 auto 1.75rem; }
.hero-install { display: inline-block; margin-bottom: 1.75rem; }
.hero-install code { padding: 0.6rem 1rem; font-size: 0.85rem; }
.hero-ctas { display: flex; gap: 0.75rem; justify-content: center; }
.btn-primary { background: var(--accent-strong); color: #fff; padding: 0.6rem 1.3rem; border-radius: 8px; font-weight: 600; }
.btn-primary:hover { background: #388bfd; text-decoration: none; }
.btn-ghost { border: 1px solid var(--border); color: var(--fg); padding: 0.6rem 1.3rem; border-radius: 8px; font-weight: 600; }
.btn-ghost:hover { border-color: var(--accent); text-decoration: none; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 3rem 0; }
.feature-card { display: block; background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1.25rem 1.4rem; color: var(--fg); }
.feature-card:hover { border-color: var(--accent-strong); text-decoration: none; }
.feature-card h3 { margin: 0 0 0.4rem; color: var(--accent); }
.feature-card p { margin: 0; color: var(--fg-muted); font-size: 0.925rem; }

.showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin: 3rem 0; align-items: start; }
.showcase h2 { margin-top: 0; }
.showcase .counter-card { margin: 1rem 0; }
@media (max-width: 860px) { .showcase { grid-template-columns: 1fr; } }

.cta-row { text-align: center; margin: 3rem 0; padding: 2rem; }

/* ---- examples gallery ---------------------------------------------------- */

.example-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.example-card { display: block; background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1.1rem 1.25rem; color: var(--fg); }
a.example-card:hover { border-color: var(--accent-strong); text-decoration: none; }
.example-card-soon { opacity: 0.55; }
.example-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.example-card h3 { margin: 0; font-size: 1.05rem; }
.example-card p { margin: 0.5rem 0 0; color: var(--fg-muted); font-size: 0.9rem; }
.example-badge { font: 0.68rem var(--mono); color: var(--fg-muted); border: 1px solid var(--border-soft); border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }

.ex-header { margin-bottom: 1.5rem; }
.ex-points { color: var(--fg-muted); font-size: 0.925rem; margin: 0.75rem 0; }

.dash-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin: 1rem 0; }
.dash-tab { padding: 0.35rem 0.8rem; border: 1px solid var(--border-soft); border-radius: 6px; color: var(--fg-muted); font-size: 0.9rem; }
.dash-tab:hover { color: var(--fg); text-decoration: none; }
.dash-tab.active { color: var(--accent); border-color: var(--accent-strong); }

/* ---- wave-2 example pages ------------------------------------------------ */

.sw-card, .calc-card, .keys-card, .poll-card, .chat-card { background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 1.25rem 1.5rem; max-width: 28rem; }
.sw-time { font-size: 3rem; font-variant-numeric: tabular-nums; display: block; margin-bottom: 0.75rem; font-family: var(--mono); }

.calc-display { font: 1.8rem var(--mono); text-align: right; background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 6px; padding: 0.5rem 0.8rem; margin-bottom: 0.75rem; min-height: 2.6rem; }
.calc-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.calc-pad button { margin: 0; padding: 0.6rem 0; font-size: 1.05rem; }
.calc-eq { grid-column: span 4; background: var(--green); }
.calc-eq:hover { background: #34d399; }

.keys-card input { width: 100%; }
.keys-readout { margin-top: 0.75rem; }
.keys-readout p { margin: 0.3rem 0; }

.poll-rows { display: grid; gap: 0.5rem; }
.poll-row { display: flex; align-items: center; gap: 0.75rem; }
.poll-row button { margin: 0; min-width: 9rem; text-align: left; }
.poll-count { font: 1.2rem var(--mono); }

.mdpad { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.mdpad textarea { width: 100%; font: 0.85rem var(--mono); resize: vertical; }
.mdpad-preview { background: var(--bg-raised); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 0.25rem 1rem; min-height: 16rem; overflow-x: auto; }
@media (max-width: 860px) { .mdpad { grid-template-columns: 1fr; } }

.chat-card { max-width: 32rem; }
.chat-history { list-style: none; padding: 0; margin: 0.25rem 0 0.75rem; color: var(--fg-muted); font-size: 0.9rem; }
.chat-live { min-height: 8rem; border: 1px dashed var(--border-soft); border-radius: 6px; padding: 0.5rem 0.8rem; margin-bottom: 0.75rem; }
.chat-msg { margin: 0.25rem 0; }
.chat-compose { display: flex; gap: 0.5rem; }
.chat-compose input { flex: 1; }

/* ---- demo / example page styles (adapted from shipped demo app) -------- */

.home { max-width: 46rem; margin: 0 auto; padding: 2rem 1.5rem; }
.examples-main { padding: 1.5rem 0 3rem; }

.counter-card { padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); max-width: 24rem; margin: 2rem auto; }
.count { font-size: 3rem; display: block; margin: 1rem 0; font-variant-numeric: tabular-nums; }
.counter-form { display: inline; }
.counter-form button, .counter-card > button { margin-right: 0.5rem; }
.clicks { color: var(--fg-muted); }

.todo-form { display: flex; gap: 0.5rem; margin: 1rem 0; }
.todo-form input[type="text"] { flex: 1; }
.todo-list { list-style: none; padding: 0; margin: 1rem 0; }
.todo-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border-bottom: 1px solid var(--border-soft); }
.todo-list li span { flex: 1; }
.todo-remove button { background: #3d1d1d; padding: 0.25rem 0.5rem; }
.todo-remove button:hover { background: #5b2727; }

.anim-deck { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
.anim-card { width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center; background: var(--accent-strong); border-radius: 8px; font-weight: 600; }
.anim-controls { display: flex; gap: 0.25rem; flex-wrap: wrap; margin: 0.5rem 0; }
.anim-controls button { padding: 0.35rem 0.7rem; }
.anim-pulse { width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--accent); margin: 0.5rem 0; }
.anim-spacer { height: 60vh; }
.anim-scroll h2.in-view { color: var(--accent); }
.anim-pin-panel { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.anim-scrub-bar { height: 0.5rem; border-radius: 4px; background: var(--accent-strong); transform-origin: left center; margin-bottom: 0.75rem; }
.anim-probe { padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.anim-orbit-wrap { position: relative; margin: 1rem 0; }
.anim-orbiter { position: absolute; top: -6px; left: -6px; width: 12px; height: 12px; background: var(--amber); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.anim-scrub-dot { position: absolute; top: -5px; left: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

.drag-pen { position: relative; height: 200px; border: 1px dashed var(--border); border-radius: var(--radius); margin: 1rem 0; overflow: hidden; }
.drag-card { cursor: grab; width: 4rem; height: 4rem; }
.drag-card.dragging { box-shadow: 0 0 0 2px var(--accent); opacity: 0.9; }
.st-char, .st-word { display: inline-block; will-change: transform; }
.flip-grid { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; max-width: 18rem; }
.fcard { width: 3.5rem; height: 3.5rem; }
.drop-row { display: flex; gap: 0.5rem; margin: 0.75rem 0; }
.drop-zone { flex: 1; min-height: 4rem; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--fg-muted); }
.drop-zone.drop-hover { border-color: var(--accent); color: var(--accent); background: #11161f; }

/* v0.8.0 anim showcase: grapheme/RTL split + Sortable demo */
.grapheme-line { font-size: 1.5rem; margin: 1rem 0; }
.rtl-line { font-size: 1.25rem; margin: 1rem 0; }
.grapheme-line .st-char, .rtl-line .st-word { display: inline-block; will-change: transform; }

.sort-list { list-style: none; padding: 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.35rem; min-height: 2rem; }
.sort-item { padding: 0.55rem 1rem; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); cursor: grab; user-select: none; touch-action: none; }
.sort-item:active { cursor: grabbing; }
.sort-item.sorting { opacity: 0.55; border-style: dashed; box-shadow: 0 0 0 2px var(--accent); }
.sort-board { display: flex; gap: 1rem; margin-top: 0.75rem; }
.sort-board-col { flex: 1; }
.sort-board-col h3 { margin: 0 0 0.4rem; font-size: 0.85em; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.board-col { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.4rem; min-height: 6rem; }

.smooth-page { max-width: none; }
.smooth-hero { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.smooth-bg, .smooth-mid { position: absolute; inset: -20% 0; pointer-events: none; will-change: transform; }
.smooth-bg { background: radial-gradient(circle at 30% 40%, #16233a 0, transparent 60%); }
.smooth-mid { background: radial-gradient(circle at 70% 60%, #1b2a1f 0, transparent 50%); }
.smooth-badge { display: inline-block; align-self: flex-start; padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-raised); will-change: transform; }
.smooth-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; border-top: 1px dashed var(--border-soft); }
.smooth-section h2 { font-size: 3rem; }
#snap-deck { position: relative; }
.smooth-deck-bar { position: absolute; top: 0; left: 0; right: 0; height: 0.4rem; background: var(--accent); transform-origin: left center; z-index: 5; }

.viz-card svg { touch-action: none; max-width: 100%; }
.viz-node { cursor: grab; }
.viz-node.selected circle { stroke: #fff; stroke-width: 3; }
.viz-node.collapsed circle { stroke: var(--amber); stroke-width: 3; stroke-dasharray: 3 2; }
.viz-controls { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.viz-controls .live-on { background: var(--green); }

.gl-wrap canvas { width: 100%; max-width: 640px; }
