@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --blue:      #003976;
  --blue-mid:  #1e3a6e;
  --blue-lt:   #1a2e50;
  --gold:      #FFC72C;
  --gold-dim:  #c89a00;
  --bg:        #0a1628;
  --bg-panel:  #112236;
  --bg-card:   #152840;
  --txt:       #d8e8f5;
  --txt-dim:   #7a9ab8;
  --txt-faint: #3a5a7a;
  --green:     #34d058;
  --amber:     #fbbf24;
  --red:       #f87171;
  --purple:    #c084fc;
  --border:    #1e3a5a;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 16px;
  line-height: 1.7;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #060f1e;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  display: block;
}
.sidebar-brand:hover { background: rgba(255,199,44,0.03); }
.sidebar-brand .wordmark {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.sidebar-brand .sub {
  font-size: 11px;
  color: var(--txt-dim);
  margin-top: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.sidebar-brand .badge {
  display: inline-block;
  background: var(--blue);
  color: var(--gold);
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.nav-section { padding: 12px 0 4px; }
.nav-section-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--txt-faint);
  padding: 0 20px 6px;
  font-family: 'JetBrains Mono', monospace;
}
.nav-item {
  display: block;
  padding: 7px 20px;
  color: var(--txt-dim);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.nav-item:hover {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(255,199,44,0.05);
}
.nav-item.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(255,199,44,0.07);
}
.nav-item.sub { padding-left: 32px; font-size: 12px; }

/* ── Main content ── */
.main { flex: 1; overflow-y: auto; }

/* ── Page header (inner pages) ── */
.page-header {
  background: linear-gradient(135deg, #001a3a 0%, #003976 60%, #001a3a 100%);
  padding: 48px 64px 40px;
  border-bottom: 2px solid var(--gold);
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,199,44,0.1) 0%, transparent 70%);
  pointer-events: none;
}
.page-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  opacity: 0.8;
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 38px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.page-header .lead {
  margin-top: 12px;
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  max-width: 520px;
  font-weight: 300;
}

/* ── Content body ── */
.content {
  padding: 48px 64px 72px;
  max-width: 960px;
}
.content h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: #fff;
  margin: 40px 0 14px;
  letter-spacing: -0.3px;
}
.content h2:first-child { margin-top: 0; }
.content h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--gold);
  margin: 32px 0 10px;
}
.content h4 {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--txt-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 20px 0 6px;
}
.content p { color: var(--txt); margin-bottom: 14px; max-width: 720px; }
.content ul, .content ol {
  margin: 0 0 16px 20px;
  max-width: 700px;
}
.content li { color: var(--txt); margin-bottom: 6px; }
.content li strong { color: var(--gold); font-weight: 600; }
.content a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(255,199,44,0.3); }
.content a:hover { border-bottom-color: var(--gold); }

/* ── Cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0 28px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--gold); transform: translateY(-2px); }
.card-icon { font-size: 22px; margin-bottom: 10px; }
.card h4 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  color: #fff;
  margin: 0 0 6px;
  text-transform: none;
  letter-spacing: 0;
}
.card p { font-size: 13px; color: var(--txt-dim); margin: 0; max-width: none; }

/* ── Steps ── */
.steps { margin: 20px 0 28px; }
.step { display: flex; gap: 18px; margin-bottom: 24px; align-items: flex-start; }
.step-num {
  flex-shrink: 0;
  width: 34px; height: 34px;
  background: var(--blue);
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--gold);
  font-size: 13px;
}
.step-body h4 {
  color: #fff;
  font-size: 15px;
  font-family: 'Source Serif 4', serif;
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 3px;
  font-weight: 600;
}
.step-body p { font-size: 14px; color: var(--txt-dim); margin: 0; max-width: none; }

/* ── Code ── */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  background: rgba(255,199,44,0.08);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 3px;
}
pre {
  background: #040d18;
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 14px 0 20px;
}
pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--txt);
  line-height: 1.6;
}
.comment { color: var(--txt-faint); }
.kw { color: #c084fc; }
.str { color: #34d058; }
.num { color: #fbbf24; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px;
  font-size: 13px;
}
th {
  background: var(--blue);
  color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid var(--border);
}
td {
  padding: 9px 14px;
  border: 1px solid var(--border);
  color: var(--txt);
  vertical-align: top;
}
tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
td code { font-size: 11.5px; }

/* ── Alerts ── */
.alert {
  border-left: 3px solid var(--gold);
  background: rgba(255,199,44,0.06);
  padding: 14px 18px;
  border-radius: 0 6px 6px 0;
  margin: 16px 0 20px;
}
.alert-title { font-weight: 600; color: var(--gold); font-size: 13px; margin-bottom: 4px; }
.alert p { font-size: 13px; color: var(--txt-dim); margin: 0; max-width: none; }
.alert-blue { border-left-color: #60a5fa; background: rgba(96,165,250,0.06); }
.alert-blue .alert-title { color: #60a5fa; }
.alert-green { border-left-color: var(--green); background: rgba(52,208,88,0.06); }
.alert-green .alert-title { color: var(--green); }

/* ── Grade chips ── */
.grade-mastery    { color: #34d058; font-weight: 700; }
.grade-approach   { color: #fbbf24; font-weight: 700; }
.grade-proficient { color: #60a5fa; font-weight: 700; }
.grade-quiz       { color: #c084fc; font-weight: 700; }

/* ── Workflow diagram ── */
.workflow {
  display: flex;
  gap: 0;
  margin: 20px 0 28px;
  flex-wrap: wrap;
  align-items: center;
}
.wf-node {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 110px;
  text-align: center;
}
.wf-node .icon { font-size: 20px; }
.wf-node .label { font-size: 12px; color: var(--txt-dim); margin-top: 4px; }
.wf-arrow { padding: 0 6px; color: var(--gold); font-size: 18px; opacity: 0.6; }

/* ── Schema ── */
.schema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.schema-table { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.schema-table-hdr { background: var(--blue); padding: 8px 12px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--gold); font-weight: 500; }
.schema-col { padding: 5px 12px; font-size: 11.5px; color: var(--txt-dim); border-top: 1px solid var(--border); font-family: 'JetBrains Mono', monospace; display: flex; justify-content: space-between; }
.schema-col .type { color: var(--txt-faint); }
.schema-col.pk { color: var(--gold); }
.schema-col.fk { color: #60a5fa; }

/* ── API ── */
.api-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.api-search {
  flex: 1; min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 14px;
  color: var(--txt);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.api-search:focus { border-color: var(--gold); }
.api-search::placeholder { color: var(--txt-faint); }
.module-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.mod-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--txt-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.mod-btn:hover, .mod-btn.active { background: var(--blue); border-color: var(--gold); color: var(--gold); }
#api-count { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--txt-faint); }
.fn-list { display: flex; flex-direction: column; gap: 6px; }
.fn-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; transition: border-color 0.15s; }
.fn-card:hover { border-color: rgba(255,199,44,0.3); }
.fn-header { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; user-select: none; }
.fn-name { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; color: var(--gold); }
.fn-args { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--txt-faint); }
.fn-module-tag { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 10px; padding: 2px 7px; background: var(--blue); color: var(--gold); border-radius: 3px; flex-shrink: 0; }
.fn-body { padding: 0 14px 12px; border-top: 1px solid var(--border); display: none; }
.fn-body.open { display: block; }
.fn-doc { font-size: 13px; color: var(--txt-dim); margin-top: 8px; line-height: 1.6; }
.fn-line { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--txt-faint); margin-top: 5px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-mid); }
