:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-2: #eef1f5;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --code-bg: #0b1020;
  --code-text: #e2e8f0;
  --code-muted: #7c8aa5;
  --code-str: #86efac;
  --code-kw: #93c5fd;
  --code-num: #fca5a5;
  --code-id: #f0abfc;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

input,
select,
textarea {
  background-color: var(--surface);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

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

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0 0 .4em;
  letter-spacing: -.02em;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 1rem;
}

code,
pre,
kbd {
  font-family: var(--mono);
}

code {
  font-size: .9em;
}

.container {
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
}

.container.narrow {
  width: min(760px, calc(100% - 2.5rem));
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: .15s ease;
  text-decoration: none !important;
}

.btn-sm {
  padding: .45rem .8rem;
  font-size: .85rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-ghost {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 300;
  color: var(--accent);
  letter-spacing: -.02em;
  font-size: 1.5rem;
}

.brand:hover {
  text-decoration: none;
}

.brand-name b {
  font-weight: 800;
  color: var(--accent-strong);
}

/* Logo: a rounded box split down the middle by a lightning-bolt shaped crack.
   Two clipped halves leave a transparent zigzag gap between them. */
.brand-mark {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--accent);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  border-radius: 3px;
  -webkit-clip-path: polygon(0 0, 49% 0, 35% 38%, 57% 46%, 41% 100%, 0 100%);
  clip-path: polygon(0 0, 49% 0, 35% 38%, 57% 46%, 41% 100%, 0 100%);
}

.brand-mark::after {
  -webkit-clip-path: polygon(55% 0, 100% 0, 100% 100%, 47% 100%, 63% 46%, 41% 38%);
  clip-path: polygon(55% 0, 100% 0, 100% 100%, 47% 100%, 63% 46%, 41% 38%);
  opacity: 0.72;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-left: auto;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
  font-size: .95rem;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-login {
  color: var(--muted);
  font-weight: 500;
  font-size: .95rem;
}

.nav-login:hover {
  color: var(--text);
  text-decoration: none;
}

/* Hero */
.hero {
  padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 3rem;
  align-items: center;
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.lede {
  font-size: 1.12rem;
  color: var(--muted);
  max-width: 34rem;
}

.hero-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 .75rem;
}

.hero-note {
  color: var(--muted);
  font-size: .9rem;
}

/* Terminal card */
.terminal {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow);
  border: 1px solid #1e293b;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem .9rem;
  background: #111830;
  border-bottom: 1px solid #1e293b;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.terminal-body {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  color: var(--code-text);
  font-size: .82rem;
  line-height: 1.7;
}

.terminal-body code {
  font-size: inherit;
}

.c-muted {
  color: var(--code-muted);
}

.c-str {
  color: var(--code-str);
}

.c-kw {
  color: var(--code-kw);
}

.c-num {
  color: var(--code-num);
}

.c-id {
  color: var(--code-id);
}

.c-ok {
  color: #4ade80;
}

.c-comment {
  color: var(--code-muted);
}

/* Sections */
.section {
  padding: clamp(3rem, 6vw, 4.5rem) 0;
}

.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  max-width: 44rem;
  margin-bottom: 2rem;
}

.section-head p {
  color: var(--muted);
  margin: 0;
}

/* Playground */
.playground {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
}

.presets {
  display: flex;
  gap: .35rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 999px;
  padding: .2rem .6rem;
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
  border-color: #cbd5e1;
}

#schema {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 0;
  outline: none;
  padding: 1rem;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  tab-size: 2;
}

#schema:focus {
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.control label {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .4rem;
}

.control output {
  color: var(--accent);
  font-family: var(--mono);
}

.control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.control input[type="text"],
.control select {
  width: 100%;
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .85rem;
  background: var(--bg);
  color: var(--text);
}

.seed-row {
  display: flex;
  gap: .4rem;
}

.seed-row input {
  flex: 1;
}

.control-inline label {
  margin-bottom: .4rem;
}

