:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --ink: #111827;
  --muted: #5b6472;
  --border: #d9dee8;
  --border-strong: #b8c2d3;
  --blue: #225cff;
  --blue-soft: #eff6ff;
  --green: #18a38d;
  --green-soft: #ecfdf5;
  --orange: #ef7d57;
  --orange-soft: #fff7ed;
  --code-bg: #101827;
  --code-text: #f8fafc;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
  color: #0f3f97;
  font-size: 0.92em;
}

pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.docs-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.docs-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  overflow-y: auto;
}

.docs-sidebar .brand {
  margin: 0 6px 18px;
  color: var(--ink);
}

.docs-nav {
  display: grid;
  gap: 3px;
}

.docs-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.docs-nav a:hover,
.docs-nav a:focus-visible {
  background: var(--surface-soft);
  color: var(--ink);
  outline: 0;
}

.docs-nav svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.docs-main {
  min-width: 0;
  padding: 0 36px 64px;
}

.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 12px 0;
  background: rgba(247, 248, 251, 0.88);
  border-bottom: 1px solid rgba(217, 222, 232, 0.72);
  backdrop-filter: blur(16px);
}

.back-link,
.text-link,
.copy-page-button,
.primary-action,
.secondary-action,
.copy-code-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  font-weight: 700;
}

.back-link,
.text-link {
  color: var(--muted);
}

.back-link:hover,
.text-link:hover,
.back-link:focus-visible,
.text-link:focus-visible {
  color: var(--ink);
  outline: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: 100%;
}

.copy-page-button,
.copy-code-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}

.copy-page-button {
  padding: 0 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.copy-code-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--code-text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  font-size: 12px;
}

.copy-page-button:hover,
.copy-page-button:focus-visible {
  border-color: var(--blue);
  outline: 0;
}

.copy-code-button:hover,
.copy-code-button:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: 0;
}

.copy-code-button svg {
  width: 16px;
  height: 16px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.code-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.code-select {
  min-height: 32px;
  max-width: 220px;
  padding: 0 34px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--code-text);
  font-size: 12px;
  font-weight: 800;
}

.code-select:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.code-select option {
  color: var(--ink);
  background: var(--surface);
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.75fr);
  gap: 36px;
  align-items: center;
  padding: 54px 0 30px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0;
  line-height: 1.05;
}

h1 {
  max-width: 860px;
  font-size: clamp(42px, 6vw, 72px);
}

h2 {
  font-size: clamp(30px, 3.5vw, 46px);
}

h3 {
  font-size: 20px;
}

.lead,
.section-heading p,
.detail-panel p,
.info-card p,
.step-card p,
.price-card p,
.latency-card p,
.model-card p {
  color: var(--muted);
}

.lead {
  max-width: 760px;
  margin: 20px 0 0;
  font-size: 19px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  padding: 0 16px;
  border: 1px solid var(--border);
}

