:root {
  /* Rich Dark Oceanic Theme */
  --bg: #05080f; 
  --bg-2: #0a0f1d; 
  --panel: rgba(16, 25, 43, 0.4); 
  --panel-soft: rgba(24, 35, 55, 0.6);
  --ink: #f8fafc; 
  --ink-soft: #94a3b8; 
  --line: rgba(255, 255, 255, 0.08); 
  --line-glow: rgba(59, 130, 246, 0.2);
  --accent: #3b82f6; 
  --accent-deep: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.4);
  --accent-green: #10b981; 
  --accent-yellow: #f59e0b;
  --white: #ffffff; 
  --radius: 1.5rem; 
  --radius-sm: 16px;
  
  /* Modern Typography Stack */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif; 
  --font-serif: "Iowan Old Style", Georgia, serif; 
  --font-mono: 'JetBrains Mono', Consolas, monospace;
  
  /* Smooth Shadows & Glass */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --glass-blur: blur(16px);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html { 
  scroll-behavior: smooth; 
  overscroll-behavior-y: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.6);
}

body { 
  margin: 0; 
  color: var(--ink); 
  background: var(--bg); 
  font-family: var(--font-sans); 
  line-height: 1.7; 
  overflow-x: hidden;
  overscroll-behavior-y: none;
  transition: opacity 0.3s ease;
}

body.page-exit {
  opacity: 0 !important;
}

/* Dynamic Animated Background */
body::before { 
  content: ""; 
  position: fixed; 
  top: -20%; left: -10%; right: -10%; height: 140%;
  z-index: -2; 
  background: 
    radial-gradient(circle at 15% 30%, rgba(37, 99, 235, 0.12), transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(16, 185, 129, 0.05), transparent 40%);
  pointer-events: none;
  animation: bg-drift 20s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  0% { transform: scale(1); }
  100% { transform: scale(1.05) translate(2%, 2%); }
}

/* Subtle Grid Overlay */
body::after {
  content: ""; 
  position: fixed; 
  inset: 0; 
  z-index: -1;
  background-image: 
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px), 
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 3rem 3rem; 
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9) 10%, rgba(0,0,0,0.1) 90%); 
  pointer-events: none;
}

a { color: inherit; text-decoration: none; transition: all 0.3s ease; }
.wrap { width: min(calc(100% - 2.5rem), 84rem); margin: 0 auto; }

/* -------------------------------------
   NAVIGATION & TOPBAR (Glassmorphism)
------------------------------------- */
.topbar { 
  position: sticky; 
  top: 0; 
  z-index: 50; 
  background: rgba(5, 8, 15, 0.6); 
  backdrop-filter: var(--glass-blur); 
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line); 
  padding: 0.75rem 0; 
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

.brand-title { 
  display: block; 
  font-family: var(--font-serif); 
  font-size: 1.5rem; 
  color: var(--white); 
  letter-spacing: -0.02em;
}
.brand-sub { 
  display: block; 
  font-size: 0.7rem; 
  letter-spacing: 0.25em; 
  text-transform: uppercase; 
  color: var(--accent); 
  font-family: var(--font-mono); 
  opacity: 0.9;
}

.nav { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 1.5rem; 
  font-size: 0.75rem; 
  letter-spacing: 0.15em; 
  text-transform: uppercase; 
  font-family: var(--font-mono); 
  align-items: center; 
}
.nav a { 
  color: var(--ink-soft); 
  padding: 0.5rem 0; 
  position: relative;
}
.nav a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: right;
}
.nav a:hover, .nav a.is-current { color: var(--white); }
.nav a:hover::after, .nav a.is-current::after { 
  transform: scaleX(1); 
  transform-origin: left; 
}

/* Dropdown styling */
.dropdown { position: relative; display: inline-block; }
.dropbtn { 
  color: var(--ink-soft); 
  padding: 0.5rem 0; 
  border: none; 
  background: none; 
  font-family: var(--font-mono); 
  font-size: 0.75rem; 
  letter-spacing: 0.15em; 
  text-transform: uppercase; 
  cursor: pointer; 
  transition: color 0.3s; 
}
.dropdown:hover .dropbtn { color: var(--white); }

