/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --bg:            #ffffff;
  --bg-subtle:     #f8fafc;
  --border:        #e2e8f0;
  --dark-bg:       #0f1117;
  --dark-text:     #f1f5f9;
  --dark-muted:    #94a3b8;
  --code-bg:       #13161f;
  --code-response: #1a1f2e;
  --radius:        8px;
  --radius-lg:     12px;
  --font-sans:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code', Menlo, monospace;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* === Typography === */
h1 { font-size: clamp(2rem, 5vw, 3.5rem);   font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h3 { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; }

/* === Layout === */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* === Nav === */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 60px;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-right: auto;
}
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9375rem;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-subtle); }
.nav-signin {
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s;
  white-space: nowrap;
}
.nav-signin:hover { color: var(--text); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  margin: -8px 0 -8px -4px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.nav-toggle:hover { color: var(--text); background: var(--bg-subtle); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { opacity: 0.88; }
.btn-primary   { background: var(--accent);  color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); border-color: #cbd5e1; }
.btn-ghost-dark { background: transparent; color: var(--dark-text); border-color: rgba(255,255,255,0.2); }
.btn-ghost-dark:hover { background: rgba(255,255,255,0.08); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

/* === Hero === */
.hero {
  background: var(--dark-bg);
  color: var(--dark-text);
  padding: 100px 0 88px;
}
.hero h1 { color: #fff; margin-bottom: 20px; }
.hero p  { color: var(--dark-muted); font-size: 1.125rem; margin-bottom: 36px; max-width: 52ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* === Code blocks === */
/*
 * The copy button lives in its own flex row above the <pre> rather than as
 * an absolutely-positioned overlay. An overlay button anchored to the
 * container's right edge sits in the same coordinate space as the (often
 * much wider than the viewport) first line of code, so on narrow viewports
 * the visible portion of that line renders directly underneath it. Putting
 * the button in normal flow, on its own row, means it can never overlap the
 * code regardless of line length or container width.
 */
.code-block {
  background: var(--code-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.75;
  display: flex;
  flex-direction: column;
}
.code-block pre {
  padding: 6px 24px 20px;
  overflow-x: auto;
  white-space: pre;
  color: #e2e8f0;
}
.copy-btn {
  align-self: flex-end;
  flex-shrink: 0;
  margin: 10px 10px 0 0;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.11);
  color: var(--dark-muted);
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.5;
}
.copy-btn:hover  { background: rgba(255,255,255,0.13); color: var(--dark-text); }
.copy-btn.copied { color: #86efac; }

.code-response {
  background: var(--code-response);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  overflow-y: hidden;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.75;
  position: relative;
}
.code-response pre { padding: 16px 20px; overflow-x: visible; white-space: pre; color: #cbd5e1; }

/* Syntax tokens */
.t-cmd    { color: #e2e8f0; }
.t-flag   { color: #94a3b8; }
.t-str    { color: #a5d6ff; }
.t-url    { color: #86efac; }
.t-prompt { color: #4b5563; user-select: none; }
.t-key    { color: #7dd3fc; }
.t-val    { color: #a5d6ff; }
.t-num    { color: #f9a8d4; }
.t-bool   { color: #f9a8d4; }
.t-dim    { color: #4b5563; }
.t-comment { color: #4b5563; font-style: italic; }

/* === Demo section === */
.demo { padding: 80px 0; background: var(--bg-subtle); }
.demo-header { text-align: center; margin-bottom: 64px; }
.demo-header h2 { margin-bottom: 10px; }
.demo-header p  { color: var(--text-muted); margin: 0 auto; font-size: 1.0625rem; max-width: 50ch; }

.steps { display: flex; flex-direction: column; gap: 52px; }

.step { display: grid; grid-template-columns: 48px 1fr; gap: 28px; }
.step-num {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.0625rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-body { min-width: 0; }
.step-body h3  { margin-bottom: 6px; }
.step-body > p { color: var(--text-muted); font-size: 0.9375rem; margin-bottom: 16px; max-width: 55ch; }
.step-code     { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* === Feature grid === */
.features { padding: 80px 0; }
.features-header { text-align: center; margin-bottom: 48px; }
.features-header h2 { margin-bottom: 8px; }
.features-header p  { color: var(--text-muted); margin: 0 auto; max-width: 48ch; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.feature-icon  { font-size: 1.5rem; margin-bottom: 14px; }
.feature-card h3 { margin-bottom: 6px; }
.feature-card p  { color: var(--text-muted); font-size: 0.9375rem; }

/* === CTA === */
.cta { background: var(--dark-bg); padding: 88px 0; text-align: center; }
.cta h2 { color: #fff; margin-bottom: 12px; }
.cta p  { color: var(--dark-muted); font-size: 1.0625rem; margin: 0 auto 32px; max-width: 50ch; }
.cta-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* === Page hero (sub-pages) === */
.page-hero { padding: 72px 0 56px; }
.page-hero h1 { margin-bottom: 10px; }
.page-hero p  { color: var(--text-muted); font-size: 1.0625rem; max-width: 55ch; }

/* === Pricing === */
.pricing-section { padding: 0 0 80px; }

.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
  font-size: 0.9375rem;
}
.toggle-label { color: var(--text-muted); }
.toggle-label.active { color: var(--text); font-weight: 500; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

.toggle-save {
  background: #dcfce7;
  color: #15803d;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.pricing-card {
  max-width: 440px;
  margin: 0 auto;
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 0 0 5px rgba(99,102,241,0.07);
}
.plan-name {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 20px;
}
.price-row { display: flex; align-items: baseline; gap: 4px; margin-bottom: 2px; }
.price-amount { font-size: 3rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text); line-height: 1; }
.price-per    { color: var(--text-muted); font-size: 0.9375rem; }
.price-billed { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 28px; min-height: 1.4em; }

.pricing-divider { height: 1px; background: var(--border); margin: 24px 0; }

.pricing-features { list-style: none; display: flex; flex-direction: column; gap: 13px; margin-bottom: 32px; }
.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--text);
}
.pricing-features li::before { content: '✓'; color: var(--accent); font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.pricing-features li.note { color: var(--text-muted); font-size: 0.875rem; }
.pricing-features li.note::before { content: '*'; color: var(--text-muted); }

.pricing-cta .btn { width: 100%; justify-content: center; font-size: 1rem; padding: 12px; }

/* === FAQ === */
.faq-section { padding: 0 0 80px; }
.faq-section h2 { margin-bottom: 32px; }
.faq details { border-top: 1px solid var(--border); }
.faq details:last-child { border-bottom: 1px solid var(--border); }
.faq summary {
  padding: 18px 0;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  color: var(--text-muted);
  font-size: 1.25rem;
  font-weight: 300;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq-body { padding: 0 0 18px; }
.faq-body p { font-size: 0.9375rem; color: var(--text-muted); max-width: 65ch; }
.faq-body p + p { margin-top: 8px; }

/* === Docs === */
.docs-wrap { display: grid; grid-template-columns: 216px 1fr; min-height: calc(100vh - 60px); }

.docs-sidebar {
  border-right: 1px solid var(--border);
  padding: 32px 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.docs-sidebar-inner { padding: 0 12px; }
.sidebar-group { margin-bottom: 24px; }
.sidebar-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 4px;
  display: block;
}
.docs-sidebar a {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.docs-sidebar a:hover { color: var(--text); background: var(--bg-subtle); }
.docs-sidebar a.active { color: var(--accent); background: rgba(99,102,241,0.08); font-weight: 500; }

.docs-content { padding: 48px 48px 96px; max-width: 820px; min-width: 0; }
.docs-content h1 { margin-bottom: 12px; }
.docs-lead { font-size: 1.0625rem; color: var(--text-muted); margin-bottom: 56px; max-width: 60ch; }

.docs-section { margin-bottom: 64px; scroll-margin-top: 80px; }
.docs-section h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.docs-section h3 { font-size: 1rem; font-weight: 600; margin: 24px 0 8px; color: var(--text); }
.docs-section p  { font-size: 0.9375rem; color: var(--text-muted); margin-bottom: 12px; max-width: 65ch; }
.docs-section ul, .docs-section ol { padding-left: 20px; margin-bottom: 12px; }
.docs-section li { font-size: 0.9375rem; color: var(--text-muted); margin-bottom: 4px; }

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}

.endpoint {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 40px;
}
.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.method {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.method-post   { background: #dcfce7; color: #15803d; }
.method-get    { background: #dbeafe; color: #1d4ed8; }
.method-delete { background: #fee2e2; color: #b91c1c; }
.endpoint-path { font-family: var(--font-mono); font-size: 0.9375rem; color: var(--text); font-weight: 500; }
.endpoint-auth {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}
.endpoint-body { padding: 20px; }
.endpoint-body p { font-size: 0.9375rem; color: var(--text-muted); margin-bottom: 16px; max-width: 65ch; }

.param-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin: 4px 0 20px; }
.param-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.param-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.param-table tr:last-child td { border-bottom: none; }
.param-name { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text); }
.param-type { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--accent); }
.param-desc { color: var(--text-muted); }
.param-opt  { font-size: 0.75rem; color: var(--text-muted); background: var(--bg-subtle); border: 1px solid var(--border); padding: 1px 6px; border-radius: 10px; white-space: nowrap; }

.error-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-top: 8px; }
.error-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.error-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.error-table tr:last-child td { border-bottom: none; }
.status-code { font-family: var(--font-mono); font-weight: 600; }
.status-4xx  { color: #d97706; }
.status-5xx  { color: #dc2626; }

/* === Contact === */
.contact-section { padding: 0 0 80px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 72px; align-items: start; }

.contact-info h2 { font-size: 1.125rem; margin-bottom: 6px; }
.contact-info p  { font-size: 0.9375rem; color: var(--text-muted); margin-bottom: 6px; }
.contact-info a  { color: var(--accent); font-weight: 500; }
.contact-info a:hover { text-decoration: underline; }
.contact-info-block { margin-bottom: 32px; }

.contact-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.875rem; font-weight: 500; }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-group textarea { resize: vertical; min-height: 130px; }
.form-hp { display: none !important; } /* honeypot — bots fill this, we reject silently */
.form-turnstile { margin-top: 4px; }

.form-submit .btn { width: 100%; justify-content: center; padding: 11px; font-size: 1rem; }
.form-status {
  font-size: 0.9375rem;
  padding: 12px 16px;
  border-radius: var(--radius);
  display: none;
}
.form-status.success { display: block; background: #dcfce7; color: #15803d; }
.form-status.error   { display: block; background: #fee2e2; color: #b91c1c; }

/* === Footer === */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-logo { font-weight: 700; font-size: 0.9375rem; letter-spacing: -0.02em; }
.footer-logo span { color: var(--accent); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 0.875rem; color: var(--text-muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 0.8125rem; color: var(--text-muted); }

/* === Responsive === */
@media (max-width: 900px) {
  .docs-wrap { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .docs-content { padding: 32px 24px 64px; }
}

@media (max-width: 960px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
}

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

@media (max-width: 768px) {
  .nav-toggle { display: flex; order: 3; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 32px rgba(15,23,42,0.18), 0 4px 10px rgba(15,23,42,0.12);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 8px; }
  .feature-grid { grid-template-columns: 1fr; gap: 14px; }
  .contact-grid { grid-template-columns: 1fr; gap: 40px; }
  .step { grid-template-columns: 40px 1fr; gap: 18px; }
  .step-num { width: 40px; height: 40px; font-size: 0.9375rem; }
  .pricing-card { padding: 28px 22px; }
  .endpoint-auth { margin-left: 0; }
  .endpoint-path { flex-basis: 100%; order: 3; font-size: 0.875rem; }

  .param-table thead,
  .error-table thead { display: none; }

  .param-table tbody,
  .param-table tr,
  .error-table tbody,
  .error-table tr { display: block; }

  .param-table tr,
  .error-table tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .param-table tr:last-child,
  .error-table tr:last-child { border-bottom: none; }

  .param-table td,
  .error-table td { display: block; padding: 0; border: none; }

  .param-table td.param-desc,
  .error-table td.param-desc { flex-basis: 100%; padding-top: 4px; }
  .hero { padding: 64px 0 56px; }
  .demo, .features { padding: 56px 0; }
  .cta { padding: 64px 0; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

@media (max-width: 480px) {
  .hero-actions, .cta-actions { flex-direction: column; align-items: flex-start; }
  .cta-actions { align-items: center; }
  .pricing-card { padding: 24px 18px; }
  .price-amount { font-size: 2.5rem; }
}
