:root {
  --bg: #fafaf9;
  --fg: #1c1917;
  --muted: #78716c;
  --accent: #d97706;
  --accent-dim: #fef3c7;
  --border: #e7e5e4;
  --code-bg: #f5f5f4;
  --max-w: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --fg: #fafaf9;
    --muted: #a8a29e;
    --accent: #f59e0b;
    --accent-dim: #422006;
    --border: #44403c;
    --code-bg: #292524;
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Nav */
nav {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .logo {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-weight: 800;
  font-size: 18px;
  color: var(--fg);
  text-decoration: none;
}

nav .logo:hover { text-decoration: none; }

nav .nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

nav .nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}

nav .nav-links a:hover { color: var(--fg); }
nav .nav-links a.active { color: var(--fg); font-weight: 600; }

/* Header */
header {
  padding: 60px 0 48px;
  text-align: center;
}

header .badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 20px;
}

h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

h1 code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-weight: 800;
  color: var(--accent);
}

header p.subtitle {
  font-size: 19px;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Page header (guide) */
.page-header {
  padding: 48px 0 32px;
}

.page-header h1 {
  font-size: 36px;
  margin-bottom: 12px;
}

.page-header p {
  color: var(--muted);
  font-size: 17px;
}

/* Sections */
section {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 8px;
}

h4 {
  font-size: 16px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 6px;
}

p { margin-bottom: 16px; }
p + ul, p + ol { margin-top: -4px; }
strong { font-weight: 600; }

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

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li { margin-bottom: 6px; }
li strong { color: var(--fg); }

/* Callout boxes */
.callout {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 28px 32px;
  margin: 24px 0;
}

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

.callout-accent {
  border-left: 3px solid var(--accent);
}

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 16px 0 24px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.9em;
}

p code, li code, h2 code, h3 code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* Comparison boxes */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}

.comparison-box {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 20px 24px;
}

.comparison-box .label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.comparison-box.bad .label { color: #ef4444; }
.comparison-box.good .label { color: #22c55e; }

.comparison-box p {
  font-size: 15px;
  margin-bottom: 0;
  color: var(--muted);
}

/* Sections grid */
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin: 24px 0;
}

.section-item { padding: 8px 0; }

.section-item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.section-item span {
  font-size: 14px;
  color: var(--muted);
}

/* Pipeline */
.pipeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 32px 0;
}

.pipeline-stage {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
}

.pipeline-marker {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-top: 2px;
}

.pipeline-content h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
  margin-top: 0;
}

.pipeline-content p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 0;
}

.pipeline-arrow {
  width: 36px;
  display: flex;
  justify-content: center;
  color: var(--border);
  font-size: 18px;
  padding: 0;
  line-height: 1;
}

/* Stage detail blocks (guide page) */
.stage {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.stage-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.stage h2 {
  margin-bottom: 16px;
}

.output-box {
  background: var(--accent-dim);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 15px;
}

.output-box strong {
  color: var(--accent);
}

/* Author avatar */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

/* Guide page header with author */
.page-header .author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 15px;
}

.page-header .author a {
  color: var(--muted);
}

.page-header .author a:hover {
  color: var(--fg);
}

/* Footer */
footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

footer .footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

footer a {
  color: var(--muted);
  text-decoration: underline;
}

footer a:hover {
  color: var(--fg);
}

/* Guide link button */
.guide-link {
  display: inline-block;
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  font-size: 16px;
  padding: 14px 32px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.guide-link:hover {
  opacity: 0.85;
  text-decoration: none;
}

/* Responsive */
@media (max-width: 560px) {
  header { padding: 36px 0 32px; }
  h1 { font-size: 36px; }
  h2 { font-size: 24px; }
  header p.subtitle { font-size: 17px; }
  section, .stage { padding: 36px 0; }
  .comparison { grid-template-columns: 1fr; }
  .sections-grid { grid-template-columns: 1fr; }
  pre { padding: 16px; font-size: 13px; }
  .page-header h1 { font-size: 28px; }
}
