/* Stackbyte APIs marketplace. One file, no build step. Phone-first, dark, one accent.
   Colours, radii and fonts come from tokens.css, a verbatim copy of the website repo's
   design/tokens.css (website/stackbyte/design/tokens.css). When the site's tokens change,
   copy the file again; never edit tokens.css here. */
@import url("tokens.css");
:root {
  --bg: var(--sb-bg);
  --bg-2: var(--sb-bg-light);
  --surface: var(--sb-bg-card);
  --surface-2: var(--sb-bg-input);
  --text: var(--sb-text);
  --text-2: var(--sb-text-strong);
  --muted: var(--sb-muted);
  --muted-2: var(--sb-subtle);
  --border: var(--sb-border);
  --border-strong: var(--sb-border-strong);
  --accent: var(--sb-accent);
  --accent-dark: var(--sb-accent-dark);
  --accent-ink: #06210f;               /* text on the accent; not a site token */
  --warn: var(--sb-draft);
  --radius: var(--sb-radius);
  --radius-sm: var(--sb-radius-sm);
  --font: var(--sb-font-sans);         /* Space Grotesk when installed, else the system stack */
  --mono: var(--sb-font-mono);
  --gutter: 16px;
  --max: var(--sb-page-width);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--text-2); }
button { font: inherit; color: inherit; }
::selection { background: rgba(34, 197, 94, 0.3); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 10; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* header */
.top { background: var(--bg); border-bottom: 1px solid var(--border); }
.top-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 22px; width: auto; display: block; }
.brand-suffix { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); line-height: 1; }
.nav { order: 3; flex-basis: 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); white-space: nowrap; font-size: 15px; }
.nav a:hover { color: var(--text); background: var(--bg-2); text-decoration: none; }
.btn-key { margin-left: auto; }
.search { order: 4; flex-basis: 100%; margin: 0; }
.search input { width: 100%; min-height: 40px; padding: 8px 16px; border-radius: var(--sb-radius-pill); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 16px; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--muted-2); }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-weight: 500; font-size: 15px; line-height: 1; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--muted-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn.is-disabled { background: var(--bg-2); border-color: var(--border); color: var(--muted-2); cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }

