:root {
  --bg: #ffffff;
  --bg-alt: #f9fafb;
  --surface: #ffffff;
  --text: #111111;
  --text-2: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --btn-bg: #111111;
  --btn-fg: #ffffff;
  --code-bg: #101010;
  --code-fg: #e5e7eb;
  --code-dim: #8b8b8b;
  --code-key: #c4b5fd;
  --code-str: #a7f3d0;
  --code-kw: #fda4af;
  --green: #16a34a;
  --amber: #d97706;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.12);
  --radius: 12px;
  --display: "Cal Sans", "Inter", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --bg-alt: #111111;
    --surface: #141414;
    --text: #f5f5f5;
    --text-2: #d4d4d4;
    --muted: #a3a3a3;
    --border: #262626;
    --border-strong: #3a3a3a;
    --btn-bg: #f5f5f5;
    --btn-fg: #0a0a0a;
    --code-bg: #141414;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-alt: #111111;
  --surface: #141414;
  --text: #f5f5f5;
  --text-2: #d4d4d4;
  --muted: #a3a3a3;
  --border: #262626;
  --border-strong: #3a3a3a;
  --btn-bg: #f5f5f5;
  --btn-fg: #0a0a0a;
  --code-bg: #141414;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font-family: var(--mono); font-size: .9em; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0; margin: 0; color: var(--text); }
p { margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px;
  font: 500 15px/1 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: opacity .15s, background .15s;
}
.btn-dark { background: var(--btn-bg); color: var(--btn-fg); }
.btn-dark:hover { opacity: .86; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-light:hover { background: var(--bg-alt); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }
.btn:focus-visible, .tab-list button:focus-visible, .copy:focus-visible, a:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 32px; height: 64px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 18px/1 var(--display); text-decoration: none; letter-spacing: -0.01em;
}
.brand-mark {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--btn-bg); color: var(--btn-fg);
}
.nav-links { display: flex; gap: 24px; margin-right: auto; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--text); }

