/* Phylo docs — clean, readable, responsive */

:root {
  --bg: #ffffff;
  --fg: #1a1a2e;
  --code-bg: #f6f8fa;
  --border: #d0d7de;
  --accent: #0969da;
  --accent-light: #ddf4ff;
  --sidebar-bg: #f6f8fa;
  --sidebar-width: 260px;
  --max-content: 860px;
  --header-bg: #24292f;
  --header-fg: #ffffff;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

/* Header */
.site-header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header a {
  color: var(--header-fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
}

.site-header nav { margin-left: auto; display: flex; gap: 1.25rem; }
.site-header nav a { font-weight: 400; font-size: 0.9rem; opacity: 0.85; }
.site-header nav a:hover { opacity: 1; }

/* Layout */
.page-wrapper {
  display: flex;
  min-height: calc(100vh - 48px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #57606a;
  margin: 1.25rem 0 0.5rem;
}

.sidebar h3:first-child { margin-top: 0; }

.sidebar ul { list-style: none; }

.sidebar li a {
  display: block;
  padding: 0.2rem 0.5rem;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 4px;
}

.sidebar li a:hover { background: var(--accent-light); }
.sidebar li a.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* Main content */
.content {
  flex: 1;
  max-width: var(--max-content);
  padding: 2rem 2.5rem 4rem;
  margin: 0 auto;
}

/* Typography */
.content h1 { font-size: 2rem; margin-bottom: 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.content h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 0.75rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 1.2rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.content h4 { font-size: 1rem; margin-top: 1.25rem; margin-bottom: 0.5rem; }

.content p { margin-bottom: 1rem; }

.content a { color: var(--accent); text-decoration: none; }
.content a:hover { text-decoration: underline; }

/* Code */
.content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

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

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

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

.content th {
  background: var(--code-bg);
  font-weight: 600;
}

.content tr:nth-child(even) td { background: #fafbfc; }

/* Lists */
.content ul, .content ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.content li { margin-bottom: 0.25rem; }

/* Blockquotes */
.content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  color: #57606a;
  background: var(--accent-light);
  border-radius: 0 4px 4px 0;
}

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

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

/* Math */
.content .katex-display { overflow-x: auto; margin: 1rem 0; }

/* Footer */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: #57606a;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { padding: 1.5rem 1rem 3rem; }
  .site-header nav { gap: 0.75rem; }
}

/* Diagram blocks (ASCII art in pre) */
.content pre.diagram {
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.4;
}
