/* zpi — palette lifted from src/ui/theme.zig "dark" (pi's theme), so the
   site wears the product's own colours rather than an invented brand. */
:root {
  --bg: #0f1113;
  --bg-term: #0b0d0e;
  --bg-raise: #15181a;
  --line: #262b2e;
  --text: #dee0e1;
  --muted: #9da5a9;
  --dim: #7e888e;
  --accent: #a798d7;
  --accent-dim: #5a4e7a;
  --border: #5fa8cc;
  --ok: #68b78d;
  --err: #ea7f81;
  --warn: #cd9a22;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Noto Sans Mono CJK SC", "PingFang SC", "Microsoft YaHei", monospace;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --measure: 72ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

code, pre, .brand, h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 400;
}
code { color: var(--accent); font-size: 0.92em; }
/* Inline code in prose / tables: a little air on both sides so a run of
   them (read write edit …) reads as separate tokens. */
p code, li code, td code { padding: 0 0.15em; }
p code + code, li code + code, td code + code { margin-left: 0.35em; }
a { color: var(--border); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- top bar ---- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--text); font-size: 1rem; letter-spacing: 0.02em; display: inline-flex; align-items: baseline; gap: 0.45rem; }
.brand:hover { text-decoration: none; }
.brand-logo { color: var(--accent); font-family: var(--mono); font-size: 0.8rem; letter-spacing: -0.05em; }
.top nav { display: flex; gap: 1.4rem; font-family: var(--mono); font-size: 0.85rem; }
.top nav a { color: var(--muted); }
.top nav a:hover { color: var(--text); text-decoration: none; }

/* ---- layout ---- */
main, footer > * { max-width: 980px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
main { display: block; }
.section { padding: 4rem 0 3rem; border-top: 1px solid var(--line); margin-top: 3rem; }
h2 { font-size: 1.6rem; margin: 0 0 1.6rem; line-height: 1.3; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; color: var(--text); }
p { max-width: var(--measure); }
p, li { color: var(--muted); }
p a, li a { color: var(--border); }

/* ---- hero ---- */
.hero { padding: 5rem 0 2rem; }
.hero h1 {
  font-size: clamp(1.8rem, 4.2vw, 3rem);
  line-height: 1.25;
  margin: 0 0 1.2rem;
  max-width: 22ch;
  letter-spacing: -0.01em;
}
.lede { font-size: 1.05rem; max-width: 60ch; margin-bottom: 2.2rem; }
.lede a { color: var(--border); }

.install-cmd {
  display: flex; align-items: stretch;
  max-width: 640px;
  background: var(--bg-term);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.install-cmd code {
  flex: 1; padding: 0.75rem 1rem;
  color: var(--text); font-size: 0.9rem;
  white-space: nowrap; overflow-x: auto;
}
.copy {
  font-family: var(--mono); font-size: 0.78rem;
  background: transparent; color: var(--muted);
  border: 0; border-left: 1px solid var(--line);
  padding: 0 1rem; cursor: pointer;
  white-space: nowrap;
}
.copy:hover { color: var(--text); background: var(--bg-raise); }
.copy.copied { color: var(--ok); }
.install-alt { font-size: 0.85rem; color: var(--dim); margin-bottom: 2.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; max-width: none; }
.install-alt .sep { color: var(--line); }
.install-alt code { color: var(--muted); font-size: 0.85rem; }
.copy-inline { border: 1px solid var(--line); border-radius: 3px; padding: 0 0.5rem; font-size: 0.75rem; }
.install-cmd.wide { max-width: none; }

/* ---- terminal demo ---- */
.term {
  max-width: 860px;
  background: var(--bg-term);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
}
.term-bar {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-raise);
  border-bottom: 1px solid var(--line);
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line); }
.term-title { margin-left: 0.6rem; color: var(--dim); font-family: var(--mono); font-size: 0.75rem; }
.term-body {
  margin: 0; padding: 0.9rem 1.1rem 1.1rem;
  min-height: 26em;
  white-space: pre-wrap; word-break: break-all;
  font-family: var(--mono);
  color: var(--text);
  overflow: hidden;
}
.term-body .u { color: var(--text); background: #213b49; display: inline-block; width: 100%; }  /* pi userMessageBg, full-width rows */
.term-body .a { color: var(--text); }                            /* assistant text */
.term-body .t { color: var(--muted); }                           /* tool cmd */
.term-body .o { color: var(--dim); }                             /* tool output */
.term-body .g { color: var(--ok); }                              /* took / ok */
.term-body .k { color: var(--dim); }                             /* footer */
.term-body .c { display: inline-block; width: 0.6em; height: 1.1em; background: var(--accent); vertical-align: -0.2em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term-body .c { animation: none; } }

/* ---- why ---- */
.why-grid, .feat-grid, .install-grid { display: grid; gap: 2rem 2.5rem; }
.why-grid { grid-template-columns: repeat(3, 1fr); }
.feat-grid { grid-template-columns: repeat(2, 1fr); }
.install-grid { grid-template-columns: repeat(2, 1fr); margin-bottom: 2.5rem; }
.why-grid p, .feat-grid p, .install-grid p { font-size: 0.95rem; margin: 0; max-width: none; }
.why-note { margin-top: 2rem; font-size: 0.95rem; color: var(--dim); font-style: italic; }

/* ---- compat table ---- */
.compat, .dl { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.compat th, .dl th { text-align: left; font-family: var(--mono); font-weight: 400; color: var(--dim); font-size: 0.8rem; padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--line); }
.compat td, .dl td { padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.compat td:first-child { color: var(--text); font-family: var(--mono); white-space: nowrap; }
.compat .ok { color: var(--ok); font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.compat .no { color: var(--err); font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.dl td { white-space: nowrap; }
.dl td:first-child { color: var(--text); }
.dl td:nth-child(2) { width: 100%; }
.dl td a { color: var(--border); }
.dl .num { text-align: right; font-family: var(--mono); color: var(--dim); }
.dl td:last-child { text-align: right; padding-right: 0; font-family: var(--mono); font-size: 0.85rem; }
.dl-note { font-size: 0.85rem; color: var(--dim); margin-top: 0.8rem; }
#ver { color: var(--muted); font-family: var(--mono); }

/* ---- steps ---- */
.steps { padding-left: 1.4rem; max-width: var(--measure); }
.steps li { margin-bottom: 0.9rem; }
.steps li::marker { color: var(--accent); font-family: var(--mono); }

/* ---- docs / footer ---- */
.docs ul { padding-left: 1.2rem; max-width: var(--measure); }
.docs li { margin-bottom: 0.5rem; }
footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2rem 0 3rem; font-size: 0.85rem; }
footer p { color: var(--dim); margin: 0.3rem 0; max-width: none; }
footer a { color: var(--muted); }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .top nav { gap: 0.9rem; font-size: 0.78rem; }
  .why-grid, .feat-grid, .install-grid { grid-template-columns: 1fr; gap: 1.6rem; }
  .hero { padding-top: 3rem; }
  .hero h1 { max-width: none; }
  .term { font-size: 11.5px; }
  .term-body { min-height: 22em; }
  .install-cmd code { white-space: normal; word-break: break-all; }
  .compat td:nth-child(3) { min-width: 40vw; }
}
