/* Private Credit Documentation - Neutral Compact Theme */

:root {
  --text-color: #333333;
  --heading-color: #1a1a1a;
  --link-color: #2563eb;
  --link-hover: #1d4ed8;
  --bg-color: #ffffff;
  --code-bg: #f5f5f5;
  --border-color: #e5e5e5;
  --sidebar-bg: #fafafa;
  --sidebar-width: 220px;
  --content-max: 900px;
}

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

html {
  font-size: 14px;
  line-height: 1.5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-color);
  background: var(--bg-color);
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--heading-color);
  text-decoration: none;
  display: block;
}

.site-title:hover {
  color: var(--link-color);
}

.site-tagline {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 0.25rem;
}

.nav-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--heading-color);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-section-title:hover {
  background: var(--border-color);
}

.nav-section-title.active {
  color: var(--link-color);
  background: rgba(37, 99, 235, 0.08);
}

.nav-section-title svg {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.nav-section.expanded .nav-section-title svg {
  transform: rotate(90deg);
}

.nav-children {
  display: none;
  padding-left: 0.5rem;
}

.nav-section.expanded .nav-children {
  display: block;
}

.nav-link {
  display: block;
  padding: 0.3rem 1rem 0.3rem 1.5rem;
  font-size: 0.8rem;
  color: var(--text-color);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--link-color);
  background: var(--border-color);
}

.nav-link.active {
  color: var(--link-color);
  font-weight: 500;
  background: rgba(37, 99, 235, 0.08);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.github-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-color);
  text-decoration: none;
}

.github-link:hover {
  color: var(--link-color);
}

/* Content */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 1.5rem 2rem;
  max-width: calc(var(--content-max) + 4rem);
}

.page-header {
  margin-bottom: 1rem;
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.5rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--heading-color);
  line-height: 1.3;
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.page-content {
  line-height: 1.6;
}

.page-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: #666;
}

/* Typography */
h1 { font-size: 1.5rem; margin: 1.5rem 0 0.75rem; line-height: 1.3; color: var(--heading-color); }
h2 { font-size: 1.25rem; margin: 1.25rem 0 0.6rem; line-height: 1.3; color: var(--heading-color); }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; line-height: 1.4; color: var(--heading-color); }
h4 { font-size: 0.9rem; margin: 0.75rem 0 0.4rem; line-height: 1.4; color: var(--heading-color); }

p { margin: 0.6rem 0; }

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin: 0.6rem 0;
  padding-left: 1.5rem;
}

li {
  margin: 0.2rem 0;
}

li > ul, li > ol {
  margin: 0.1rem 0;
}

/* Code */
code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.75rem 0;
  border: 1px solid var(--border-color);
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Line numbers */
.highlight .lineno {
  color: #999;
  padding-right: 0.75rem;
  user-select: none;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

th, td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border: 1px solid var(--border-color);
}

th {
  background: var(--code-bg);
  font-weight: 600;
  color: var(--heading-color);
}

tr:nth-child(even) {
  background: var(--sidebar-bg);
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--link-color);
  margin: 0.75rem 0;
  padding: 0.5rem 1rem;
  background: var(--sidebar-bg);
  color: #555;
}

blockquote p {
  margin: 0.25rem 0;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.5rem 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--link-color);
  color: white;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
}

.btn:hover {
  background: var(--link-hover);
  color: white;
  text-decoration: none;
}

/* Details/Summary */
details {
  margin: 0.75rem 0;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

summary {
  padding: 0.5rem 0.75rem;
  background: var(--code-bg);
  cursor: pointer;
  font-weight: 500;
}

details[open] summary {
  border-bottom: 1px solid var(--border-color);
}

details > *:not(summary) {
  padding: 0.75rem;
}

/* Math */
.MathJax {
  font-size: 0.95em !important;
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

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

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .content {
    margin-left: 0;
    padding: 1rem;
  }

  .menu-toggle {
    display: block;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

/* Print */
@media print {
  .sidebar, .menu-toggle, .sidebar-overlay {
    display: none;
  }

  .content {
    margin-left: 0;
    max-width: none;
  }
}
