:root {
  --navy: #1a1a40;
  --navy-light: #252560;
  --gold: #c9a227;
  --crimson: #8b1a1a;
  --bg: #f8f5f0;
  --card: #ffffff;
  --text: #2c2c2c;
  --text-muted: #666;
  --border: #dde0e6;
  --sidebar-w: 230px;
  --link: #1a3a7a;
  --max-w: 880px;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
}

/* ── Sidebar ────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--navy); color: #d0d0e8;
  overflow-y: auto; z-index: 100;
  display: flex; flex-direction: column;
}

.sidebar-header {
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-title {
  font-size: 13px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold); margin-bottom: 3px;
}

.sidebar-subtitle {
  font-size: 11px; color: #778; font-style: italic;
}

.sidebar nav { padding: 8px 0 24px; }

.sidebar-section {
  padding: 12px 16px 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: #556;
}

.sidebar nav a {
  display: block; padding: 6px 16px;
  color: #b0b4cc; text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.12s;
  line-height: 1.4;
}

.sidebar nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  border-left-color: var(--gold);
}

.sidebar nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: var(--gold);
}

.sidebar nav a.src {
  font-size: 12px; color: #778; font-style: italic;
}
.sidebar nav a.src:hover { color: #aab; }

.sidebar hr {
  border: none; border-top: 1px solid rgba(255,255,255,0.07);
  margin: 8px 0;
}

/* ── Main Content ───────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  padding: 44px 52px 80px;
  max-width: calc(var(--sidebar-w) + var(--max-w));
  width: 100%;
}

.main h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px; font-weight: 700;
  color: var(--navy);
  border-bottom: 3px solid var(--gold);
  padding-bottom: 12px; margin-bottom: 24px;
  line-height: 1.3;
}

.main h2 {
  font-family: Georgia, serif;
  font-size: 19px; color: var(--navy);
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.main h3 {
  font-size: 13px; font-weight: 700;
  color: var(--crimson);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin: 24px 0 8px;
}

.main p { line-height: 1.75; margin-bottom: 12px; }
.main ul, .main ol { margin: 8px 0 16px 22px; }
.main li { line-height: 1.7; margin-bottom: 4px; }
.main a { color: var(--link); }
.main strong { color: var(--navy); }

/* ── Mnemonic / Summary Box ─────────────────── */
.mnemonic {
  background: #fff;
  border-left: 4px solid var(--gold);
  padding: 16px 20px 14px;
  margin: 0 0 28px;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.mnemonic p { margin: 0; font-style: italic; color: #444; line-height: 1.7; }
.mnemonic p + p { margin-top: 8px; }
.mnemonic-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--gold); margin-bottom: 8px;
}

/* ── Tables ─────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 16px 0 28px; }
table {
  width: 100%; border-collapse: collapse;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: 13.5px;
}
thead th {
  background: var(--navy); color: white;
  padding: 9px 12px; text-align: left;
  font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #eaeef2;
  vertical-align: top; line-height: 1.5;
}
tbody tr:hover { background: #f9f9fb; }
tbody tr:last-child td { border-bottom: none; }
td a { color: var(--link); }
td .tbd {
  display: inline-block;
  background: #f0f0f0; color: #999;
  font-size: 11px; padding: 2px 6px;
  border-radius: 3px; font-style: italic;
}

/* ── Hinge Cards ─────────────────────────────── */
.hinges { margin: 20px 0; }
.hinge {
  background: white;
  border: 1px solid var(--border);
  border-left: 4px solid var(--crimson);
  padding: 16px 20px 14px;
  margin: 0 0 14px;
  border-radius: 0 4px 4px 0;
}
.hinge-num {
  font-size: 10px; font-weight: 700;
  color: var(--crimson); text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 3px;
}
.hinge h3 {
  color: var(--navy); font-size: 15px;
  margin: 0 0 4px; font-family: Georgia, serif;
  text-transform: none; letter-spacing: 0;
  font-weight: 700; color: #1a1a40;
}
.hinge .off-ramp {
  font-size: 12.5px; color: #777;
  font-style: italic; margin-bottom: 10px;
}
.hinge .char-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 10px;
}
.hinge .char-box {
  background: #f7f7f9; padding: 8px 12px;
  border-radius: 4px; font-size: 13px; line-height: 1.55;
}
.hinge .char-name {
  font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--navy); display: block; margin-bottom: 3px;
}