.dropdown-content { 
  display: none; 
  position: absolute; 
  background-color: rgba(10, 15, 29, 0.85); 
  backdrop-filter: blur(20px);
  min-width: 200px; 
  box-shadow: var(--shadow-lg); 
  z-index: 100; 
  border: 1px solid var(--line); 
  border-radius: 12px; 
  overflow: hidden; 
  top: 100%; 
  left: -1rem; 
  padding: 0.5rem;
  animation: fade-in-up 0.2s ease forwards;
}
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-content a { 
  color: var(--ink-soft); 
  padding: 0.75rem 1rem; 
  text-decoration: none; 
  display: block; 
  text-transform: none; 
  font-family: var(--font-sans); 
  letter-spacing: normal; 
  font-size: 0.9rem; 
  border-radius: 6px;
  transition: all 0.2s;
}
.dropdown-content a::after { display: none; }
.dropdown-content a:hover { 
  background-color: rgba(59, 130, 246, 0.15); 
  color: var(--white); 
  padding-left: 1.25rem;
}
.dropdown:hover .dropdown-content { display: block; }

/* -------------------------------------
   HERO SECTION
------------------------------------- */
.hero { 
  padding: 1rem 0 1rem; 
  position: relative; 
  background: radial-gradient(circle at 50% 100%, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  margin-bottom: 1rem;
}
.eyebrow { 
  font-family: var(--font-mono); 
  font-size: 0.85rem; 
  text-transform: uppercase; 
  letter-spacing: 0.25em; 
  color: var(--accent); 
  margin-bottom: 0.75rem; 
  display: inline-block;
  padding: 0.2rem 0.8rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 99px;
}
h1 { 
  margin: 0 0 0.5rem; 
  font-family: var(--font-serif); 
  font-size: clamp(2rem, 4vw, 3rem); 
  font-weight: 400; 
  line-height: 1.05; 
  max-width: 20ch; 
  letter-spacing: -0.03em;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p { 
  max-width: 48rem; 
  margin: 0 0 1.5rem; 
  font-size: 1.15rem; 
  color: var(--ink-soft); 
  line-height: 1.5;
}

/* BUTTONS */
.btn { 
  display: inline-flex; 
  align-items: center; 
  padding: 0.9rem 1.8rem; 
  border-radius: 999px; 
  font-family: var(--font-mono); 
  font-size: 0.85rem; 
  text-transform: uppercase; 
  letter-spacing: 0.15em; 
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1); 
  margin-right: 0.75rem; 
  margin-bottom: 0.75rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { 
  background: var(--accent); 
  color: #fff; 
  border: 1px solid var(--accent); 
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { 
  background: var(--accent-deep); 
  transform: translateY(-3px); 
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-secondary { 
  background: rgba(255, 255, 255, 0.03); 
  color: #fff; 
  border: 1px solid rgba(255, 255, 255, 0.15); 
  backdrop-filter: blur(4px);
}
.btn-secondary:hover { 
  background: rgba(255, 255, 255, 0.1); 
  transform: translateY(-3px); 
  border-color: rgba(255,255,255,0.3);
}

/* -------------------------------------
   MAIN SHELL & SECTIONS (Glass panels)
------------------------------------- */
.main-shell { position: relative; margin-bottom: 6rem; }
.main-inner { 
  background: var(--panel); 
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius); 
  overflow: clip; 
  box-shadow: var(--shadow-lg); 
  border: 1px solid var(--line); 
}

.section { 
  padding: 3rem; 
  border-bottom: 1px solid var(--line); 
  display: flex; 
  flex-wrap: wrap; 
  gap: 3rem; 
  align-items: flex-start; 
}
.section:last-child { border-bottom: none; }
.section-content { flex: 1; min-width: 320px; }

.section-kicker { 
  font-family: var(--font-mono); 
  font-size: 0.8rem; 
  text-transform: uppercase; 
  letter-spacing: 0.2em; 
  color: var(--accent); 
  margin-bottom: 1rem; 
  display: block; 
}
.section h2 { 
  font-family: var(--font-serif); 
  font-size: 2.75rem; 
  margin: 0 0 1.5rem; 
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.section h3 {
  font-family: var(--font-serif); 
  font-size: 2rem; 
  margin: 0 0 1.5rem;
}
.section p { 
  color: var(--ink-soft); 
  font-size: 1.15rem; 
  margin-bottom: 1.5rem; 
  line-height: 1.75; 
}

.section-visual { 
  flex: 1; 
  min-width: 320px; 
  background: rgba(0,0,0,0.4); 
  border: 1px solid var(--line); 
  border-radius: var(--radius-sm); 
  padding: 2.5rem; 
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 20px rgba(0,0,0,0.5);
}
.section-visual::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-glow), transparent);
}
.section-visual img { 
  width: 100%; 
  border-radius: 8px; 
  border: 1px solid var(--line); 
  box-shadow: var(--shadow); 
  margin-bottom: 1rem; 
}

/* -------------------------------------
   CODE BLOCKS & PANELS
------------------------------------- */
.panel-kicker { 
  display: inline-block; 
  font-family: var(--font-mono); 
  font-size: 0.75rem; 
  text-transform: uppercase; 
  letter-spacing: 0.15em; 
  color: var(--accent); 
  padding: 0.3rem 0.8rem; 
  background: rgba(59,130,246,0.15); 
  border-radius: 999px; 
  margin-bottom: 1.5rem; 
  border: 1px solid rgba(59,130,246,0.3);
}

.callout { 
  background: rgba(59,130,246,0.05); 
  border: 1px solid rgba(59,130,246,0.2); 
  padding: 1.75rem; 
  border-radius: 12px; 
  margin-top: 2rem; 
  border-left: 4px solid var(--accent);
}
.callout strong { 
  display: block; 
  font-family: var(--font-mono); 
  font-size: 0.85rem; 
  color: var(--accent); 
  text-transform: uppercase; 
  letter-spacing: 0.15em; 
  margin-bottom: 0.5rem;
}
.callout p { font-size: 1rem; color: var(--ink-soft); margin-bottom: 0; }

pre { 
  background: #030509; 
  padding: 1.5rem; 
  border-radius: 12px; 
  overflow-x: auto; 
  border: 1px solid var(--line); 
  margin-bottom: 1.5rem; 
  font-family: var(--font-mono); 
  font-size: 0.9rem; 
}
code { font-family: var(--font-mono); color: #e2e8f0; }
p code, li code { 
  background: rgba(255,255,255,0.1); 
  padding: 0.2rem 0.4rem; 
  border-radius: 4px; 
}
pre {
  background: #010409 !important;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  margin-bottom: 1.5rem; 
  font-family: var(--font-mono); 
  font-size: 0.9rem; 
  line-height: 1.5;
}
pre code {
  color: #e6edf3;
  text-shadow: none;
}

/* Syntax Highlighting Tokens */
.tok-keyword { color: #38bdf8; font-weight: bold; text-shadow: 0 0 8px rgba(56,189,248,0.4); }
.tok-string { color: #10b981; }
.tok-comment { color: #8b949e; font-style: italic; }
.tok-number { color: #f472b6; }
.tok-function { color: #a78bfa; }

/* -------------------------------------
   GRID & CARDS (Rich Interactions)
------------------------------------- */
.section-block { 
  display: block; 
  padding: 4rem; 
  background: linear-gradient(135deg, rgba(15,23,36,0.85) 0%, rgba(10,15,29,0.95) 100%) !important;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  margin-bottom: 3rem;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.section-block:hover {
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 10px 40px rgba(56, 189, 248, 0.1);
}
.section-block::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.8), transparent);
  opacity: 0.3;
  transition: opacity 0.3s ease;
}
.section-block:hover::before {
  opacity: 1;
}

/* Force scrambled premium headers inside section blocks */
.section-block h2 {
  font-family: var(--font-serif) !important; 
  font-size: 2.5rem !important; 
  margin: 0 0 1rem !important;
  color: #fff;
}
.section-block h2:hover {
  animation: scramble-glitch 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  color: #38bdf8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

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

/* Bento Grid Layout */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(280px, auto);
  gap: 2rem;
}

@media (max-width: 992px) {
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
  .col-span-2 { grid-column: span 2; }
}

@media (max-width: 768px) {
  .bento-grid { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .row-span-2 { grid-row: span 1; }
}

.col-span-2 { grid-column: span 2; }
.row-span-2 { grid-row: span 2; }

/* Image backgrounds inside bento cards */
.bento-bg-img {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.15;
  transition: opacity 0.5s ease, transform 0.5s ease;
  z-index: 0;
  border-radius: var(--radius-sm);
  mask-image: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
}

.panel:hover .bento-bg-img {
  opacity: 0.5;
  transform: scale(1.03);
}

.bento-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.bento-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}


.panel { 
  background: rgba(10, 15, 25, 0.5); 
  backdrop-filter: blur(8px);
  border: 1px solid var(--line); 
  border-radius: var(--radius-sm); 
  padding: 2.5rem; 
  display: flex; 
  flex-direction: column; 
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1); 
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s;
}
.panel:hover { 
  background: rgba(15, 22, 38, 0.7); 
  transform: translateY(-6px); 
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 20px rgba(59,130,246,0.1);
}
.panel:hover::before { opacity: 1; }
.panel h3 { 
  font-family: var(--font-serif); 
  font-size: 1.65rem; 
  margin: 0 0 1rem; 
  position: relative;
  z-index: 1;
}
.panel p { 
  color: var(--ink-soft); 
  font-size: 1rem; 
  margin-bottom: 1.5rem; 
  flex-grow: 1;
  position: relative;
  z-index: 1;
}

/* Status Labels */
.status-label { 
  font-family: var(--font-mono); 
  font-size: 0.7rem; 
  padding: 0.3rem 0.6rem; 
  border-radius: 6px; 
  text-transform: uppercase; 
  letter-spacing: 0.1em; 
  display: inline-flex;
  align-items: center;
  margin-bottom: 1.25rem; 
  width: fit-content;
  position: relative;
  z-index: 1;
}
.status-label::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px;
}
.status-implemented { 
  background: rgba(16, 185, 129, 0.1); 
  color: var(--accent-green); 
  border: 1px solid rgba(16, 185, 129, 0.2); 
}
.status-implemented::before { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.status-partial { 
  background: rgba(245, 158, 11, 0.1); 
  color: var(--accent-yellow); 
  border: 1px solid rgba(245, 158, 11, 0.2); 
}
.status-partial::before { background: var(--accent-yellow); box-shadow: 0 0 8px var(--accent-yellow); }
.status-planned { 
  background: rgba(255, 255, 255, 0.05); 
  color: var(--ink-soft); 
  border: 1px solid rgba(255, 255, 255, 0.1); 
}
.status-planned::before { background: var(--ink-soft); }

/* -------------------------------------
   FOOTER
------------------------------------- */
.footer { 
  border-top: 1px solid var(--line); 
  padding: 4rem 0; 
  text-align: center; 
  font-family: var(--font-mono); 
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.2em; 
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .section { padding: 3rem 2rem; gap: 3rem; }
  .section-block { padding: 3rem 2rem; border-radius: 8px; }
  .hero { padding: 2rem 0 1rem; text-align: center; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); margin: 0 auto 1rem; }
  .hero p { margin: 0 auto 1.5rem; }
  .nav { justify-content: center; }
}

/* -------------------------------------
   JS UX: Animations & Copy to Clipboard
------------------------------------- */
.section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Cascading Text Animation */
.cascade-text {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.cascade-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Lightbox */
.zoomable-img {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.zoomable-img:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 30px rgba(56,189,248,0.2);
}
#lightbox-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(1, 4, 9, 0.9);
  backdrop-filter: blur(5px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}
#lightbox-overlay.active {
  opacity: 1;
  pointer-events: all;
}
#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#lightbox-overlay.active #lightbox-img {
  transform: scale(1);
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink-soft);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.2); color: var(--white); }
.copy-btn.copied { background: rgba(16, 185, 129, 0.2); border-color: var(--accent-green); }

