:root {
  --bg: #0a0f0d;
  --surface: #0f1714;
  --surface-2: #0c1411;
  --border: #1e2b25;
  --border-lit: #2c4a3b;
  --text: #dce5e0;
  --muted: #8aa499;
  --accent: #4ade80;
  --accent-2: #22d3ee;
  --err: #f87171;
  --code: #cfe8da;
  --radius: 14px;
  --maxw: 1080px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans:
    system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Theme toggle button (injected into the nav by app.js). */
.theme-toggle {
  margin-left: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  line-height: 1;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
}

/* Light theme — toggled by setting data-theme="light" on <html>. */
:root[data-theme="light"] {
  --bg: #f6faf7;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --border: #d8e3dc;
  --border-lit: #aacfba;
  --text: #15201a;
  --muted: #576f64;
  --accent: #15a04a;
  --accent-2: #0e9aba;
  --err: #dc2626;
  --code: #1c2c23;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(74, 222, 128, 0.08);
  color: #b8f3cf;
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.025em;
}

/* Announcement bar */
.announce {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.88rem;
  color: var(--text);
  background:
    linear-gradient(
      90deg,
      rgba(74, 222, 128, 0.12),
      rgba(34, 211, 238, 0.12)
    );
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.announce:hover {
  text-decoration: none;
}
.announce code {
  background: rgba(0, 0, 0, 0.35);
}
.announce-tag {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.66rem;
  font-weight: 800;
  color: #04140c;
  background: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
}
.announce-arrow {
  color: var(--accent);
  transition: transform 0.2s ease;
}
.announce:hover .announce-arrow {
  transform: translateX(4px);
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(10, 15, 13, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.brand img {
  border-radius: 6px;
}
.brand:hover {
  text-decoration: none;
}
.nav nav {
  display: flex;
  align-items: center;
  gap: 22px;
}
.nav nav a {
  color: var(--muted);
  font-size: 0.95rem;
}
.nav nav a:hover {
  color: var(--text);
  text-decoration: none;
}
.nav-gh {
  color: var(--text) !important;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
}
.nav-gh:hover {
  border-color: var(--accent);
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* Section labels */
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 10px;
}
section h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  margin: 0 0 6px;
  font-weight: 800;
}
.lead {
  max-width: 680px;
  font-size: 1.02rem;
}

/* Hero */
.hero {
  position: relative;
  text-align: center;
  padding: 96px 0 72px;
  overflow: hidden;
}
.hero-glow {
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 760px;
  height: 520px;
  max-width: 120vw;
  background: radial-gradient(
    ellipse at center,
    rgba(74, 222, 128, 0.18),
    rgba(34, 211, 238, 0.06) 45%,
    transparent 70%
  );
  filter: blur(8px);
  pointer-events: none;
  z-index: -1;
}
.logo {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  margin: 0 auto 24px;
  display: block;
  box-shadow: 0 0 50px rgba(74, 222, 128, 0.3);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 14px;
}
.eyebrow b {
  color: var(--accent);
  font-weight: 800;
}
.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  margin: 0 0 22px;
  font-weight: 800;
}
.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  max-width: 640px;
  margin: 0 auto 30px;
  font-size: 1.18rem;
  color: var(--muted);
}
.cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
  transition:
    transform 0.12s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--accent);
}
.btn.primary {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #04140c;
  border: none;
}
.btn.primary:hover {
  box-shadow: 0 8px 28px rgba(74, 222, 128, 0.3);
}
.badges {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 26px;
}
.badges img {
  height: 20px;
  display: block;
}
.pronounce {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}
.pronounce span {
  font-family: var(--mono);
  color: var(--accent);
  background: rgba(74, 222, 128, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
  margin-right: 6px;
}

/* Panes / code */
.pane {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.pane-title {
  color: var(--muted);
}
.meter {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}
.meter b {
  color: var(--accent);
  font-weight: 600;
}
.meter-sep {
  opacity: 0.5;
  margin: 0 2px;
}
.tag {
  color: var(--accent);
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
}
pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
}
pre code {
  background: none;
  color: var(--code);
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

.showcase-wrap {
  padding: 8px 0 56px;
}
.showcase,
.pg {
  display: flex;
  align-items: stretch;
  gap: 16px;
}
.showcase {
  margin-top: 6px;
}
.arrow {
  align-self: center;
  color: var(--accent);
  font-size: 1.6rem;
  flex: 0 0 auto;
}

/* Generic section spacing */
.features,
.language,
.how,
.ai,
.playground,
.community {
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

/* Features */
.grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition:
    transform 0.15s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-lit);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--accent);
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Language */
.language pre,
.quickstart-inline pre {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* How it works */
.steps {
  margin: 22px 0 0;
  padding-left: 22px;
  color: var(--muted);
  display: grid;
  gap: 12px;
  max-width: 760px;
}
.steps b {
  color: var(--text);
}
.runtime-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.runtime-grid div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.runtime-grid b {
  display: block;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 0.95rem;
}
.runtime-grid span {
  color: var(--muted);
  font-size: 0.88rem;
}

/* Write with AI */
.prompt-box {
  position: relative;
  margin: 22px 0;
}
.prompt-box pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 380px;
}
#copy-prompt {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Playground */
.presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.muted {
  color: var(--muted);
}
#pg-input {
  width: 100%;
  height: 340px;
  border: none;
  resize: vertical;
  background: var(--surface);
  color: var(--code);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 16px;
  outline: none;
}
#pg-output {
  display: block;
  height: 340px;
}
.pg .pane pre {
  height: 340px;
}
.pg-status {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}
.pg-status.ok {
  color: var(--accent);
}
.pg-status.err {
  color: var(--err);
}

