/* ============================================================
   Tami API Documentation — styles
   Brand: primary #a02554 · accent #009cc7 · dark #0a112d
   Type:  IBM Plex Sans (UI) · JetBrains Mono (code)
   ============================================================ */

:root {
  /* Brand */
  --brand-primary: #a02554;
  --brand-primary-700: #71193c;
  --brand-accent: #009cc7;
  --brand-dark: #0a112d;

  /* Derived brand shades */
  --brand-primary-600: #8c2049;
  --brand-primary-050: #fbeef3;
  --brand-accent-600: #0086ac;
  --brand-accent-050: #e6f6fb;

  /* Neutrals (light docs theme) */
  --bg: #ffffff;
  --bg-subtle: #f7f8fb;
  --bg-sidebar: #fbfbfd;
  --text: #16203a;
  --text-muted: #5b6478;
  --text-faint: #8a92a6;
  --border: #e7eaf1;
  --border-strong: #d6dbe6;

  /* Code / dark surfaces */
  --code-bg: #0a112d;
  --code-bg-soft: #111a3d;
  --code-border: #20294f;
  --code-text: #d7def0;
  --code-muted: #8b97c4;

  /* Syntax */
  --syn-key: #6fd3ff;     /* keys / properties */
  --syn-str: #6ee7a8;     /* strings */
  --syn-num: #ffc777;     /* numbers / booleans */
  --syn-punc: #8b97c4;    /* punctuation */
  --syn-kw: #ff8fb6;      /* keywords (curl, const, etc.) */

  /* Layout metrics */
  --topbar-h: 60px;
  --sidebar-w: 286px;
  --code-w: 520px;
  --maxw: 1480px;
  --radius: 10px;
  --radius-sm: 7px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 24px rgba(16, 24, 40, .10);

  --z-topbar: 50;
  --z-sidebar: 40;
  --z-overlay: 45;
  --z-drawer: 48;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 18px); }

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

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand-accent-600); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ============================ Top bar ============================ */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: var(--brand-dark);
  border-bottom: 1px solid #1a2348;
  z-index: var(--z-topbar);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar__logo { height: 26px; width: auto; display: block; }
.topbar__brand-sep { width: 1px; height: 22px; background: #2a3566; }
.topbar__tag {
  color: #aeb6d6; font-size: 12.5px; font-weight: 500; letter-spacing: .02em;
  padding-left: 2px; white-space: nowrap;
}
.topbar__brand-pill {
  font-size: 11px; font-weight: 600; color: #cdd5f0;
  border: 1px solid #2c376a; border-radius: 999px; padding: 2px 8px;
  letter-spacing: .04em; text-transform: uppercase;
}

.topbar__search {
  position: relative; flex: 1 1 auto; max-width: 460px; margin-left: 6px;
}
.topbar__search input {
  width: 100%; height: 36px; border-radius: 8px;
  border: 1px solid #283261; background: #0e1738; color: #e8ecfb;
  padding: 0 12px 0 36px; font-size: 14px; outline: none;
  font-family: inherit;
}
.topbar__search input::placeholder { color: #7c86b4; }
.topbar__search input:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(0,156,199,.25); }
.topbar__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #7c86b4; }
.topbar__search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: #9aa3cf; background: #18234d; border: 1px solid #2a3566;
  border-radius: 5px; padding: 1px 6px;
}

.topbar__spacer { flex: 1 1 auto; }

.topbar__key {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
}
.topbar__key label { color: #aeb6d6; font-size: 12px; font-weight: 500; white-space: nowrap; }
.topbar__key input {
  height: 34px; width: 210px; border-radius: 8px;
  border: 1px solid #283261; background: #0e1738; color: #e8ecfb;
  padding: 0 10px; font-size: 13px; outline: none; font-family: 'JetBrains Mono', monospace;
}
.topbar__key input:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(0,156,199,.25); }
.topbar__key .key-saved { color: #6ee7a8; font-size: 16px; opacity: 0; transition: opacity .2s; }
.topbar__key .key-saved.show { opacity: 1; }

.menu-toggle {
  display: none; background: transparent; border: 1px solid #2a3566; color: #e8ecfb;
  width: 38px; height: 36px; border-radius: 8px; cursor: pointer; align-items: center; justify-content: center;
}

/* ============================ Layout ============================ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: var(--maxw);
  margin: 0 auto;
  padding-top: var(--topbar-h);
}

/* ============================ Sidebar ============================ */
.sidebar {
  position: sticky; top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 14px 64px;
}
.sidebar__group { margin-bottom: 22px; }
.sidebar__group-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint); padding: 0 10px; margin: 0 0 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; margin: 1px 0;
  color: var(--text-muted); font-size: 14px; cursor: pointer;
  border-left: 2px solid transparent;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: #eef0f6; color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--brand-primary-050); color: var(--brand-primary); font-weight: 600; }
