/**
 * Neural Network Visualization - Manim Style
 * Clean, professional neural network banner
 */

/* ====== Hero Section ====== */
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #040b14 0%, #0a192f 50%, #112240 100%);
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(20, 157, 221, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(79, 195, 247, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

/* ====== Centered Layout ====== */
#hero .hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 20px;
  position: relative;
  z-index: 10;
  gap: 25px;
}

/* ====== Digit Selector ====== */
.nn-digit-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.nn-selector-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
}

.nn-digit-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.nn-digit-btn {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(79, 195, 247, 0.3);
  background: rgba(79, 195, 247, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Roboto Mono', monospace;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.nn-digit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(79, 195, 247, 0.2) 0%, rgba(76, 175, 80, 0.2) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.nn-digit-btn:hover {
  border-color: rgba(79, 195, 247, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(79, 195, 247, 0.2);
}

.nn-digit-btn:hover::before {
  opacity: 1;
}

.nn-digit-btn.active {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.15);
  color: #4caf50;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.nn-digit-btn.active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(76, 175, 80, 0.1) 100%);
}

.nn-digit-btn:active {
  transform: translateY(0);
}

/* ====== Neural Network Container ====== */
.nn-visual {
  width: 580px;
  height: 280px;
  position: relative;
  order: 2;
}

.nn-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ====== Input Grid (MNIST-style) ====== */
.nn-input-cell {
  transition: fill-opacity 0.3s ease;
}

/* ====== Network Nodes ====== */
.nn-node {
  transform-origin: center;
  will-change: opacity, transform, fill, filter;
}

.nn-ready .nn-node {
  opacity: 1;
}

/* Layer stagger for entrance animation */
.nn-ready .nn-layer-0 { transition-delay: 0.1s; }
.nn-ready .nn-layer-1 { transition-delay: 0.15s; }
.nn-ready .nn-layer-2 { transition-delay: 0.2s; }
.nn-ready .nn-layer-3 { transition-delay: 0.25s; }

/* ====== Connections ====== */
.nn-connection {
  will-change: opacity, stroke, stroke-width;
  pointer-events: none;
}

.nn-input-connection {
  stroke-dasharray: 4 2;
}

/* ====== Signal Animation ====== */
.nn-signal {
  pointer-events: none;
  will-change: cx, cy;
}

/* ====== Output Labels ====== */
.nn-output-label {
  transition: fill 0.3s ease, font-weight 0.3s ease;
  user-select: none;
  pointer-events: none;
}

/* ====== Scroll Indicator ====== */
.hero-scroll-indicator {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  opacity: 0;
  animation: fadeIn 0.6s ease 2s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.hero-scroll-indicator a {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.3s ease;
}

.hero-scroll-indicator a:hover {
  color: #4fc3f7;
}

.hero-scroll-indicator .mouse {
  width: 20px;
  height: 32px;
  border: 2px solid currentColor;
  border-radius: 10px;
  position: relative;
  margin-bottom: 5px;
}

.hero-scroll-indicator .wheel {
  width: 3px;
  height: 6px;
  background: currentColor;
  border-radius: 2px;
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollWheel 1.5s ease-in-out infinite;
}

@keyframes scrollWheel {
  0%, 100% { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
  }
  50% { 
    opacity: 0.3; 
    transform: translateX(-50%) translateY(8px); 
  }
}

.hero-scroll-indicator span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* ====== Responsive Design ====== */
@media (max-width: 992px) {
  .nn-visual {
    width: 500px;
    height: 240px;
  }
  
  .nn-digit-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  #hero .hero-container {
    gap: 20px;
  }
  
  .nn-visual {
    width: 420px;
    height: 200px;
  }
  
  .nn-digit-btn {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }
  
  .nn-digit-buttons {
    gap: 6px;
  }
  
  .nn-selector-label {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .nn-visual {
    width: 320px;
    height: 160px;
  }
  
  .nn-digit-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
    border-radius: 6px;
  }
  
  .nn-digit-buttons {
    gap: 5px;
  }
  
  .hero-scroll-indicator {
    bottom: 15px;
  }
}

/* ====== Reduced Motion ====== */
@media (prefers-reduced-motion: reduce) {
  .nn-node,
  .nn-connection,
  .nn-input-cell,
  .nn-output-label {
    transition: none !important;
  }
  
  .nn-signal {
    display: none;
  }
  
  .hero-scroll-indicator {
    opacity: 1;
    animation: none;
  }
  
  .hero-scroll-indicator .wheel {
    animation: none;
  }
}

/* ====== Dark Mode Adjustments ====== */
[data-theme="dark"] #hero {
  background: linear-gradient(135deg, #020508 0%, #050d17 50%, #0a1628 100%);
}

[data-theme="dark"] #hero::before {
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(20, 157, 221, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(79, 195, 247, 0.02) 0%, transparent 50%);
}

/* ====== Animation Optimization ====== */
.nn-visual {
  contain: layout style paint;
}

.nn-svg * {
  shape-rendering: geometricPrecision;
}