/* -------------------------------------
   JS UX: Table of Contents
------------------------------------- */
.main-shell.has-toc {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}
.toc-sidebar {
  position: sticky;
  top: 100px;
  padding: 2rem;
  border-left: 1px solid var(--line);
}
.toc-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin: 0 0 1.5rem;
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 0.75rem; }
.toc-list a {
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: color 0.2s;
  display: block;
  line-height: 1.4;
}
.toc-list a:hover { color: var(--white); }
.toc-list a.is-active { color: var(--accent); font-weight: 500; }

/* -------------------------------------
   JS UX: Command Palette Search
------------------------------------- */
.nav-search-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 99px;
  padding: 0.4rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-search-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); }
.nav-search-btn kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.search-overlay.is-open { opacity: 1; pointer-events: auto; }

.search-modal {
  width: 100%;
  max-width: 600px;
  background: rgba(10, 15, 29, 0.95);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.2s cubic-bezier(0.25,1,0.5,1);
}
.search-overlay.is-open .search-modal { transform: translateY(0); }

.search-input-wrapper {
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
}
#search-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.1rem;
  font-family: var(--font-sans);
}
#search-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.search-results {
  max-height: 400px;
  overflow-y: auto;
}
.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.2s;
}
.search-result-item:hover, .search-result-item.is-highlighted {
  background: rgba(59, 130, 246, 0.1);
}
.search-result-title { color: var(--white); font-weight: 500; font-size: 1rem; }
.search-result-url { color: var(--accent); font-size: 0.8rem; font-family: var(--font-mono); }
.search-empty { padding: 2rem; text-align: center; color: var(--ink-soft); font-style: italic; }


