/* Tokenaro front page. Readable documentation first, with a light HUD accent. */

/* ------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --bg-band: #eaf0f2;
  --surface: #ffffff;
  --text: #0e1a22;
  --muted: #4a5c68;
  --border: #d3dde2;
  --border-strong: #b7c6cd;
  --accent: #0a7a81;          /* text links and focus on light (5:1 on white) */
  --accent-hover: #075e64;
  --accent-bright: #22d3d3;   /* the monitor's cyan: decoration only */
  --accent-soft: #dff4f4;
  --on-accent: #ffffff;
  --btn-bg: #0a7a81;
  --btn-bg-hover: #075e64;
  --code-bg: #0b141a;
  --code-bar: #111e26;
  --code-text: #d9e6ec;
  --code-muted: #8ea6b2;
  --code-border: #1d2d37;
  --ph-bg: rgba(34, 211, 211, 0.16);
  --ph-text: #6ee8e8;
  --tag-main: #0a7a81;
  --tag-fast: #2f6f2a;
  --tag-slow: #8a4b07;
  --shadow: 0 1px 2px rgba(14, 26, 34, 0.06), 0 8px 24px rgba(14, 26, 34, 0.06);
  --grid-line: rgba(10, 122, 129, 0.07);
  --radius: 6px;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080d11;
    --bg-band: #0c141a;
    --surface: #0f181f;
    --text: #e3edf2;
    --muted: #9fb3bf;
    --border: #1e2c36;
    --border-strong: #2c3f4b;
    --accent: #22d3d3;
    --accent-hover: #6ee8e8;
    --accent-soft: rgba(34, 211, 211, 0.12);
    --on-accent: #03181a;
    --btn-bg: #22d3d3;
    --btn-bg-hover: #6ee8e8;
    --code-bg: #060b0e;
    --code-bar: #0c151b;
    --code-border: #1b2a33;
    --tag-main: #22d3d3;
    --tag-fast: #8fd88a;
    --tag-slow: #f2b36b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --grid-line: rgba(34, 211, 211, 0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d11;
  --bg-band: #0c141a;
  --surface: #0f181f;
  --text: #e3edf2;
  --muted: #9fb3bf;
  --border: #1e2c36;
  --border-strong: #2c3f4b;
  --accent: #22d3d3;
  --accent-hover: #6ee8e8;
  --accent-soft: rgba(34, 211, 211, 0.12);
  --on-accent: #03181a;
  --btn-bg: #22d3d3;
  --btn-bg-hover: #6ee8e8;
  --code-bg: #060b0e;
  --code-bar: #0c151b;
  --code-border: #1b2a33;
  --tag-main: #22d3d3;
  --tag-fast: #8fd88a;
  --tag-slow: #f2b36b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --grid-line: rgba(34, 211, 211, 0.06);
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: var(--font-mono); }
:not(pre) > code {
  font-size: 0.875em;
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.08em 0.35em;
  overflow-wrap: anywhere;
}
strong { font-weight: 600; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--btn-bg); color: var(--on-accent); padding: 0.5rem 0.9rem; border-radius: var(--radius);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0.75rem; color: var(--on-accent); }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.small { font-size: 0.875rem; color: var(--muted); }
.nowrap { white-space: nowrap; }
.note {
  font-size: 0.9375rem;
  border-left: 3px solid var(--accent-bright);
  background: var(--accent-soft);
  padding: 0.6rem 0.9rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.section-lede { color: var(--muted); max-width: 70ch; }

/* HUD corner brackets: the monitor's look, kept to a hint */
.hud { position: relative; }
.hud::before {
  content: ""; position: absolute; inset: -1px; pointer-events: none; border-radius: inherit;
  --c: var(--accent-bright);
  background:
    linear-gradient(var(--c), var(--c)) top left / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 2px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 16px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 2px 16px no-repeat;
}

/* ------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-weight: 600; }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark .plate { fill: #0a1218; stroke: var(--accent-bright); stroke-width: 4; }
.brand-mark .glyph { fill: var(--accent-bright); }
.brand-name { font-size: 1.0625rem; letter-spacing: 0.02em; }
.site-nav { margin-left: auto; min-width: 0; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem 0.25rem; }
.site-nav a {
  display: block; padding: 0.35rem 0.6rem; border-radius: var(--radius);
  color: var(--muted); text-decoration: none; font-size: 0.9375rem;
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); }
@media (max-width: 640px) {
  .header-inner { padding-top: 0.4rem; padding-bottom: 0.4rem; gap: 0.25rem; }
  .site-nav { margin-left: 0; width: 100%; }
  .site-nav ul { gap: 0; justify-content: space-between; }
  .site-nav a { padding: 0.3rem 0.4rem; font-size: 0.875rem; }
  html { scroll-padding-top: 6rem; }
}

/* ------------------------------------------------------------ hero */
.hero {
  padding: 3rem 0 2.5rem;
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg-band);
  border-bottom: 1px solid var(--border);
}
.hero-grid { display: grid; gap: 2rem; align-items: start; }
.hero-grid > * { min-width: 0; }
@media (min-width: 920px) {
  .hero { padding: 4.5rem 0 4rem; }
  .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 3rem; }
}
.hero h1 { font-size: clamp(2.5rem, 7vw, 3.75rem); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.4em; }
.lede { font-size: 1.125rem; color: var(--muted); max-width: 60ch; }