/* hero */
.hero { padding: 28px 0 16px; }
.hero h1 { margin: 0; font-size: clamp(28px, 6vw, 40px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 600; }
.lead { margin: 12px 0 0; max-width: 62ch; color: var(--muted); font-size: 17px; }

/* layout: rail + grid */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 8px 0 48px; scroll-margin-top: 72px; }
.account-main { min-width: 0; }
.rail-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.rail-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); }
.rail-list::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); color: var(--muted); cursor: pointer; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { background: rgba(34, 197, 94, 0.12); border-color: var(--accent); color: var(--text); }
.chip .count { font-size: 12px; color: var(--muted-2); background: var(--surface); padding: 1px 7px; border-radius: 999px; }
.chip.is-active .count { color: var(--accent); }
.results { margin: 0 0 12px; color: var(--muted-2); font-size: 14px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.catalog, .rail { min-width: 0; }
.empty { color: var(--muted); padding: 24px 0; }

/* card */
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); transition: border-color 0.15s; }
.card:hover { border-color: var(--border-strong); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cat { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); background: rgba(34, 197, 94, 0.1); padding: 3px 9px; border-radius: 999px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-transform: capitalize; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.badge-live .dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.badge-live { color: var(--text-2); }
.badge-stale .dot, .badge-paused .dot { background: var(--warn); }
.badge-coming-soon .dot { background: var(--muted-2); }
.title { margin: 2px 0 0; font-size: 20px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.title .num { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--muted-2); margin-right: 4px; }
.blurb { margin: 0; color: var(--muted); font-size: 15px; }
.note { margin: 0; font-size: 13px; color: var(--warn); }
.badge-live .dot { background: var(--accent); }
.sources { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.sources .k { color: var(--muted-2); margin-right: 6px; }
.sources a { color: var(--text-2); border-bottom: 1px solid var(--border-strong); }
.sources a:hover { text-decoration: none; border-color: var(--accent); }
.sources .sep { margin: 0 6px; color: var(--muted-2); }
.stats { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.stats .sep { margin: 0 8px; color: var(--muted-2); }
.stats time { color: var(--text-2); }
.costs { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.costs li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); text-transform: capitalize; }
.costs b { font-weight: 500; color: var(--text-2); text-transform: none; font-family: var(--mono); font-size: 12.5px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.price { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.price b { font-weight: 600; font-size: 15px; color: var(--text); }
.price span { font-size: 12px; color: var(--muted-2); }
.actions { display: flex; gap: 6px; flex-shrink: 0; }
.actions .btn { padding: 8px 12px; }

/* pricing */
.plans { padding-bottom: 8px; }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.plan { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-2); }
.plan.is-featured { border-color: var(--accent); }
.plan-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan h2 { margin: 0; font-size: 18px; font-weight: 500; }
.pill { white-space: nowrap; border: 1px solid var(--border); border-radius: var(--sb-radius-pill); padding: 2px 10px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.plan-price { margin: 6px 0 0; }
.plan-price b { font-size: 36px; font-weight: 500; letter-spacing: -0.02em; }
.plan-price span { margin-left: 6px; font-size: 14px; color: var(--muted); }
.plan-credits { margin: 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
.plan-note { margin: 0; font-size: 14px; color: var(--muted); }
.plan .btn { margin-top: auto; }
.plan-enterprise { margin-top: 12px; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.costs-section { padding: 32px 0 8px; }
.costs-section h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: -0.01em; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cost-table th, .cost-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cost-table th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; }
.cost-table .num { text-align: right; white-space: nowrap; }
.cost-table .call { color: var(--muted); text-transform: capitalize; }
.cost-table .is-planned td { color: var(--muted-2); }
.fine { font-size: 13px; color: var(--muted-2); }
.fine a { color: var(--text-2); border-bottom: 1px solid var(--border-strong); }

/* get a key */
.getkey { margin: 8px 0 48px; padding: 24px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); scroll-margin-top: 72px; }
.getkey h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -0.01em; }
.getkey p { margin: 0 0 12px; max-width: 70ch; color: var(--muted); }
.getkey a:not(.btn) { color: var(--text-2); border-bottom: 1px solid var(--border-strong); }
.getkey .fine { font-size: 13px; color: var(--muted-2); margin-bottom: 0; }

/* footer */
.foot { border-top: 1px solid var(--border); background: var(--bg-2); padding: 28px 0 40px; color: var(--muted); font-size: 13px; }
.foot-title { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.attrib { margin: 0; padding-left: 18px; display: grid; gap: 6px; max-width: 80ch; }
.company { margin: 16px 0 0; color: var(--muted-2); }
.foot-links { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 14px; }
.foot-links a { color: var(--text-2); }

/* ≥720: two columns; header nav inline */
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { position: sticky; top: 0; z-index: 5; background: rgba(11, 15, 20, 0.9); backdrop-filter: blur(8px); }
  .top-row { flex-wrap: nowrap; }
  .nav { order: 0; flex-basis: auto; margin: 0 0 0 12px; padding: 0; overflow: visible; }
  .search { order: 0; flex: 1 1 200px; max-width: 340px; margin-left: auto; }
  .btn-key { margin-left: 0; }
  .hero { padding-top: 48px; }
}

/* ≥1100: three columns; left rail */
@media (min-width: 1100px) {
  .layout { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
  .rail { position: sticky; top: 80px; align-self: start; }
  .rail-list { flex-direction: column; overflow: visible; margin: 0; padding: 0; }
  .chip { justify-content: space-between; border-radius: var(--radius-sm); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plan-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card { transition: none; } }

/* account area */
.btn-signin { margin-left: auto; }
.btn-signin + .btn-key { margin-left: 0; }
.auth { max-width: 460px; padding: 36px 0 48px; }
.auth h1 { margin: 0; font-size: clamp(28px, 6vw, 36px); letter-spacing: -0.02em; }
.auth-box { margin-top: 20px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.btn-wide { width: 100%; }
.or { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.hp { position: absolute; left: -9999px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form h2 { margin: 10px 0 0; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input, .field select { min-height: 42px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 16px; font-family: inherit; }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.field-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.callout { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text-2); font-size: 14px; }
.callout-warn { border-color: var(--warn); }
.callout-key { border-color: var(--accent); }
.callout p { margin: 0 0 8px; }
.code { margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 13px; overflow-x: auto; white-space: pre; color: var(--text-2); }
.account-main h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.account-main h2 { margin: 28px 0 8px; font-size: 18px; }
.account-main .lead { margin-bottom: 18px; font-size: 15px; }
.account-main p { max-width: 70ch; }
.account .rail-list form.inline { display: contents; }
.rail-list a.chip { text-decoration: none; }
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.tile .k { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.tile b { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.tile .s { font-size: 13px; color: var(--muted); }
.tile .s a { color: var(--text-2); border-bottom: 1px solid var(--border-strong); }
.inline { display: flex; align-items: center; gap: 12px; margin: 12px 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }
.table .is-muted td { color: var(--muted-2); }
.table .is-err { color: var(--warn); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.bar span { display: block; width: 100%; min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: 0.85; }
.danger { margin-top: 32px; padding: 16px; border-radius: var(--radius); border: 1px solid rgba(239, 68, 68, 0.5); }
.danger h2 { margin-top: 0; }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, 0.7); color: #f87171; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.12); border-color: #ef4444; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
@media (min-width: 720px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
