/* ==========================================================================
   PHANTOMKERNEL RESEARCH BLOG DESIGN SYSTEM
   lulztigre.pw — Stealth brutalist research terminal for systems, circuits & crypto
   ========================================================================== */

:root {
  /* Default: Phantom Void (Stealth Kernel Dark) */
  --bg-primary: #07090b;
  --bg-surface: #0e1115;
  --bg-elevated: #161b22;
  --bg-card: #111419;
  --bg-invert: #f0f6fc;
  
  --text-primary: #e6edf3;
  --text-secondary: #9da7b3;
  --text-muted: #656d76;
  --text-invert: #07090b;
  
  --border-color: #30363d;
  --border-light: #21262d;
  --border-highlight: #58a6ff;
  --border-width: 1.5px;
  --border-thick: 3px;
  
  /* Phantom Kernel Accents */
  --accent-primary: #00ff88;    /* Phosphor Emerald */
  --accent-secondary: #38bdf8;  /* Ice Cyan */
  --accent-amber: #ffb400;      /* Core Amber */
  --accent-glow: rgba(0, 255, 136, 0.15);
  --accent-tag-bg: #161b22;
  --accent-tag-text: #7ee787;

  --shadow-sm: 2px 2px 0px #000000;
  --shadow-md: 4px 4px 0px #000000;
  --shadow-lg: 7px 7px 0px #000000;
  --shadow-hover: 5px 5px 0px #000000;
  --shadow-active: 1px 1px 0px #000000;
  --shadow-emerald: 4px 4px 0px #00ff88;
  
  --font-mono: 'Space Mono', 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Newsreader', Georgia, serif;
  
  --header-height: 60px;
  --container-max: 1160px;
  --reading-max: 780px;
}

/* Phosphor Amber Terminal Mode */
[data-theme="amber"] {
  --bg-primary: #0c0a04;
  --bg-surface: #171207;
  --bg-elevated: #241d0c;
  --bg-card: #1b1609;
  --bg-invert: #ffb700;
  
  --text-primary: #ffc42e;
  --text-secondary: #cca02c;
  --text-muted: #8c6f20;
  --text-invert: #0c0a04;
  
  --border-color: #5c4714;
  --border-light: #3d2f0d;
  --border-highlight: #ffb700;
  
  --accent-primary: #ffb700;
  --accent-secondary: #ff8800;
  --accent-amber: #ffe680;
  --accent-glow: rgba(255, 183, 0, 0.18);
  --accent-tag-bg: #241d0c;
  --accent-tag-text: #ffc42e;

  --shadow-sm: 2px 2px 0px #000000;
  --shadow-md: 4px 4px 0px #000000;
  --shadow-lg: 7px 7px 0px #000000;
  --shadow-hover: 5px 5px 0px #000000;
  --shadow-active: 1px 1px 0px #000000;
  --shadow-emerald: 4px 4px 0px #ffb700;
}

