:root {
  --color-background: #f8fafa;
  --color-text: #1a2424;
  --color-text-subtle: #5a6b6b;
  --color-border: #d8e2e2;
  --color-accent: #2a7c7c;
  --color-accent-light: rgba(42, 124, 124, 0.08);
  --color-surface: #eef4f4;
  --font-serif: 'Newsreader', Georgia, serif;
  --font-mono: 'DM Mono', 'Menlo', monospace;
  --sidebar-width: 220px;
  --toc-width: 220px;
  --content-max-width: 680px;
  --header-height: 60px;
  --layout-max-width: 1400px;
  --layout-padding: 24px;
  --border-radius: 2px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0c1214;
    --color-text: #e2eaea;
    --color-text-subtle: #8aa0a0;
    --color-border: #1e2e2e;
    --color-accent: #4db8b8;
    --color-accent-light: rgba(77, 184, 184, 0.1);
    --color-surface: #141e20;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  background: var(--color-background);
  color: var(--color-text);
  line-height: 1.75;
}

code, pre { font-family: var(--font-mono); }
code {
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: var(--border-radius);
  font-size: 0.85em;
  border: 1px solid var(--color-border);
}
pre {
  background: var(--color-surface);
  padding: 1rem 1.25rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
}

@media (prefers-color-scheme: dark) {
  code, pre { background: var(--color-surface); }
}

a {
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: border-color 0.2s;
}
a:hover {
  border-color: var(--color-accent);
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 0 var(--layout-padding);
  padding-left: calc(var(--layout-padding) + 0.5rem);
  height: var(--header-height);
  background: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  border: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

nav { display: flex; gap: 1.75rem; }
nav a {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  border: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}
nav a:hover { opacity: 1; }

/* Layout - Centered 3-Column Grid */
.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: var(--header-height) var(--layout-padding) 0;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 2rem 1rem 2rem 0;
  border-right: 1px solid var(--color-border);
}

.sidebar-section {
  margin-bottom: 1.75rem;
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text);
  margin-bottom: 0.6rem;
  padding-left: 0.5rem;
}

.sidebar-links {
  list-style: none;
}

.sidebar-links li {
  margin-bottom: 2px;
}

.sidebar-links a {
  display: block;
  padding: 0.4rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border: none;
  color: var(--color-text-subtle);
  border-radius: var(--border-radius);
  transition: all 0.15s;
}

.sidebar-links a:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.sidebar-links a.active {
  color: var(--color-accent);
  background: var(--color-accent-light);
}

/* Main Content */
.docs-content {
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

/* Right Sidebar - Table of Contents */
.toc {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 2rem 0 2rem 1.5rem;
  border-left: 1px solid var(--color-border);
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-subtle);
  margin-bottom: 0.75rem;
}

.toc-links {
  list-style: none;
}

.toc-links li {
  margin-bottom: 0.25rem;
}

.toc-links a {
  display: block;
  padding: 0.25rem 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: none;
  color: var(--color-text-subtle);
  transition: color 0.15s;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
}

.toc-links a:hover {
  color: var(--color-text);
}

.toc-links a.active {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
}

/* Breadcrumb */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--color-text-subtle);
  border: none;
}

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

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.page-description {
  color: var(--color-text-subtle);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  font-style: italic;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  scroll-margin-top: 80px;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--color-accent);
  scroll-margin-top: 80px;
}

p { margin-bottom: 1rem; }
ul, ol { margin: 1rem 0 1rem 1.5rem; }
li { margin-bottom: 0.5rem; }

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

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

th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Page navigation */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.page-nav a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-subtle);
  border: none;
  transition: color 0.2s;
}

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

.page-nav .next {
  margin-left: auto;
}

/* Callout boxes */
.callout {
  padding: 1rem 1.25rem;
  border-radius: var(--border-radius);
  margin: 1.5rem 0;
  border-left: 3px solid var(--color-accent);
  background: var(--color-accent-light);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Tablet - Hide TOC */
@media (max-width: 1100px) {
  .docs-layout {
    grid-template-columns: var(--sidebar-width) 1fr;
  }
  .toc { display: none; }
  .docs-content {
    max-width: 720px;
  }
}

/* Mobile - Single column */
@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
    padding: var(--header-height) 1rem 0;
  }
  .sidebar { display: none; }
  .docs-content {
    padding: 1.5rem 0;
    max-width: 100%;
  }
  header { padding: 0 1rem; }
  nav { gap: 1rem; }
  h1 { font-size: 1.75rem; }
}
