/* Tollgate design system — developer-infra dark, single cyan accent.
   Palette per DESIGN-SYSTEM.md ("MCP product"): bg #0B0E14, accent #22D3EE,
   Geist for text, Geist Mono for everything that smells like a terminal. */

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/geist-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/geist-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/geist-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/geist-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/geist-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --bg: #0B0E14;
  --surface: #11151F;
  --surface-2: #151B28;
  --code-bg: #0D1019;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #E6E9EF;
  --muted: #8B93A7;
  /* #7C8499 keeps "faint" feeling faint while clearing 4.5:1 on every surface */
  --faint: #7C8499;
  --accent: #22D3EE;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --accent-line: rgba(34, 211, 238, 0.35);
  --good: #4ADE80;
  --bad: #F87171;
  --radius: 10px;
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* display:flex/grid on a class would otherwise defeat the hidden attribute */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 2% grain so dark surfaces don't read as plastic. */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 2147483647;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent); color: #06262C; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* In-text links must not rely on color alone (axe link-in-text-block) */
p a, li a, td a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(34, 211, 238, 0.45);
}
p a:hover, li a:hover, td a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { max-width: 1140px; margin-inline: auto; padding-inline: clamp(20px, 4vw, 48px); }

/* ---------- type ---------- */

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; margin: 0 0 16px; }
h1 { font-size: clamp(38px, 5.4vw, 58px); }
h2 { font-size: clamp(28px, 3.4vw, 36px); }
h3 { font-size: 20px; letter-spacing: -0.01em; }
p { margin: 0 0 14px; max-width: 62ch; }
.lead { font-size: 18.5px; color: var(--muted); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13.5px; }

.kicker {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.mono { font-family: var(--mono); }

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 14, 20, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; gap: 28px;
  height: 60px;
}
.brand {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand .tick { color: var(--accent); }
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--muted); font-size: 14.5px; padding: 8px 2px; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
/* .nav-links a outranks .btn-primary; restate the button's own colors */
.nav-links a.btn-primary { color: #06262C; padding: 11px 18px; }
.nav-links a.btn-primary:hover { color: #06262C; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 14px; font-weight: 500;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
  text-decoration: none !important;
}
.btn-primary { background: var(--accent); color: #06262C; }
.btn-primary:hover { background: #67E8F9; transform: translateY(-1px); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: default; transform: none; }

/* ---------- cards / surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.card h3 { margin-top: 2px; }

.term {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px; color: var(--faint);
}
.term-bar .dots { display: flex; gap: 6px; }
.term-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: #232A3A; }
.term-bar .title { margin-left: 6px; }
.term pre {
  margin: 0; padding: 16px 18px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.62;
  overflow-x: auto;
  color: var(--text);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
.term pre::-webkit-scrollbar { height: 6px; }
.term pre::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.term pre::-webkit-scrollbar-track { background: transparent; }

/* code tokens — cyan + grays only, no rainbow */
.c-k { color: var(--accent); }
.c-s { color: #BFD3F2; }
.c-c { color: var(--faint); }
.c-n { color: #67E8F9; }
.c-m { color: var(--muted); }

/* ---------- sections ---------- */

.section { padding: clamp(72px, 9vw, 120px) 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: 44px; }

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 28px;
  align-items: center;
}
/* Grid/flex children must be allowed to shrink below their content width,
   or a wide <pre> blows the whole column out of the viewport. */
.grid > *, .docs-layout > *, .cards-3 > *, .cards-2 > * { min-width: 0; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }

.cards-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.cards-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: stretch; }

/* ---------- hero ---------- */

.hero { padding: clamp(64px, 8vw, 104px) 0 clamp(56px, 7vw, 88px); }
.hero .grid { align-items: start; }
.hero h1 .accent { color: var(--accent); }
.hero-ctas { display: flex; gap: 14px; margin: 26px 0 18px; flex-wrap: wrap; }
.hero-note { font-size: 13.5px; color: var(--faint); font-family: var(--mono); }

.statline {
  display: flex; align-items: baseline; gap: 12px;
  margin-top: 18px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
}
.statline .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  align-self: center;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.statline .num { font-size: 26px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.statline .lbl { font-size: 12.5px; color: var(--faint); line-height: 1.4; }

/* ---------- tables ---------- */

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  font-family: var(--mono); font-weight: 500; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
table.data td.mono, table.data th.num, table.data td.num { font-family: var(--mono); font-size: 13.5px; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }

/* ---------- forms ---------- */

.field { display: flex; gap: 10px; flex-wrap: wrap; }
input[type="email"], input[type="text"], input[type="password"] {
  background: var(--code-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--mono);
  font-size: 14.5px;
  min-width: 0;
  flex: 1 1 240px;
  transition: border-color 160ms ease;
}
input:focus { outline: none; border-color: var(--accent); }
.form-error { color: var(--bad); font-size: 14px; font-family: var(--mono); margin-top: 10px; }
.form-ok { color: var(--good); font-size: 14px; font-family: var(--mono); margin-top: 10px; }

.keybox {
  display: flex; align-items: center; gap: 10px;
  background: var(--code-bg);
  border: 1px dashed var(--accent-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--mono); font-size: 14px;
  word-break: break-all;
}
.copybtn {
  font-family: var(--mono); font-size: 12px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
  transition: background 160ms ease;
  white-space: nowrap;
}
.copybtn:hover { background: rgba(34, 211, 238, 0.22); }

/* ---------- misc ---------- */

.pill {
  display: inline-block;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
  vertical-align: middle;
}
.pill.gray { color: var(--muted); border-color: var(--border-strong); background: transparent; }

.divider-label {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 56px;
  color: var(--muted); font-size: 14px;
}
.footer .cols { display: flex; gap: 48px; flex-wrap: wrap; justify-content: space-between; }
.footer p { line-height: 2.1; } /* breathing room doubles as touch-target size */
.footer a { color: var(--muted); padding: 4px 0; }
.footer a:hover { color: var(--accent); }
.footer .mono { font-size: 12.5px; color: var(--faint); }

.bignum { font-family: var(--mono); font-size: 34px; font-weight: 500; font-variant-numeric: tabular-nums; }

.sparkline { width: 100%; height: 64px; }
.sparkline rect { fill: var(--accent); opacity: 0.75; }
.sparkline rect:hover { opacity: 1; }

/* ---------- docs ---------- */

.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 48px; padding: 48px 0 96px; align-items: start; }
.docs-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 4px; }
.docs-nav a {
  color: var(--muted); font-size: 14px; padding: 10px 12px;
  border-radius: 8px; border-left: 2px solid transparent;
}
.docs-nav a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.docs-nav a.active { color: var(--accent); border-left-color: var(--accent); background: var(--surface); }
.docs-nav .group { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 18px 0 6px 12px; }
.docs-body h1 { font-size: 38px; }
.docs-body h2 { font-size: 24px; margin-top: 44px; }
.docs-body h3 { font-size: 18px; margin-top: 28px; }
.docs-body .term { margin: 18px 0 26px; }
.docs-body table.data { margin: 18px 0 26px; }
.docs-body code:not(pre code) {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px;
}
.docs-next { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; }

/* ---------- responsive ---------- */

@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; gap: 24px; }
  .col-7, .col-6, .col-5, .col-4 { grid-column: 1 / -1; }
  .cards-3, .cards-2 { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; gap: 24px; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .docs-nav .group { display: none; }
  .nav-links a:not(.btn) { display: none; }
  .hero { padding-top: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
