/* ===========================================================================
   API BCE — design system
   Premium developer-docs aesthetic. Light default + dark mode.
   =========================================================================== */
:root {
  --ink: #0b1220;
  --ink-2: #1e293b;
  --slate: #475569;
  --muted: #64748b;
  --line: #e6e8ee;
  --line-2: #eef0f5;
  --bg: #ffffff;
  --bg-2: #f7f8fb;
  --bg-3: #f1f3f9;
  --surface: #ffffff;

  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-ink: #1e3a8a;
  --brand-50: #eff4ff;
  --brand-100: #dbe6ff;
  --gold: #f5b301;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;

  /* code blocks are always dark, Stripe-style */
  --code-bg: #0d1424;
  --code-bg-2: #131c30;
  --code-line: #1e293b;
  --code-fg: #d7dee9;
  --code-muted: #7c8aa5;
  --code-tab: #8aa0c6;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow-md: 0 12px 32px -14px rgba(15,23,42,.20);
  --shadow-lg: 0 40px 80px -28px rgba(11,23,52,.40);
  --maxw: 1240px;
  --nav-h: 64px;
  --sidebar-w: 268px;
  --toc-w: 220px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
:root[data-theme="dark"] {
  --ink: #e8edf5;
  --ink-2: #cdd6e4;
  --slate: #a7b3c6;
  --muted: #8593a9;
  --line: rgba(255,255,255,.10);
  --line-2: rgba(255,255,255,.07);
  --bg: #0a0f1c;
  --bg-2: #0e1424;
  --bg-3: #121a2c;
  --surface: #0f1626;
  --brand: #5b8cff;
  --brand-2: #6d99ff;
  --brand-50: rgba(91,140,255,.12);
  --brand-100: rgba(91,140,255,.20);
  --code-bg: #070b15;
  --code-bg-2: #0c1322;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 14px 34px -14px rgba(0,0,0,.7);
  --shadow-lg: 0 40px 80px -28px rgba(0,0,0,.8);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  line-height: 1.65; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
::selection { background: var(--brand-100); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 600; font-size: 14.5px; line-height: 1;
  padding: 12px 20px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: transform .14s ease, box-shadow .2s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -8px rgba(37,99,235,.55); }
.btn-primary:hover { background: var(--brand-2); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); background: var(--bg-2); }
.btn-light { background: #fff; color: var(--brand-ink); }
.btn-light:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-lg { padding: 15px 26px; font-size: 15.5px; }

/* ---------- Header ---------- */
header.nav {
  position: sticky; top: 0; z-index: 60; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 18px; height: var(--nav-h); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; flex-shrink: 0; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; display: block; }
.brand small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.brand .name { display: flex; flex-direction: column; line-height: 1.15; }
.nav-links { display: flex; align-items: center; gap: 4px; margin: 0 auto; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--slate); padding: 8px 12px; border-radius: 8px; }
.nav-links a:hover { color: var(--ink); background: var(--bg-2); }
.nav-links a.active { color: var(--brand); }
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* icon button */
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--slate);
  cursor: pointer; transition: color .18s, border-color .18s, background .18s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

/* language switcher */
.lang-switch { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px;
  font-size: 13.5px; font-weight: 600; color: var(--slate); font-family: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; cursor: pointer;
}
.lang-btn:hover { color: var(--ink); border-color: var(--muted); }
.lang-btn .chev { width: 12px; height: 12px; transition: transform .2s; }
.lang-switch.open .lang-btn .chev { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 188px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-md); padding: 6px; z-index: 70;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity .16s, transform .16s;
}
.lang-switch.open .lang-menu { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lang-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--slate); }
.lang-menu a:hover { background: var(--bg-2); color: var(--ink); }
.lang-menu a.active { color: var(--brand); font-weight: 700; }

/* hamburger */
.nav-toggle { display: none; }
@media (max-width: 1000px) {
  .nav-links { display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0; margin: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 24px 18px; box-shadow: var(--shadow-md); }
  body.menu-open .nav-links { display: flex; }
  .nav-links a { padding: 13px 6px; font-size: 16px; border-bottom: 1px solid var(--line-2); border-radius: 0; }
  .nav-links a:last-child { border-bottom: none; }
  .nav-toggle { display: inline-flex; flex-direction: column; gap: 5px; }
  .nav-toggle span { width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s, opacity .2s; }
  body.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-links { margin-left: 0; }
}

/* ===========================================================================
   LANDING
   =========================================================================== */
.hero {
  position: relative; overflow: hidden; padding: 86px 0 74px;
  background:
    radial-gradient(900px 460px at 88% -8%, rgba(37,99,235,.16), transparent 60%),
    radial-gradient(640px 380px at 2% 0%, rgba(245,179,1,.10), transparent 55%);
}
:root[data-theme="dark"] .hero { background:
  radial-gradient(900px 460px at 88% -8%, rgba(91,140,255,.18), transparent 60%),
  radial-gradient(640px 380px at 2% 0%, rgba(245,179,1,.07), transparent 55%); }