.primary-action {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.secondary-action {
  background: var(--surface);
  color: var(--ink);
}

.hero-diagram {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-diagram svg,
.flow-diagram svg,
.billing-diagram svg,
.webhook-visual svg {
  width: 100%;
  height: auto;
}

.svg-title {
  fill: var(--ink);
  font: 700 18px "IBM Plex Sans", sans-serif;
}

.svg-muted {
  fill: var(--muted);
  font: 500 18px "IBM Plex Sans", sans-serif;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 12px 0 72px;
}

.metric-card,
.step-card,
.info-card,
.sdk-panel,
.detail-panel,
.price-card,
.latency-card,
.model-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-card svg {
  color: var(--blue);
}

.metric-card span,
.price-card span,
.latency-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.docs-section {
  padding: 46px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 90px;
}

.intro-section {
  padding-top: 34px;
  border-top: 0;
}

.section-heading {
  max-width: 900px;
  margin-bottom: 24px;
}

.section-heading p {
  margin: 14px 0 0;
  font-size: 17px;
}

.step-grid,
.info-grid,
.price-grid,
.latency-grid,
.model-grid {
  display: grid;
  gap: 16px;
}

.step-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.step-card,
.info-card,
.detail-panel,
.model-card {
  padding: 22px;
}

.step-card h3,
.info-card h3,
.detail-panel h3,
.model-card h3 {
  margin-top: 14px;
}

.step-card p,
.info-card p,
.detail-panel p,
.model-card p {
  margin: 10px 0 0;
}

.info-card svg,
.model-card svg {
  color: var(--green);
}

.icon-pill {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
}

.icon-pill.green {
  color: var(--green);
  background: var(--green-soft);
}

.icon-pill.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.code-panel {
  min-width: 0;
  margin-top: 18px;
  border: 1px solid #1f2a3d;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  overflow: hidden;
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 800;
}

pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.7;
}

.two-column,
.code-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.webhook-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.sdk-panel {
  overflow: hidden;
}

.sdk-panel .code-panel {
  margin-top: 0;
}

.sdk-panel .sdk-code-panel {
  margin: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 0;
}

.panel-heading svg {
  color: var(--blue);
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.sdk-panel pre {
  margin-top: 12px;
  background: var(--code-bg);
  color: var(--code-text);
}

.callout-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.callout svg {
  flex: 0 0 auto;
  color: var(--blue);
}

.callout strong,
.callout span {
  display: block;
}

.callout span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.flow-diagram,
.billing-diagram,
.webhook-visual {
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.flow-box {
  fill: #eff6ff;
  stroke: #bfdbfe;
}

.flow-box.green {
  fill: #ecfdf5;
  stroke: #bbf7d0;
}

.flow-box.orange {
  fill: #fff7ed;
  stroke: #fed7aa;
}

.flow-box.blue {
  fill: #eef2ff;
  stroke: #c7d2fe;
}

.flow-line-dark {
  stroke: #225cff;
  stroke-width: 8;
  stroke-linecap: round;
  fill: none;
}

.flow-arrow {
  stroke: #9aa4b2;
  stroke-width: 4;
  stroke-linecap: round;
}

.flow-arrow-fill {
  fill: #9aa4b2;
}

.flow-circle {
  fill: #ffffff;
  stroke: #ef7d57;
  stroke-width: 4;
}

.flow-diagram text {
  fill: var(--ink);
  font: 700 18px "IBM Plex Sans", sans-serif;
}

.endpoint-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.endpoint-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.endpoint-method,
.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.method {
  min-width: 64px;
}

.method.get {
  background: var(--green);
}

.method.delete {
  background: #d8563f;
}

.limit-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.limit-strip div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 800;
}

.limit-strip svg {
  color: var(--orange);
  flex: 0 0 auto;
}

.webhook-layout {
  align-items: stretch;
}

.webhook-layout .code-panel {
  margin-top: 0;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 26px;
  color: var(--muted);
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, var(--green), var(--blue));
}

.price-grid {
  grid-template-columns: 1.1fr repeat(3, minmax(0, 1fr));
}

.price-card {
  padding: 22px;
}

.price-card.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.price-card.primary span,
.price-card.primary p {
  color: #cbd5e1;
}

.price-card strong {
  display: block;
  margin: 8px 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 34px;
  line-height: 1;
}

.latency-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.latency-card {
  padding: 18px;
}

.latency-card strong {
  display: block;
  margin-top: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
}

.model-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.endpoint-table {
  margin-top: 24px;
}

.endpoint-table h3 {
  margin-bottom: 12px;
}

.final-section {
  padding-bottom: 24px;
}

@media (max-width: 1180px) {
  .docs-shell {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .docs-main {
    padding: 0 24px 56px;
  }

  .hero-section,
  .price-grid,
  .latency-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .docs-shell {
    display: block;
  }

  .docs-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .docs-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .docs-nav a {
    flex: 0 0 auto;
  }

  .hero-section,
  .step-grid,
  .info-grid,
  .two-column,
  .code-grid,
  .callout-row,
  .limit-strip,
  .webhook-layout,
  .price-grid,
  .latency-grid,
  .model-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    padding-top: 36px;
  }

  .endpoint-card {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .docs-main {
    padding: 0 16px 44px;
  }

  .docs-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .code-actions {
    width: 100%;
    justify-content: space-between;
  }

  .code-select {
    max-width: min(220px, 100%);
  }

  .copy-page-button {
    min-width: 132px;
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 30px;
  }

  .lead {
    font-size: 17px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .docs-section {
    padding: 38px 0;
  }

  pre {
    font-size: 13px;
  }
}
