/*
 * The API reference: three panes.
 *
 * What there is (left), what a call does (middle), and a console that makes it (right).
 * The panes scroll independently, because reading the description of a parameter while
 * the field for it stays on screen is the whole point of the arrangement.
 */

.docs-body {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.docs-body header.top { flex: none; }

.panes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) 460px;
}

.pane {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.pane::-webkit-scrollbar { width: 10px; height: 10px; }
.pane::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 3px solid var(--bg);
}
.pane::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- sidebar */

.pane-nav {
  border-right: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 1.5rem 0 4rem;
}

.api-id { padding: 0 1.25rem 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.api-id h1 { font-size: 1rem; font-weight: 650; letter-spacing: -0.01em; }
.api-id .ver {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

.nav-group { margin-bottom: 1.6rem; }
.nav-title {
  padding: 0 1.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}
.nav-desc {
  padding: 0 1.25rem;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0 0 0.6rem;
  line-height: 1.45;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 1.25rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left-color: var(--accent);
  color: var(--text);
}
.nav-path { font-family: var(--mono); font-size: 0.79rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- methods */

.method {
  flex: none;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.16rem 0.38rem;
  border-radius: 4px;
  min-width: 34px;
  text-align: center;
}
.method.big { font-size: 0.72rem; padding: 0.26rem 0.55rem; min-width: 44px; }
.m-get { background: color-mix(in srgb, #38bdf8 20%, transparent); color: #7dd3fc; }
.m-post { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.m-put { background: color-mix(in srgb, #fbbf24 20%, transparent); color: #fcd34d; }
.m-del { background: color-mix(in srgb, #f87171 20%, transparent); color: #fca5a5; }
:root[data-theme="light"] .m-get, :root:not([data-theme="dark"]) .m-get { color: #0369a1; }

/* ---------------------------------------------------------------- doc pane */

.pane-doc { padding: 2.25rem 2.5rem 6rem; }
@media (max-width: 1100px) { .pane-doc { padding: 1.75rem 1.25rem 4rem; } }

.op-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.op-path {
  font-family: var(--mono);
  font-size: 0.92rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.24rem 0.6rem;
  color: var(--text);
}
.op-title { font-size: 1.6rem; font-weight: 680; margin-bottom: 1.1rem; max-width: 30ch; }

.prose { max-width: var(--measure); color: var(--text-dim); }
.prose p { margin: 0 0 0.9rem; }
.prose strong { color: var(--text); font-weight: 620; }
.prose ul { padding-left: 1.15rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose h3, .prose h4, .prose h5, .prose h6 {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 640;
  letter-spacing: -0.01em;
  margin: 1.9rem 0 0.7rem;
}
.prose > h3:first-child, .prose > h4:first-child, .prose > h5:first-child { margin-top: 0; }
.prose code { color: var(--text); }

h3.sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

/* ---------------------------------------------------------------- params */

table.params { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.params th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
table.params td { padding: 0.85rem 0.9rem 0.85rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
table.params td:last-child, table.params th:last-child { padding-right: 0; }
.p-name { white-space: nowrap; }
.p-name code { background: none; border: none; padding: 0; color: var(--text); font-weight: 600; }
.p-type { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); max-width: 18ch; }
.p-desc { color: var(--text-dim); }
.p-desc p { margin: 0 0 0.4rem; }
.p-desc p:last-child { margin: 0; }
.p-in {
  display: block;
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}
.req {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fca5a5;
}
.p-default { display: block; margin-top: 0.35rem; font-size: 0.8rem; color: var(--text-faint); }

/* ---------------------------------------------------------------- responses */

.responses { display: flex; flex-direction: column; gap: 0.7rem; }
.resp-row { display: flex; gap: 0.85rem; align-items: flex-start; }
.status {
  flex: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.16rem 0.45rem;
  border-radius: 4px;
  min-width: 42px;
  text-align: center;
}
.status.s2 { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.status.s4 { background: color-mix(in srgb, #fbbf24 18%, transparent); color: #fcd34d; }
.status.s5 { background: color-mix(in srgb, #f87171 18%, transparent); color: #fca5a5; }
.resp-text { color: var(--text-dim); font-size: 0.9rem; }
.resp-text p { margin: 0 0 0.4rem; }
.resp-text p:last-child { margin: 0; }

/* ---------------------------------------------------------------- console */

.pane-console {
  border-left: 1px solid var(--border);
  background: var(--bg-sunken);
  padding: 1.5rem 1.25rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.send {
  margin-left: auto;
  background: var(--accent);
  color: #04120d;
  border: none;
  border-radius: 6px;
  padding: 0.38rem 1.05rem;
  font-weight: 650;
  font-size: 0.83rem;
  font-family: inherit;
  cursor: pointer;
}
.send:hover { background: var(--accent-strong); }
.send:disabled { opacity: 0.55; cursor: default; }

.ghost-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 0.28rem 0.7rem;
  font-size: 0.76rem;
  font-family: inherit;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent); }

.urlbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}
.urlbar .url {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
  word-break: break-all;
  line-height: 1.45;
}

.fields { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.9rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { display: flex; align-items: center; font-size: 0.82rem; color: var(--text-dim); }
.field-label code { background: none; border: none; padding: 0; color: var(--text); font-weight: 600; }
.field input, .field select {
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.83rem;
  padding: 0.45rem 0.6rem;
  width: 100%;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.presets { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.1rem; }
.preset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-faint);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
}
.preset:hover { border-color: var(--accent); color: var(--accent); }

.code-block, .response-body {
  margin: 0;
  padding: 0.85rem 0.9rem;
  background: var(--bg-sunken);
  border: none;
  border-radius: 0;
  font-size: 0.76rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.response-body { max-height: 46vh; overflow-y: auto; }
.resp-meta { margin-left: auto; font-family: var(--mono); font-size: 0.74rem; color: var(--text-faint); }
.resp-meta.good { color: var(--accent); }
.resp-meta.bad { color: #fca5a5; }
.clip { margin-top: 0.6rem; font-size: 0.74rem; }

pre.json { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.j-key { color: #7dd3fc; }
.j-str { color: var(--accent); }
.j-num { color: #fcd34d; }
.j-bool { color: #c4b5fd; }
.j-null { color: var(--text-faint); }
:root[data-theme="light"] .j-key, :root:not([data-theme="dark"]) .j-key { color: #0369a1; }
:root[data-theme="light"] .j-num, :root:not([data-theme="dark"]) .j-num { color: #a16207; }
:root[data-theme="light"] .j-bool, :root:not([data-theme="dark"]) .j-bool { color: #6d28d9; }

.muted { color: var(--text-faint); }

/* ---------------------------------------------------------------- narrow */

#nav-toggle { display: none; }
#scrim { display: none; }

@media (max-width: 1180px) {
  .panes { grid-template-columns: 250px minmax(0, 1fr); }
  .pane-console {
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  /* Both panes now share one scroll context, so let the page scroll instead. */
  .docs-body { height: auto; overflow: visible; }
  .panes { display: block; }
  .pane { overflow: visible; }
  .pane-nav {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
  }
}

@media (max-width: 820px) {
  #nav-toggle {
    display: grid;
    place-items: center;
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    width: 34px; height: 34px;
    cursor: pointer;
    padding: 0;
  }
  #nav-toggle svg { width: 16px; height: 16px; }

  .pane-nav {
    position: fixed;
    top: 62px; left: 0; bottom: 0;
    width: 272px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border);
  }
  body.nav-open .pane-nav { transform: none; }
  body.nav-open #scrim {
    display: block;
    position: fixed;
    inset: 62px 0 0 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 45;
  }
  .pane-doc { padding: 1.5rem 1rem 3rem; }
  .pane-console { padding: 1.25rem 1rem 4rem; }
  .op-title { font-size: 1.3rem; }
  table.params { font-size: 0.85rem; }
}

/* ---------------------------------------------------------------- intro */

.eyebrow-sm {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.op-title.wide { max-width: none; font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
.intro-lead {
  font-size: 1.08rem;
  color: var(--text-dim);
  max-width: var(--measure);
  margin: 0 0 1.6rem;
}
.intro-item { font-weight: 600; padding-left: 1.25rem; }
.intro-item .nav-path { font-family: var(--sans); font-size: 0.88rem; }

.servers { display: flex; flex-direction: column; gap: 0.6rem; }
.server-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.server-url { background: none; border: none; padding: 0; color: var(--accent); font-size: 0.86rem; }
.server-desc { font-size: 0.85rem; color: var(--text-faint); }

.next-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.9rem;
  color: var(--text);
  font-size: 0.9rem;
}
.next-link:hover { background: color-mix(in srgb, var(--text) 5%, transparent); text-decoration: none; }
