/* ============================================================
   THIN FOIL FACT — Dark Dossier Stylesheet
   ============================================================ */

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #141414;
  --bg-tertiary: #1a1a1a;
  --bg-card: #111111;
  --bg-hover: #1e1e1e;
  --text-primary: #e2d9c8;
  --text-secondary: #a89880;
  --text-muted: #6b5f52;
  --accent-gold: #c8a45a;
  --accent-amber: #e8b84b;
  --accent-red: #c0392b;
  --accent-red-dim: #7a2020;
  --accent-green: #4a7c59;
  --border-color: #2a2520;
  --border-accent: #3d3028;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'Courier New', 'Courier', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --sidebar-width: 280px;
  --content-max: 860px;
  --header-height: 56px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle grain texture on body */
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.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: bold;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 2.2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.6rem; letter-spacing: -0.01em; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.25rem; margin: 2rem 0 0.75rem; color: var(--accent-gold); }
h4 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; }
h5 { font-size: 0.95rem; margin: 1.2rem 0 0.4rem; }

p { margin-bottom: 1.2rem; }

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-amber);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

strong { color: var(--text-primary); font-weight: 700; }
em { color: var(--text-secondary); }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 0.15em 0.4em;
  color: var(--accent-amber);
}

pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-gold);
  border-radius: 4px;
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

blockquote {
  border-left: 3px solid var(--accent-gold);
  margin: 1.5rem 0;
  padding: 0.8rem 1.2rem;
  background: var(--bg-tertiary);
  border-radius: 0 4px 4px 0;
  color: var(--text-secondary);
  font-style: italic;
}

blockquote p { margin-bottom: 0.4rem; }
blockquote p:last-child { margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2.5rem 0;
}

ul, ol {
  margin: 0.75rem 0 1.2rem 0;
  padding-left: 1.6rem;
}

ul li, ol li {
  margin-bottom: 0.6rem;
  line-height: 1.65;
}

ul li::marker {
  color: var(--accent-gold);
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 10, 10, 0.97);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1000;
  backdrop-filter: blur(8px);
  gap: 1rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent-red);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: white;
  letter-spacing: -0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
}

.logo-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  display: block;
}

.header-search-wrap {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  outline: none;
  transition: border-color 0.15s;
}

.header-search:focus {
  border-color: var(--accent-gold);
}

.header-search::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}

.header-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-sidebar-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  transition: all 0.15s;
  display: none;
}

.btn-sidebar-toggle:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

/* ============================================================
   LAYOUT
   ============================================================ */

.page-layout {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  transition: transform 0.25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border-accent) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 2px; }

.sidebar-inner {
  padding: 1.25rem 0 3rem;
}

.sidebar-section {
  margin-bottom: 0.25rem;
}

.sidebar-part-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  transition: color 0.15s;
  position: relative;
}

.sidebar-part-header:hover {
  color: var(--accent-gold);
}

.sidebar-part-header .part-toggle {
  margin-left: auto;
  transition: transform 0.2s;
  font-size: 0.55rem;
}

.sidebar-part-header.collapsed .part-toggle {
  transform: rotate(-90deg);
}

.sidebar-topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-topic-list.collapsed {
  max-height: 0;
}

.sidebar-topic-item a {
  display: block;
  padding: 0.4rem 1rem 0.4rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  line-height: 1.4;
}

.sidebar-topic-item a:hover {
  color: var(--text-primary);
  border-left-color: var(--accent-gold);
  background: rgba(200, 164, 90, 0.05);
  text-decoration: none;
}

.sidebar-topic-item a.active {
  color: var(--accent-gold);
  border-left-color: var(--accent-gold);
  background: rgba(200, 164, 90, 0.08);
}

.sidebar-section-label {
  padding: 0.6rem 1rem 0.2rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.content-area {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

/* ============================================================
   HOMEPAGE
   ============================================================ */

.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 3rem;
  position: relative;
}

.hero::before {
  content: 'CLASSIFIED';
  position: absolute;
  top: 1.5rem;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--accent-red);
  border: 2px solid var(--accent-red);
  padding: 0.2rem 0.5rem;
  transform: rotate(15deg);
  opacity: 0.6;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-red);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.hero h1 span {
  color: var(--accent-gold);
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-number {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-gold);
  display: block;
  line-height: 1;
}

.hero-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Search results overlay */
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.search-results.visible { display: block; }

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  transition: background 0.1s;
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover {
  background: var(--bg-hover);
  text-decoration: none;
}

.search-result-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  display: block;
}

.search-result-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.search-no-results {
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Part grid on homepage */
.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 3rem;
}

.part-card {
  background: var(--bg-card);
  padding: 1.5rem;
  transition: background 0.15s;
}

.part-card:hover {
  background: var(--bg-hover);
}

.part-card-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-red);
  margin-bottom: 0.5rem;
}

