/**
 * Kubrainn Orb Styles
 * Compact header logo animation styles with fallback support
 */

/* Orb container */
.kubrainn-orb-container {
  position: relative;
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: visible;
  z-index: 3;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.kubrainn-orb-container:hover {
  transform: scale(1.05);
}

.kubrainn-orb-container:focus-visible {
  outline: 2px solid rgba(49, 230, 255, 0.8);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(49, 230, 255, 0.2);
}

/* Three.js canvas styling */
.kubrainn-orb-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
}

/* SVG fallback for reduced motion */
.logo-fallback-animated-glow {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 10px rgba(49, 230, 255, 0.55))
          drop-shadow(0 0 18px rgba(225, 6, 0, 0.25));
  transition: transform 0.3s ease, filter 0.3s ease;
  animation: gentle-pulse 3s ease-in-out infinite;
}

.logo-fallback-animated-glow:hover {
  transform: scale(1.03);
  filter: drop-shadow(0 0 15px rgba(49, 230, 255, 0.7))
          drop-shadow(0 0 25px rgba(225, 6, 0, 0.4));
}

@keyframes gentle-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(49, 230, 255, 0.55))
            drop-shadow(0 0 18px rgba(225, 6, 0, 0.25));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(49, 230, 255, 0.75))
            drop-shadow(0 0 25px rgba(225, 6, 0, 0.4));
  }
}

/* Reduced motion: disable animations */
@media (prefers-reduced-motion: reduce) {
  .kubrainn-orb-container {
    transition: none;
  }

  .kubrainn-orb-container canvas {
    display: none !important;
  }

  .logo-fallback-animated-glow {
    animation: none;
    filter: drop-shadow(0 0 10px rgba(49, 230, 255, 0.4))
            drop-shadow(0 0 15px rgba(225, 6, 0, 0.2));
  }
}

/* Loading state */
.kubrainn-orb-container.loading {
  opacity: 0.6;
}

.kubrainn-orb-container.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid rgba(49, 230, 255, 0.3);
  border-top-color: rgba(49, 230, 255, 0.9);
  border-radius: 50%;
  animation: orb-spin 0.8s linear infinite;
}

@keyframes orb-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Energized state (when 'E' is pressed) */
.kubrainn-orb-container.energized {
  animation: energize-burst 0.6s ease-out;
}

@keyframes energize-burst {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 10px rgba(49, 230, 255, 0.6));
  }
  50% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 30px rgba(49, 230, 255, 1))
            drop-shadow(0 0 50px rgba(225, 6, 0, 0.8));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 10px rgba(49, 230, 255, 0.6));
  }
}

/* Accessibility: keyboard hint */
.kubrainn-orb-hint {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.kubrainn-orb-container:hover .kubrainn-orb-hint,
.kubrainn-orb-container:focus-visible .kubrainn-orb-hint {
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .kubrainn-orb-container {
    width: 96px;
    height: 96px;
  }
}

@media (max-width: 480px) {
  .kubrainn-orb-container {
    width: 80px;
    height: 80px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .kubrainn-orb-container:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 4px;
  }
}

/* Base orb container for header */
#kubrainn-orb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  overflow: visible;
}

#kubrainn-orb canvas {
  display: block;
}

/* Right alignment helper - works without parent modifications */
#kubrainn-orb.orb--align-right {
  margin-left: auto;
}

/* Grid/Flex context alignment */
#kubrainn-orb.orb--align-right {
  justify-self: end;
  align-self: center;
}

/* Fallback for non-grid/flex parents */
#kubrainn-orb.orb--align-right {
  float: right;
}

/* Reduced motion support for aligned orb */
@media (prefers-reduced-motion: reduce) {
  #kubrainn-orb {
    opacity: 0.9;
  }
}
