/* ------------------------------
   Base reset & variables
------------------------------- */

:root {
  --bg: #ffffff;
  --bg-muted: #f8fafc;
  --bg-subtle: #f1f5f9;

  --text: #0f172a;
  --text-muted: #475569;

  --border: #e5e7eb;
  --accent: #2563eb;

  --code-bg: #0f172a;
  --code-text: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* ------------------------------
     Header
  ------------------------------- */

.app-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.brand {
  font-weight: 600;
  font-size: 1rem;
}

/* ------------------------------
     Layout
  ------------------------------- */

.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 260px;
  background: var(--bg-muted);
  border-right: 1px solid var(--border);
  padding: 1rem 0.5rem;
}

.content {
  flex: 1;
  padding: 2.5rem;
  max-width: 960px;
}

/* ------------------------------
     Sidebar navigation
  ------------------------------- */

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 0.25rem;
}

.sidebar a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sidebar a:hover {
  background: var(--hover-bg);
}

.sidebar a.active {
  background: #e0e7ff;
  color: #1e3a8a;
  font-weight: 500;
}

/* ------------------------------
     Headings & text
  ------------------------------- */

h1 {
  font-size: 2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
}

p {
  max-width: 75ch;
}

ul,
ol {
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.25rem;
}

/* ------------------------------
     Tables
  ------------------------------- */

table {
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
}

th {
  background: var(--bg-muted);
  text-align: left;
}

/* ------------------------------
     Code blocks
  ------------------------------- */

code {
  background: var(--bg-subtle);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ------------------------------
     Callouts (admonition-lite)
  ------------------------------- */

.callout {
  border-left: 4px solid var(--accent);
  background: #eff6ff;
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.callout strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* ------------------------------
     Mobile
  ------------------------------- */

@media (max-width: 916px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .content {
    padding: 1.5rem;
  }
}

.nav-section {
  display: block;
  margin: 0.75rem 0 0.25rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
}

.nav-tree ul {
  list-style: none;
  padding-left: 0.5rem;
}

/* ------------------------------
   Mobile navigation
------------------------------- */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  margin-right: 1rem;
  cursor: pointer;
}

.nav-overlay {
  display: none;
}

/* Mobile breakpoint */
@media (max-width: 916px) {
  .nav-toggle {
    display: block;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    height: calc(100vh - 56px);
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 1000;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .content {
    padding: 1.25rem;
  }
}