/* -------------------------------------
   UI/UX Additions (ToC, Copy, Search)
------------------------------------- */

/* Copy Button */
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--brand-cyan);
}
.copy-btn.copied {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

/* Table of Contents */
main.has-toc {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 1024px) {
  main.has-toc {
    grid-template-columns: 1fr;
  }
  .toc-sidebar {
    position: relative !important;
    top: 0 !important;
    margin-top: 2rem;
    max-height: none !important;
    overflow-y: visible !important;
  }
}
.toc-sidebar {
  position: sticky;
  top: 100px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.toc-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--brand-cyan);
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-list li {
  margin-bottom: 0.75rem;
}
.toc-list a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
  display: block;
  line-height: 1.4;
}
.toc-list a:hover, .toc-list a.is-active {
  color: #10b981;
}

/* Search Palette */
.nav-search-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--ink-soft);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  margin-left: 1rem;
}
.nav-search-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--ink);
}
.nav-search-btn kbd {
  background: rgba(0,0,0,0.5);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--ink);
}
.search-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}
.search-overlay.is-open {
  display: flex;
}
.search-modal {
  background: #111;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}
.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  gap: 1rem;
}
.search-input-wrapper input {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 1.1rem;
  font-family: var(--font-sans);
  width: 100%;
  outline: none;
}
.search-results {
  max-height: 400px;
  overflow-y: auto;
}
.search-empty {
  padding: 2rem;
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
}
.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-decoration: none;
  transition: background 0.2s ease;
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover, .search-result-item.is-highlighted {
  background: rgba(16, 185, 129, 0.1);
}
.search-result-title {
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.search-result-url {
  color: var(--brand-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}


/* -------------------------------------
   Print Stylesheet
------------------------------------- */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .topbar, .toc-sidebar, .copy-btn, .nav-search-btn, .search-overlay {
    display: none !important;
  }
  main.has-toc {
    display: block !important;
  }
  main.main-shell {
    margin-top: 0 !important;
    padding: 0 !important;
  }
  .section {
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
    background: none !important;
    box-shadow: none !important;
  }
  pre, code {
    background: #f4f4f4 !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
  }
  .hero {
    page-break-after: always;
  }
}

/* Terminal Glitch Transition */
.terminal-glitch {
  animation: glitch-anim 0.2s linear infinite;
  background-color: #000 !important;
  color: #0f0 !important;
  filter: invert(1) hue-rotate(180deg);
}
@keyframes glitch-anim {
  0% { transform: translate(0) }
  20% { transform: translate(-5px, 5px) }
  40% { transform: translate(-5px, -5px) }
  60% { transform: translate(5px, 5px) }
  80% { transform: translate(5px, -5px) }
  100% { transform: translate(0) }
}

/* -------------------------------------
   Homepage Redesign Animations & Interactions
------------------------------------- */

/* Hero Animations */
.hero-animated {
  position: relative;
  overflow: hidden;
  padding-top: 8rem;
  padding-bottom: 8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-content {
  position: relative;
  z-index: 10;
}

/* Glowing Orbs Background */
.hero-bg-orbs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: floatOrb 15s ease-in-out infinite alternate;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: rgba(59, 130, 246, 0.2);
  top: -10%;
  left: -10%;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: rgba(16, 185, 129, 0.15);
  bottom: 10%;
  right: -5%;
  animation-delay: -5s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: rgba(139, 92, 246, 0.15);
  top: 40%;
  left: 40%;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(100px, 50px) scale(1.1); }
}

