/* =============================================================================
   Commercial Units — Developer API docs
   Dark, professional theme. CU brand blue (#3b82f6 / #2563eb family).
   Zero external dependencies (system font stack + bundled SVG favicon).
   ========================================================================== */

:root {
  --bg:        #0b1120;   /* page background (deep navy) */
  --bg-elev:   #111827;   /* elevated surfaces (sidebar, code) */
  --bg-code:   #0d1424;   /* code block background */
  --border:    #1f2a3d;
  --border-soft: #16203250;
  --text:      #e5edf7;   /* body text */
  --text-dim:  #9fb0c5;   /* secondary text */
  --text-faint:#6b7d96;
  --brand:     #3b82f6;   /* CU primary */
  --brand-600: #2563eb;
  --brand-300: #93c5fd;
  --accent-bg: #14233f;
  --quote-bg:  #0f1b30;
  --radius:    10px;
  --maxw:      820px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand-300); text-decoration: none; }
a:hover { color: #bcd5fb; text-decoration: underline; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brand); color: #fff; padding: 8px 14px; z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ----- Top bar ----------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  height: 58px; padding: 0 22px;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { display: block; border-radius: 6px; }
.brand-name { font-weight: 700; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 12px; font-weight: 600; color: var(--brand-300);
  border: 1px solid #2b4a78; border-radius: 999px; padding: 2px 9px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.topbar-link { color: var(--text-dim); font-size: 14px; }

/* ----- Layout ------------------------------------------------------------ */
.layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  position: sticky; top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 24px 14px 40px 22px;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
}
.nav-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-faint);
  margin: 0 0 10px 8px;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 1px 0; }
.sidebar li a {
  display: block; padding: 7px 12px; border-radius: 8px;
  color: var(--text-dim); font-size: 14.5px; font-weight: 500;
}
.sidebar li a:hover { background: #18243a; color: var(--text); text-decoration: none; }
.sidebar li.active a {
  background: var(--accent-bg); color: #fff; font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand);
}

/* ----- Content ----------------------------------------------------------- */
.content { padding: 40px 36px 60px; min-width: 0; }
.doc { max-width: var(--maxw); margin: 0 auto; }

.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6 {
  line-height: 1.25; font-weight: 700; letter-spacing: -0.012em;
  scroll-margin-top: 76px;
}
.doc h1 {
  font-size: 2.05rem; margin: 0 0 0.5em;
  padding-bottom: 0.4em; border-bottom: 1px solid var(--border);
}
.doc h2 {
  font-size: 1.5rem; margin: 2em 0 0.7em;
  padding-bottom: 0.3em; border-bottom: 1px solid var(--border-soft);
}
.doc h3 { font-size: 1.18rem; margin: 1.7em 0 0.6em; color: #d7e3f2; }
.doc h4 { font-size: 1.02rem; margin: 1.4em 0 0.5em; color: var(--text-dim); }

.doc p { margin: 0.85em 0; }
.doc strong { color: #fff; font-weight: 650; }
.doc em { color: #cdd9e8; }

.doc ul, .doc ol { margin: 0.85em 0; padding-left: 1.5em; }
.doc li { margin: 0.32em 0; }
.doc li::marker { color: var(--brand); }

.doc hr {
  border: 0; height: 1px; background: var(--border); margin: 2.4em 0;
}

/* Inline code */
.doc code {
  font-family: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace,
    Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: #1b2740; color: #b8d3ff;
  padding: 0.13em 0.42em; border-radius: 5px;
  border: 1px solid #24365a;
  word-break: break-word;
}

/* Code blocks */
.doc pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1.1em 0;
  line-height: 1.55;
}
.doc pre code {
  background: none; border: 0; padding: 0; color: #d6e4f5;
  font-size: 0.875rem; white-space: pre;
}

/* Blockquotes / callouts */
.doc blockquote {
  margin: 1.2em 0; padding: 2px 18px;
  background: var(--quote-bg);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}
.doc blockquote strong { color: var(--brand-300); }
.doc blockquote p:first-child { margin-top: 0.7em; }
.doc blockquote p:last-child { margin-bottom: 0.7em; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.2em 0; }
.doc table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.doc thead th {
  background: #16223a; color: #fff; font-weight: 650; text-align: left;
  padding: 9px 13px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.doc tbody td {
  padding: 9px 13px; border-bottom: 1px solid var(--border-soft);
  vertical-align: top; color: var(--text-dim);
}
.doc tbody tr:nth-child(even) { background: #0e1830; }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc table code { font-size: 0.82em; }

/* Footer */
.docfoot {
  max-width: var(--maxw); margin: 56px auto 0;
  padding-top: 22px; border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: 13.5px;
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; width: 100%;
    border-right: 0; border-bottom: 1px solid var(--border);
    padding: 16px 18px;
  }
  .sidebar ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar li.active a { box-shadow: none; }
  .content { padding: 26px 20px 48px; }
  .doc h1 { font-size: 1.7rem; }
  .brand-sub { display: none; }
}
