@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

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

:root {
  --ink:      #0f1117;
  --paper:    #f5f3ee;
  --paper2:   #eceae4;
  --paper3:   #e2dfd8;
  --text:     #1e2330;
  --muted:    #6b7180;
  --faint:    #9ca3af;
  --green:    #16a34a;
  --green-lo: rgba(22,163,74,.1);
  --amber:    #b45309;
  --amber-lo: rgba(180,83,9,.08);
  --cyan:     #0e7490;
  --lora:     'Lora', Georgia, serif;
  --sans:     'DM Sans', system-ui, sans-serif;
  --mono:     'JetBrains Mono', monospace;
  --r:        10px;
}

body { font-family: var(--sans); background: var(--paper); color: var(--text); line-height: 1.6; }

/* Nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px; height: 58px;
  background: rgba(245,243,238,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--paper3);
}
.nav-name { font-family: var(--lora); font-size: 15px; font-weight: 600; color: var(--text); text-decoration: none; }
.nav-back { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; display: flex; align-items: center; gap: 6px; transition: color .15s; }
.nav-back:hover { color: var(--green); }

/* Page */
.page { padding-top: 58px; }

/* Driver header */
.driver-hero {
  max-width: 760px; margin: 0 auto;
  padding: 64px 48px 48px;
  border-bottom: 1px solid var(--paper3);
}

.driver-arc {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  letter-spacing: .1em; text-transform: uppercase;
  margin-bottom: 6px;
}

.driver-num {
  font-family: var(--mono); font-size: 13px; color: var(--green);
  letter-spacing: .06em; margin-bottom: 12px;
}

.driver-hero h1 {
  font-family: var(--lora); font-size: clamp(28px, 4vw, 44px);
  font-weight: 600; letter-spacing: -.02em; line-height: 1.1;
  color: var(--ink); margin-bottom: 16px;
}

.driver-sub { font-size: 15px; color: var(--muted); margin-bottom: 22px; line-height: 1.65; max-width: 580px; }

.driver-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dtag {
  font-family: var(--mono); font-size: 10px;
  padding: 3px 9px; border-radius: 4px;
  background: var(--paper2); color: var(--muted); border: 1px solid var(--paper3);
}

/* Content */
.driver-body {
  max-width: 760px; margin: 0 auto;
  padding: 56px 48px 100px;
}

.section { margin-bottom: 52px; }

.section h2 {
  font-family: var(--lora); font-size: 22px; font-weight: 600;
  color: var(--ink); letter-spacing: -.01em;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--paper3);
}

.section h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 20px 0 10px; }

.section p { font-size: 14.5px; color: var(--muted); line-height: 1.8; max-width: 640px; }
.section p + p { margin-top: 14px; }

/* Code */
pre {
  background: var(--ink); border-radius: var(--r);
  padding: 22px 24px; overflow-x: auto; margin: 16px 0;
}
code {
  font-family: var(--mono); font-size: 12.5px;
  color: #86efac; line-height: 1.7;
}
p code, td code, li code {
  background: var(--paper2); color: var(--cyan);
  font-size: 12px; padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--paper3);
}

/* Table */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--paper2); border: 1px solid var(--paper3);
  padding: 10px 16px; text-align: left;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase;
}
td { border: 1px solid var(--paper3); padding: 10px 16px; color: var(--muted); vertical-align: top; }
tr:hover td { background: rgba(0,0,0,.015); }

/* Callouts */
.note {
  background: var(--green-lo); border-left: 2px solid var(--green);
  padding: 13px 16px; border-radius: 0 6px 6px 0;
  font-size: 13.5px; color: var(--green); font-style: italic;
  line-height: 1.7; margin: 16px 0;
}
.warn {
  background: var(--amber-lo); border-left: 2px solid var(--amber);
  padding: 13px 16px; border-radius: 0 6px 6px 0;
  font-size: 13.5px; color: var(--amber); line-height: 1.7; margin: 16px 0;
}

/* Nav between chapters */
.chapter-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 0; border-top: 1px solid var(--paper3);
  margin-top: 32px; flex-wrap: wrap; gap: 12px;
}
.chapter-nav a {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--muted); font-size: 13px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--paper3);
  transition: .15s;
}
.chapter-nav a:hover { color: var(--green); border-color: rgba(22,163,74,.25); background: var(--green-lo); }

/* Source link */
.source-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 6px;
  background: var(--ink); color: #86efac;
  font-family: var(--mono); font-size: 12px; text-decoration: none;
  transition: .15s; margin-top: 6px;
}
.source-link:hover { opacity: .85; }

/* Footer */
.footer {
  border-top: 1px solid var(--paper3); padding: 24px 48px;
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; color: var(--faint);
}
.footer a { color: var(--faint); text-decoration: none; }
.footer a:hover { color: var(--muted); }

@media (max-width: 640px) {
  .nav { padding: 0 20px; }
  .driver-hero, .driver-body { padding-left: 20px; padding-right: 20px; }
  .footer { padding: 20px; flex-direction: column; gap: 6px; }
}
