:root {
  --bg: #ffffff;
  --bg-soft: #f5f7f6;
  --surface: #ffffff;
  --text: #15201c;
  --muted: #5b6863;
  --border: #dfe5e2;
  --brand: #0f7b5f;
  --brand-strong: #0a5c47;
  --brand-soft: #e6f3ef;
  --code-bg: #f0f3f2;
  --up: #0f7b5f;
  --down: #c2412d;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 8px 24px rgba(16, 24, 20, .06);
  --radius: 12px;
  --max: 1120px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --bg-soft: #121c19;
    --surface: #16211e;
    --text: #e6eeeb;
    --muted: #9aaba5;
    --border: #26342f;
    --brand: #34c29a;
    --brand-strong: #5fd8b4;
    --brand-soft: #173029;
    --code-bg: #1b2925;
    --up: #34c29a;
    --down: #f07a64;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

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

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

code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--code-bg); padding: .1em .4em; border-radius: 5px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .container { padding: 0 24px; } }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 1.1rem; }
.logo:hover { text-decoration: none; }
.logo img { width: 28px; height: 28px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.nav .btn { margin-left: 8px; color: #fff; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px 10px; font: inherit; cursor: pointer; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px 16px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .nav .btn { margin: 8px 0 0; text-align: center; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; font-weight: 650;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  transition: background .15s ease, transform .15s ease;
}
@media (prefers-color-scheme: dark) { .btn { color: #06140f; } .nav .btn { color: #06140f; } }
.btn:hover { background: var(--brand-strong); text-decoration: none; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }
@media (prefers-color-scheme: dark) { .btn-ghost { color: var(--text); } }
.btn-sm { padding: 8px 14px; font-size: .9rem; }

/* Hero */
.hero { padding: 72px 0 56px; background: radial-gradient(1200px 400px at 80% -10%, var(--brand-soft), transparent 70%); }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1fr 1.05fr; } }
.eyebrow { display: inline-block; font-size: .85rem; font-weight: 650; color: var(--brand); background: var(--brand-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 16px; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 20px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 20px; color: var(--muted); font-size: .92rem; }
.hero-meta strong { color: var(--text); }

/* Spreadsheet mock */
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font-size: .88rem; }
.sheet-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.sheet-bar .fx { font-style: italic; font-weight: 700; color: var(--muted); font-family: Georgia, serif; }
.sheet-bar .formula { font-family: var(--mono); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-scroll { overflow-x: auto; }
.sheet table { border-collapse: collapse; width: 100%; min-width: 420px; }
.sheet th, .sheet td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 7px 10px; text-align: left; white-space: nowrap; }
.sheet thead th { background: var(--bg-soft); color: var(--muted); font-weight: 600; text-align: center; font-size: .8rem; }
.sheet tbody th { background: var(--bg-soft); color: var(--muted); font-weight: 600; width: 34px; text-align: center; font-size: .8rem; }
.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet tr.hdr td { font-weight: 650; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Sections */
section { padding: 72px 0; }
.section-soft { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 680px; margin-bottom: 40px; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.center { text-align: center; margin-left: auto; margin-right: auto; }

.grid { display: grid; gap: 20px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card p { color: var(--muted); margin-bottom: 0; }
.card .icon { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 14px; }
.card .icon svg { width: 22px; height: 22px; }

/* Function cards */
.fn-card { display: flex; flex-direction: column; gap: 10px; }
.fn-card h3 { font-family: var(--mono); font-size: 1rem; color: var(--brand); margin: 0; }
.fn-card p { flex: 1; }
.snippet { display: flex; align-items: center; gap: 8px; background: var(--code-bg); border-radius: 8px; padding: 8px 8px 8px 12px; font-family: var(--mono); font-size: .85rem; }
.snippet code { background: none; padding: 0; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; }
.copy { flex: none; background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 4px 8px; font: 600 .75rem var(--font); cursor: pointer; }
.copy:hover { color: var(--text); }
.copy.done { color: var(--brand); border-color: var(--brand); }

/* Asset class chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip { border: 1px solid var(--border); background: var(--surface); padding: 8px 16px; border-radius: 999px; font-weight: 600; }

/* Steps */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 56px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 750; display: grid; place-items: center;
}
@media (prefers-color-scheme: dark) { .step::before { color: #06140f; } }
.step p { color: var(--muted); }

/* Pricing */
.pricing { display: grid; gap: 20px; max-width: 780px; margin: 0 auto; }
@media (min-width: 720px) { .pricing { grid-template-columns: 1fr 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.plan .price { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 4px; }
.plan .price span { font-size: 1rem; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 20px 0 28px; flex: 1; }
.plan li { padding: 6px 0 6px 28px; position: relative; }
.plan li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 12px; height: 7px; border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg); }
.plan .btn { width: 100%; }

/* Quotes */
blockquote { margin: 0; }
.quote p { color: var(--text); font-size: 1.05rem; }
.quote footer { color: var(--muted); font-size: .9rem; margin-top: 12px; }
.stars { color: #e3a008; letter-spacing: 2px; }

/* FAQ */
details { border-bottom: 1px solid var(--border); padding: 18px 0; }
details summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--muted); font-size: 1.3rem; line-height: 1; }
details[open] summary::after { content: "–"; }
details p, details ul, details ol { color: var(--muted); margin-top: 12px; }

/* CTA band */
.cta-band { background: var(--brand); color: #fff; border-radius: 20px; padding: 48px 24px; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); font-size: 1.1rem; }
.cta-band .btn { background: #fff; color: var(--brand-strong); }
.cta-band .btn:hover { background: #f0f7f4; }
@media (prefers-color-scheme: dark) {
  .cta-band { background: var(--brand-soft); border: 1px solid var(--border); }
  .cta-band p { color: var(--muted); }
  .cta-band h2 { color: var(--text); }
  .cta-band .btn { background: var(--brand); color: #06140f; }
}

/* Docs layout */
.docs { display: grid; gap: 40px; padding: 48px 0 72px; }
@media (min-width: 960px) { .docs { grid-template-columns: 220px 1fr; } }
.toc { position: sticky; top: 88px; align-self: start; font-size: .93rem; }
.toc h4 { margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.toc ul { list-style: none; margin: 0 0 24px; padding: 0; }
.toc a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); font-family: var(--mono); font-size: .85rem; }
.toc a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
@media (max-width: 959px) { .toc { position: static; } .toc ul { display: flex; flex-wrap: wrap; gap: 4px; } }

.fn { padding-bottom: 48px; margin-bottom: 48px; border-bottom: 1px solid var(--border); }
.fn:last-child { border-bottom: 0; }
.fn h2 { font-family: var(--mono); font-size: 1.6rem; color: var(--brand); }
.fn h3 { margin-top: 28px; }
.syntax { background: var(--code-bg); border-radius: 8px; padding: 12px 16px; font-family: var(--mono); overflow-x: auto; white-space: nowrap; }
.params { width: 100%; border-collapse: collapse; margin-top: 8px; }
.params th, .params td { text-align: left; vertical-align: top; padding: 12px; border-bottom: 1px solid var(--border); }
.params th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.params td:first-child { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.opt { display: inline-block; font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; margin-left: 6px; font-family: var(--font); font-weight: 500; }
.params-wrap { overflow-x: auto; }

.attr-group { margin-top: 16px; }
.attr-group summary { font-family: var(--mono); }
.attr-group summary small { font-family: var(--font); color: var(--muted); font-weight: 400; margin-left: 8px; }
.attrs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.attrs li code { font-size: .8rem; }

/* Prose (legal / support) */
.page-head { padding: 56px 0 24px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.page-head p { color: var(--muted); }
.prose { max-width: 760px; padding: 40px 0 72px; }
.prose h2 { font-size: 1.35rem; margin-top: 2.2em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.callout { background: var(--brand-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin: 24px 0; }
.callout p:last-child { margin-bottom: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); font-size: .92rem; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.disclaimer { flex-basis: 100%; font-size: .82rem; }

.not-found { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 80px 0; }
.not-found .code { font-size: 5rem; font-weight: 800; color: var(--brand); line-height: 1; }

/* Let grid children shrink so long code lines scroll inside their box instead of widening the page */
.grid > *, .docs > *, .hero-grid > * { min-width: 0; }
