/* ============================================
   EE Formula Hub — Design System & Styles
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-primary: #0a0e27;
  --bg-secondary: #0f1538;
  --bg-card: #111a42;
  --bg-card-hover: #162050;
  --surface: #1a2255;
  --neon-cyan: #00f0ff;
  --neon-green: #39ff14;
  --neon-purple: #bc13fe;
  --neon-orange: #ff6b2b;
  --neon-pink: #ff2d95;
  --neon-yellow: #ffe600;
  --electric-yellow: #facc15;
  --neon-blue: #4da6ff;
  --text-primary: #e8eaf6;
  --text-secondary: #9fa8da;
  --text-muted: #5c6bc0;
  --border: rgba(0, 240, 255, 0.12);
  --glow-cyan: 0 0 15px rgba(0, 240, 255, 0.5), 0 0 40px rgba(0, 240, 255, 0.15);
  --glow-green: 0 0 15px rgba(57, 255, 20, 0.5), 0 0 40px rgba(57, 255, 20, 0.15);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-head: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
  --nav-height: 70px;

  /* Category colors */
  --cat-circuit: #4da6ff;
  --cat-machines: #ff6b2b;
  --cat-measurements: #00e5a0;
  --cat-power: #ffe600;
  --cat-control: #ffab40;
  --cat-electronics: #ff5252;
  --cat-signals: #bc13fe;
  --cat-micro: #e040fb;
  --cat-estimation: #69f0ae;
}

/* ---------- Light Mode ---------- */
body.light-mode {
  --bg-primary: #f0f2f8;
  --bg-secondary: #e3e7f2;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f7ff;
  --surface: #dce1f0;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #7878a0;
  --border: rgba(0, 100, 180, 0.15);
  --neon-cyan: #0088aa;
  --neon-green: #00a010;
  --glow-cyan: 0 0 10px rgba(0, 136, 170, 0.25);
  --glow-green: 0 0 10px rgba(0, 160, 16, 0.25);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

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

/* ---------- Circuit Board Background ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--neon-cyan) 1px, transparent 1px),
    linear-gradient(90deg, var(--neon-cyan) 1px, transparent 1px),
    radial-gradient(circle 2px, var(--neon-cyan) 1px, transparent 1px);
  background-size: 60px 60px, 60px 60px, 60px 60px;
  background-position: 0 0, 0 0, 30px 30px;
}

/* ---------- Loading Screen ---------- */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#loading-screen svg {
  width: 180px;
  height: 180px;
}

#loading-screen .circuit-path {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 2;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: drawCircuit 2s ease forwards;
  filter: drop-shadow(0 0 6px var(--neon-cyan));
}

#loading-screen p {
  font-family: var(--font-head);
  color: var(--neon-cyan);
  margin-top: 24px;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: pulseFade 1.5s ease infinite;
}

@keyframes drawCircuit {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes pulseFade {

  0%,
  100% {
    opacity: 0.4;
  }

  50% {
    opacity: 1;
  }
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--nav-height);
  height: auto;
  padding: 10px 32px;
  background: rgba(10, 14, 39, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: background var(--transition);
}

body.light-mode .navbar {
  background: rgba(240, 242, 248, 0.92);
}

.navbar__logo {
  font-family: var(--font-head);
  font-size: 1.2rem;
  color: var(--neon-cyan);
  text-decoration: none;
  letter-spacing: 2px;
  text-shadow: var(--glow-cyan);
  white-space: nowrap;
  margin-right: 24px;
}

.navbar__links {
  display: flex;
  list-style: none;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  overflow: visible;
  flex: 1;
}

.navbar__links::-webkit-scrollbar {
  display: none;
}

.navbar__links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 8px 12px;
  white-space: nowrap;
  border-radius: 6px;
  position: relative;
  transition: color var(--transition);
}

.navbar__links a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  transition: width 0.35s ease, left 0.35s ease;
}

.navbar__links a:hover {
  color: var(--neon-cyan);
}