/* ── Timeline ────────────────────────────────── */
.timeline { margin: 16px 0 28px; }
.tl-year {
  font-family: Georgia, serif; font-size: 17px;
  font-weight: 700; color: var(--navy);
  margin: 28px 0 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.tl-item { display: flex; margin-bottom: 14px; gap: 0; }
.tl-date {
  width: 72px; min-width: 72px;
  font-weight: 700; color: var(--crimson);
  font-size: 13px; padding-top: 2px;
}
.tl-body {
  border-left: 2px solid #d0d0d0;
  padding: 0 0 0 18px; margin-left: 4px; flex: 1;
  padding-bottom: 4px;
}
.tl-body strong { color: var(--navy); font-size: 14px; }
.tl-body p { font-size: 13px; color: #555; margin: 3px 0 0; line-height: 1.6; }
.tl-hinge .tl-body { border-left-color: var(--crimson); }
.tl-hinge .tl-date { color: var(--gold); font-size: 11.5px; }

/* ── Character Profiles ──────────────────────── */
.profile {
  background: white; border: 1px solid var(--border);
  border-top: 3px solid var(--navy);
  padding: 24px 28px; margin: 0 0 28px;
  border-radius: 0 0 4px 4px;
}
.profile h2 {
  border: none; margin: 0 0 4px; padding: 0;
  font-size: 22px; color: var(--navy);
}
.profile .role {
  font-size: 13px; color: var(--gold); font-weight: 600;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px;
}
.profile .arc-steps { counter-reset: arc; }
.profile .arc-steps li {
  counter-increment: arc; list-style: none;
  padding-left: 28px; position: relative; margin-bottom: 6px;
}
.profile .arc-steps li::before {
  content: counter(arc);
  position: absolute; left: 0;
  width: 18px; height: 18px; background: var(--navy); color: white;
  border-radius: 50%; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  top: 3px;
}

/* ── Full-doc footer ─────────────────────────── */
.full-doc {
  margin-top: 44px; padding: 14px 20px;
  background: white; border: 1px solid var(--border);
  border-radius: 4px; font-size: 13.5px; color: #555;
}
.full-doc a { color: var(--crimson); font-weight: 600; }

/* ── Info card grid ──────────────────────────── */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin: 16px 0 28px;
}
.card {
  background: white; border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  padding: 16px 18px; border-radius: 0 0 4px 4px;
}
.card h4 {
  font-family: Georgia, serif; font-size: 15px;
  color: var(--navy); margin-bottom: 8px;
}
.card p { font-size: 13px; color: #555; line-height: 1.6; margin: 0; }

/* ── Image placeholder ───────────────────────── */
.img-ph {
  width: 100px; height: 65px; background: #eee;
  border: 1px dashed #bbb; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #aaa; text-align: center; line-height: 1.3;
}

/* ── Misc ────────────────────────────────────── */
.tag {
  display: inline-block; font-size: 11px;
  padding: 2px 8px; border-radius: 10px;
  margin-right: 4px; margin-bottom: 2px;
  font-weight: 600;
}
.tag-navy { background: var(--navy); color: white; }
.tag-crimson { background: var(--crimson); color: white; }
.tag-gold { background: var(--gold); color: var(--navy); }

blockquote {
  border-left: 3px solid var(--gold); margin: 16px 0;
  padding: 8px 16px; background: #fff;
  color: #444; font-style: italic; font-size: 14.5px; line-height: 1.7;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
