/* ===================================================================
   Master Thesis Webpage - Design System & Stylesheet
   Author: Sean Pribadi (Pusan National University - AI Convergence)
   Topic: Ultra-Low SNR LoRa Receiver Pipeline with Machine Learning
   =================================================================== */

:root {
  /* Color Palette - Modern Academic Dark Mode (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2234;
  --bg-card: rgba(22, 30, 49, 0.75);
  --bg-card-hover: rgba(28, 38, 62, 0.9);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);
  --border-glow: rgba(16, 185, 129, 0.3);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b0f19;

  /* Accent & Functional Colors */
  --accent-cyan: #38bdf8;
  --accent-teal: #14b8a6;
  --accent-emerald: #10b981;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #38bdf8 0%, #10b981 100%);
  --grad-accent: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --grad-dark: linear-gradient(180deg, #0b0f19 0%, #111827 100%);
  --grad-card: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-glow-cyan: 0 0 25px rgba(56, 189, 248, 0.25);
  --shadow-glow-emerald: 0 0 25px rgba(16, 185, 129, 0.25);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Layout */
  --max-w-content: 1240px;
  --header-h: 72px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-subtle: rgba(0, 0, 0, 0.09);
  --border-focus: rgba(14, 165, 233, 0.6);
  --border-glow: rgba(16, 185, 129, 0.25);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow-cyan: 0 0 20px rgba(14, 165, 233, 0.15);
  --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.15);

  --grad-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(241, 245, 249, 0.85));
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.68;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.25;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--accent-emerald);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
}

/* Glassmorphism utility */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-w-content);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Reading Progress Bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--grad-primary);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease-out;
}

/* Header & Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 900;
  transition: var(--transition);
}

.site-header.scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b0f19;
  font-weight: 900;
  font-size: 1.1rem;
  box-shadow: var(--shadow-glow-cyan);
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  position: relative;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0.6rem;
  right: 0.6rem;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: var(--radius-full);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Control Buttons */
.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--grad-primary);
  color: #0b0f19;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
  color: #0b0f19;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-outline:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent-cyan);
}

.menu-toggle {
  display: none;
}

/* Hero Section */
.hero-section {
  position: relative;
  padding: calc(var(--header-h) + 4rem) 0 4.5rem 0;
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, rgba(56, 189, 248, 0.12) 0%, transparent 60%),
              radial-gradient(circle at 80% 60%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
}

.hero-badge-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.badge-cyan {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  line-height: 1.18;
}

.text-gradient {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.hero-author-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 2.25rem;
  width: fit-content;
  flex-wrap: wrap;
}

.author-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--grad-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.author-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.author-role {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.author-divider {
  width: 1px;
  height: 36px;
  background: var(--border-subtle);
}

.pnu-logo-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
}

/* Metric Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--grad-primary);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Page Layout: Sticky TOC + Main Article */
.layout-wrapper {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.75rem;
  padding: 3rem 0 6rem 0;
}

/* Sidebar TOC */
.sidebar-toc {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  height: fit-content;
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.toc-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toc-item a {
  display: block;
  font-size: 0.84rem;
  color: var(--text-secondary);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  line-height: 1.35;
}

.toc-item a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.toc-item.active a {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  font-weight: 600;
  border-left: 3px solid var(--accent-cyan);
}

/* Content Sections */
.content-body {
  min-width: 0; /* Prevents overflow in grid child */
}

.article-section {
  margin-bottom: 4.5rem;
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.section-heading {
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-intro {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

/* Interactive Tabs */
.tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-cyan);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Cards & Grid Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 1.75rem 0;
}

/* Figure / Image Display Container */
.figure-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.figure-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.figure-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

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

.figure-img-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #080c14;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.figure-img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  transition: transform 0.3s ease;
  display: block;
}

.figure-img-wrap:hover .figure-img {
  transform: scale(1.015);
}

.img-zoom-hint {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border-subtle);
  pointer-events: none;
}

.figure-caption {
  margin-top: 1.15rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
}

.figure-caption strong {
  color: var(--text-primary);
}

/* Callout Box / Note */
.callout {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  border-left: 4px solid;
  background: var(--bg-tertiary);
}

.callout-info {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.06);
}

.callout-warning {
  border-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.06);
}

.callout-success {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.06);
}

.callout-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Interactive SNR Simulator */
.snr-simulator {
  background: var(--grad-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
}

.sim-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.sim-control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.sim-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
  -webkit-appearance: none;
}

.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-cyan);
}

.sim-canvas-wrap {
  width: 100%;
  height: 160px;
  background: #080c14;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  position: relative;
}

