@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #0a0a0a;
  --ink-soft: #171717;
  --muted: #737373;
  --muted-2: #a3a3a3;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --surface: #ffffff;
  --bg: #fafafa;
  --soft: #f5f5f5;
  --accent: #0a0a0a;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --warn-text: #92400e;
  --code-bg: #0a0a0a;
  --code-text: #f5f5f5;
  --font: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 10px;
  --nav: 240px;
  --header: 60px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 20px);
}

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

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

a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { opacity: 0.75; }

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 5px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(250, 250, 250, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand:hover { opacity: 1; text-decoration: none; }

.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, opacity 180ms ease;
  text-decoration: none;
}

.btn:hover { text-decoration: none; opacity: 1; }
.btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

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

.btn-primary:hover { background: #262626; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover { background: var(--soft); }

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr);
  max-width: 1180px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--header);
  height: calc(100vh - var(--header));
  overflow-y: auto;
  padding: 28px 14px 40px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.nav-group { margin-bottom: 22px; }

.nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-link {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.nav-link:hover {
  background: var(--soft);
  color: var(--ink);
  opacity: 1;
  text-decoration: none;
}

.nav-link.active {
  background: var(--ink);
  color: #fff;
}

.content {
  padding: 36px 48px 72px;
  max-width: 760px;
}

/* Hero — brand first */
.hero {
  margin-bottom: 48px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--line);
  animation: rise 0.45s ease both;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.hero-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
}

.hero-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-brand-text strong {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-brand-text span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 3.6vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 700;
  max-width: 14ch;
}

.hero p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34em;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px 0 0;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.feature strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.feature span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Sections */
.section {
  margin-bottom: 52px;
  animation: rise 0.5s ease both;
}

.section h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.section h3 {
  margin: 26px 0 10px;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.section > p,
.lead {
  color: var(--muted);
  margin: 0 0 18px;
}

.section ul {
  margin: 0 0 8px;
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.section li { margin-bottom: 6px; }

/* Steps — simple numbered flow */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.steps li {
  position: relative;
  padding: 0 0 18px 44px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.steps li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px;
  top: 32px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}

.steps strong { display: block; margin-bottom: 2px; }
.steps span { color: var(--muted); font-size: 0.92rem; }

/* Code */
.code-tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.tab-btn {
  padding: 7px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.tab-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid #171717;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.code-block.solo { border-radius: var(--radius); }

.code-block pre,
.code-block pre code {
  margin: 0;
  padding: 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: #f5f5f5 !important;
  background: transparent !important;
  border: none !important;
}

.code-block pre {
  padding: 16px 18px;
  display: block;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-family: var(--font);
  font-weight: 600;
  background: #262626;
  color: #d4d4d4;
  border: 1px solid #404040;
  border-radius: 6px;
  cursor: pointer;
}

.copy-btn:hover { background: #404040; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Endpoint */
.endpoint {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.endpoint-path {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.method {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
}

.method.get {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.path {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
}

.endpoint p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 10px 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

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

th {
  background: var(--soft);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

td code {
  font-size: 0.78rem;
}

tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  margin-left: 5px;
  vertical-align: middle;
}

.badge.optional {
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
}

.callout {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0 20px;
  color: var(--warn-text);
  font-size: 0.9rem;
}

/* Playground */
.playground {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.form-grid { display: grid; gap: 14px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 0.92rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}

textarea {
  min-height: 92px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.field-hint a {
  color: var(--ink);
}

.form-row-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.check-wrap {
  display: flex;
  align-items: flex-end;
  min-height: 42px;
  padding-bottom: 2px;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin: 0;
}

.check-label input {
  width: auto;
  margin: 0;
  accent-color: var(--ink);
}

.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 16px;
}

.status-bar.ok {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #166534;
}

.status-bar.err {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #991b1b;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
}

.status-bar.ok .status-dot { background: var(--success); }
.status-bar.err .status-dot { background: var(--danger); }

.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.provider-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.provider-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.provider-card span {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.play-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  display: none;
}

.play-result.show { display: block; }
.play-result.ok {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #166534;
}
.play-result.err {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #991b1b;
}

.footer-note {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-note img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.7;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header);
    width: min(280px, 88vw);
    z-index: 50;
    background: var(--surface);
    transform: translateX(-105%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .content { padding: 24px 18px 56px; }
  .form-row { grid-template-columns: 1fr; }
  .feature-row { grid-template-columns: 1fr; }
  .provider-grid { grid-template-columns: 1fr; }
  .form-row-inner { grid-template-columns: 1fr; }
  .header-actions .hide-sm { display: none; }
  .hero h1 { max-width: none; }
}