/* Ghost Paper Light Mode */
[data-theme="ghost"] {
  --bg-primary: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-elevated: #e4e7eb;
  --bg-card: #ffffff;
  --bg-invert: #08090a;
  
  --text-primary: #0d1117;
  --text-secondary: #343a40;
  --text-muted: #57606a;
  --text-invert: #f0f6fc;
  
  --border-color: #0d1117;
  --border-light: #d0d7de;
  --border-highlight: #0969da;
  
  --accent-primary: #058241;
  --accent-secondary: #0969da;
  --accent-amber: #b25000;
  --accent-glow: rgba(5, 130, 65, 0.12);
  --accent-tag-bg: #e4e7eb;
  --accent-tag-text: #058241;

  --shadow-sm: 2px 2px 0px #0d1117;
  --shadow-md: 4px 4px 0px #0d1117;
  --shadow-lg: 7px 7px 0px #0d1117;
  --shadow-hover: 5px 5px 0px #0d1117;
  --shadow-active: 1px 1px 0px #0d1117;
  --shadow-emerald: 4px 4px 0px #058241;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.15s ease, color 0.15s ease;
  background-image: radial-gradient(var(--border-light) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Selection */
::selection {
  background-color: var(--accent-primary);
  color: #000000;
}

/* Reading Progress Bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
  width: 0%;
  z-index: 1000;
  transition: width 0.05s linear;
}

/* Utility Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-reading {
  width: 100%;
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Top Telemetry / Status Ticker */
.system-ticker {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.4rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.ticker-left, .ticker-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-primary);
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-primary);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Header & Navigation */
header.site-header {
  border-bottom: var(--border-thick) solid var(--border-color);
  background: rgba(14, 17, 21, 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 900;
}

[data-theme="ghost"] header.site-header {
  background: rgba(255, 255, 255, 0.95);
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  min-height: var(--header-height);
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  padding: 0.5rem 1rem;
  border-right: 1px solid var(--border-color);
  transition: all 0.1s ease;
}

.site-brand:hover {
  background: var(--bg-elevated);
  color: var(--accent-primary);
}

.brand-badge {
  background: var(--accent-primary);
  color: #000000;
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  display: flex;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-secondary);
  border-left: 1px solid var(--border-color);
  transition: all 0.1s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-link.active {
  color: var(--accent-primary);
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--accent-primary);
}

.nav-controls {
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--border-color);
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  padding: 0 1rem;
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.1s, color 0.1s;
}

.theme-toggle-btn:hover {
  background: var(--bg-elevated);
  color: var(--accent-primary);
}

.mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-color);
  padding: 0 1rem;
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1.2rem;
}

/* Phantom Hero Section */
.hero-section {
  padding: 3.5rem 0 2.75rem;
  border-bottom: var(--border-thick) solid var(--border-color);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}

.hero-section::after {
  content: "SYS_KERNEL_INIT";
  position: absolute;
  right: 2%;
  bottom: -15px;
  font-family: var(--font-mono);
  font-size: 5rem;
  font-weight: 900;
  color: var(--border-light);
  opacity: 0.35;
  pointer-events: none;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2.5rem;
  align-items: start;
  position: relative;
  z-index: 2;
}

.hero-title-area {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.research-tagline {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-heading {
  font-size: clamp(2.3rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.6;
}

.hero-meta-box {
  border: var(--border-width) solid var(--border-color);
  background: var(--bg-card);
  padding: 1.35rem;
  box-shadow: var(--shadow-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  position: relative;
}

.hero-meta-box::before {
  content: "TELEMETRY";
  position: absolute;
  top: -9px;
  left: 14px;
  background: var(--bg-card);
  padding: 0 6px;
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--accent-primary);
  border: 1px solid var(--border-color);
}

.hero-meta-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  font-weight: 900;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  color: var(--text-primary);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border-light);
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-key {
  color: var(--text-muted);
  font-weight: 600;
}

.meta-val {
  font-weight: 700;
  color: var(--text-primary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Brutalist Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: var(--border-width) solid var(--border-color);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.08s ease, color 0.08s ease;
  user-select: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #000000;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 900;
}

.btn-primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
  background: #26ff98;
}

.btn-primary:active {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-active);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
  background: var(--bg-elevated);
  border-color: var(--text-primary);
}

.btn-secondary:active {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-active);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
}

/* Controls & Search */
.feed-controls {
  padding: 1.25rem 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

.feed-controls-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.tag-btn {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.1s ease;
}

.tag-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.tag-btn.active {
  background: var(--accent-primary);
  color: #000000;
  border-color: var(--accent-primary);
  font-weight: 900;
}

.search-input-box {
  position: relative;
  min-width: 280px;
  flex-grow: 1;
  max-width: 380px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 2.2rem 0.5rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.search-kbd-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Post Listings */
.posts-section {
  padding: 2.5rem 0 4rem;
  flex-grow: 1;
}

.section-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: var(--border-thick) solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title span {
  color: var(--accent-primary);
}

.posts-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.posts-feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Research Post Card */
.post-card {
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 1.6rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
}

.post-id-badge {
  background: var(--bg-elevated);
  color: var(--accent-primary);
  font-weight: 900;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border-color);
}

.post-card-title {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.post-card-title a {
  text-decoration: none;
  color: var(--text-primary);
  display: inline-block;
  transition: color 0.1s ease;
}

.post-card-title a:hover {
  color: var(--accent-primary);
}

.post-abstract {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.post-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-light);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent-tag-bg);
  color: var(--accent-tag-text);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border-color);
  text-transform: uppercase;
}

