:root {
  --bg: #04080b;
  --panel: #081217;
  --panel-hi: #0d1c24;
  --line: #152b35;
  --line-spec: #244f61;
  --line-soft: #0f2028;
  --ink: #e9f4f7;
  --mid: #8aa5b0;
  --accent: #22d3ee;
  --accent-hi: #67e8f9;
  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --ease: 150ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, p { margin: 0; }

a {
  color: inherit;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color var(--ease);
}
a:hover { color: var(--accent); }

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

:is(a, button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; color: var(--bg); }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding-inline: 32px;
}

/* Header */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font: 500 16px/1 var(--mono);
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
}
.brand:hover { color: var(--accent); }

.bar-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mid);
}

.bar-nav a {
  padding: 8px 0;
  text-decoration: none;
  white-space: nowrap;
}
.bar-nav a:hover { color: var(--accent); }

.bar-key {
  padding: 8px 14px !important;
  border: 1px solid var(--line-spec);
  background: var(--panel);
  color: var(--ink) !important;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.bar-key:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg) !important;
}

/* Main */
main {
  padding-block: 56px 56px;
}

.intro {
  padding-bottom: 36px;
}

.intro h1 {
  font-size: clamp(32px, 4.4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 12px;
  max-width: 720px;
}

.lead {
  max-width: 640px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--mid);
}

/* Wire console */
.console {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top-color: var(--line-spec);
  margin-bottom: 48px;
}

.console-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.console-tab {
  min-height: 44px;
  min-width: 104px;
  appearance: none;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mid);
  white-space: nowrap;
  transition: background-color var(--ease), color var(--ease);
}
.console-tab:hover { background: var(--panel); color: var(--ink); }
.console-tab[aria-selected="true"] {
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
}

.console-body {
  position: relative;
  padding: 20px 24px;
}

.console-body pre {
  margin: 0 88px 0 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  min-height: 180px;
}

.copy-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 36px;
  min-width: 72px;
  appearance: none;
  background: var(--bg);
  border: 1px solid var(--line-spec);
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  transition: background-color var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
}
.copy-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.copy-btn:active { transform: scale(0.98); }

.console-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mid);
}

/* Endpoint contract table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-top-color: var(--line-spec);
  background: var(--panel);
}

.contract {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.contract th,
.contract td {
  text-align: left;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  vertical-align: baseline;
}

.contract thead th {
  border-top: 0;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--mid);
  white-space: nowrap;
}

.contract code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

.m-post { color: var(--accent); font-family: var(--mono); font-size: 12px; margin-right: 8px; }
.m-get { color: var(--mid); font-family: var(--mono); font-size: 12px; margin-right: 8px; }
.c-tool { font-family: var(--mono); font-size: 12.5px; color: var(--mid); white-space: nowrap; }
.c-req { font-family: var(--mono); font-size: 12.5px; color: var(--mid); white-space: nowrap; }
.c-units { font-family: var(--mono); font-size: 12.5px; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.contract th:last-child { text-align: right; }

/* Footer */
footer {
  border-top: 1px solid var(--line);
  padding-block: 24px 40px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--mid);
}
.footer-links a { text-decoration: none; padding: 4px 0; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 720px) {
  .wrap { padding-inline: 20px; }
  main { padding-block: 40px 44px; }
  .bar-nav { gap: 14px; font-size: 12px; }
  .console-tab { flex: 1; min-width: 0; }
  .console-tab:last-child { border-right: 0; }
  .console-body { padding: 16px; }
  .console-body pre { margin-right: 0; padding-top: 44px; }
  .copy-btn { top: 12px; right: 12px; }
  .console-meta { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
