/* ==========================================================================
   CIRCUITS MASTERCLASS - PROFESSIONAL ELECTRONICS WORKBENCH STYLING
   Precision Laboratory Aesthetic • High-Contrast Optics • Tactile Instruments
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Laboratory Bench Dark Palette */
  --bench-bg: #070a12;
  --bench-surface: #0d121f;
  --bench-card: #121829;
  --bench-card-hover: #182036;
  --bench-border: rgba(99, 115, 148, 0.22);
  --bench-border-bright: rgba(6, 182, 212, 0.45);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Electrical Signal Colors */
  --electric-cyan: #00f0ff;
  --electric-cyan-glow: rgba(0, 240, 255, 0.35);
  --electric-amber: #ffb703;
  --electric-amber-glow: rgba(255, 183, 3, 0.35);
  --electric-emerald: #10b981;
  --electric-emerald-glow: rgba(16, 185, 129, 0.35);
  --electric-purple: #c084fc;
  --electric-purple-glow: rgba(192, 132, 252, 0.35);
  --electric-rose: #ff3366;
  --electric-rose-glow: rgba(255, 51, 102, 0.35);

  /* Instrument Hardware */
  --dmm-display-bg: #091316;
  --dmm-lcd-text: #00f0ff;
  --brass-post: #d97706;
}

body.light-theme {
  --bench-bg: #f1f5f9;
  --bench-surface: #e2e8f0;
  --bench-card: #ffffff;
  --bench-card-hover: #f8fafc;
  --bench-border: rgba(148, 163, 184, 0.35);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --dmm-display-bg: #e2e8f0;
  --dmm-lcd-text: #0284c7;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bench-bg);
  color: var(--text-primary);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 240, 255, 0.05) 0%, transparent 35%),
    radial-gradient(circle at 90% 80%, rgba(192, 132, 252, 0.05) 0%, transparent 35%),
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  min-height: 100vh;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

code, pre, .font-mono, .lcd-readout {
  font-family: var(--font-mono);
}

/* ==========================================================================
   ENGINEERING WORKBENCH HARDWARE PANELS
   ========================================================================== */
.lab-card {
  background: var(--bench-card);
  border: 1px solid var(--bench-border);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.lab-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lab-card:hover {
  border-color: var(--bench-border-bright);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.6), 0 0 20px -3px var(--electric-cyan-glow);
}

.lab-card:hover::before {
  opacity: 1;
}

/* ==========================================================================
   DIGITAL MULTIMETER (DMM) & LCD INSTRUMENT HARDWARE
   ========================================================================== */
.dmm-chassis {
  background: linear-gradient(145deg, #1e2433, #111624);
  border: 2px solid #2b354d;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.dmm-screen {
  background-color: var(--dmm-display-bg);
  border: 2px solid #1a2536;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.8);
  font-family: var(--font-mono);
  color: var(--dmm-lcd-text);
  text-shadow: 0 0 10px var(--electric-cyan-glow);
  position: relative;
}

.dmm-screen::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  opacity: 0.35;
}

.brass-terminal {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef08a, #b45309 70%, #78350f);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  border: 2px solid #451a03;
  display: inline-block;
}

/* ==========================================================================
   CIRCUIT SCHEMATICS & DYNAMIC ANIMATIONS
   ========================================================================== */
.circuit-schematic-bg {
  background-color: #080d19;
  background-image: 
    linear-gradient(to right, rgba(56, 189, 248, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1px solid #1a233a;
  border-radius: 16px;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Dynamic current pulse animations */
@keyframes electronRun {
  to {
    stroke-dashoffset: -40;
  }
}

.anim-electron-normal {
  stroke-dasharray: 6 12;
  animation: electronRun 1.2s linear infinite;
}

.anim-electron-fast {
  stroke-dasharray: 6 10;
  animation: electronRun 0.4s linear infinite;
}

.anim-electron-reverse {
  stroke-dasharray: 6 12;
  animation: electronRun 1.2s linear infinite reverse;
}

/* Glowing Nodes & Interaction */
.probe-node {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.probe-node:hover {
  transform: scale(1.4);
  filter: drop-shadow(0 0 10px #00f0ff);
}

.probe-node-selected-red {
  fill: #ff3366 !important;
  stroke: #ffffff !important;
  stroke-width: 2.5 !important;
  filter: drop-shadow(0 0 12px #ff3366);
}

.probe-node-selected-black {
  fill: #1e293b !important;
  stroke: #38bdf8 !important;
  stroke-width: 2.5 !important;
  filter: drop-shadow(0 0 12px #00f0ff);
}

/* ==========================================================================
   TACTILE TABS, TOGGLES & SLIDERS
   ========================================================================== */
.nav-tab {
  transition: all 0.2s ease;
  position: relative;
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(192, 132, 252, 0.15));
  border-color: #00f0ff;
  color: #00f0ff;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
  border-radius: 9999px;
}

/* Perspective Pills */
.wording-pill {
  transition: all 0.2s ease;
  cursor: pointer;
}

.wording-pill.active-prof {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #93c5fd;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.wording-pill.active-intuition {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #6ee7b7;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.wording-pill.active-trap {
  background: rgba(255, 51, 102, 0.25);
  border-color: #ff3366;
  color: #fca5a5;
  box-shadow: 0 0 10px rgba(255, 51, 102, 0.3);
}

/* Sliders */
input[type=range] {
  -webkit-appearance: none;
  background: #1e293b;
  border-radius: 9999px;
  height: 7px;
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #67e8f9, #00f0ff 60%, #0891b2);
  cursor: pointer;
  box-shadow: 0 0 12px var(--electric-cyan), 0 2px 4px rgba(0, 0, 0, 0.5);
  border: 1.5px solid #ffffff;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.22);
  box-shadow: 0 0 18px var(--electric-cyan), 0 4px 8px rgba(0, 0, 0, 0.6);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #090e1a;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
  border: 1px solid #334155;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* KaTeX Clean Inline Math */
.katex-display {
  margin: 0.6em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.35rem 0;
}