.navbar__links a:hover::after,
.navbar__links a.active::after {
  width: 70%;
  left: 15%;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

/* Search Box */
.search-box {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width var(--transition), border-color var(--transition), box-shadow var(--transition);
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}

.search-box:hover,
.search-box:focus-within {
  width: 220px;
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.search-box input {
  width: 100%;
  height: 100%;
  padding: 6px 12px 6px 42px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  cursor: text;
}

.search-box:hover input,
.search-box:focus-within input {
  opacity: 1;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neon-cyan);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
}

.theme-toggle:hover {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

/* Mobile Menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--neon-cyan);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: flex;
  }

  .navbar__links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
  }

  .navbar__links.open {
    display: flex;
  }

  .search-box:hover,
  .search-box:focus-within {
    width: 180px;
    /* Slightly smaller on mobile */
  }
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  overflow: hidden;
}

.hero__lightning {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120px;
  pointer-events: none;
}

.hero__lightning path {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 2.5;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: lightningDraw 2s ease forwards 0.5s;
  filter: drop-shadow(0 0 12px var(--neon-cyan)) drop-shadow(0 0 25px rgba(0, 240, 255, 0.3));
}

@keyframes lightningDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.hero__title {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 5.5vw, 4.5rem);
  color: var(--text-primary);
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.hero__title span {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.hero__author {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1.5vw, 1.05rem);
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 24px;
  opacity: 0.85;
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--text-secondary);
  margin-bottom: 40px;
  min-height: 2rem;
  font-weight: 300;
}

.hero__subtitle .cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--neon-cyan);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  background: transparent;
  border: 2px solid var(--neon-cyan);
  border-radius: 50px;
  color: var(--neon-cyan);
  font-family: var(--font-head);
  font-size: 1rem;
  letter-spacing: 2px;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.hero__cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--neon-cyan);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.hero__cta:hover {
  color: var(--bg-primary);
  box-shadow: var(--glow-cyan);
}

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

/* Formula Ticker */
.ticker {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  background: rgba(0, 240, 255, 0.04);
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.ticker__track {
  display: flex;
  gap: 60px;
  white-space: nowrap;
  animation: tickerScroll 45s linear infinite;
  will-change: transform;
}

.ticker__track span {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

@keyframes tickerScroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

/* ---------- Section Styles ---------- */
.section {
  position: relative;
  padding: 100px 24px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.section__header {
  text-align: center;
  margin-bottom: 60px;
}

.section__header h2 {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
}

.section__header h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  border-radius: 2px;
}

.section__header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 20px auto 0;
}

/* Category-specific heading colors */
.section[data-category="circuit"] .section__header h2 {
  color: var(--cat-circuit);
}

.section[data-category="circuit"] .section__header h2::after {
  background: var(--cat-circuit);
}

.section[data-category="machines"] .section__header h2 {
  color: var(--cat-machines);
}

.section[data-category="machines"] .section__header h2::after {
  background: var(--cat-machines);
}

.section[data-category="measurements"] .section__header h2 {
  color: var(--cat-measurements);
}

.section[data-category="measurements"] .section__header h2::after {
  background: var(--cat-measurements);
}

.section[data-category="power"] .section__header h2 {
  color: var(--cat-power);
}

.section[data-category="power"] .section__header h2::after {
  background: var(--cat-power);
}

.section[data-category="control"] .section__header h2 {
  color: var(--cat-control);
}

.section[data-category="control"] .section__header h2::after {
  background: var(--cat-control);
}

.section[data-category="electronics"] .section__header h2 {
  color: var(--cat-electronics);
}

.section[data-category="electronics"] .section__header h2::after {
  background: var(--cat-electronics);
}

.section[data-category="signals"] .section__header h2 {
  color: var(--cat-signals);
}

.section[data-category="signals"] .section__header h2::after {
  background: var(--cat-signals);
}

.section[data-category="micro"] .section__header h2 {
  color: var(--cat-micro);
}

.section[data-category="micro"] .section__header h2::after {
  background: var(--cat-micro);
}

.section[data-category="estimation"] .section__header h2 {
  color: var(--cat-estimation);
}

.section[data-category="estimation"] .section__header h2::after {
  background: var(--cat-estimation);
}

/* ---------- Formula Cards Grid ---------- */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

@media (max-width: 600px) {
  .formula-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Formula Card ---------- */
.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 22px;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
}

.formula-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.formula-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.formula-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

/* Category border-top colors */
.formula-card[data-cat="circuit"]::before {
  background: var(--cat-circuit);
}

.formula-card[data-cat="machines"]::before {
  background: var(--cat-machines);
}

.formula-card[data-cat="measurements"]::before {
  background: var(--cat-measurements);
}

.formula-card[data-cat="power"]::before {
  background: var(--cat-power);
}

.formula-card[data-cat="control"]::before {
  background: var(--cat-control);
}

.formula-card[data-cat="electronics"]::before {
  background: var(--cat-electronics);
}

.formula-card[data-cat="signals"]::before {
  background: var(--cat-signals);
}

.formula-card[data-cat="micro"]::before {
  background: var(--cat-micro);
}

.formula-card[data-cat="estimation"]::before {
  background: var(--cat-estimation);
}

.formula-card:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

.formula-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.formula-card__name {
  font-family: var(--font-head);
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.formula-card__actions {
  display: flex;
  gap: 6px;
}

.formula-card__actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}

.formula-card__actions button:hover {
  color: var(--neon-cyan);
}

.formula-card__actions button.bookmarked {
  color: var(--neon-yellow);
}

.formula-card__formula {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.08);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.formula-card__formula .katex {
  font-size: 1.3rem;
}

.formula-card__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.formula-card__units {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.formula-card__units strong {
  color: var(--text-secondary);
}

.formula-card__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: 12px;
}

/* ---------- Calculator Modal ---------- */
.calc-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.calc-modal.open {
  display: flex;
}

.calc-modal__content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 90%;
  max-width: 500px;
  position: relative;
}