.base-url {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 0.8rem;
  box-shadow: var(--shadow);
}
.base-url-label { display: block; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.base-url-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.25rem 0 0.4rem; flex-wrap: wrap; }
.base-url-row code {
  font-size: clamp(1rem, 3.6vw, 1.3rem);
  font-weight: 500;
  background: none; padding: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}
.base-url-note { font-size: 0.875rem; color: var(--muted); margin: 0; }

/* key panel */
.key-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.key-label { display: block; font-weight: 600; font-size: 1.0625rem; margin-bottom: 0.25rem; }
.key-help { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.85rem; }
.key-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.key-row input {
  flex: 1 1 14rem; min-width: 0;
  font: 500 1rem/1.4 var(--font-mono);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}
.key-row input::placeholder { color: var(--muted); opacity: 0.8; }
.key-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.key-tools { display: flex; gap: 0.5rem; }
.key-state { font-size: 0.875rem; color: var(--muted); margin: 0.75rem 0 0; }
.key-state.is-set { color: var(--text); }
.key-state code.ph { white-space: nowrap; }

/* ------------------------------------------------------------ buttons */
button { font: inherit; }
.copy-btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2.25rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.copy-btn {
  background: var(--btn-bg); color: var(--on-accent);
  border: 1px solid transparent;
}
.copy-btn:hover { background: var(--btn-bg-hover); }
.copy-btn.is-done { background: transparent; color: var(--accent); border-color: var(--accent); }
.code .copy-btn {
  min-height: 2rem; padding: 0.2rem 0.75rem; font-size: 0.8125rem;
  background: transparent; color: var(--accent-bright); border-color: rgba(34, 211, 211, 0.45);
}
.code .copy-btn:hover { background: rgba(34, 211, 211, 0.14); color: #a5f3f3; }
.code .copy-btn.is-done { color: #a5f3f3; border-color: #a5f3f3; }
.code .copy-btn:focus-visible { outline-color: var(--accent-bright); }

/* ------------------------------------------------------------ sections */
.section { padding: 3.25rem 0; border-bottom: 1px solid var(--border); }
.section:nth-of-type(odd) { background: var(--bg-band); }
@media (min-width: 720px) { .section { padding: 4.5rem 0; } }

/* steps */
.steps { list-style: none; counter-reset: step; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1rem; }
.step {
  counter-increment: step;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 0.5rem 4rem;
  min-width: 0;
}
.step::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 1.1rem; top: 1.15rem;
  font: 600 0.95rem/1 var(--font-mono);
  color: var(--accent);
  border: 1px solid var(--accent-bright);
  border-radius: 4px;
  padding: 0.35rem 0.4rem;
}
.step h3 { margin-bottom: 0.35rem; }
.step > p { max-width: 70ch; }
@media (max-width: 520px) {
  .step { padding: 3.6rem 1rem 0.4rem; }
  .step::before { top: 1rem; left: 1rem; }
}

/* ------------------------------------------------------------ tables */
.table-wrap { margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { text-align: left; vertical-align: top; padding: 0.8rem 0.85rem; border-bottom: 1px solid var(--border); }
thead th {
  font: 500 0.75rem/1.3 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
}
tbody th { font-weight: 600; }
.table-wrap table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }
.model-id { font-size: 0.875rem !important; font-weight: 600; white-space: nowrap; }
.table-wrap code { overflow-wrap: normal; }           /* keep paths and ids whole; break between them */
.models-table td:nth-child(4) { white-space: nowrap; }
@media (min-width: 1100px) { .models-table td:nth-child(3) { width: 12.5rem; } }
.models-table th[scope="row"] { min-width: 13rem; }
.endpoints-table th[scope="row"] code { white-space: nowrap; }
@media (min-width: 861px) { .endpoints-table td[data-label="Models"] code { white-space: nowrap; } }   /* break between model ids, not inside them */
.tag {
  display: inline-block; margin-left: 0.5rem; vertical-align: 0.1em;
  font: 600 0.6875rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.25rem 0.4rem; border-radius: 3px; border: 1px solid currentColor;
}
.tag-main { color: var(--tag-main); }
.tag-fast { color: var(--tag-fast); }
.tag-slow { color: var(--tag-slow); }

/* tables become stacked cards on narrow screens */
@media (max-width: 860px) {
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; }
  .table-wrap table { background: none; border: 0; overflow: visible; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .table-wrap tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    padding: 0.35rem 0;
  }
  .table-wrap th, .table-wrap td { border: 0; padding: 0.35rem 0.9rem; white-space: normal !important; }
  .table-wrap tbody th[scope="row"] { min-width: 0; padding-top: 0.55rem; }
  .table-wrap code, .endpoints-table th[scope="row"] code { white-space: normal; overflow-wrap: anywhere; }
  .table-wrap td[data-label]::before {
    content: attr(data-label);
    display: block;
    font: 500 0.6875rem/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  }
  .table-wrap tbody tr:last-child > * { border-bottom: 0; }
}

