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

:root {
  --bg: #0d0d0d;
  --card: #141414;
  --border: #2a1a1a;
  --accent: #8b1a1a;
  --accent-dim: #5a1010;
  --text: #c8b8a8;
  --text-muted: #7a6a5a;
  --heading: #e8d8c0;
  --link: #b03030;
  --link-hover: #d04040;
  --sidebar-width: 220px;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.4;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: #0a0a0a;
  border-right: 1px solid var(--border);
  padding: 2rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.site-title {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 1.4rem;
  color: var(--heading);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 1rem;
  display: block;
}

.site-title:hover { color: var(--link-hover); }

.nav-sections {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-item:hover { color: var(--text); border-left-color: var(--accent-dim); }
.nav-item.active { color: var(--heading); border-left-color: var(--accent); }

/* ── Content ─────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-width);
  padding: 3rem 4rem;
  max-width: calc(var(--sidebar-width) + 860px);
  width: 100%;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: 2rem;
  color: var(--heading);
  letter-spacing: 0.04em;
  font-weight: normal;
}

/* ── Typography ──────────────────────────────────── */
.page-body h1, .page-body h2, .page-body h3 {
  font-family: 'Special Elite', 'Courier New', monospace;
  color: var(--heading);
  font-weight: normal;
  margin: 1.8rem 0 0.6rem;
  letter-spacing: 0.03em;
}

.page-body h1 { font-size: 1.6rem; }
.page-body h2 { font-size: 1.3rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3rem; }
.page-body h3 { font-size: 1.1rem; color: var(--text); }

.page-body p { margin-bottom: 1rem; }

.page-body a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.page-body a:hover { color: var(--link-hover); }

.broken-link {
  color: var(--text-muted);
  text-decoration: line-through;
  cursor: default;
}

/* ── Tables ──────────────────────────────────────── */
.page-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2rem 0;
  font-size: 0.95rem;
}

.page-body th {
  font-family: 'Special Elite', monospace;
  text-align: left;
  background: #1a0f0f;
  color: var(--heading);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  font-weight: normal;
  letter-spacing: 0.04em;
}

.page-body td {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.page-body tr:nth-child(even) td { background: #111010; }

/* ── Callouts ────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: #1a0f0f;
  padding: 1rem 1.25rem;
  margin: 1.2rem 0;
  border-radius: 0 4px 4px 0;
}

.callout-title {
  font-family: 'Special Elite', monospace;
  color: var(--heading);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.callout-body { font-size: 0.97rem; }

/* ── Status badges ───────────────────────────────── */
.status-badge {
  display: inline-block;
  font-family: 'Special Elite', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  border: 1px solid transparent;
}

.status-alive    { background: #0d1f0d; border-color: #2d5a27; color: #6ab860; }
.status-dead     { background: #1f0d0d; border-color: #5a1a1a; color: #b06060; }
.status-missing  { background: #1f1a0d; border-color: #5a4a1a; color: #b09060; }
.status-unknown  { background: #141414; border-color: #3a3a3a; color: #787878; }
.status-found    { background: #0d1a1f; border-color: #1a4a5a; color: #60a0b0; }
.status-hidden   { background: #130d1f; border-color: #3a1a5a; color: #9060b0; }
.status-analyzed { background: #0d131f; border-color: #1a2a5a; color: #6080b0; }
.status-active   { background: #1f0d0d; border-color: var(--accent); color: #d06060; }
.status-dormant  { background: #141414; border-color: #3a3a3a; color: #787878; }
.status-resolved { background: #0d1a0d; border-color: #1a5a1a; color: #60b060; }
.status-visited  { background: #0d1a1f; border-color: #1a4a5a; color: #60a0b0; }
.status-unexplored { background: #141414; border-color: #3a3a3a; color: #787878; }
.status-cleared  { background: #0d1a0d; border-color: #1a5a1a; color: #60b060; }
.status-dangerous{ background: #1f0d0d; border-color: var(--accent); color: #d06060; }

/* ── Blockquote fallback ─────────────────────────── */
.page-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 1rem 0;
}

/* ── Code ────────────────────────────────────────── */
.page-body code {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  background: #1a1010;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  color: #c0a080;
}

.page-body pre {
  background: #1a1010;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  border-left: 2px solid var(--border);
}

.page-body pre code { background: none; padding: 0; }

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 768px) {
  body { flex-direction: column; }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .site-title {
    border-bottom: none;
    padding-bottom: 0;
    font-size: 1.1rem;
  }

  .nav-sections {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.1rem;
  }

  .nav-item { padding: 0.3rem 0.5rem; font-size: 0.75rem; }

  .content { margin-left: 0; padding: 1.5rem; }
}