.post-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  display: none;
  padding: 3.5rem 1.5rem;
  text-align: center;
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--shadow-md);
  font-family: var(--font-mono);
}

.empty-state h3 {
  font-size: 1.15rem;
  color: var(--accent-amber);
  margin-bottom: 0.5rem;
}

/* Article / Post Page Styles */
.article-header {
  padding: 3.5rem 0 2rem;
  border-bottom: var(--border-thick) solid var(--border-color);
  background: var(--bg-surface);
}

.article-breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.article-breadcrumbs a {
  color: var(--text-secondary);
  font-weight: 700;
  text-decoration: none;
}

.article-breadcrumbs a:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.article-title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 1.5rem;
}

.article-meta-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 600;
}

/* Article Layout & Typography */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 3rem;
  padding: 3rem 0 5rem;
  align-items: start;
}

.prose {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.prose p {
  margin-bottom: 1.5rem;
}

.prose h2 {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 2.75rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border-color);
  text-transform: uppercase;
}

.prose h3 {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 800;
  margin: 2rem 0 0.75rem;
}

.prose ul, .prose ol {
  margin: 0 0 1.5rem 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose blockquote {
  border-left: 3px solid var(--accent-primary);
  background: var(--bg-elevated);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.35rem;
  color: var(--accent-primary);
}

.prose pre {
  margin: 1.75rem 0;
  background: #06080a;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow-x: auto;
}

.prose pre code {
  display: block;
  padding: 1.25rem;
  background: transparent;
  border: none;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #c9d1d9;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.copy-code-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  transition: all 0.1s;
}

.copy-code-btn:hover {
  background: var(--accent-primary);
  color: #000000;
}

/* Callouts / Academic Theorems */
.callout {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  margin: 2rem 0;
  font-family: var(--font-sans);
}

.callout-header {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.callout-theorem {
  border-left: 5px solid var(--accent-primary);
}

.callout-definition {
  border-left: 5px solid var(--accent-secondary);
}

.callout-remark {
  border-left: 5px solid var(--accent-amber);
}

/* Table of Contents Sticky Sidebar */
.article-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.toc-link {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 0.2rem 0 0.2rem 0.5rem;
  border-left: 2px solid transparent;
  transition: all 0.1s ease;
}

.toc-link:hover {
  color: var(--text-primary);
}

.toc-link.active {
  color: var(--accent-primary);
  font-weight: 700;
  border-left-color: var(--accent-primary);
  background: var(--bg-elevated);
}

/* BibTeX Citation Box */
.citation-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  margin-top: 3rem;
}

.citation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.citation-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-primary);
}

.bibtex-code {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-secondary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-elevated);
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
}

.modal-close-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 900;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
}

.modal-close-btn:hover {
  background: var(--accent-primary);
  color: #000;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--accent-primary);
  box-shadow: var(--shadow-emerald);
  padding: 0.65rem 1.15rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastSlide 0.2s ease;
}

@keyframes toastSlide {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Footer */
footer.site-footer {
  border-top: var(--border-thick) solid var(--border-color);
  background: var(--bg-surface);
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  padding: 2.5rem 0;
}

.footer-col h4 {
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.1s;
}

.footer-links a:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding: 1rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Math Display */
.math-display {
  overflow-x: auto;
  padding: 1rem 0;
  text-align: center;
  margin: 1.5rem 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
    align-items: center;
  }
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    flex-direction: column;
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-link {
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
  }
  .feed-controls-grid {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-box {
    max-width: 100%;
  }
}