.calc-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color var(--transition);
}

.calc-modal__close:hover {
  color: var(--neon-cyan);
}

.calc-modal h3 {
  font-family: var(--font-head);
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  margin-bottom: 20px;
}

.calc-modal select,
.calc-modal input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  margin-bottom: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.calc-modal select:focus,
.calc-modal input:focus {
  border-color: var(--neon-cyan);
}

.calc-modal__btn {
  width: 100%;
  padding: 12px;
  background: var(--neon-cyan);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 0.9rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.calc-modal__btn:hover {
  box-shadow: var(--glow-cyan);
}

.calc-modal__result {
  margin-top: 18px;
  padding: 14px;
  background: rgba(0, 240, 255, 0.06);
  border-radius: 8px;
  text-align: center;
  font-size: 1.1rem;
  color: var(--neon-green);
  font-family: var(--font-head);
  min-height: 48px;
}

/* ---------- Bookmarks Panel ---------- */
.bookmarks-panel {
  position: fixed;
  top: var(--nav-height);
  right: -400px;
  width: 380px;
  max-width: 90vw;
  height: calc(100vh - var(--nav-height));
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 2000;
  overflow-y: auto;
  padding: 28px;
  transition: right 0.4s ease;
}

.bookmarks-panel.open {
  right: 0;
}

.bookmarks-panel h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.bookmark-item {
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.bookmark-item:hover {
  border-color: var(--neon-cyan);
}

.bookmark-item__name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* =========================================
   Hero Section (Global)
   ========================================= */
.circuit-hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  overflow: hidden;
  padding-top: var(--nav-height);
}

/* Three.js Canvas */
#hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.4;
}

/* Animated Lightning Overlay */
.lightning-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.15;
}

.bolt-path {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 0.5;
  filter: drop-shadow(0 0 8px var(--neon-cyan));
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: strike 4s infinite linear;
}

@keyframes strike {
  0% {
    stroke-dashoffset: 200;
    opacity: 0;
  }

  10% {
    stroke-dashoffset: 0;
    opacity: 1;
    filter: drop-shadow(0 0 20px var(--neon-cyan));
  }

  15% {
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}

/* Content */
.circuit-hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: 0 20px;
}

.circuit-hero__title {
  font-family: var(--font-head);
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-transform: uppercase;
}

.neon-text {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.4),
    0 0 20px rgba(0, 245, 255, 0.2),
    0 0 40px rgba(0, 245, 255, 0.1);
}