/* Playground toolbar (TOON-style controls row) */
.pg-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.pg-toolbar-spacer {
  flex: 1 1 auto;
}
.ctl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ctl-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.select {
  appearance: none;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 30px 6px 12px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238aa499' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s ease;
}
.select:hover,
.select:focus {
  border-color: var(--accent);
  outline: none;
}
.btn-ghost {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pg-savings {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  min-height: 1.2em;
}

/* Community */
.quickstart-inline pre {
  max-width: 560px;
}
.community .cta {
  justify-content: flex-start;
  margin-top: 26px;
}
.contributors {
  display: block;
  margin-top: 34px;
}
.contributors:hover {
  text-decoration: none;
}
.contributors img {
  max-width: 100%;
  border-radius: 10px;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.dot {
  opacity: 0.5;
}

/* Active nav link */
.nav nav a.active {
  color: var(--accent);
}

/* Generic page header (docs / examples / playground) */
.page-head {
  padding: 56px 0 8px;
}
.page-head h1,
.docs-content h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  margin: 0 0 14px;
  font-weight: 800;
}

/* Docs: sidebar + content */
.docs-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 44px;
  padding-top: 40px;
  padding-bottom: 72px;
}
.docs-sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
}
.docs-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid var(--border);
}
.docs-sidebar a {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 4px 14px;
  border-left: 2px solid transparent;
  margin-left: -1px;
}
.docs-sidebar a:hover {
  color: var(--text);
  border-left-color: var(--accent);
  text-decoration: none;
}
.side-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  margin: 18px 0 6px 14px;
}
.side-label:first-child {
  margin-top: 0;
}
.docs-content {
  min-width: 0;
  max-width: 760px;
}
.docs-content h2 {
  font-size: 1.5rem;
  margin: 46px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.docs-content p {
  color: var(--text);
}
.docs-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
}
.docs-content .flow {
  color: var(--muted);
}

/* Mermaid diagrams */
.mermaid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 18px;
  margin: 16px 0;
  text-align: center;
  overflow-x: auto;
  /* hide the raw source until mermaid swaps in the SVG */
  color: transparent;
  font-size: 0;
  line-height: 0;
}
.mermaid[data-processed] {
  color: var(--text);
}
.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}
tbody tr:last-child td {
  border-bottom: none;
}
td {
  color: var(--muted);
}

/* Examples */
.examples-list {
  display: grid;
  gap: 40px;
  padding: 24px 0 8px;
}
.example h3 {
  font-size: 1.2rem;
  margin: 0 0 14px;
}
.example h3 .muted {
  font-weight: 400;
  font-size: 0.95rem;
}
.page-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 40px 0 64px;
}

/* Tutorial steps */
.tutorial-step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 18px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.tutorial-step h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
  border: none;
  padding: 0;
}
.tutorial-step > div {
  min-width: 0;
}
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #04140c;
  font-weight: 800;
  font-size: 1.05rem;
}
.tutorial-step pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 0;
}

/* Blog */
.blog-list {
  display: grid;
  gap: 28px;
  padding: 24px 0 8px;
}
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.post-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}
.post-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #04140c;
  background: var(--accent);
  padding: 2px 9px;
  border-radius: 999px;
}
.post h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}
.post pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 0;
}
.post-list {
  color: var(--muted);
  display: grid;
  gap: 8px;
  padding-left: 22px;
}
.post-list b {
  color: var(--text);
}

/* Playground page */
.playground-page {
  padding: 8px 0 72px;
}
.showcase-cta {
  margin-top: 16px;
}

@media (max-width: 860px) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .docs-sidebar {
    position: static;
    max-height: none;
  }
  .docs-sidebar nav {
    flex-flow: row wrap;
    border-left: none;
  }
  .side-label {
    display: none;
  }
  .runtime-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 760px) {
  .nav {
    padding: 12px 16px;
  }
  .nav nav {
    gap: 14px;
    font-size: 0.9rem;
  }
  .showcase,
  .pg {
    flex-direction: column;
  }
  .arrow {
    transform: rotate(90deg);
  }
  .grid {
    grid-template-columns: 1fr;
  }
}