.nav-link .verb {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700;
  border-radius: 4px; padding: 1px 5px; line-height: 1.5; flex: 0 0 auto;
}
.verb.get  { color: #0086ac; background: var(--brand-accent-050); }
.verb.post { color: var(--brand-primary); background: var(--brand-primary-050); }
.nav-link.is-hidden { display: none; }
.sidebar__empty { color: var(--text-faint); font-size: 13px; padding: 10px; display: none; }

/* ============================ Main / sections ============================ */
.main { min-width: 0; padding: 0 0 120px; }
.section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--code-w);
  gap: 56px;
  padding: 46px 48px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--topbar-h) + 8px);
}
.section--full { grid-template-columns: minmax(0, 1fr); }
.section__doc { min-width: 0; }
.section__code { min-width: 0; }
.section--has-code .section__code {
  position: sticky; top: calc(var(--topbar-h) + 24px);
  align-self: start;
}

.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--brand-accent-600); margin: 0 0 6px;
}
.section h2.section__title { font-size: 27px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; line-height: 1.2; }
.section h3 { font-size: 18px; font-weight: 600; margin: 30px 0 8px; }
.section h4 { font-size: 14.5px; font-weight: 600; margin: 22px 0 6px; }

.endpoint-line {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0 18px;
}
.method {
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  border-radius: 6px; padding: 3px 9px; letter-spacing: .03em;
}
.method.get  { color: #0086ac; background: var(--brand-accent-050); border: 1px solid #bce6f0; }
.method.post { color: var(--brand-primary); background: var(--brand-primary-050); border: 1px solid #f1c9d7; }
.endpoint-path {
  font-family: 'JetBrains Mono', monospace; font-size: 13.5px; color: var(--text);
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; word-break: break-all;
}
.endpoint-path .pp { color: var(--brand-primary); }

/* prose */
.prose p { margin: 12px 0; }
.prose ul { margin: 12px 0; padding-left: 20px; }
.prose li { margin: 5px 0; }
.prose strong { font-weight: 600; }
.prose code, .inline-code {
  font-size: .88em; background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; color: #b1376a;
}
.prose a { color: var(--brand-accent-600); }

/* callouts */
.callout {
  border-radius: var(--radius-sm); padding: 13px 15px; margin: 16px 0;
  font-size: 14px; border: 1px solid; display: flex; gap: 11px; align-items: flex-start;
}
.callout svg { flex: 0 0 auto; margin-top: 2px; }
.callout--info    { background: var(--brand-accent-050); border-color: #bce6f0; color: #0b5e76; }
.callout--info svg { color: var(--brand-accent-600); }
.callout--warn    { background: #fff6e9; border-color: #f7dcae; color: #8a5a12; }
.callout--warn svg { color: #c9851b; }
.callout--confirm { background: #fff6e9; border-color: #f7dcae; color: #8a5a12; }
.callout--confirm svg { color: #c9851b; }
.callout strong { font-weight: 600; }
.callout code { background: rgba(0,0,0,.05); border: none; color: inherit; }

/* parameter tables */
.params { margin: 8px 0 6px; border-top: 1px solid var(--border); }
.param {
  display: grid; grid-template-columns: 1fr; gap: 2px;
  padding: 13px 2px; border-bottom: 1px solid var(--border);
}
.param__head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.param__name { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; color: var(--text); }
.param__type { font-size: 12px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }
.param__req  { font-size: 11px; font-weight: 600; color: var(--brand-primary); letter-spacing: .02em; }
.param__opt  { font-size: 11px; color: var(--text-faint); }
.param__desc { font-size: 13.5px; color: var(--text-muted); }
.param__desc a { color: var(--brand-accent-600); }
.param__desc .inline-code { color: #b1376a; }

.confirm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; color: #8a5a12; background: #fff1d6;
  border: 1px solid #f0d199; border-radius: 999px; padding: 0 7px; line-height: 1.7;
  vertical-align: middle; cursor: help;
}
.confirm-badge::before { content: "▲"; font-size: 8px; }

.enum-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.enum-list .inline-code { color: #b1376a; }

/* ============================ Code cards (dark) ============================ */
.code-card {
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.code-card__head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--code-border);
  background: var(--code-bg-soft);
}
.code-card__label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--code-muted); margin-right: auto;
}
.code-tabs { display: flex; gap: 2px; }
.code-tab {
  font-size: 12px; color: var(--code-muted); background: transparent; border: none;
  padding: 5px 9px; border-radius: 6px; cursor: pointer; font-family: inherit;
  transition: background-color .15s, color .15s;
}
.code-tab:hover { color: #fff; background: rgba(255,255,255,.06); }
.code-tab.is-active { color: #fff; background: rgba(255,255,255,.10); font-weight: 600; }

.copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 28px; border-radius: 6px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--code-muted);
  transition: background-color .15s, color .15s;
}
.copy-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.copy-btn.copied { color: #6ee7a8; }

.code-card__body { margin: 0; overflow: auto; max-height: 560px; }
.code-card__body pre { margin: 0; padding: 14px 16px; }
.code-card__body code {
  font-size: 12.6px; line-height: 1.7; color: var(--code-text);
  white-space: pre; display: block;
}
.code-card__body::-webkit-scrollbar { height: 9px; width: 9px; }
.code-card__body::-webkit-scrollbar-thumb { background: #2a3566; border-radius: 8px; }

/* syntax tokens */
.tok-key  { color: var(--syn-key); }
.tok-str  { color: var(--syn-str); }
.tok-num  { color: var(--syn-num); }
.tok-punc { color: var(--syn-punc); }
.tok-kw   { color: var(--syn-kw); }
.tok-cmt  { color: #5c6896; font-style: italic; }
.tok-fn   { color: #c4b5ff; }

/* ============================ Try it ============================ */
.tryit { border-top: 1px solid var(--code-border); }
.tryit__bar {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  background: var(--code-bg-soft);
}
.tryit__toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: #e8ecfb; background: rgba(255,255,255,.06);
  border: 1px solid var(--code-border); border-radius: 7px; padding: 6px 11px; cursor: pointer;
  font-family: inherit;
}
.tryit__toggle:hover { background: rgba(255,255,255,.12); }
.tryit__toggle .chev { transition: transform .2s; }
.tryit__toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.tryit__hint { font-size: 11.5px; color: var(--code-muted); }

.tryit__panel { display: none; padding: 4px 14px 16px; }
.tryit__panel.open { display: block; }
.tryit__field { margin: 11px 0; }
.tryit__field label {
  display: block; font-size: 11px; font-weight: 600; color: var(--code-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px;
}
.tryit__field label .req { color: var(--syn-kw); }
.tryit__field input, .tryit__field textarea {
  width: 100%; background: #070d22; border: 1px solid var(--code-border); color: var(--code-text);
  border-radius: 7px; padding: 8px 10px; font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
  outline: none; resize: vertical;
}
.tryit__field input:focus, .tryit__field textarea:focus { border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(0,156,199,.2); }
.tryit__field textarea { min-height: 120px; line-height: 1.55; }

.tryit__actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.tryit__send {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-primary); color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background-color .15s;
}
.tryit__send:hover { background: var(--brand-primary-600); }
.tryit__send:disabled { opacity: .6; cursor: not-allowed; }
.tryit__send .spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: none;
}
.tryit__send.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.tryit__status { font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.tryit__status .ok { color: #6ee7a8; }
.tryit__status .err { color: #ff8fb6; }
.tryit__status .muted { color: var(--code-muted); }

.tryit__result { margin-top: 12px; display: none; }
.tryit__result.show { display: block; }
.tryit__result pre {
  margin: 0; background: #070d22; border: 1px solid var(--code-border); border-radius: 8px;
  padding: 12px 14px; max-height: 340px; overflow: auto;
}
.tryit__result code { font-size: 12px; color: var(--code-text); white-space: pre; display: block; }

/* base-url table (used inside prose) */
.url-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.url-table th, .url-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.url-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.url-table td code { color: var(--text); }

/* small footer */
.docs-footer {
  padding: 28px 48px; color: var(--text-faint); font-size: 13px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* overlay for mobile drawer */
.overlay {
  position: fixed; inset: 0; background: rgba(10,17,45,.45);
  z-index: var(--z-overlay); opacity: 0; visibility: hidden; transition: opacity .2s;
}
.overlay.show { opacity: 1; visibility: visible; }

/* back-to-top */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 30;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: #fff; color: var(--brand-primary); cursor: pointer; box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { transform: translateY(-2px); }

/* ============================ Responsive ============================ */
@media (max-width: 1280px) {
  :root { --code-w: 440px; }
  .section { gap: 36px; padding: 40px 36px; }
}

@media (max-width: 1080px) {
  .section, .section--has-code {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .section--has-code .section__code { position: static; }
  .topbar__key input { width: 150px; }
}

@media (max-width: 920px) {
  :root { --sidebar-w: 0px; }
  .menu-toggle { display: inline-flex; }
  .layout { grid-template-columns: minmax(0,1fr); }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 290px;
    transform: translateX(-100%); transition: transform .22s ease; z-index: var(--z-drawer);
    height: calc(100vh - var(--topbar-h));
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar__search { max-width: none; }
  .topbar__key { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar__tag, .topbar__brand-sep, .topbar__brand-pill { display: none; }
  .section { padding: 30px 18px; }
  .section h2.section__title { font-size: 23px; }
  .topbar__search kbd { display: none; }
  .docs-footer { padding: 24px 18px; }
}