/* Hero */
.hero { padding: 88px 0 72px; border-bottom: 1px solid var(--border); overflow: hidden; }
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; color: var(--text-2); text-decoration: none; background: var(--surface);
}
.pill:hover { border-color: var(--border-strong); }
.pill-tag {
  padding: 2px 10px; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg);
  font-size: 12px; font-weight: 500;
}
.hero h1 { font-size: clamp(40px, 7vw, 72px); line-height: 1.05; margin: 28px 0 20px; max-width: 14ch; }
.lead { font-size: clamp(17px, 2vw, 19px); color: var(--muted); max-width: 640px; }
.hero-actions { margin-top: 32px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* Product preview */
.preview {
  display: grid; grid-template-columns: 220px 1fr;
  width: 100%; max-width: 940px; margin-top: 64px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden; font-size: 14px;
}
.preview-side { background: var(--bg-alt); border-right: 1px solid var(--border); padding: 16px 12px; }
.preview-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 8px; }
.preview-label.mt { margin-top: 18px; }
.chan, .member { padding: 6px 8px; border-radius: 8px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.chan.active { background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 500; }
.hash { color: var(--muted); }
.lock-ico { font-size: 11px; margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.dot.idle { background: var(--border-strong); }
.preview-main { display: flex; flex-direction: column; min-width: 0; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.badge { font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); white-space: nowrap; }
.badge-light { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.msgs { padding: 8px 20px 20px; display: flex; flex-direction: column; }
.msg { display: flex; gap: 12px; padding: 12px 0; }
.msg + .msg { border-top: 1px dashed var(--border); }
.avatar {
  width: 32px; height: 32px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
  border: 1px solid var(--border); background: var(--bg-alt); color: var(--text);
}
.avatar.a1 { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
.msg-meta { display: flex; gap: 8px; align-items: baseline; }
.msg-meta span { font-size: 12px; color: var(--muted); }
.msg-body { color: var(--text-2); margin-top: 2px; }
.msg-sys { color: var(--muted); font-size: 13px; margin-top: 2px; }
.msg code, .msg-sys code {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 12px;
}

/* Sections */
.section { padding: 96px 0; border-bottom: 1px solid var(--border); }
.section-alt { background: var(--bg-alt); }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 56px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.section h2 { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.1; }
.sub { color: var(--muted); font-size: 17px; margin-top: 16px; }
.sub.left { text-align: left; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { padding: 28px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border-strong); font-size: 13px; font-weight: 600; margin-bottom: 6px;
}
.step h3 { font-size: 20px; }
.step p { color: var(--muted); font-size: 15px; }
.mini {
  margin: auto 0 0; padding: 12px 14px; border-radius: 8px; background: var(--code-bg); color: var(--code-fg);
  font-size: 12.5px; line-height: 1.6; overflow-x: auto;
}
.step .mini { margin-top: 12px; }

/* Feature grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid.grid-2 { grid-template-columns: repeat(2, 1fr); }
.feature a { color: var(--text); }
.feature { padding: 28px; transition: border-color .15s; }
.feature:hover { border-color: var(--border-strong); }
.f-ico {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  display: grid; place-items: center; margin-bottom: 20px; background: var(--bg-alt);
}
.f-ico svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { font-size: 19px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 15px; }

/* Tabs + code */
.tabs { max-width: 880px; margin: 0 auto; }
.tab-list {
  display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-alt); margin: 0 auto 20px; position: relative; left: 50%; transform: translateX(-50%);
  max-width: 100%; overflow-x: auto;
}
.tab-list button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap;
  font: 500 14px/1 var(--sans); padding: 10px 18px; border-radius: 999px;
}
.tab-list button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.code-card { background: var(--code-bg); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.code-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
  color: var(--code-dim); font: 12.5px/1 var(--mono);
}
.copy {
  border: 1px solid rgba(255,255,255,.14); background: transparent; color: var(--code-fg);
  border-radius: 6px; padding: 5px 10px; font: 500 12px/1 var(--sans); cursor: pointer;
}
.copy:hover { background: rgba(255,255,255,.08); }
.code-card pre, .cta-code pre {
  margin: 0; padding: 20px; overflow-x: auto; color: var(--code-fg);
  font: 13.5px/1.7 var(--mono);
}
.code-card pre code, .cta-code pre code { font-size: inherit; }
.c-dim { color: var(--code-dim); }
.c-key { color: var(--code-key); }
.c-str { color: var(--code-str); }
.c-kw { color: var(--code-kw); }
.tool-list { border-top: 1px solid rgba(255,255,255,.08); display: grid; grid-template-columns: 1fr 1fr; }
.tool { display: flex; flex-direction: column; gap: 2px; padding: 12px 20px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; color: var(--code-dim); }
.tool code { color: var(--code-fg); font-size: 13px; }

/* Scoping split */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.split h2 { text-align: left; }
.checks { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.checks li { display: flex; gap: 12px; align-items: center; color: var(--text-2); }
.checks li::before {
  content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%;
  background: var(--btn-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center/12px no-repeat;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .checks li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E");
  }
}
.scope-diagram { padding: 20px; display: grid; gap: 16px; box-shadow: var(--shadow); }
.scope { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 16px; display: grid; gap: 12px; }
.scope-title { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 15px; }
.scope-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-alt); color: var(--text-2); }
.scope-lock { font: 12.5px/1.4 var(--mono); color: var(--muted); }

.split-h3 { font-size: 22px; }
.checks code, .savings-est code, .context-grid code { font: 12.5px var(--mono); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.savings-est { margin-top: 20px; }
.savings-est a { color: var(--text); }
.savings { padding: 8px 20px 18px; box-shadow: var(--shadow); }
.savings-head, .savings-row, .savings-total { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.savings-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.savings-row code { font: 12.5px/1.5 var(--mono); color: var(--text-2); overflow-wrap: anywhere; }
.savings-n, .savings-total span:last-child { white-space: nowrap; color: var(--muted); font-size: 14px; }
.savings-n b, .savings-total b { color: var(--text); }
.savings-total { border-bottom: 0; font-weight: 600; }
.savings-foot { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.context-grid { margin-top: 48px; }

/* Explainer videos */
.explainer { padding: 0; overflow: hidden; box-shadow: var(--shadow); max-width: 960px; margin: 0 auto; }
.explainer-video, .loop-video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--bg-alt); }
.loops { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 32px auto 0; max-width: 960px; }
.loop { padding: 0; overflow: hidden; margin: 0; }
.loops-inline { margin-bottom: 56px; }
.loop figcaption { padding: 14px 16px 16px; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.loop figcaption strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 4px; }
@media (max-width: 560px) { .loops { grid-template-columns: 1fr; } }

/* Context sharing vs CrossTalk */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 960px; margin: 0 auto; }
.vs-col { border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; background: var(--surface); }
.vs-old { background: var(--bg-alt); border-style: dashed; }
.vs-new { box-shadow: var(--shadow); border-color: var(--border-strong); }
.vs-label { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.vs-num { margin: 8px 0 6px; font: 400 clamp(40px, 6vw, 64px)/1 var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.vs-old .vs-num { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.vs-how { margin: 0; color: var(--text-2); font-size: 15px; }
.vs-foot { max-width: 760px; margin: 16px auto 56px; text-align: center; font-size: 13px; color: var(--muted); }
.vs-foot a { color: var(--text); }
@media (max-width: 720px) { .vs { grid-template-columns: 1fr; } .vs-col { padding: 22px; } }

/* CTA */
.cta { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; padding: 48px; }
.cta h2 { text-align: left; }
.cta-code { background: var(--code-bg); border-radius: 10px; overflow: hidden; }

/* Footer */
.footer { padding: 40px 0 56px; }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.footer .brand { margin-bottom: 8px; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a, .footer a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 900px) {
  .steps, .grid, .grid.grid-2 { grid-template-columns: 1fr 1fr; }
  .split, .cta { grid-template-columns: 1fr; gap: 32px; }
  .preview { grid-template-columns: 1fr; }
  .preview-side { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .nav-links { display: none; }
  .nav-inner { justify-content: space-between; }
  .hero { padding: 56px 0 48px; }
  .section { padding: 64px 0; }
  .steps, .grid, .grid.grid-2, .tool-list { grid-template-columns: 1fr; }
  .cta { padding: 24px; }
  .preview-head { padding: 12px 16px; }
  .msgs { padding: 4px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Grid children must be allowed to shrink below their code blocks' width */
.steps > *, .grid > *, .split > *, .cta > *, .tabs, .code-card, .cta-code { min-width: 0; }
.mini { white-space: pre-wrap; word-break: break-word; }

/* FAQ (landing + docs) */
.faq { display: grid; gap: 12px; }
.faq-center { max-width: 760px; margin: 0 auto; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.faq-item[open] { border-color: var(--border-strong); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 18px 52px 18px 22px; position: relative;
  font-weight: 500; font-size: 16px; color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; right: 22px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(45deg);
  transition: transform .15s;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-item summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: var(--radius); }
.faq-a { padding: 0 22px 20px; color: var(--text-2); font-size: 15px; display: grid; gap: 12px; }
.faq-a code { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.faq-a a { text-decoration: underline; text-underline-offset: 2px; }
.block {
  margin: 0; padding: 16px 18px; border-radius: 10px; background: var(--code-bg); color: var(--code-fg);
  font: 13px/1.7 var(--mono); overflow-x: auto;
}
.block code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.faq-more { text-align: center; margin-top: 28px; }
.faq-more a { font-weight: 500; text-decoration: none; }
.faq-more a:hover { text-decoration: underline; }
.nav-links a[aria-current="page"] { color: var(--text); }
@media (max-width: 720px) { .faq-a .block { font-size: 12px; } }

/* Usage globe */
.globe-stage { position: relative; max-width: 560px; margin: 0 auto; }
#usage-globe { width: 100%; max-width: 560px; aspect-ratio: 1; display: block; margin: 0 auto; touch-action: pan-y; cursor: grab; }
#usage-globe:active { cursor: grabbing; }
.globe-summary { text-align: center; margin-top: 16px; min-height: 1.6em; }
.globe-note { text-align: center; font-size: 13px; color: var(--muted); max-width: 560px; margin: 8px auto 0; }
.globe-note code { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-size: 12px; }
.globe-note a { color: var(--text); }
