:root {
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --bg: #ffffff;
  --text: #111827;
  --muted: #5b6472;
  --border: #e5e7eb;
  --soft: #f8fafc;
  --soft-2: #f1f5f9;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-inline-bg: #eef2f7;
  --max: 1180px;
  --nav-height: 64px;
  --sidebar-width: 260px;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --text: #e5e7eb;
    --muted: #a3afc2;
    --border: #243044;
    --soft: #111827;
    --soft-2: #172033;
    --accent: #60a5fa;
    --accent-dark: #93c5fd;
    --code-bg: #020617;
    --code-text: #e2e8f0;
  }
}

* { box-sizing: border-box; }

html { width: 100%; max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.nav-open { overflow: hidden; }

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: white;
  border-radius: 8px;
}
.skip-link:focus { left: 12px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: var(--nav-height);
  padding: 0 20px;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; color: var(--text); font-weight: 750; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: #fff; display: grid; place-items: center; font-size: 14px; }
.page-title { display: none; min-width: 0; flex: 1; color: var(--muted); font-size: 14px; font-weight: 650; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.topnav { display: flex; align-items: center; gap: 18px; min-width: 0; font-size: 14px; }
.topnav a { color: var(--muted); font-weight: 600; }
.topnav a:hover { color: var(--accent); text-decoration: none; }

.menu-toggle { display: none; flex: 0 0 auto; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 0; font: inherit; cursor: pointer; }
.menu-toggle:hover { background: var(--soft); }
.menu-toggle:focus-visible, .drawer-close:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-toggle-line, .menu-toggle-line::before, .menu-toggle-line::after { display: block; width: 17px; height: 2px; border-radius: 99px; background: currentColor; content: ""; transition: transform 160ms ease, opacity 160ms ease; }
.menu-toggle-line { position: relative; }
.menu-toggle-line::before { position: absolute; transform: translateY(-6px); }
.menu-toggle-line::after { position: absolute; transform: translateY(6px); }
.menu-toggle[aria-expanded="true"] .menu-toggle-line { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-line::before { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-line::after { transform: rotate(-45deg); }

.layout {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 34px;
  padding: 26px 20px 56px;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 10px);
  align-self: start;
  height: calc(100vh - var(--nav-height) - 24px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding-right: 20px;
  scrollbar-width: thin;
}

.sidebar-title { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin: 8px 0 10px; }
.sidebar a { position: relative; display: block; color: var(--muted); padding: 8px 10px 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; transition: background-color 140ms ease, color 140ms ease; }
.sidebar a:hover { background: var(--soft); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--soft-2); color: var(--accent); text-decoration: none; }
.sidebar a.active::before { position: absolute; left: 5px; top: 50%; width: 3px; height: 18px; border-radius: 99px; background: var(--accent); content: ""; transform: translateY(-50%); }
.drawer-header { display: none; }
.drawer-overlay { position: fixed; inset: 0; z-index: 85; background: rgba(15, 23, 42, 0.42); opacity: 0; pointer-events: none; transition: opacity 180ms ease; backdrop-filter: blur(2px); }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-close { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 10px; padding: 7px 10px; font: inherit; cursor: pointer; }

.content, .docs-content { width: 100%; min-width: 0; max-width: 920px; }
.layout > .content:only-child { grid-column: 1 / -1; max-width: 920px; }
.hero { padding: 54px 0 34px; }
.eyebrow { color: var(--accent); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 10px 0 18px; font-size: clamp(34px, 5vw, 58px); line-height: 1.04; letter-spacing: -0.045em; }
h2 { margin: 46px 0 16px; font-size: clamp(25px, 3vw, 34px); line-height: 1.18; letter-spacing: -0.03em; }
h3 { margin: 28px 0 10px; font-size: clamp(19px, 2vw, 22px); line-height: 1.28; letter-spacing: -0.015em; }
h4 { margin: 22px 0 8px; font-size: 16px; }
p { margin: 0 0 16px; }
ul, ol { padding-left: 1.35rem; margin: 0 0 18px; }
li + li { margin-top: 6px; }
.lead { color: var(--muted); font-size: 20px; max-width: 760px; }
.muted { color: var(--muted); }

.actions, .cluster { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; min-width: 0; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; padding: 10px 16px; font-weight: 750; border: 1px solid var(--border); color: var(--text); background: var(--bg); }
.button.primary { background: var(--accent); color: white; border-color: var(--accent); }
.button:hover { text-decoration: none; transform: translateY(-1px); }

.grid, .docs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 18px 0 28px; min-width: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stack { display: grid; gap: 16px; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--bg); }
.card.soft { background: var(--soft); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.provider-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.provider { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--soft); }
.provider strong { display: block; margin-bottom: 4px; }

.sponsor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0 28px; }
.sponsor-card, .tier-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--bg); }
.sponsor-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sponsor-card h3, .tier-card h3 { margin: 0 0 6px; }
.sponsor-card span { display: inline-flex; color: var(--muted); font-size: 13px; font-weight: 700; }
.sponsor-logo, .sponsor-logo-fallback { width: 48px; height: 48px; border-radius: 12px; flex: 0 0 auto; }
.sponsor-logo { object-fit: cover; border: 1px solid var(--border); }
.sponsor-logo-fallback { display: grid; place-items: center; background: var(--soft-2); color: var(--text); border: 1px solid var(--border); font-weight: 800; }
.sponsor-empty { background: var(--soft); grid-column: 1 / -1; }
.tier-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0 28px; }
.faq-list article { border-top: 1px solid var(--border); padding: 16px 0; }
.faq-list h3 { margin-top: 0; }

