/* ============================================
   GROWING CIRCUIT & CONSTELLATION — Special Styles
   Handles the digital grid background, svg neon traces,
   glowing nodes, and interactive widgets.
   ============================================ */

/* ── Digital Grid Blueprint Overlay ── */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  z-index: -1;
  pointer-events: none;
}

/* ── SVG Circuit Container ── */
#circuit-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 25vw; /* take exactly 25% of the screen width */
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#circuit-svg {
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100vh;
  opacity: 0.85;
  transition: opacity 0.5s ease;
}

/* ── Circuit Traces ── */
.circuit-bg-trace {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.circuit-pulse-trace {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px var(--accent-glow-color, rgba(56, 189, 248, 0.5)));
  transition: stroke 0.5s ease, filter 0.5s ease;
}

/* ── Glowing Nodes ── */
.circuit-node {
  fill: #0f172a;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 2.2;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
  cursor: pointer;
  pointer-events: all;
}

.circuit-node:hover {
  transform: scale(1.2);
}

.circuit-node.active {
  stroke-width: 3.5;
}

/* Specific active states for nodes */
#node-start.active { fill: #0284c7; stroke: #38bdf8; filter: drop-shadow(0 0 8px #38bdf8); }
#node-cricket.active { fill: #16a34a; stroke: #4ade80; filter: drop-shadow(0 0 8px #4ade80); }
#node-electronics.active { fill: #d97706; stroke: #fbbf24; filter: drop-shadow(0 0 8px #fbbf24); }
#node-coding.active { fill: #4f46e5; stroke: #818cf8; filter: drop-shadow(0 0 8px #818cf8); }
#node-web-biz.active { fill: #9333ea; stroke: #c084fc; filter: drop-shadow(0 0 8px #c084fc); }
#node-future.active { fill: #db2777; stroke: #f472b6; filter: drop-shadow(0 0 8px #f472b6); }

/* ── HTML Navigation Labels ── */
.circuit-labels-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.circuit-label-html {
  position: absolute;
  left: calc(12.5vw + 24px); /* aligns 24px to the right of the center trace line */
  transform: translateY(-50%);
  font-family: 'Outfit', sans-serif;
  font-size: clamp(0.78rem, 1.1vw, 0.95rem); /* text size remains perfectly readable! */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  opacity: 0.55;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}

.circuit-label-html.active {
  color: #fff;
  opacity: 1;
}

/* Specific glows for active labels */
#label-start.active { color: #38bdf8; text-shadow: 0 0 8px rgba(56, 189, 248, 0.4); }
#label-cricket.active { color: #4ade80; text-shadow: 0 0 8px rgba(74, 222, 128, 0.4); }
#label-electronics.active { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
#label-coding.active { color: #818cf8; text-shadow: 0 0 8px rgba(129, 140, 248, 0.4); }
#label-web-biz.active { color: #c084fc; text-shadow: 0 0 8px rgba(192, 132, 252, 0.4); }
#label-future.active { color: #f472b6; text-shadow: 0 0 8px rgba(244, 114, 182, 0.4); }

@media (max-width: 768px) {
  .circuit-labels-overlay {
    display: none;
  }
}