.pick-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin: 0 0 1rem; }
.pick {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent-bright);
  border-radius: var(--radius); padding: 0.75rem 0.9rem; font-size: 0.9375rem;
}
.pick-k { display: block; font-weight: 600; }

/* ------------------------------------------------------------ code blocks */
.code {
  margin: 0.75rem 0 1rem;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.code-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.35rem 0.45rem 0.35rem 0.85rem;
  background: var(--code-bar);
  border-bottom: 1px solid var(--code-border);
}
.code-lang { font: 500 0.75rem/1.3 var(--font-mono); letter-spacing: 0.06em; color: var(--code-muted); min-width: 0; overflow-wrap: anywhere; }
.code pre {
  margin: 0;
  padding: 0.9rem 1rem 1rem;
  color: var(--code-text);
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-x: auto;
  tab-size: 2;
}
.code pre code { font-size: inherit; background: none; padding: 0; color: inherit; }
.code pre:focus-visible { outline-offset: -2px; outline-color: var(--accent-bright); }
@media (min-width: 720px) { .code pre { font-size: 0.875rem; } }

/* agent prompts: wrap long lines, cap the height */
.prompt pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30rem; overflow-y: auto; }
@media (max-width: 640px) { .prompt pre { max-height: 24rem; } }

/* agent tabs: "set it up yourself" steps, then the prompt */
.setup-h {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.85rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.manual { list-style: none; counter-reset: manual; margin: 0 0 0.5rem; padding: 0; }
.manual > li { counter-increment: manual; position: relative; padding-left: 2.5rem; margin: 0 0 1rem; min-width: 0; }
.manual > li::before {
  content: counter(manual);
  position: absolute; left: 0; top: 0.1rem;
  width: 1.65rem; height: 1.65rem;
  font: 600 0.8125rem/1.55rem var(--font-mono); text-align: center;
  color: var(--accent);
  border: 1px solid var(--accent-bright);
  border-radius: 4px;
}
.manual > li > p { max-width: 75ch; margin-bottom: 0.5rem; }
.manual .code { margin: 0.5rem 0 0.75rem; }
.undo { font-size: 0.9375rem; }
@media (max-width: 520px) {
  .manual > li { padding-left: 2.25rem; }
  .manual > li > .code { margin-left: -2.25rem; }   /* code uses the full width on phones */
}

/* key placeholder / key inside code */
.key-slot {
  background: var(--ph-bg);
  color: var(--ph-text);
  border-radius: 3px;
  padding: 0 0.15em;
  box-shadow: inset 0 -1px 0 rgba(34, 211, 211, 0.6);
}
.key-slot.is-set { color: #c8fafa; }

/* ------------------------------------------------------------ examples, tabs */
.examples { margin-top: 2rem; }
.examples-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.examples-head h3 { margin: 0; }

.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 2px; margin: 0; background: var(--surface); }
.lang-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lang-switch label {
  padding: 0.3rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.875rem; font-weight: 500; color: var(--muted);
}
.lang-switch input:checked + label { background: var(--btn-bg); color: var(--on-accent); }
.lang-switch input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }

.tablist {
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: 1.25rem;
}
.tablist [role="tab"] {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 0.55rem 0.8rem;
  font-size: 0.9375rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 4px 4px 0 0;
}
.tablist [role="tab"]:hover { color: var(--text); background: var(--accent-soft); }
.tablist [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-bright); font-weight: 600; }
.tabpanel > p { max-width: 75ch; }
.tabpanel:focus-visible { outline-offset: 4px; }

/* language filter (set by app.js; without JS every language shows) */
#endpoints[data-lang="curl"] .snip:not([data-lang="curl"]),
#endpoints[data-lang="python"] .snip:not([data-lang="python"]),
#endpoints[data-lang="js"] .snip:not([data-lang="js"]) { display: none; }

.flow { padding-left: 1.4rem; margin: 0 0 1rem; max-width: 75ch; }
.flow li { margin: 0.2rem 0; }

/* ------------------------------------------------------------ limits, help */
.tips { list-style: none; padding: 0; margin: 1.25rem 0 2.5rem; display: grid; gap: 0.75rem; }
.tips li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.85rem 1rem; max-width: 80ch;
}
.tips strong { display: block; margin-bottom: 0.15rem; }
.capacity-table td { font-family: var(--font-mono); font-size: 0.875rem; }

.help-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.25rem 0.4rem; max-width: 70ch; box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ footer */
.site-footer { padding: 1.75rem 0 2.25rem; color: var(--muted); font-size: 0.875rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; align-items: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--text); }
.small-mark { width: 20px; height: 20px; }

@media print {
  .site-header, .key-panel, .copy-btn, .lang-switch, .tablist { display: none !important; }
  [role="tabpanel"][hidden] { display: block !important; }
  .prompt pre { max-height: none; }
}