.hero-grid { display: grid; grid-template-columns: 1.04fr .96fr; gap: 52px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--brand); background: var(--brand-50); border: 1px solid var(--brand-100);
  padding: 6px 13px; border-radius: 999px; margin-bottom: 22px; letter-spacing: .01em;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(245,179,1,.22); }
.hero h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.06; font-weight: 800; letter-spacing: -.035em; margin-bottom: 20px; }
.hero h1 .hl { background: linear-gradient(120deg, var(--brand), var(--brand-ink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .hero h1 .hl { background: linear-gradient(120deg, #7aa2ff, #b9ccff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 18.5px; color: var(--slate); max-width: 560px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.hero-note { font-size: 13.5px; color: var(--muted); max-width: 520px; }

/* hero code card */
.code-card { background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.code-card .cc-top { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--code-line); }
.code-card .cc-top .dots { display: flex; gap: 6px; }
.code-card .cc-top .dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.code-card .cc-top .label { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--code-muted); }
.code-card pre { margin: 0; padding: 18px 18px 20px; overflow-x: auto; }
.code-card code { font-family: var(--mono); font-size: 13px; line-height: 1.75; color: var(--code-fg); }

/* ---------- Code block component (tabs + copy) — shared landing + docs ---------- */
.code { background: var(--code-bg); border: 1px solid var(--code-line); border-radius: var(--radius-sm); overflow: hidden; margin: 16px 0; }
.code-head { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--code-line); background: var(--code-bg-2); }
.code-tab { font-family: var(--mono); font-size: 12px; color: var(--code-tab); background: none; border: none; padding: 11px 12px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; }
.code-tab:hover { color: #cdd9ee; }
.code-tab.active { color: #fff; border-bottom-color: var(--brand); }
.code-copy { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 12px; color: var(--code-muted); background: none; border: none; cursor: pointer; padding: 8px 10px; border-radius: 7px; }
.code-copy:hover { color: #fff; background: rgba(255,255,255,.06); }
.code-copy svg { width: 14px; height: 14px; }
.code-body { display: none; }
.code-body.active { display: block; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--code-fg); white-space: pre; }
.code .tok-key { color: #7aa2ff; }
.code .tok-str { color: #9ece6a; }
.code .tok-num { color: #ff9e64; }
.code .tok-bool { color: #f7768e; }
.code .tok-punc { color: #7c8aa5; }
.code .tok-comment { color: #5a6987; font-style: italic; }

/* trust strip */
.trust { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; margin-top: 60px; padding-top: 36px; border-top: 1px solid var(--line); }
.trust .t-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.trust .t-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* sections */
section.block { padding: 84px 0; }
section.alt { background: var(--bg-2); }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 50px; }
.kicker { color: var(--brand); font-weight: 700; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 12px; }
.section-head h2 { font-size: clamp(27px, 4vw, 38px); letter-spacing: -.03em; line-height: 1.15; margin-bottom: 14px; }
.section-head p { font-size: 17px; color: var(--muted); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-100); }
.card .ico { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; font-size: 22px; margin-bottom: 16px; background: var(--brand-50); }
.card h3 { font-size: 18px; margin-bottom: 8px; letter-spacing: -.01em; }
.card p { color: var(--muted); font-size: 14.5px; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-sm); }
.step .num { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--brand-ink), var(--brand)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 17px; margin-bottom: 16px; }
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 14.5px; }

/* FAQ */
.faq-wrap { max-width: 780px; margin: 0 auto; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--surface); overflow: hidden; }
.faq-q { width: 100%; text-align: left; background: none; border: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 22px; font-size: 16px; font-weight: 600; color: var(--ink); font-family: inherit; }
.faq-q .sign { font-size: 22px; color: var(--brand); transition: transform .25s; line-height: 1; flex-shrink: 0; }
.faq-item.open .faq-q .sign { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-a p { padding: 0 22px 20px; color: var(--muted); font-size: 14.5px; }
.faq-item.open .faq-a { max-height: 360px; }

/* CTA */
.cta-band { background: linear-gradient(135deg, var(--brand-ink), var(--brand)); color: #fff; text-align: center; border-radius: 0; }
.cta-band h2 { font-size: clamp(27px, 4vw, 40px); letter-spacing: -.03em; margin-bottom: 14px; }
.cta-band p { font-size: 18px; color: rgba(255,255,255,.85); margin-bottom: 28px; max-width: 560px; margin-left: auto; margin-right: auto; }
.cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* footer */
footer.site { background: var(--bg-2); border-top: 1px solid var(--line); padding: 56px 0 30px; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 30px; }
.foot-about .brand { margin-bottom: 12px; }
.foot-about p { font-size: 13.5px; color: var(--muted); max-width: 320px; }
.foot-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; }
.foot-col a { display: block; font-size: 14px; color: var(--slate); padding: 5px 0; }
.foot-col a:hover { color: var(--brand); }
.foot-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .trust { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .steps { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 26px; }
}
@media (max-width: 600px) { .brand small { display: none; } .trust { grid-template-columns: 1fr 1fr; } .foot-grid { grid-template-columns: 1fr; } }