.circuit-hero__subtitle {
  font-family: var(--font-head);
  font-size: 1.5rem;
  color: var(--electric-yellow, #facc15);
  margin-bottom: 40px;
  min-height: 2rem;
  letter-spacing: 1.5px;
}

/* Floating Icons */
.hero-icons {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 40px;
}

.hero-icon {
  font-size: 2.5rem;
  color: var(--neon-cyan);
  background: rgba(0, 245, 255, 0.05);
  border: 1px solid rgba(0, 245, 255, 0.2);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  animation: float 4s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.1);
}

.hero-icon:nth-child(2) {
  animation-delay: 1s;
  color: #ff5252;
  border-color: rgba(255, 82, 82, 0.2);
}

.hero-icon:nth-child(3) {
  animation-delay: 2s;
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.2);
}

.hero-icon:nth-child(4) {
  animation-delay: 3s;
  color: #00e5a0;
  border-color: rgba(0, 229, 160, 0.2);
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

/* CTAs */
.circuit-hero__ctas {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.neon-btn {
  background: transparent;
  color: var(--neon-cyan);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.2), inset 0 0 10px rgba(0, 245, 255, 0.1);
}

.neon-btn:hover {
  background: var(--neon-cyan);
  color: var(--bg-primary);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.6);
  transform: translateY(-2px);
}

.outline-btn {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--text-muted);
}

.outline-btn:hover {
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .circuit-hero__title {
    font-size: 3rem;
  }

  .circuit-hero__subtitle {
    font-size: 1rem;
  }

  .circuit-hero__ctas {
    gap: 12px;
  }

  .circuit-nav ul {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .circuit-hero {
    padding-top: 60px;
  }

  .circuit-hero__title {
    font-size: 2rem;
    letter-spacing: 1px;
  }

  .circuit-hero__subtitle {
    font-size: 0.85rem;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
  }

  .hero-icons {
    gap: 10px;
    margin-bottom: 24px;
  }

  .hero-icon {
    width: 42px;
    height: 42px;
    font-size: 1.5rem;
    border-radius: 8px;
  }

  .hero__cta {
    padding: 12px 24px;
    font-size: 0.8rem;
    letter-spacing: 1px;
  }
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  padding: 60px 32px 32px;
  text-align: center;
  margin-top: 80px;
}

.footer__circuit-line {
  width: 100%;
  height: 40px;
  position: absolute;
  top: 0;
  left: 0;
}

.footer__circuit-line path {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 1.5;
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  filter: drop-shadow(0 0 4px var(--neon-cyan));
}

.footer__content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
}

.footer__col h4 {
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neon-cyan);
  margin-bottom: 14px;
}

.footer__col a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 3px 0;
  transition: color var(--transition);
}

.footer__col a:hover {
  color: var(--neon-cyan);
}

.footer__socials {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 24px;
}

.footer__socials a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1rem;
  transition: all var(--transition);
}

.footer__socials a:hover {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.footer__tagline {
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.footer__copy {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---------- Sine Wave Canvas ---------- */
.sine-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.08;
  z-index: 0;
}

/* ---------- No Results ---------- */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
  display: none;
}

.no-results.show {
  display: block;
}

/* ---------- Tooltips & Misc ---------- */
.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  color: var(--neon-green);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  border: 1px solid var(--border);
}

.tooltip.show {
  opacity: 1;
}

/* ---------- KaTeX Overrides ---------- */
.katex {
  color: var(--text-primary) !important;
}

body.light-mode .katex {
  color: #1a1a2e !important;
}

/* Internal Page Navigation */
.circuit-nav {
  position: sticky;
  top: var(--nav-height);
  background: rgba(10, 14, 26, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  padding: 15px 0;
}

.circuit-nav::-webkit-scrollbar {
  display: none;
}

.circuit-nav ul {
  display: flex;
  list-style: none;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  padding: 0 20px;
  margin: 0;
}

.circuit-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 5px 0;
  position: relative;
  transition: color var(--transition);
}

.circuit-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--electric-yellow, #facc15);
  box-shadow: 0 0 8px var(--electric-yellow, #facc15);
  transition: width 0.3s ease;
}

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

.circuit-nav a:hover::after,
.circuit-nav a.active::after {
  width: 100%;
}

/* Base Main Content Layout for all subjects */
.circuit-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  width: 100%;
}