.callout { border-left: 4px solid var(--accent); background: var(--soft); padding: 16px 18px; border-radius: 0 var(--radius) var(--radius) 0; margin: 18px 0; }
.callout.warning { border-left-color: #d97706; }

code { font-family: var(--font-mono); }
:not(pre) > code { padding: 0.15rem 0.35rem; border-radius: 6px; background: var(--code-inline-bg); border: 1px solid var(--border); font-size: 0.9em; line-height: 1.4; word-break: break-word; }
pre, .code-block { position: relative; max-width: 100%; margin: 18px 0; padding: 18px; border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); overflow-x: auto; overflow-y: hidden; border: 1px solid #1e293b; -webkit-overflow-scrolling: touch; }
pre code { display: block; min-width: max-content; white-space: pre; padding: 0; border: 0; background: transparent; color: inherit; font-size: clamp(12px, 1.7vw, 13px); line-height: 1.65; }
.copy-button { position: absolute; right: 10px; top: 10px; border: 1px solid #334155; background: #172033; color: #cbd5e1; border-radius: 8px; padding: 5px 8px; font-size: 12px; cursor: pointer; }

.table { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 18px 0; border: 1px solid var(--border); border-radius: 12px; }
.table table { width: 100%; min-width: 640px; border-collapse: collapse; margin: 0; font-size: 14px; }
.table th, .table td { white-space: nowrap; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
.table th:last-child, .table td:last-child { border-right: 0; }
.table tr:last-child td { border-bottom: 0; }
.table th { background: var(--soft); font-weight: 750; }
table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
th, td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
th { background: var(--soft); }

.footer { border-top: 1px solid var(--border); margin-top: 56px; padding: 28px 0; color: var(--muted); font-size: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.mobile-only { display: none; }
.desktop-only { display: initial; }

.not-found { min-height: 55vh; display: grid; align-content: center; }

@media (min-width: 1440px) {
  :root { --max: 1240px; --sidebar-width: 280px; }
}

@media (max-width: 1023px) {
  .topbar { z-index: 90; }
  .menu-toggle { display: inline-flex; }
  .page-title { display: block; }
  .topnav { display: none; }
  .layout { display: block; padding: 22px 20px 48px; }
  .content { max-width: none; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: min(84vw, 320px);
    height: 100dvh;
    max-height: none;
    padding: 0 16px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg);
    box-shadow: none;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    will-change: transform;
  }
  .sidebar.open { transform: translateX(0); }
  .drawer-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--nav-height); margin: 0 -16px 8px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .drawer-header strong { font-size: 14px; }
  .sidebar-title { margin-top: 14px; }
  .grid, .grid.two, .provider-list, .sponsor-grid, .tier-grid { grid-template-columns: 1fr; }
  .hero { padding: 34px 0 24px; }
  .desktop-only { display: none; }
  .mobile-only { display: initial; }
}

@media (min-width: 700px) and (max-width: 1023px) {
  .sponsor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar-inner { padding-inline: 14px; }
  .layout { padding: 18px 14px 42px; }
  .brand span:last-child { display: none; }
  h1 { font-size: clamp(34px, 12vw, 46px); }
  h2 { margin-top: 36px; }
  .lead { font-size: 18px; }
  .button { width: 100%; }
  .actions .button { flex: 1 1 100%; }
  pre { margin-inline: -2px; padding: 16px 14px; }
  .copy-button { top: 8px; right: 8px; }
}

@media (max-width: 480px) {
  body { font-size: 15.5px; }
  .layout { padding-inline: 12px; }
  .card, .sponsor-card, .tier-card { padding: 16px; }
  .table { margin-inline: -2px; width: calc(100% + 4px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
