:root {
  color-scheme: dark;
  --color-primary: #22d3ee;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-bg: #020617;
  --color-surface: #0f172a;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv05", "cv11", "ss01";
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
}

/* Skip to main content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: var(--color-bg);
  padding: 8px 16px;
  z-index: 9999;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  transition: top 0.3s;
}
.skip-link:focus {
  top: 0;
}

/* Enhanced focus states for accessibility */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Selection styling */
::selection {
  background: rgba(34, 211, 238, 0.3);
  color: #fff;
}

/* Multi-layer Mesh Background with animation */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ambient-bg::before {
  content: "";
  position: absolute;
  top: -20%; left: -10%; width: 60%; height: 60%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.08) 0%, transparent 70%);
  filter: blur(80px);
  animation: float-slow 20s ease-in-out infinite;
}
.ambient-bg::after {
  content: "";
  position: absolute;
  bottom: -10%; right: -5%; width: 50%; height: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
  filter: blur(100px);
  animation: float-slow 25s ease-in-out infinite reverse;
}

@keyframes float-slow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -20px) scale(1.05); }
}

/* Noise Grain Texture */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
}

/* Glass morphism effects */
.glass {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.3), rgba(15, 23, 42, 0.2));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.glass-card:hover {
  border-color: rgba(34, 211, 238, 0.2);
  box-shadow: 0 35px 70px -15px rgba(0, 0, 0, 0.7), 0 0 40px -15px rgba(34, 211, 238, 0.1);
}

/* Custom Range Slider with better accessibility */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  transition: background 0.2s;
}
input[type=range]:hover::-webkit-slider-runnable-track {
  background: rgba(255, 255, 255, 0.2);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  margin-top: -8px;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15), 0 4px 12px rgba(0,0,0,0.4);
  border: 2px solid var(--color-primary);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}
input[type=range]:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.2), 0 6px 16px rgba(0,0,0,0.5);
}
input[type=range]:active::-webkit-slider-thumb {
  transform: scale(1.2);
}
input[type=range]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.3), 0 6px 16px rgba(0,0,0,0.5);
}

/* Firefox range slider styles */
input[type=range]::-moz-range-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}
input[type=range]::-moz-range-thumb {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: 2px solid var(--color-primary);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15), 0 4px 12px rgba(0,0,0,0.4);
}

/* Animation for brand */
@keyframes brand-pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.2)); }
  50% { filter: drop-shadow(0 0 20px rgba(34, 211, 238, 0.45)); }
}
.neon-brand { animation: brand-pulse 4s infinite ease-in-out; }

/* Fade in animation for content */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in-up 0.6s ease-out forwards;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 10px;
  transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

/* Loading state */
.loading-shimmer {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* Print styles */
@media print {
  .ambient-bg, .noise-overlay, header, footer {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
  .glass-card {
    background: white !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
  }
}

/* Noscript SEO content */
.noscript-seo {
  padding: 40px 20px;
  max-width: 800px;
  margin: 0 auto;
  font-family: system-ui, sans-serif;
  line-height: 1.7;
  color: #f8fafc;
}
.noscript-seo h1 { color: #22d3ee; margin-bottom: 20px; font-size: 1.8em; }
.noscript-seo h2 { color: #10b981; margin: 24px 0 12px; font-size: 1.3em; }
.noscript-seo h3 { color: #22d3ee; margin-bottom: 12px; }
.noscript-seo p { margin-bottom: 16px; }
.noscript-seo ul { margin-bottom: 16px; padding-left: 24px; }
.noscript-seo li { margin-bottom: 8px; }
.noscript-seo nav { margin-top: 32px; padding-top: 24px; border-top: 1px solid #334155; }
.noscript-seo a { color: #22d3ee; text-decoration: none; }
.noscript-seo a:hover { text-decoration: underline; }
