/**
 * RACK MODULE ENHANCEMENTS
 * Hover animations, pulse effects, ARIA labels, tooltips
 */

/* Enhanced hover effects for rack modules */
.rack-module-graphic {
  position: relative;
  transition: all 0.3s ease;
}

.rack-module-graphic:hover {
  transform: translateY(-4px);
  filter: brightness(1.05);
}

.rack-module-graphic::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 159, 28, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.rack-module-graphic:hover::before {
  opacity: 1;
}

/* Glowing border on focus (keyboard navigation) */
.rack-module-graphic a:focus {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
  border-radius: 4px;
}

.rack-module-graphic a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

/* Tooltip system for rack modules */
.rack-tooltip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 10, 0.95);
  border: 2px solid var(--amber);
  border-radius: 6px;
  padding: 1rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--crs-text);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 20px var(--amber-glow);
  white-space: nowrap;
}

.rack-module-graphic:hover .rack-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) translateY(-10px);
}

.rack-tooltip::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--amber);
}

/* LED pulse animation enhancement */
@keyframes led-pulse-strong {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px currentColor, 0 0 16px currentColor;
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 0 4px currentColor, 0 0 8px currentColor;
  }
}

/* Animated LEDs on rack graphics */
.rack-module-led {
  animation: led-pulse-strong 2s ease-in-out infinite;
}

/* Button click feedback */
.cta-service:active,
.book-now-button:active,
.rack-cta-button:active {
  transform: translateY(2px);
  box-shadow: 0 0 8px var(--amber-glow);
}

/* Service block hover enhancement */
.service-block {
  transition: all 0.3s ease;
}

.service-block:hover {
  border-color: var(--amber);
  box-shadow: 0 4px 12px rgba(255, 159, 28, 0.15);
  transform: translateY(-2px);
}

/* Improved contrast for better accessibility */
.service-intro,
.price-note,
.location-note {
  color: #d0d0d0; /* Improved from #crs-text-dim for better contrast */
}

.rack-title,
h2,
h3 {
  color: var(--brass);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* Better readability */
}

/* Focus indicators for all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

/* Skip to content link (accessibility) */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--amber);
  color: #000000;
  padding: 0.75rem 1.5rem;
  z-index: 99999;
  text-decoration: none;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: top 0.3s ease;
}

.skip-to-content:focus {
  top: 0;
}

/* Loading state for interactive elements */
.rack-module-graphic.loading {
  opacity: 0.6;
  pointer-events: none;
}

.rack-module-graphic.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--amber);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 10;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Mobile touch feedback */
@media (max-width: 768px) {
  .rack-module-graphic:active {
    transform: scale(0.98);
  }
  
  .rack-tooltip {
    display: none; /* Hide tooltips on mobile, use ARIA labels instead */
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .rack-module-graphic {
    border: 2px solid var(--crs-text);
  }
  
  .service-intro,
  .price-note {
    color: var(--crs-text);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .rack-module-graphic,
  .rack-module-graphic::before,
  .service-block,
  .rack-tooltip {
    transition: none;
    animation: none;
  }
  
  .rack-module-graphic:hover {
    transform: none;
  }
}