.run-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem 1rem;
}

.tabs {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tab {
  border: 0;
  background: var(--bg);
  color: var(--muted);
  padding: .45rem .9rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}

.tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.curl {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.curl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .9rem 0;
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--mono);
}

.curl pre {
  margin: 0;
  padding: .5rem .9rem 1rem;
  overflow-x: auto;
}

.curl code {
  font-size: .78rem;
  color: var(--text);
  white-space: pre;
}

.copy {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 6px;
  padding: .2rem .55rem;
  font: inherit;
  font-size: .72rem;
  cursor: pointer;
}

.copy:hover {
  color: var(--text);
}

.copy.copied {
  color: var(--ok);
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.status {
  color: var(--muted);
}

.status.is-running {
  color: var(--accent);
}

.status.is-ok {
  color: var(--ok);
}

.status.is-err {
  color: var(--danger);
}

.output {
  margin: 0;
  padding: 1rem;
  min-height: 360px;
  max-height: 560px;
  overflow: auto;
  background: var(--code-bg);
}

.output code {
  display: block;
  color: var(--code-text);
  font-size: .78rem;
  line-height: 1.65;
  white-space: pre;
}

.output code:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.error {
  margin: 0;
  padding: .9rem 1rem;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: .85rem;
  border-top: 1px solid #fecaca;
  white-space: pre-wrap;
}

/* Stack line */
.stack-line {
  text-align: center;
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0;
}

.stack-tags {
  display: inline-flex;
  gap: .5rem;
  margin-left: .6rem;
}

.stack-tags span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .82rem;
  color: var(--text);
  font-weight: 600;
}

.stack-note {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  margin: .7rem 0 0;
}

/* Free limits */
.limits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 1.25rem;
}

.limit {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  background: var(--bg);
}

.limit h3 {
  margin: 0 0 .5rem;
}

.limit .big {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.limits-cta {
  text-align: center;
  margin: 0;
}

/* Steps */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: .8rem;
}

.steps p {
  color: var(--muted);
  margin: 0;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.feature {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.feature h3 {
  margin-bottom: .35rem;
}

.feature p {
  color: var(--muted);
  margin: 0;
}

.feature code {
  background: var(--surface-2);
  padding: .05rem .3rem;
  border-radius: 4px;
}

/* Chaos showcase */
.chaos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.chaos-card {
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--shadow);
}

.chaos-type {
  margin: 0 0 .6rem;
}

.chaos-type code {
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}

.chaos-base {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .82rem;
  word-break: break-all;
}

.chaos-values {
  list-style: none;
  margin: .7rem 0 0;
  padding: .7rem 0 0;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: .4rem;
}

.chaos-values code {
  font-size: .82rem;
  word-break: break-all;
}

/* Pipe */
.pipe-grid {
  display: grid;
  gap: 1rem;
}

.cmd {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cmd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .85rem;
}

.cmd pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  background: var(--code-bg);
}

.cmd code {
  color: var(--code-text);
  font-size: .8rem;
  white-space: pre;
}

.fineprint {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 1rem;
}

/* FAQ */
details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: .85rem 1rem;
  margin-bottom: .6rem;
}

details[open] {
  background: var(--bg);
}

summary {
  cursor: pointer;
  font-weight: 600;
}

summary::marker {
  color: var(--accent);
}

details p {
  color: var(--muted);
  margin: .7rem 0 0;
}

details code {
  background: var(--surface-2);
  padding: .05rem .3rem;
  border-radius: 4px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  background: var(--bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
}

.footer-links a {
  color: var(--muted);
  font-size: .9rem;
}

.footer-copy {
  width: 100%;
  color: var(--muted);
  font-size: .85rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .playground {
    grid-template-columns: 1fr;
  }

  .steps,
  .features,
  .chaos-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .nav-links {
    display: none;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .steps,
  .features,
  .chaos-grid {
    grid-template-columns: 1fr;
  }

  .footer-links {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
    animation: none !important;
  }
}