/* ── Dynamic Light Dot (Current representation) ── */
.current-dot {
  fill: #fff;
  filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 12px var(--accent-glow-color, #38bdf8));
  transition: filter 0.5s ease;
}

/* ═══════════════════════════════════════════
   INTERACTIVE SIMULATOR WIDGETS
   ═══════════════════════════════════════════ */

/* General Widget Styles */
.interactive-widget {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  position: relative;
  overflow: hidden;
}

.widget-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

/* Widget Control Buttons */
.widget-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.5rem 1.2rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.widget-btn:active {
  transform: translateY(1px);
}

/* Widget Accent Buttons */
.widget-btn.btn-cricket:hover { background: rgba(74, 222, 128, 0.15); border-color: #4ade80; color: #4ade80; }
.widget-btn.btn-electronics:hover { background: rgba(251, 191, 36, 0.15); border-color: #fbbf24; color: #fbbf24; }
.widget-btn.btn-coding:hover { background: rgba(129, 140, 248, 0.15); border-color: #818cf8; color: #818cf8; }

/* 🏏 WIDGET 1: Bowling Radar */
.radar-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.radar-gauge {
  text-align: center;
}

.radar-speed {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
  line-height: 1;
}

.radar-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.radar-stats {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.radar-stat-row {
  display: flex;
  justify-content: space-between;
  width: 140px;
  color: var(--text-secondary);
}

.radar-stat-val {
  color: #fff;
  font-weight: 500;
}

/* Bowling Ball Canvas Simulator */
.bowling-canvas-container {
  width: 100%;
  height: 90px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 1rem;
}

.bowling-ball-sim {
  position: absolute;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 30% 30%, #ef4444, #991b1b);
  border-radius: 50%;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  opacity: 0;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.sim-pitcher-hand {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.sim-batsman {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.sim-trail {
  position: absolute;
  height: 2px;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.5), transparent);
  top: 50%;
  left: 25px;
  width: 0;
  transform: translateY(-50%);
}

/* 💡 WIDGET 2: Smart Street Light Simulator */
.street-light-widget {
  padding: 1rem;
}

.road-scene {
  position: relative;
  width: 100%;
  height: 140px;
  background: linear-gradient(to bottom, #020617, #0f172a);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Lane lines */
.road-scene::after {
  content: '';
  position: absolute;
  bottom: 25px;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(255, 255, 255, 0.2) 15px, rgba(255, 255, 255, 0.2) 30px);
}

/* Street lamps */
.lamp-post {
  position: absolute;
  bottom: 30px;
  width: 4px;
  height: 70px;
  background: #475569;
  border-radius: 2px;
}

.lamp-post-1 { left: 25%; }
.lamp-post-2 { left: 75%; }

.lamp-head {
  position: absolute;
  top: -4px;
  left: -2px;
  width: 14px;
  height: 8px;
  background: #334155;
  border-radius: 4px 4px 0 0;
}

.lamp-light-cone {
  position: absolute;
  top: 4px;
  left: -18px;
  width: 40px;
  height: 95px;
  background: radial-gradient(ellipse at top, rgba(253, 224, 71, 0.25) 0%, transparent 70%);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sensor-range {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 80px;
  height: 50px;
  border: 1px dashed rgba(245, 158, 11, 0.15);
  border-radius: 50% 50% 0 0;
  background: rgba(245, 158, 11, 0.01);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.sensor-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 4px #ef4444;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* Light Active States */
.street-light-widget.active .lamp-light-cone {
  opacity: 1;
}

.street-light-widget.active .sensor-indicator {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

/* The interactive walker/car */
.interactive-walker {
  position: absolute;
  bottom: 12px;
  left: 10px;
  font-size: 1.4rem;
  cursor: grab;
  user-select: none;
  z-index: 10;
  transition: left 0.1s linear;
}

.interactive-walker:active {
  cursor: grabbing;
}

/* 💻 WIDGET 3: Business Code Terminal */
.terminal-widget {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.terminal-header {
  background: #0f172a;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-dots {
  display: flex;
  gap: 0.4rem;
}

.terminal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.terminal-dot-r { background: #ef4444; }
.terminal-dot-y { background: #fbbf24; }
.terminal-dot-g { background: #22c55e; }

.terminal-title {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.terminal-tabs {
  display: flex;
  background: #0b0f19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-tab {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

.terminal-tab.active {
  background: #020617;
  color: #818cf8;
  border-bottom: 1.5px solid #818cf8;
}

.terminal-content {
  padding: 1.2rem;
  font-size: 0.85rem;
  min-height: 180px;
  overflow-y: auto;
  color: #e2e8f0;
}

.terminal-line {
  margin-bottom: 0.3rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.terminal-comment { color: #64748b; }
.terminal-tag { color: #f43f5e; }
.terminal-attr { color: #fb923c; }
.terminal-val { color: #4ade80; }
.terminal-keyword { color: #38bdf8; }

/* Interactive simulator buttons */
.terminal-controls {
  padding: 0.8rem;
  background: #090d16;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
}

/* Responsive adjustments for Circuit Nodes */
@media (max-width: 1024px) {
  .circuit-pulse-trace, .circuit-bg-trace {
    stroke-width: 3.5;
  }
}

@media (max-width: 768px) {
  #circuit-container {
    opacity: 0.35;
  }
  .circuit-pulse-trace, .circuit-bg-trace {
    stroke-width: 2.5;
  }
}