#chirp-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sim-readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sim-status {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.78rem;
}
.status-normal { background: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); }
.status-limit { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.status-ultralow { background: rgba(244, 63, 94, 0.2); color: var(--accent-rose); }

/* Comparison Table */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
  background: var(--bg-card);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.custom-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 700;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.custom-table td {
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.custom-table .highlight-row td {
  background: rgba(56, 189, 248, 0.08);
  font-weight: 600;
  color: var(--text-primary);
}

/* Offsets Feature Cards */
.offset-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  position: relative;
  transition: var(--transition);
}

.offset-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.offset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.offset-title {
  font-size: 1.1rem;
  font-weight: 700;
}

/* ===================================================================
   Native Academic Mathematical Typography System
   Crisp, Publication-Grade Rendering (No external dependencies needed)
   =================================================================== */

.equation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.equation-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.12);
}

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

.equation-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.equation-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.equation-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  font-family: 'Cambria Math', 'Latin Modern Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 1.32rem;
  color: var(--text-primary);
  flex-wrap: wrap;
  gap: 0.35rem;
  user-select: all;
  overflow-x: auto;
}

.equation-body.compact {
  font-size: 1.15rem;
  padding: 0.5rem 0;
}

/* Math Components */
.math-var {
  font-style: italic;
  font-family: 'Cambria Math', 'Latin Modern Math', 'Times New Roman', serif;
  color: var(--text-primary);
}

.math-func {
  font-style: normal;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  margin: 0 0.15rem;
}

.math-op {
  font-style: normal;
  margin: 0 0.45rem;
  color: var(--accent-cyan);
  font-weight: 400;
}

.math-sub {
  font-size: 0.72em;
  vertical-align: sub;
  font-style: normal;
  font-family: var(--font-sans);
  margin-left: 0.05rem;
}

.math-sup {
  font-size: 0.72em;
  vertical-align: super;
  font-style: normal;
  font-family: var(--font-sans);
  margin-left: 0.05rem;
}

.math-paren {
  font-size: 1.35em;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1;
}

.math-bracket {
  font-size: 1.4em;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1;
}

/* Vertical Fractions */
.math-frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 0.35rem;
  margin: 0 0.2rem;
}

.math-num {
  padding-bottom: 0.2rem;
  border-bottom: 1.8px solid var(--text-primary);
  line-height: 1.2;
}

.math-den {
  padding-top: 0.2rem;
  line-height: 1.2;
}

/* Big Integral & Greek Symbol accents */
.math-symbol {
  font-size: 1.45em;
  vertical-align: -0.18em;
  color: var(--accent-emerald);
  margin: 0 0.15rem;
}

.math-integral {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin: 0 0.3rem;
}

.math-integral .int-sym {
  font-size: 1.75em;
  color: var(--accent-purple);
  line-height: 1;
  vertical-align: -0.2em;
}

.math-integral .int-bounds {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.65em;
  margin-left: -0.15rem;
  height: 2.2em;
  font-family: var(--font-mono);
}

.equation-legend {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.equation-legend strong {
  color: var(--text-secondary);
}

/* Inline Mathematical Badges and Highlights */
.math-inline {
  display: inline-flex;
  align-items: center;
  font-family: 'Cambria Math', 'STIX Two Math', 'Times New Roman', serif;
  font-size: 1.05em;
  color: var(--accent-cyan);
  padding: 0.05rem 0.35rem;
  background: rgba(56, 189, 248, 0.08);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.2);
  margin: 0 0.15rem;
  white-space: nowrap;
}

[data-theme="light"] .math-inline {
  color: #0369a1;
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.25);
}

/* SOTA Matrix Cards */
.sota-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
}

.sota-card.this-work {
  border: 2px solid var(--accent-cyan);
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.08), rgba(16, 185, 129, 0.08));
  box-shadow: var(--shadow-glow-cyan);
}

.sota-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sota-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.sota-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.sota-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

/* Bibliography & References */
.ref-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ref-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 0.86rem;
  line-height: 1.6;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: var(--transition);
}

.ref-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.ref-number {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 28px;
}

.ref-text {
  flex: 1;
}

.ref-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.ref-btn:hover {
  color: var(--accent-cyan);
  background: var(--bg-tertiary);
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 9, 15, 0.94);
  backdrop-filter: blur(16px);
  z-index: 2000;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox-modal.active {
  display: flex;
  opacity: 1;
}

.lightbox-toolbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(11, 15, 25, 0.8);
}

.lightbox-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: grab;
}

.lightbox-body:active {
  cursor: grabbing;
}

.lightbox-img {
  max-width: 95%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transition: transform 0.15s ease-out;
  transform-origin: center center;
  box-shadow: var(--shadow-lg);
}

/* Citation Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.bibtex-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 1.25rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--accent-emerald);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 0 2rem 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-heading {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

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

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.footer-links a:hover {
  color: var(--accent-cyan);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .layout-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar-toc {
    display: none;
  }

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

@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    display: none;
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.mobile-open {
    display: flex;
  }

  .menu-toggle {
    display: flex;
  }

  .sim-controls {
    grid-template-columns: 1fr;
  }

  .hero-author-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .author-divider {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
