/* ==========================================================================
   COSMIC DESIGN SYSTEM & DUAL-THEME TOKENS (DARK & LIGHT)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* Default Dark Mode (Deep Cosmic Void) */
  --space-void: #030712;
  --space-dark: #070b14;
  --space-surface: rgba(13, 20, 36, 0.75);
  --space-surface-border: rgba(0, 242, 254, 0.2);
  --space-surface-hover: rgba(20, 32, 56, 0.9);
  --nav-bg: rgba(3, 7, 18, 0.85);
  --card-bg: rgba(13, 20, 36, 0.7);

  /* Spectral Accents */
  --cyan-beam: #00f2fe;
  --blue-doppler: #4facfe;
  --violet-singularity: #7928ca;
  --gold-pulsar: #ffd700;
  --amber-horizon: #ff5722;
  --quantum-emerald: #00e676;
  --starlight-white: #f8fafc;
  --stellar-dim: #94a3b8;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --grid-line: rgba(255, 255, 255, 0.018);
  --box-shadow-panel: 0 10px 30px rgba(0, 0, 0, 0.5);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Dimensions & Spacing */
  --hud-height: 68px;
  --content-max-width: 1280px;

  --cosmic-hue-shift: 0deg;
  --cosmic-contrast: 1;
}

/* ==========================================================================
   LIGHT THEME: CRISP SCIENTIFIC DAYLIGHT OBSERVATORY
   ========================================================================== */
[data-theme="light"] {
  --space-void: #f8fafc;
  --space-dark: #ffffff;
  --space-surface: rgba(255, 255, 255, 0.94);
  --space-surface-border: rgba(2, 132, 199, 0.22);
  --space-surface-hover: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --card-bg: #ffffff;

  /* Refined High-Contrast Accents for Light Mode */
  --cyan-beam: #0284c7;
  --blue-doppler: #2563eb;
  --violet-singularity: #6d28d9;
  --gold-pulsar: #b45309;
  --amber-horizon: #ea580c;
  --quantum-emerald: #059669;
  --starlight-white: #0f172a;
  --stellar-dim: #475569;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --grid-line: rgba(15, 23, 42, 0.04);
  --box-shadow-panel: 0 10px 30px rgba(15, 23, 42, 0.07);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--space-void);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  position: relative;
  background-color: var(--space-void);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Canvas Background Viewports */
#starfield-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

/* Grid Overlay */
.cosmic-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 30%, rgba(2, 132, 199, 0.03) 0%, transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 100%, 56px 56px, 56px 56px;
  z-index: 1;
}

/* Master Container */
.main-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 28px 80px;
}

@media (max-width: 640px) {
  .main-wrapper {
    padding: 0 14px 60px;
  }
}

/* Global Section Styling */
.cosmic-sector {
  padding: 90px 0 50px;
  position: relative;
  border-bottom: 1px solid var(--space-surface-border);
}

.sector-header {
  margin-bottom: 40px;
  position: relative;
}

.sector-telemetry-tag {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan-beam);
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid var(--space-surface-border);
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  font-weight: 600;
  max-width: 100%;
}

.sector-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.sector-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 780px;
  margin-top: 8px;
  font-weight: 400;
  line-height: 1.55;
}

/* Glassmorphic Panel Primitive */
.glass-panel {
  background: var(--space-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--space-surface-border);
  border-radius: 12px;
  box-shadow: var(--box-shadow-panel);
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Sci-fi Corner Brackets */
.bracket-corner::before,
.bracket-corner::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--cyan-beam);
  pointer-events: none;
}
.bracket-corner::before {
  top: 6px;
  left: 6px;
  border-top: 1.5px solid;
  border-left: 1.5px solid;
}
.bracket-corner::after {
  bottom: 6px;
  right: 6px;
  border-bottom: 1.5px solid;
  border-right: 1.5px solid;
}

/* Standardized Clean Buttons */
.cosmic-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: linear-gradient(135deg, var(--cyan-beam), var(--blue-doppler));
  border: none;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.cosmic-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
  color: #ffffff;
}

.cosmic-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--space-surface);
  border: 1px solid var(--space-surface-border);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cosmic-btn-secondary:hover {
  border-color: var(--cyan-beam);
  color: var(--cyan-beam);
  background: var(--space-surface-hover);
  transform: translateY(-1px);
}

.cosmic-btn-youtube {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #ff0033;
  border: 1px solid #e6002e;
  color: #ffffff !important;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(255, 0, 51, 0.3);
}
.cosmic-btn-youtube:hover {
  background: #e6002e;
  box-shadow: 0 6px 20px rgba(255, 0, 51, 0.5);
  transform: translateY(-2px);
}

/* Warp Flash Overlay */
#warp-jump-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle, rgba(2, 132, 199, 0.35) 0%, var(--space-void) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
}
#warp-jump-overlay.warp-active {
  opacity: 1;
}

