/* app.css — a small Tailwind-flavored utility set + design tokens. No Tailwind.
   Dark mode is pure CSS: color-scheme + light-dark() follow the OS; a [data-theme]
   on <html> (set server-side from a cookie) overrides it with no flash, no JS. */

:root {
  color-scheme: light dark;
  /* Tailwind Zinc scale — neutral/monochrome. light-dark(light, dark). */
  --bg:        light-dark(#fafafa, #09090b); /* zinc-50  / zinc-950 */
  --surface:   light-dark(#ffffff, #18181b); /* white    / zinc-900 */
  --fg:        light-dark(#18181b, #fafafa); /* zinc-900 / zinc-50  */
  --muted:     light-dark(#71717a, #a1a1aa); /* zinc-500 / zinc-400 */
  --border:    light-dark(#e4e4e7, #27272a); /* zinc-200 / zinc-800 */
  --accent:    light-dark(#27272a, #e4e4e7); /* zinc-800 / zinc-200 — high-contrast, still monochrome */
  --on-accent: light-dark(#fafafa, #18181b); /* zinc-50  / zinc-900 */
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 10px 30px rgb(0 0 0 / .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font-family: var(--font); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* layout */
.min-h-screen { min-height: 100dvh; }
.flex { display: flex; } .grid { display: grid; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; } .gap-4 { gap: 1rem; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .grid-cols-3 { grid-template-columns: 1fr; } }

/* spacing */
.p-4 { padding: 1rem; } .p-8 { padding: 2rem; }
.mt-2 { margin-top: .5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }

/* sizing */
.w-full { width: 100%; } .max-w-2xl { max-width: 42rem; margin-inline: auto; }

/* typography */
.text-center { text-align: center; }
.text-sm { font-size: .875rem; } .text-lg { font-size: 1.125rem; } .text-5xl { font-size: clamp(2.25rem, 6vw, 3rem); line-height: 1.1; }
.font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.tracking-tight { letter-spacing: -.02em; }
.text-muted { color: var(--muted); }

/* surfaces & components */
.border-b { border-bottom: 1px solid var(--border); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); text-align: left; }
.badge { display: inline-block; padding: .2rem .7rem; border-radius: 9999px; font-size: .8rem; font-weight: 600; color: var(--accent); background: color-mix(in oklab, var(--accent) 15%, transparent); }
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem .85rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .04s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.workspace { width: 100%; height: calc(100dvh - 58px); } /* fills below the ~58px nav */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; }
.query-form { display: flex; gap: .5rem; padding: .75rem 0; }
.query-input { flex: 1; font: 13px/1.5 ui-monospace, SFMono-Regular, monospace; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--fg); resize: vertical; }
.query-out { overflow: auto; }
.query-err { color: light-dark(#b91c1c, #fca5a5); white-space: pre-wrap; font: 12px/1.5 ui-monospace, monospace; }
.dock-panel { height: 100%; padding: 1rem; font: 400 14px/1.6 var(--font); }

/* Theme toggle: show the button for the *other* theme. CSS resolves the active
   theme — including the no-cookie case, which follows the OS — so the control is
   always correct without any JS. */
.to-dark { display: inline-flex; }
.to-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .to-dark { display: none; }
  :root:not([data-theme]) .to-light { display: inline-flex; }
}
:root[data-theme="dark"] .to-dark { display: none; }
:root[data-theme="dark"] .to-light { display: inline-flex; }
:root[data-theme="light"] .to-dark { display: inline-flex; }
:root[data-theme="light"] .to-light { display: none; }

/* ── Landing page ───────────────────────────────────────────────────────────
   Same Zinc tokens as everything else; no new palette, no new font. Sections
   are separated by hairlines rather than boxes so the page reads as one column. */
.wrap { max-width: 60rem; margin-inline: auto; padding: 0 1.5rem 5rem; }
.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2rem, 5vw, 3.5rem); text-align: center; }
.hero h1 { max-width: 20ch; margin-inline: auto; }
.lede { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--muted); max-width: 56ch; margin-inline: auto; }
.invoke { margin: 0; }
.invoke code {
  display: inline-block; padding: .6rem 1.1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
  font: 600 1.05rem/1 ui-monospace, SFMono-Regular, monospace; color: var(--fg); letter-spacing: -.01em;
}
.cta-row { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { text-decoration: none; opacity: .9; }

.section { padding: clamp(2.5rem, 6vw, 4rem) 0; border-top: 1px solid var(--border); }
.section-title { font-size: clamp(1.5rem, 3.5vw, 2rem); font-weight: 700; letter-spacing: -.02em; margin: 0 0 .75rem; }
.section > p { max-width: 62ch; }

.drifts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.drift-quote { margin: 0; font-weight: 600; font-size: 1.02rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step-n {
  flex: none; width: 2rem; height: 2rem; border-radius: 9999px;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  background: var(--accent); color: var(--on-accent);
}
.step-name { font: 600 .95rem/1.4 ui-monospace, SFMono-Regular, monospace; }
.step p { margin: 0; max-width: 62ch; }

.pull { margin: 0; border-left: 3px solid var(--accent); padding: .25rem 0 .25rem 1.5rem; }
.pull-quote { margin: 0; font-size: clamp(1.25rem, 3vw, 1.6rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.pull-body { margin: 1rem 0 0; color: var(--muted); max-width: 62ch; }

.guard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.guard { background: var(--surface); padding: 1.1rem; }
.guard-rule { margin: 0; font-weight: 600; font-size: .95rem; }
.guard-detail { margin: .4rem 0 0; color: var(--muted); font-size: .875rem; }

.facts { margin: 0; padding: 0; list-style: none; display: grid; gap: .85rem; }
.facts li { padding-left: 1.4rem; position: relative; max-width: 70ch; color: var(--muted); }
.facts li::before { content: "▲"; position: absolute; left: 0; color: var(--accent); font-size: .7rem; top: .45rem; }

.cta-end { text-align: center; }
.cta-end .section-title, .cta-end > p { margin-inline: auto; }

@media (max-width: 800px) {
  .drifts, .guard-grid { grid-template-columns: 1fr; }
}