/* Typing Effect */
.typing-wrapper {
  display: inline-flex;
  align-items: center;
  height: 2rem;
}

.typing-text {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: blink-caret .75s step-end infinite;
  display: inline-block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--accent); }
}

/* Stagger Fade Up */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Magnetic / Premium Hover States for Panels */
.panel {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.panel:hover, .bento-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.omega-panel-hover:hover {
  box-shadow: 0 10px 40px rgba(59, 130, 246, 0.2) !important;
  border-color: rgba(59, 130, 246, 0.5) !important;
}
.omega-panel-hover:hover .hover-scale-icon {
  transform: scale(1.1);
}

.beta-panel-hover:hover {
  box-shadow: 0 10px 40px rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}


/* -------------------------------------
   Phase 3: Ocean Ecosystem & Advanced FX
------------------------------------- */

/* Dark Abyssal Background Override for Homepage */
html {
  background-color: #030712 !important; /* Extremely dark blue */
}
body {
  background-color: transparent !important; 
}

/* Scroll Progress Bar */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--brand-cyan);
  box-shadow: 0 0 10px var(--brand-cyan);
  z-index: 10000;
  width: 0%;
  transition: width 0.1s ease;
}

/* Cursor Spotlight Hover Effect */
.panel {
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    800px circle at var(--mouse-x) var(--mouse-y), 
    rgba(255, 255, 255, 0.04),
    transparent 40%
  );
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.panel:hover::before {
  opacity: 1;
}

