/**
 * NORDLYS DESIGN SYSTEM - Aurora Theme & Brand Layer
 * Northern Lights inspired gradients and effects
 * Version: 1.0.0
 */

/* ==========================================
   AURORA GRADIENTS
   ========================================== */

.nordlys-aurora-gradient {
  background: linear-gradient(
    135deg,
    var(--nordlys-aurora-purple) 0%,
    var(--nordlys-aurora-teal) 33%,
    var(--nordlys-aurora-pink) 66%,
    var(--nordlys-aurora-green) 100%
  );
  background-size: 400% 400%;
  animation: nordlys-aurora-flow 15s ease infinite;
}

@keyframes nordlys-aurora-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.nordlys-aurora-subtle {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.1) 0%,
    rgba(6, 182, 212, 0.08) 50%,
    rgba(236, 72, 153, 0.06) 100%
  );
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
}

.nordlys-aurora-text {
  background: linear-gradient(
    90deg,
    var(--nordlys-aurora-purple),
    var(--nordlys-aurora-teal),
    var(--nordlys-aurora-pink)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: nordlys-aurora-text-flow 3s linear infinite;
}

@keyframes nordlys-aurora-text-flow {
  to { background-position: 200% center; }
}

/* ==========================================
   GLASSMORPHISM SURFACES
   ========================================== */

.nordlys-glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.15),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.nordlys-glass-elevated {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 20px 60px 0 rgba(31, 38, 135, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 -40px 40px -40px rgba(139, 92, 246, 0.1);
}

/* ==========================================
   HERO SURFACES
   ========================================== */

.nordlys-hero {
  position: relative;
  overflow: hidden;
  background: var(--nordlys-bg-base);
}

.nordlys-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 20% 80%,
    rgba(139, 92, 246, 0.15) 0%,
    transparent 50%
  ),
  radial-gradient(
    circle at 80% 20%,
    rgba(6, 182, 212, 0.15) 0%,
    transparent 50%
  ),
  radial-gradient(
    circle at 40% 40%,
    rgba(236, 72, 153, 0.1) 0%,
    transparent 50%
  );
  animation: nordlys-hero-rotate 30s linear infinite;
}

@keyframes nordlys-hero-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.nordlys-hero-content {
  position: relative;
  z-index: 1;
}

/* ==========================================
   AMBIENT LIGHTING
   ========================================== */

.nordlys-ambient-glow {
  position: relative;
}

.nordlys-ambient-glow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.2) 0%,
    transparent 70%
  );
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.5;
  animation: nordlys-ambient-pulse 4s ease-in-out infinite;
}

@keyframes nordlys-ambient-pulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

/* ==========================================
   ACCENT ELEMENTS
   ========================================== */

.nordlys-accent-border {
  position: relative;
  border: 1px solid transparent;
  background: linear-gradient(var(--nordlys-bg-surface), var(--nordlys-bg-surface)) padding-box,
              linear-gradient(135deg, var(--nordlys-aurora-purple), var(--nordlys-aurora-teal)) border-box;
}

.nordlys-accent-underline {
  position: relative;
  display: inline-block;
}

.nordlys-accent-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--nordlys-aurora-purple),
    var(--nordlys-aurora-teal)
  );
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--nordlys-duration-standard) var(--nordlys-ease-default);
}

.nordlys-accent-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ==========================================
   CINEMATIC TRANSITIONS
   ========================================== */

.nordlys-entrance-fade {
  animation: nordlys-entrance-fade var(--nordlys-duration-narrative) var(--nordlys-ease-default) both;
}

@keyframes nordlys-entrance-fade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nordlys-entrance-scale {
  animation: nordlys-entrance-scale var(--nordlys-duration-entrance) var(--nordlys-ease-default) both;
}

@keyframes nordlys-entrance-scale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.nordlys-entrance-slide {
  animation: nordlys-entrance-slide var(--nordlys-duration-entrance) var(--nordlys-ease-default) both;
}

@keyframes nordlys-entrance-slide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Stagger children animations */
.nordlys-stagger-children > * {
  animation: nordlys-entrance-fade var(--nordlys-duration-entrance) var(--nordlys-ease-default) both;
}

.nordlys-stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.nordlys-stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.nordlys-stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.nordlys-stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.nordlys-stagger-children > *:nth-child(5) { animation-delay: 400ms; }

/* ==========================================
   BRAND ELEMENTS
   ========================================== */

.nordlys-logo {
  font-size: var(--nordlys-text-2xl);
  font-weight: var(--nordlys-font-bold);
  letter-spacing: var(--nordlys-tracking-tight);
  position: relative;
  display: inline-block;
}

.nordlys-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--nordlys-radius-lg);
  background: linear-gradient(135deg, var(--nordlys-aurora-purple), var(--nordlys-aurora-teal));
  color: white;
  font-weight: var(--nordlys-font-bold);
  margin-right: var(--nordlys-space-3);
  position: relative;
  overflow: hidden;
}

.nordlys-logo-mark::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: rotate(45deg);
  animation: nordlys-logo-shine 3s ease-in-out infinite;
}

@keyframes nordlys-logo-shine {
  0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* ==========================================
   DARK MODE ENHANCEMENTS
   ========================================== */

.nordlys-dark-enhance {
  position: relative;
}

.nordlys-dark-enhance::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.3),
    rgba(6, 182, 212, 0.3)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--nordlys-duration-standard) var(--nordlys-ease-default);
}

.nordlys-dark-enhance:hover::before {
  opacity: 1;
}


/* ==========================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================== */

/* Ensure sufficient contrast for aurora elements */
.nordlys-aurora-text {
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Focus rings for glass elements */
.nordlys-glass:focus-within {
  outline: 2px solid var(--nordlys-ring-focus);
  outline-offset: 2px;
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .nordlys-aurora-gradient {
    background: var(--nordlys-accent-600);
  }
  
  .nordlys-glass {
    background: var(--nordlys-bg-surface);
    border: 2px solid var(--nordlys-border-strong);
  }
  
  .nordlys-aurora-text {
    background: none;
    -webkit-text-fill-color: var(--nordlys-accent-600);
    color: var(--nordlys-accent-600);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .nordlys-aurora-gradient,
  .nordlys-aurora-text,
  .nordlys-hero::before,
  .nordlys-ambient-glow::after,
  .nordlys-logo-mark::before {
    animation: none !important;
  }
  
  .nordlys-stagger-children > * {
    animation-delay: 0ms !important;
  }
}