/* =====================================================
   ParentElement RichTextKit — Documentation Styles
   ===================================================== */

:root {
  --sidebar-width: 260px;
  --header-height: 60px;
  --accent: #4f8ef7;
  --accent-light: #7fb0ff;
  --accent-dark: #2d6edc;
  --bg-base: #0f1117;
  --bg-sidebar: #161b27;
  --bg-card: #1a2035;
  --bg-code: #111827;
  --bg-table-alt: #1e2740;
  --border: #2a3550;
  --text-primary: #e8edf8;
  --text-secondary: #8899bb;
  --text-muted: #5a6a8a;
  --text-code: #c5d3f0;
  --tag-class: #3a7fd5;
  --tag-struct: #2e8a6e;
  --tag-interface: #7b5ea7;
  --tag-enum: #b5712a;
  --tag-event: #a34040;
  --badge-type: #253555;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 8px;
  --radius-sm: 4px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-brand {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.logo-product {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-version {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 20px 4px;
}

.nav-section a {
  display: block;
  padding: 7px 20px 7px 32px;
  font-size: 13.5px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  position: relative;
}

.nav-section a:hover {
  color: var(--text-primary);
  background: rgba(79, 142, 247, 0.06);
}

.nav-section a.active {
  color: var(--accent-light);
  border-left-color: var(--accent);
  background: rgba(79, 142, 247, 0.1);
}

/* ── Top-level nav items (no indent) ─── */
.nav-section > a {
  padding-left: 20px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Main Content ────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 32px 48px 28px;
}

.page-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.page-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.page-breadcrumb a:hover { text-decoration: underline; }

.page-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 8px;
  max-width: 680px;
}

.type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.badge-class    { background: var(--tag-class);     color: #bdd8ff; }
.badge-struct   { background: var(--tag-struct);    color: #b6eed9; }
.badge-interface{ background: var(--tag-interface); color: #d4c3f5; }
.badge-enum     { background: var(--tag-enum);      color: #f5d9aa; }
.badge-event    { background: var(--tag-event);     color: #f5c3c3; }

.content {
  padding: 40px 48px 80px;
  max-width: 1000px;
}

/* ── Sections & Headings ─────────────────────────────── */
.section {
  margin-bottom: 48px;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 24px 0 10px;
}

h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 8px;
}

p { color: var(--text-secondary); margin-bottom: 12px; }

/* ── Cards & Callouts ────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  border-left: 4px solid;
  font-size: 14px;
}

.callout-note  { background: rgba(79,142,247,0.08); border-color: var(--accent); color: var(--text-secondary); }
.callout-warn  { background: rgba(200,150,40,0.08);  border-color: #c89628; color: #d4aa55; }
.callout-info  { background: rgba(46,138,110,0.08);  border-color: #2e8a6e; color: #7ac9a8; }

.callout strong { display: block; margin-bottom: 4px; font-weight: 700; }

/* ── Code Blocks ─────────────────────────────────────── */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 12px 0 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-code);
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
}

p code, li code, td code {
  background: var(--badge-type);
  color: var(--accent-light);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12.5px;
}

/* Syntax highlight tokens */
.kw  { color: #7eb6f5; } /* keywords */
.ty  { color: #f0c090; } /* types */
.st  { color: #a8d8a8; } /* strings */
.cm  { color: #5a7a9a; font-style: italic; } /* comments */
.nm  { color: #c9b7f5; } /* numbers/values */
.fc  { color: #7fd5c5; } /* function calls */
.pr  { color: #e8d4a0; } /* properties */

/* ── Tables ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: rgba(79,142,247,0.04); }

tbody tr:nth-child(even) { background: var(--bg-table-alt); }
tbody tr:nth-child(even):hover { background: rgba(79,142,247,0.07); }

td {
  padding: 10px 16px;
  color: var(--text-secondary);
  vertical-align: top;
}

td:first-child { color: var(--text-primary); font-weight: 500; }

.td-type {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-light);
  white-space: nowrap;
}

/* ── Member entries ──────────────────────────────────── */
.member {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.member-header {
  padding: 12px 16px;
  background: rgba(79,142,247,0.06);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.member-kind {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
}
.kind-prop   { background: rgba(79,142,247,0.2);   color: var(--accent-light); }
.kind-method { background: rgba(46,138,110,0.2);   color: #7ac9a8; }
.kind-event  { background: rgba(163,64,64,0.2);    color: #f5a5a5; }
.kind-ctor   { background: rgba(123,94,167,0.2);   color: #c3a8f5; }
.kind-cb     { background: rgba(181,113,42,0.2);   color: #f5d0a0; }

.member-sig {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.member-body {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ── Grid layouts ────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature-card-icon {
  font-size: 24px;
  margin-bottom: 10px;
}

.feature-card h3 {
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 13px;
  margin: 0;
}

/* ── Quick link cards ────────────────────────────────── */
.quicklink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.quicklink {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.quicklink:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.quicklink-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.quicklink-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.quicklink-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Enum value table ────────────────────────────────── */
.enum-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.enum-val {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-light);
}

/* ── Footer ──────────────────────────────────────────── */
.page-footer {
  margin-top: auto;
  padding: 24px 48px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .page-header, .content { padding-left: 24px; padding-right: 24px; }
}

/* ── Utility ─────────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
ul.clean { list-style: none; padding: 0; }
ul li { color: var(--text-secondary); margin-bottom: 4px; }
ul li::marker { color: var(--accent); }
ul { padding-left: 20px; }

a { color: var(--accent); }
a:hover { color: var(--accent-light); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