/* Ensure content stays above spotlight */
.panel > * {
  z-index: 1;
}

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

/* Specific animations generated by JS */

/* Sonar Ping Animation */
.sonar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sonar-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(59, 130, 246, 0.5);
  animation: sonarPing 3s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  opacity: 0;
}

.sonar-2 { animation-delay: 1s; }
.sonar-3 { animation-delay: 2s; }

@keyframes sonarPing {
  0% { transform: scale(1); opacity: 0.8; border-width: 4px; }
  100% { transform: scale(2.5); opacity: 0; border-width: 1px; }
}

/* Glitch Hover Effect for BETA Cards */
.glitch-hover {
  position: relative;
}

.glitch-hover::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(16, 185, 129, 0.05) 0px,
    rgba(16, 185, 129, 0.05) 1px,
    transparent 1px,
    transparent 2px
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.glitch-hover:hover::before {
  opacity: 1;
  animation: staticGlitch 0.2s steps(2) infinite;
}

@keyframes staticGlitch {
  0% { transform: translateY(0); }
  50% { transform: translateY(2px); }
  100% { transform: translateY(-2px); }
}


/* Ocean Ecosystem Particle System */
#ocean-ecosystem {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1; /* Behind everything */
  overflow: hidden;
}

.ocean-particle {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.fish {
  animation: swimUpDown 6s ease-in-out infinite alternate;
}

.fish .fish-tail {
  transform-origin: 75px 20px;
  animation: tailWiggle 0.4s linear infinite alternate;
}

@keyframes swimUpDown {
  0% { margin-top: -10px; }
  100% { margin-top: 10px; }
}

@keyframes tailWiggle {
  0% { transform: rotate(-15deg); }
  100% { transform: rotate(15deg); }
}

/* -------------------------------------
   12. SITE-WIDE UPGRADES (MERMAID & PROGRESS BAR)
------------------------------------- */

/* Reading Progress Bar */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: #38bdf8;
  z-index: 9999;
  width: 0%;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px #38bdf8;
  pointer-events: none;
}

/* Ambient Inner-Page Canvas */
#ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1;
  opacity: 0.15;
}

/* Mermaid Diagram Overrides */
.mermaid {
  background: rgba(3, 7, 18, 0.4);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}
.mermaid svg {
  max-width: 100%;
  height: auto;
}
/* Force neon text/lines on mermaid elements */
.mermaid .node rect, .mermaid .node circle, .mermaid .node ellipse, .mermaid .node polygon, .mermaid .node path {
  fill: rgba(3, 7, 18, 0.8) !important;
  stroke: #38bdf8 !important;
  stroke-width: 2px !important;
  transition: all 0.3s ease;
}
.mermaid .node:hover rect, .mermaid .node:hover circle, .mermaid .node:hover ellipse, .mermaid .node:hover polygon, .mermaid .node:hover path {
  fill: rgba(56, 189, 248, 0.2) !important;
  stroke: #fff !important;
  box-shadow: 0 0 15px #38bdf8 !important;
}
.mermaid .edgePath .path {
  stroke: rgba(56, 189, 248, 0.6) !important;
  stroke-width: 2px !important;
}
.mermaid .edgeLabel {
  background-color: rgba(3, 7, 18, 0.9) !important;
  color: #60a5fa !important;
  font-family: var(--font-mono) !important;
  font-size: 0.8rem !important;
}
.mermaid .cluster rect {
  fill: rgba(255,255,255,0.02) !important;
  stroke: rgba(255,255,255,0.1) !important;
}


/* Dropdown Accessibility */
.dropdown:focus-within .dropdown-content,
.dropdown.open .dropdown-content {
  display: block;
}

/* Accessibility Additions */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav a, .dropbtn {
  min-height: 44px;
  padding: 0.6rem 0.75rem;
}
.btn-primary {
  background: #2563eb !important;
}
