/* ==========================================================================
   PrismSMP API Docs — design system
   ========================================================================== */

:root {
  --bg: #0b0e14;
  --bg-elevated: #10141c;
  --bg-sidebar: #0a0d13;
  --bg-code: #0d1117;
  --bg-inline-code: #1a2029;
  --border: #1f2733;
  --border-soft: #171e29;
  --text: #dce1e8;
  --text-dim: #8b96a5;
  --text-faint: #5b6675;
  --accent: #5ec8d8;
  --accent-strong: #8fe3f0;
  --accent-soft: rgba(94, 200, 216, 0.12);
  --warn: #e0a13d;
  --warn-soft: rgba(224, 161, 61, 0.1);
  --danger: #e0685d;
  --danger-soft: rgba(224, 104, 93, 0.1);
  --ok: #6fcf8f;
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 268px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

/* Inline code */
:not(pre) > code {
  background: var(--bg-inline-code);
  color: var(--accent-strong);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  scroll-margin-top: 24px;
}

h1 { font-size: 2rem; margin: 0 0 0.5rem; }
h2 {
  font-size: 1.45rem;
  margin: 2.6rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
h2:first-of-type { margin-top: 0; }
h3 { font-size: 1.1rem; margin: 2rem 0 0.8rem; color: var(--text); }
h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 1.5rem 0 0.6rem;
}

p { margin: 0 0 1rem; color: var(--text); }
p.lead { font-size: 1.1rem; color: var(--text-dim); }

ul, ol { padding-left: 1.4rem; margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 1.5rem 1.1rem 3rem;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.2rem 0.6rem 1.3rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #3f8fa8);
  flex-shrink: 0;
}

.sidebar-brand .name {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  line-height: 1.15;
}

.sidebar-brand .subtitle {
  display: block;
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 400;
}

.nav-group { margin-bottom: 1.4rem; }

.nav-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 0 0.6rem;
  margin-bottom: 0.4rem;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 0.89rem;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-sublinks {
  margin-left: 0.7rem;
  padding-left: 0.7rem;
  border-left: 1px solid var(--border);
  margin-top: 0.15rem;
  margin-bottom: 0.3rem;
}

.nav-sublinks .nav-link {
  font-size: 0.83rem;
  padding: 0.3rem 0.6rem;
}

.nav-sublinks .nav-link.subnav-active {
  color: var(--accent-strong);
  font-weight: 600;
}

.nav-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-family: var(--font-mono);
  padding: 0.05em 0.4em;
  border-radius: 4px;
  margin-right: 0.4em;
  font-weight: 700;
}
.nav-badge.get { background: rgba(111, 207, 143, 0.15); color: var(--ok); }

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 3rem 3rem 6rem;
  max-width: 900px;
}

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1rem;
  align-items: center;
  gap: 0.8rem;
}

.nav-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay,
  body.nav-open .sidebar-overlay { display: block; }
  .main { margin-left: 0; padding: 2rem 1.25rem 4rem; }
  .mobile-topbar { display: flex; }
}

/* ==========================================================================
   Callouts
   ========================================================================== */

.callout {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.9rem 1.1rem;
  margin: 1.2rem 0;
}

.callout-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-soft); }

.callout-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.callout p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
  overflow-x: auto;
  margin: 1.2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  min-width: 480px;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

th {
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

tr:last-child td { border-bottom: none; }

td code { white-space: nowrap; }

/* Color-code swatch table */
.color-swatch {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border-radius: 3px;
  margin-right: 0.5em;
  vertical-align: -0.1em;
  border: 1px solid rgba(255,255,255,0.15);
}

/* ==========================================================================
   Endpoint header
   ========================================================================== */

.endpoint-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 2.6rem 0 1rem;
}

.endpoint-head h2 { border: none; margin: 0; padding: 0; }

.method {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 0.25em 0.55em;
  border-radius: 5px;
  background: rgba(111, 207, 143, 0.15);
  color: var(--ok);
  letter-spacing: 0.03em;
}

.path {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-inline-code);
  padding: 0.25em 0.6em;
  border-radius: 5px;
  border: 1px solid var(--border-soft);
}

.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2em 0.55em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-auth { background: rgba(94,200,216,0.12); color: var(--accent-strong); }

/* ==========================================================================
   Code blocks
   ========================================================================== */

.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 1.1rem 0 1.6rem;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.015);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.code-block-header .filename {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 0.28em 0.6em;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.12s;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.copy-btn.copied {
  border-color: var(--ok);
  color: var(--ok);
}

.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre;
  background: none;
  border: none;
  padding: 0;
}

/* token colors */
.tok-comment { color: var(--text-faint); font-style: italic; }
.tok-string { color: #a3d9a5; }
.tok-number { color: #e0a678; }
.tok-keyword { color: #7fb3e0; }
.tok-variable { color: #d3a1e0; }
.tok-flag { color: var(--warn); }

/* ==========================================================================
   Misc components
   ========================================================================== */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.2rem 0;
}
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  background: var(--bg-elevated);
}

.card h3 { margin-top: 0; font-size: 1rem; }
.card p:last-child { margin-bottom: 0; }

.next-links {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.next-link {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.1rem;
  flex: 1 1 200px;
  background: var(--bg-elevated);
  text-decoration: none;
}
.next-link:hover { border-color: var(--accent); text-decoration: none; }
.next-link .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.next-link .title { color: var(--text); font-weight: 600; margin-top: 0.15rem; }

.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-inline-code);
  border: 1px solid var(--border-soft);
  color: var(--accent-strong);
  padding: 0.15em 0.5em;
  border-radius: 4px;
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.page-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3341; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #364152; }

/* ==========================================================================
   Try it (live API tester)
   ========================================================================== */

.try-it-settings {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  padding: 1rem 1.2rem;
  margin: 1.2rem 0 2.2rem;
}

.try-it-settings-title {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.try-it-settings-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.try-it-settings-fields {
  display: grid;
  max-width: 360px;
}

.try-it-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.try-it-field input,
.try-it-field select {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5em 0.6em;
  color: var(--text);
}

.try-it-field input:focus,
.try-it-field select:focus {
  outline: none;
  border-color: var(--accent);
}

.try-it-key-wrap {
  display: flex;
  gap: 0.4rem;
}
.try-it-key-wrap input { flex: 1; min-width: 0; }

.try-it-toggle-key {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 5px;
  padding: 0 0.7em;
  cursor: pointer;
  font-size: 0.72rem;
  white-space: nowrap;
}
.try-it-toggle-key:hover { border-color: var(--accent); color: var(--accent-strong); }

.try-it {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  margin: 1rem 0 1.8rem;
  overflow: hidden;
}

.try-it-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-soft);
}

.try-it-body {
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
}
.try-it-body .try-it-field { min-width: 160px; flex: 1 1 160px; }

.try-it-send {
  background: var(--accent);
  color: #06222a;
  border: none;
  border-radius: 6px;
  padding: 0.55em 1.1em;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.try-it-send:hover { background: var(--accent-strong); }
.try-it-send:disabled { opacity: 0.6; cursor: not-allowed; }

.try-it-result {
  border-top: 1px solid var(--border-soft);
  background: var(--bg-code);
}

.try-it-result-status {
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}
.try-it-result-status.status-ok { color: var(--ok); }
.try-it-result-status.status-error { color: var(--danger); }

.try-it-result pre {
  margin: 0;
  padding: 0 1rem 1rem;
  overflow-x: auto;
}
.try-it-result code {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  white-space: pre;
}