.part-card h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.part-card p {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.part-card-topics {
  list-style: none;
  padding: 0;
  margin: 0;
}

.part-card-topics li {
  margin-bottom: 0.2rem;
}

.part-card-topics a {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.part-card-topics a::before {
  content: '›';
  color: var(--accent-gold);
  flex-shrink: 0;
}

.part-card-topics a:hover {
  color: var(--accent-gold);
  text-decoration: none;
}

/* ============================================================
   TOPIC PAGE
   ============================================================ */

/* Metadata bar */
.topic-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.meta-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-badge.level-fringe { background: rgba(74,124,89,0.25); color: var(--accent-green); border: 1px solid rgba(74,124,89,0.4); }
.meta-badge.level-widespread { background: rgba(200,164,90,0.15); color: var(--accent-gold); border: 1px solid rgba(200,164,90,0.3); }
.meta-badge.level-mainstream { background: rgba(192,57,43,0.2); color: #e74c3c; border: 1px solid rgba(192,57,43,0.4); }

.meta-badge.complexity-simple { color: var(--accent-green); }
.meta-badge.complexity-moderate { color: var(--accent-amber); }
.meta-badge.complexity-labyrinthine { color: var(--accent-red); }

.meta-divider {
  color: var(--text-muted);
  opacity: 0.4;
}

.meta-item {
  color: var(--text-muted);
}

.meta-section {
  color: var(--text-secondary);
}

/* Tag pills */
.tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 2rem;
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  color: var(--text-muted);
}

/* Layer dividers */
.layer-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0 2rem;
}

.layer-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.layer-divider-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

/* Image placeholders */
.image-placeholder {
  border: 1px dashed var(--border-accent);
  border-radius: 4px;
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-tertiary);
}

.image-placeholder-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.image-placeholder-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-sans);
}

.image-placeholder p {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-style: italic;
}

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

/* Deep dive details */
details {
  margin: 1.5rem 0;
  border: 1px solid var(--border-accent);
  border-radius: 4px;
  background: var(--bg-card);
  overflow: hidden;
}

details[open] {
  border-color: var(--accent-gold);
}

details summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
  background: var(--bg-tertiary);
  border-bottom: 1px solid transparent;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}

details[open] summary {
  border-bottom-color: var(--border-accent);
  background: rgba(200, 164, 90, 0.08);
}

details summary:hover {
  background: rgba(200, 164, 90, 0.08);
}

details summary::-webkit-details-marker { display: none; }

details summary::before {
  content: '▶';
  font-size: 0.6rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}

details[open] summary::before {
  transform: rotate(90deg);
}

.details-content {
  padding: 1.5rem 1.5rem 1rem;
}

.details-content > *:last-child { margin-bottom: 0; }

/* Mermaid diagrams */
.mermaid-wrap {
  margin: 2rem 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1.5rem 1rem;
  overflow-x: auto;
  text-align: center;
}

.mermaid {
  max-width: 100%;
}

/* ============================================================
   SPECIAL CALLOUT BOXES
   ============================================================ */

/* Kernel of truth */
.kernel-box {
  background: rgba(74, 124, 89, 0.08);
  border: 1px solid rgba(74, 124, 89, 0.3);
  border-left: 4px solid var(--accent-green);
  border-radius: 0 4px 4px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

/* Warning / disputed */
.disputed-box {
  background: rgba(200, 164, 90, 0.08);
  border: 1px solid rgba(200, 164, 90, 0.25);
  border-left: 4px solid var(--accent-gold);
  border-radius: 0 4px 4px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-gold);
  text-decoration: none;
}

.breadcrumb-sep {
  opacity: 0.4;
}

/* ============================================================
   RELATED TOPICS
   ============================================================ */

.related-topics {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.related-topics h4 {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.related-topics ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-topics li {
  margin-bottom: 0.5rem;
  padding: 0;
}

.related-topics li a {
  color: var(--accent-gold);
  font-size: 0.875rem;
}

/* ============================================================
   NAVIGATION ARROWS
   ============================================================ */

.topic-nav {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.topic-nav-link {
  flex: 1;
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s;
  background: var(--bg-card);
}

.topic-nav-link:hover {
  border-color: var(--accent-gold);
  background: var(--bg-hover);
  text-decoration: none;
}

.topic-nav-link.prev { text-align: left; }
.topic-nav-link.next { text-align: right; }

.topic-nav-dir {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.3rem;
}

.topic-nav-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-left: var(--sidebar-width);
}

/* ============================================================
   PROGRESS BAR (reading)
   ============================================================ */

.reading-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 999;
}

.reading-progress-bar {
  height: 100%;
  background: var(--accent-gold);
  width: 0%;
  transition: width 0.1s linear;
}

/* ============================================================
   TABLE OF CONTENTS (on-page)
   ============================================================ */

.toc {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin-bottom: 0.3rem;
}

.toc a {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color 0.15s;
}

.toc a:hover {
  color: var(--accent-gold);
  text-decoration: none;
}

.toc-l2 { padding-left: 1rem; font-size: 0.78rem; }
.toc-l3 { padding-left: 2rem; font-size: 0.74rem; }

/* ============================================================
   MERMAID THEME OVERRIDE
   ============================================================ */

.mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */

@media (max-width: 900px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 850;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .btn-sidebar-toggle {
    display: flex;
  }

  .main-content {
    margin-left: 0;
  }

  .site-footer {
    margin-left: 0;
  }

  .content-area {
    padding: 2rem 1.25rem 4rem;
  }

  .hero h1 { font-size: 2rem; }

  .parts-grid {
    grid-template-columns: 1fr;
  }

  .topic-nav {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.7rem; }
  .hero::before { display: none; }
  .hero-stats { gap: 1.25rem; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.35rem; }

  .header-search-wrap {
    max-width: 160px;
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-mono { font-family: var(--font-mono); }
.text-gold { color: var(--accent-gold); }
.text-red { color: var(--accent-red); }
.text-muted { color: var(--text-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Smooth fade-in for content */
.content-area {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stamp effect for CLASSIFIED/SECRET labels */
.stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border: 2px solid;
  border-radius: 2px;
}

.stamp-red {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

.stamp-gold {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

/* Print styles */
@media print {
  .site-header, .sidebar, .reading-progress, .topic-nav { display: none; }
  .main-content { margin-left: 0; }
  body { background: white; color: black; }
  a { color: black; }
  details { border: 1px solid #ccc; }
  details[open] { border-color: #999; }
}
