/* ============================================
   SOVEREIGN AI-GRID — Quantum CSS
   Beyond Tailwind: animations, particles, glow
   ============================================ */

/* --- Base Typography --- */
html { scroll-behavior: smooth; }

h1 { letter-spacing: -0.02em; }
h2 { letter-spacing: -0.01em; }
h3, h4 { letter-spacing: -0.005em; }

.prose-body p,
.text-body {
  line-height: 1.7;
}

/* --- Quantum Glow Keyframes --- */
@keyframes quantumFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-10px) rotate(1deg); }
  66% { transform: translateY(5px) rotate(-1deg); }
}

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

@keyframes consciousnessWave {
  0% { transform: translateX(-100%); opacity: 0; }
  50% { opacity: 0.6; }
  100% { transform: translateX(100%); opacity: 0; }
}

@keyframes nodeGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(6, 214, 160, 0.2); }
  50% { box-shadow: 0 0 20px rgba(6, 214, 160, 0.4), 0 0 40px rgba(8, 145, 178, 0.15); }
}

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

@keyframes counterGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(6, 214, 160, 0.2); }
  50% { text-shadow: 0 0 40px rgba(6, 214, 160, 0.4), 0 0 80px rgba(8, 145, 178, 0.15); }
}

/* --- Particle Canvas --- */
#quantum-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* --- Hex Grid Pattern Overlay --- */
.hex-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5L55 20V40L30 55L5 40V20L30 5Z' fill='none' stroke='%2306D6A0' stroke-width='0.5'/%3E%3C/svg%3E");
  background-size: 60px 60px;
  pointer-events: none;
}

/* --- Animated Tri-Nation Line --- */
.tri-line-animated {
  height: 3px;
  background: linear-gradient(90deg, #FF6B00, #FFCC00, #FFB800, #FF6B00);
  background-size: 200% 100%;
  animation: triGradient 4s linear infinite;
}

/* --- Static Tri-Nation Line (section dividers) --- */
.tri-gradient-line {
  height: 3px;
  background: linear-gradient(90deg, #FF6B00, #FF6B00 33%, #FFCC00 33%, #FFCC00 66%, #FFB800 66%, #FFB800);
}

/* --- Quantum Glow Text --- */
.quantum-glow {
  text-shadow: 0 0 30px rgba(6, 214, 160, 0.3), 0 0 60px rgba(8, 145, 178, 0.1);
}

/* --- Consciousness Wave (decorative bar) --- */
.consciousness-wave {
  position: relative;
  overflow: hidden;
  height: 2px;
  background: rgba(6, 214, 160, 0.1);
}

.consciousness-wave::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(6, 214, 160, 0.8), transparent);
  animation: consciousnessWave 3s ease-in-out infinite;
}

/* --- Glassmorphism Header --- */
.glass-header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(200, 216, 232, 0.15);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-header.scrolled,
header.scrolled {
  background-color: rgba(255, 255, 255, 0.98) !important;
  border-bottom-color: rgba(200, 216, 232, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* --- Scroll-triggered animations --- */
.animate-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays */
.delay-1 { transition-delay: 0.08s; }
.delay-2 { transition-delay: 0.16s; }
.delay-3 { transition-delay: 0.24s; }
.delay-4 { transition-delay: 0.32s; }
.delay-5 { transition-delay: 0.4s; }

/* --- Card quantum hover effects --- */
.quantum-card {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.4s ease;
  position: relative;
  overflow: hidden;
}

.quantum-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #0891B2, #06D6A0);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.quantum-card:hover::before {
  transform: scaleX(1);
}

.quantum-card:hover {
  transform: translateY(-4px);
  border-color: rgba(8, 145, 178, 0.2);
  box-shadow: 0 8px 32px rgba(8, 145, 178, 0.08),
              0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- Quantum Node (for network visualization) --- */
.quantum-node {
  animation: nodeGlow 3s ease-in-out infinite;
}

.quantum-node:nth-child(2) { animation-delay: 1s; }
.quantum-node:nth-child(3) { animation-delay: 2s; }

/* --- Counter Stats (dark section) --- */
.counter-stat {
  animation: counterGlow 3s ease-in-out infinite;
}

.counter-stat:nth-child(2) { animation-delay: 0.5s; }
.counter-stat:nth-child(3) { animation-delay: 1s; }

/* --- Floating elements --- */
.quantum-float {
  animation: quantumFloat 6s ease-in-out infinite;
}

.quantum-float:nth-child(2) { animation-delay: 2s; }
.quantum-float:nth-child(3) { animation-delay: 4s; }

/* --- Glass morphism panels --- */
.glass-panel {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Section label (mono uppercase) --- */
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #0891B2;
}

/* --- CTA buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.875rem 2rem;
  background: #0891B2;
  color: #fff;
  font-weight: 600;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background: #0e7490;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.875rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 0.375rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  border-color: #06D6A0;
  color: #06D6A0;
}

/* --- Custom scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #070F1C;
}

::-webkit-scrollbar-thumb {
  background: rgba(8, 145, 178, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(8, 145, 178, 0.6);
}

/* --- Range input styling --- */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #E2E8F0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0891B2;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

/* --- Mobile nav --- */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.mobile-menu.open {
  max-height: 500px;
}

@media (max-width: 768px) {
  .mobile-nav-open {
    overflow: hidden;
  }
}

/* --- Focus styles --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #0891B2;
  outline-offset: 2px;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .animate-in, .animate-scale { opacity: 1; transform: none; }
  #quantum-canvas { display: none; }
  .consciousness-wave::after { animation: none; }
}

/* --- Firefox scrollbar --- */
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(8, 145, 178, 0.4) #070F1C;
}

/* --- Print styles --- */
@media print {
  .site-header, .site-footer, #quantum-canvas, .hex-overlay,
  header, footer, #cookie-consent-banner {
    display: none;
  }
  body {
    color: #000;
    background: #fff;
  }
}