/* Universal Modal Dialog */
.cosmic-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.cosmic-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.cosmic-modal-dialog {
  background: var(--space-dark);
  border: 1px solid var(--cyan-beam);
  box-shadow: 0 0 40px rgba(2, 132, 199, 0.35);
  border-radius: 12px;
  width: 100%;
  max-width: 760px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  padding: 32px;
  color: var(--text-main);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.cosmic-modal-overlay.open .cosmic-modal-dialog {
  transform: translateY(0) scale(1);
}
.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 1px solid var(--space-surface-border);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  transition: all 0.2s ease;
}
.modal-close-btn:hover {
  background: rgba(255, 0, 85, 0.15);
  border-color: #ff0055;
  color: #ff0055;
}

/* Modal Content Aesthetics */
.modal-sector-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--cyan-beam);
  margin-bottom: 6px;
  font-weight: 700;
}
.modal-realm-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  color: var(--text-main);
  margin-bottom: 4px;
}
.modal-realm-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.modal-key-eq {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--accent, var(--cyan-beam));
  padding: 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 20px;
}
[data-theme="light"] .modal-key-eq {
  background: rgba(241, 245, 249, 0.8);
}
.eq-header {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.eq-render {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--accent, var(--cyan-beam));
  font-weight: 600;
}
.eq-caption {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.modal-section-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  font-weight: 700;
}
.modal-hypotheses-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.modal-hypotheses-list li {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: flex;
  gap: 10px;
}
.modal-hypotheses-list .bullet {
  color: var(--accent, var(--cyan-beam));
}
.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--space-surface-border);
  padding: 14px;
  border-radius: 8px;
}
[data-theme="light"] .modal-meta-grid {
  background: #f8fafc;
}
.meta-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.meta-val {
  font-size: 0.88rem;
  color: var(--text-main);
  font-weight: 600;
}

/* BibTeX modal styling */
.bibtex-paper-title {
  font-size: 1.15rem;
  font-family: var(--font-display);
  color: var(--text-main);
  margin-bottom: 14px;
}
.bibtex-code-container {
  background: #070c18;
  border: 1px solid var(--space-surface-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 18px;
}
[data-theme="light"] .bibtex-code-container {
  background: #f1f5f9;
}
.bibtex-code-container pre code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #10b981;
  line-height: 1.6;
}
[data-theme="light"] .bibtex-code-container pre code {
  color: #047857;
}
.btn-copy-bibtex {
  padding: 10px 20px;
  background: var(--cyan-beam);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-copy-bibtex:hover {
  background: var(--blue-doppler);
}

/* ==========================================================================
   PROFESSIONAL FOOTER STYLING
   ========================================================================== */
.cosmic-footer {
  position: relative;
  z-index: 2;
  background: var(--space-dark);
  border-top: 1px solid var(--space-surface-border);
  padding: 70px 28px 30px;
  margin-top: 40px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 1.45fr 1.2fr;
  gap: 44px;
  margin-bottom: 48px;
  align-items: start;
}

.footer-col-brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-emblem {
  font-size: 1.4rem;
  color: var(--cyan-beam);
}

.footer-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.footer-tagline {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 440px;
}

.footer-social-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--space-surface);
  border: 1px solid var(--space-surface-border);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.footer-social-btn.youtube:hover {
  background: #ff0033;
  border-color: #ff0033;
  color: #ffffff;
}

.footer-social-btn.linkedin:hover {
  background: #0a66c2;
  border-color: #0a66c2;
  color: #ffffff;
}

.footer-social-btn.phone:hover {
  background: var(--quantum-emerald);
  border-color: var(--quantum-emerald);
  color: #ffffff;
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--cyan-beam);
  margin-bottom: 18px;
  font-weight: 700;
}

.footer-nav-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.footer-nav-col {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.footer-nav-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: normal;
  word-break: break-word;
  transition: all 0.2s ease;
}

.footer-nav-item:hover {
  color: var(--cyan-beam);
  transform: translateX(3px);
}

.nav-idx {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cyan-beam);
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid var(--space-surface-border);
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
  word-break: normal;
  display: inline-block;
  min-width: max-content;
  margin-top: 2px;
}

.nav-name {
  font-weight: 500;
}

.footer-info-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.footer-info-text strong {
  color: var(--text-main);
}

.footer-email-link {
  color: var(--cyan-beam);
  text-decoration: none;
  font-weight: 600;
}

.footer-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid var(--space-surface-border);
  color: var(--cyan-beam);
  padding: 3px 8px;
  border-radius: 4px;
}

.footer-bottom-bar {
  max-width: var(--content-max-width);
  margin: 0 auto;
  border-top: 1px solid var(--space-surface-border);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-scroll-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--space-surface);
  border: 1px solid var(--space-surface-border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-scroll-top:hover {
  border-color: var(--cyan-beam);
  color: var(--cyan-beam);
}

@media (max-width: 1080px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }
  .footer-col-brand {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer-col-brand {
    grid-column: span 1;
  }
  .footer-nav-columns {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .footer-nav-item {
    font-size: 0.76rem;
    white-space: normal;
  }
  .nav-name {
    white-space: normal;
    word-break: break-word;
  }
  .footer-bottom-bar {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }
  .footer-bottom-bar p {
    word-break: break-word;
  }
}

@media (max-width: 420px) {
  .footer-nav-columns {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .footer-social-links {
    flex-direction: column;
    gap: 8px;
  }
}
