/* =============================================
   IKRC Effects - Animations, Glassmorphism,
   Gradients & Visual Effects
   ============================================= */

/* ---- Keyframe Animations ---- */

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes borderGlow {
  0%, 100% {
    border-color: rgba(var(--accent-rgb, 59, 130, 246), 0.3);
    box-shadow: 0 0 20px rgba(var(--accent-rgb, 59, 130, 246), 0.1),
                inset 0 0 20px rgba(var(--accent-rgb, 59, 130, 246), 0.05);
  }
  50% {
    border-color: rgba(var(--accent-rgb, 59, 130, 246), 0.6);
    box-shadow: 0 0 40px rgba(var(--accent-rgb, 59, 130, 246), 0.2),
                inset 0 0 30px rgba(var(--accent-rgb, 59, 130, 246), 0.1);
  }
}

@keyframes borderFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px var(--accent-glow); }
}

@keyframes gradientMesh {
  0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%; }
  25% { background-position: 100% 0%, 0% 100%, 25% 75%; }
  50% { background-position: 100% 100%, 0% 0%, 75% 25%; }
  75% { background-position: 0% 100%, 100% 0%, 50% 50%; }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
  25% { transform: translate(30px, -40px) scale(1.1); opacity: 0.9; }
  50% { transform: translate(-20px, -60px) scale(0.95); opacity: 0.6; }
  75% { transform: translate(-40px, -20px) scale(1.05); opacity: 0.8; }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
  33% { transform: translate(-50px, 30px) scale(1.15); opacity: 0.8; }
  66% { transform: translate(40px, -30px) scale(0.9); opacity: 0.5; }
}

@keyframes morphBlob {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
  75% { border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%; }
}

@keyframes gridPulseRadial {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.25; transform: scale(1.02); }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- Glassmorphism ---- */

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

.glass-surface {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
}

/* ---- Gradient Backgrounds ---- */

.gradient-mesh-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.gradient-mesh-bg::before {
  content: '';
  position: absolute;
  width: 150%;
  height: 150%;
  top: -25%;
  left: -25%;
  background:
    radial-gradient(ellipse at 20% 50%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(var(--accent-rgb, 59, 130, 246), 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(var(--accent-warm-rgb, 234, 88, 12), 0.06) 0%, transparent 50%);
  animation: gradientMesh 20s ease-in-out infinite;
  background-size: 100% 100%, 100% 100%, 100% 100%;
}

/* ---- Blueprint Grid ---- */

.blueprint-grid {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: center;
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
  animation: gridPulseRadial 8s ease-in-out infinite;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 0%, transparent 100%);
}

.blueprint-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(var(--grid-color-accent) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color-accent) 1px, transparent 1px);
  background-size: 240px 240px;
  background-position: center;
  animation: gridPulseRadial 12s ease-in-out infinite reverse;
}

/* ---- Noise Overlay ---- */

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: var(--noise-opacity, 0.035);
  pointer-events: none;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---- Card Glow Mouse Track ---- */

.card-glow {
  position: relative;
  overflow: hidden;
}

.card-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--accent-glow),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 0;
}

.card-glow:hover::before {
  opacity: 1;
}

/* ---- Custom Cursor ---- */

.cursor-follower {
  position: fixed;
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.15s ease, width 0.2s ease, height 0.2s ease, border-color 0.2s ease;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}

.cursor-follower.hovering {
  width: 48px;
  height: 48px;
  border-color: var(--accent-warm);
}

/* ---- Floating Orb Decorations ---- */

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
}

.orb-blue {
  background: var(--accent-glow);
  animation: orbFloat 15s ease-in-out infinite, morphBlob 20s ease-in-out infinite;
}

.orb-warm {
  background: var(--accent-warm-glow);
  animation: orbFloat2 18s ease-in-out infinite, morphBlob 25s ease-in-out infinite reverse;
}

.orb-green {
  background: rgba(16, 185, 129, 0.15);
  animation: orbFloat 22s ease-in-out infinite reverse, morphBlob 18s ease-in-out infinite;
}

.dark .orb-green {
  background: rgba(92, 184, 143, 0.2);
}

/* Dark mode card glow */
.dark .card {
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(77, 157, 224, 0.05);
}
.dark .card:hover {
  box-shadow: var(--shadow-lg), 0 0 40px rgba(77, 157, 224, 0.12);
}

/* ---- Decorative Glow Dot ---- */

.glow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow), 0 0 24px var(--accent-glow);
  animation: pulseGlow 3s ease-in-out infinite;
}

/* ---- Reconnection Modal ---- */

.reconnect-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}

.reconnect-modal[components-reconnect-show] {
  display: flex;
}

.reconnect-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 90%;
}

.reconnect-icon {
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.reconnect-title {
  font-family: var(--font-display, "Syne", sans-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.reconnect-message {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.reconnect-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

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

.reconnect-retry,
.reconnect-reload {
  margin: 0.25rem;
}

/* ---- Cookie Banner ---- */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px var(--shadow-color);
  padding: 1.5rem;
  animation: fade-in-up 0.4s ease-out;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.cookie-banner-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .cookie-banner-content {
    gap: 2rem;
  }
}

.cookie-banner-text {
  flex: 1;
  min-width: 200px;
}

.cookie-banner-text h4 {
  font-family: var(--font-display, "Syne", sans-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.cookie-banner-text p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.cookie-banner-text a {
  color: var(--accent);
  text-decoration: underline;
}

.cookie-banner-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

@media (min-width: 640px) {
  .cookie-banner-actions {
    width: auto;
    flex-shrink: 0;
  }
}

/* ---- Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
  .blueprint-grid,
  .noise-overlay,
  .gradient-mesh-bg,
  .cursor-follower,
  .orb {
    animation: none !important;
  }

  .blueprint-grid::before {
    animation: none !important;
  }

  .card-glow::before {
    display: none;
  }
}
