:root {
  --bg: #1a2636;
  --surface: #141e2b;
  --surface2: #1f2d3d;
  --border: #2a3a4d;
  --text: #c9d1db;
  --text-dim: #6b7d8f;
  --accent: #14b8a6;
  --green: #14b8a6;
  --orange: #e6a731;
  --red: #e05252;
  --purple: #9b8ec4;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.75;
  font-size: 16px;
}

/* Layout */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  overflow-y: auto;
  z-index: 100;
}

nav .logo {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  padding: 0 20px;
  margin-bottom: 20px;
}

nav a {
  display: block;
  padding: 7px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

nav a:hover, nav a.active {
  color: var(--text);
  background: rgba(20, 184, 166, 0.08);
  border-left-color: var(--accent);
}

nav a.current {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: rgba(20, 184, 166, 0.08);
}

nav .divider {
  height: 1px;
  background: var(--border);
  margin: 12px 20px;
}

main {
  margin-left: 220px;
  max-width: 780px;
  padding: 48px 56px 120px;
}

/* Typography */
h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 40px;
  max-width: 640px;
  font-weight: 400;
}

h2 {
  font-size: 22px;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 12px;
  color: var(--text);
  scroll-margin-top: 24px;
}

h2 .n {
  color: var(--accent);
  margin-right: 8px;
}

h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 8px;
}

h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 6px;
}

p { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 24px; }
li { margin-bottom: 8px; }
li strong { color: var(--accent); }
strong { color: var(--text); }
em { color: var(--text-dim); font-style: italic; }
a { color: var(--accent); }

hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

/* Callouts */
.callout {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.7;
}

.callout.principle { border-left-color: var(--purple); }
.callout.important { border-left-color: var(--orange); }
.callout.critical { border-left-color: var(--red); }

.callout-label {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  color: var(--accent);
}

.callout.principle .callout-label { color: var(--purple); }
.callout.important .callout-label { color: var(--orange); }
.callout.critical .callout-label { color: var(--red); }

/* Cards */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.card.accent { border-color: var(--accent); }
.card.green { border-color: var(--green); }
.card.orange { border-color: var(--orange); }
.card.purple { border-color: var(--purple); }
.card.red { border-color: var(--red); }

.card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}

.card-body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* Compare boxes */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0;
}

.compare-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.compare-box .compare-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.compare-box.left .compare-title { color: var(--green); }
.compare-box.right .compare-title { color: var(--red); }

/* Rules box */
.rules {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 24px 28px;
  margin: 24px 0;
}

.rules ol { counter-reset: rule; list-style: none; padding: 0; }
.rules li { counter-increment: rule; margin-bottom: 14px; padding-left: 36px; position: relative; font-size: 15px; }
.rules li::before { content: counter(rule); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; background: var(--accent); color: white; border-radius: 50%; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

th {
  background: var(--surface);
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td { background: rgba(255,255,255,0.015); }

/* Tags */
.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(20, 184, 166, 0.15);
  color: var(--accent);
}

/* Page nav (bottom) */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.page-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.page-nav a:hover { text-decoration: underline; }

.page-nav .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

/* Hero (index only) */
.hero { margin-bottom: 48px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.hero h1 { font-size: 34px; font-weight: 700; margin-bottom: 10px; }
.hero .sub { font-size: 17px; color: var(--text-dim); max-width: 600px; }
.hero .meta { margin-top: 16px; font-size: 13px; color: var(--text-dim); }
.hero .meta span { margin-right: 20px; }

/* Responsive */
@media (max-width: 800px) {
  nav { display: none; }
  main { margin-left: 0; padding: 24px; }
}
