/* layout.css — sidebar, main content, base typography */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  line-height: var(--line-height-body);
  color: var(--text-primary);
  background: var(--surface-base);
}

body {
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
}

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

.sidebar-brand {
  padding: 0 var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-4);
}

.sidebar-brand a {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-brand a:hover { color: var(--accent); }

.sidebar-brand .brand-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  display: block;
  margin-top: var(--space-1);
}

.sidebar nav { padding: 0 var(--space-3); flex: 1; }

.nav-section { margin-bottom: var(--space-6); }

.nav-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
}

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

.nav-section li { margin-bottom: 2px; }

.nav-section a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.nav-section a:hover {
  color: var(--accent);
  background: rgba(129, 140, 248, 0.08);
}

.nav-section a.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(129, 140, 248, 0.12);
}

/* Main content */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.content {
  flex: 1;
  padding: var(--space-8);
}

.content-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

h1 { font-size: 1.8rem; margin-top: 0; }
h2 { font-size: 1.35rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: var(--space-2); }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 var(--space-4); color: var(--text-secondary); }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
}

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

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .main { margin-left: 0; }

  body { flex-direction: column; }
}
