/* api.css - the /api docs page only. External on purpose: page <style> blocks
 * are frozen (house rule), all new CSS lives in external sheets. Colours come
 * from the design tokens in style.css, never hardcoded. The profile page's
 * "API keys" card is styled by profile.css. */

.apidoc {
  padding: 56px clamp(16px, 5vw, 64px) 88px;
  background: linear-gradient(to bottom, var(--bg-page), var(--bg-page-deep));
  text-align: left;
}

.apidoc_wrap {
  max-width: 1100px;
  margin: 0 auto;
}

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

.apidoc_hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-code);
  border-radius: 16px;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(27, 117, 189, .18), transparent 62%),
    var(--bg-inset-alt);
  padding: clamp(22px, 4vw, 38px);
}

.apidoc_eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.apidoc_hero h1 {
  margin: 16px 0 10px 0;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -.4px;
}

.apidoc_lead {
  margin: 0;
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-muted);
}

.apidoc_hero_row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.apidoc_baseurl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-inset);
}

.apidoc_baseurl_label {
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.apidoc_baseurl code {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-code);
}

.apidoc_btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  font-size: 14px;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.apidoc_btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

.apidoc_btn--accent {
  background: var(--accent);
  border-color: var(--accent);
}

.apidoc_btn--accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ------------------------------------------------------------- layout -- */

.apidoc_layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 44px;
  margin-top: 40px;
  align-items: start;
}

.apidoc_toc {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.apidoc_toc_title {
  margin-bottom: 10px;
  font-size: 11px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.apidoc_toc a {
  padding: 7px 12px;
  border-left: 2px solid var(--border-soft);
  border-radius: 0 6px 6px 0;
  color: var(--text-dim);
  font-size: 14px;
  text-decoration: none;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.apidoc_toc a:hover {
  background: var(--bg-inset);
  color: var(--text);
  text-decoration: none;
}

.apidoc_toc a.is_active {
  border-left-color: var(--accent);
  background: var(--bg-inset);
  color: var(--text);
}

/* ------------------------------------------------------------ content -- */

.apidoc_body {
  min-width: 0;
}

.apidoc_section {
  scroll-margin-top: 24px;
  padding-top: 8px;
}

.apidoc_section + .apidoc_section {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--border-soft);
}

.apidoc_section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px 0;
  font-size: 22px;
  font-weight: 600;
}

.apidoc_num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-soft);
}

.apidoc_section h3 {
  margin: 28px 0 10px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-on-light);
}

.apidoc_body p,
.apidoc_body li {
  line-height: 1.75;
  color: var(--text-muted);
}

.apidoc_body p {
  margin: 10px 0;
  max-width: 78ch;
}

.apidoc_body strong {
  color: var(--text);
}

.apidoc_body a {
  color: var(--accent-soft);
  text-decoration: none;
}

.apidoc_body a:hover {
  text-decoration: underline;
}

.apidoc_body code {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: .88em;
  color: var(--text-code);
}

/* --------------------------------------------------- terminal windows -- */

.term {
  margin: 16px 0;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--bg-inset);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}

.term_bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-inset-soft);
}

.term_dots {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.term_dots span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--bg-hover);
  display: inline-block;
}

.term_title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term_body {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-code);
  scrollbar-width: thin;                 /* Firefox: the webkit rules below do nothing there */
  scrollbar-color: #2f2f2f #141414;
}

.term_body code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
  color: inherit;
}

.term_body::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.term_body::-webkit-scrollbar-track {
  background: #141414;
  border-radius: 999px;
}

.term_body::-webkit-scrollbar-thumb {
  background: #2f2f2f;
  border-radius: 999px;
}

.term_body::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* shell tokens (painted by api.js) */
.tok_cmd     { color: var(--accent-soft); }
.tok_flag    { color: #c9a2ff; }
.tok_str     { color: #a3e635; }
.tok_url     { color: var(--text-code); text-decoration: underline; text-decoration-color: var(--border-strong); }
.tok_comment { color: #6f7b87; }

/* copy button, shared by the terminals and the base-URL chip */
.apidoc_copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.apidoc_copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.apidoc_copy:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.apidoc_copy.is_copied {
  border-color: var(--success);
  color: var(--success);
}

/* ------------------------------------------------------------- levels -- */

.lvl_grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 18px 0 6px 0;
}

.lvl {
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-inset);
}

.lvl_tag {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-soft);
}

.lvl_txt {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ---------------------------------------------------------- endpoints -- */

.ep_list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
}

.ep {
  display: grid;
  grid-template-columns: 62px minmax(190px, 1fr) minmax(0, 1.35fr);
  align-items: baseline;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-inset);
  transition: background .15s ease;
}

.ep + .ep {
  border-top: 1px solid var(--border-soft);
}

.ep:hover {
  background: var(--bg-inset-soft);
}

.ep_m {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  text-align: center;
  padding: 3px 0;
  border-radius: 6px;
  border: 1px solid transparent;
}

.ep_m--get {
  color: #64b5f6;
  border-color: rgba(100, 181, 246, .32);
  background: rgba(100, 181, 246, .10);
}

.ep_m--post {
  color: #6cd28f;
  border-color: rgba(108, 210, 143, .32);
  background: rgba(108, 210, 143, .10);
}

.ep .ep_p {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-code);
  word-break: break-word;
}

.ep_d {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.ep_d code,
.ep_p code {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-soft);
}

/* ------------------------------------------------------------- notes --- */

.note_list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0 0;
  padding: 0;
  list-style: none;
}

.note {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 13px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-inset);
  line-height: 1.7;
}

.note_tag {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  padding: 3px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  background: var(--bg-inset-soft);
}

.note--err .note_tag {
  color: #e6a15e;
  border-color: rgba(230, 161, 94, .3);
  background: rgba(230, 161, 94, .08);
}

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

@media (max-width: 900px) {
  .apidoc_layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .apidoc_toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 4px;
  }

  .apidoc_toc_title {
    display: none;
  }

  .apidoc_toc a {
    border-left: none;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
  }

  .apidoc_toc a.is_active {
    border-color: var(--accent);
  }

  .ep {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .ep_d {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .apidoc {
    padding: 32px 14px 56px;
  }

  .apidoc_baseurl {
    width: 100%;
    justify-content: space-between;
  }

  .apidoc_btn {
    flex: 1;
    justify-content: center;
  }

  .note {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .note_tag {
    justify-self: start;
    padding: 3px 10px;
  }
}
