@font-face {
  font-family: 'Montserrat';
  src: url('/fonts/Montserrat-Regular.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

[x-cloak] { 
  display: none !important; 
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin-slow { 
  animation: spin-slow 1.8s ease-in-out forwards; 
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .animate-spin-slow {
    animation: none;
  }
  
  .fade-slide {
    animation: none;
    opacity: 1;
    transform: translateY(0);
  }
}

body {
  font-family: 'Montserrat', sans-serif;
  background: #0e1117;
  color: #E6F0F3;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-top: env(safe-area-inset-top);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0e1117;
  z-index: -2;
}

canvas#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Improve touch targets for mobile */
nav button {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #CCDFFF;
  cursor: pointer;
  font-size: 0.875rem;
  transition: color 0.3s ease;
}

nav button:hover,
nav button:focus {
  color: white;
  outline: none;
}

nav button:focus-visible {
  outline: 2px solid #8dc5ff;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Enhanced hover effects with better accessibility */
ul.list-none li {
  transition: text-shadow 0.3s ease, transform 0.3s ease;
}

ul.list-none li:hover span,
ul.list-none li:focus-within span {
  text-shadow: 0 0 8px #8dc5ff;
  transform: translateY(-2px);
}

/* Loading states */
.loading-skeleton {
  background: linear-gradient(90deg, #1a1d23 25%, #2a2d35 50%, #1a1d23 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-skeleton {
    animation: none;
    background: #1a1d23;
  }
}

/* Section content animations */
.section-content {
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(0);
}

.fade-slide {
  animation: fadeSlideUp 1s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus improvements */
button:focus-visible:not(nav button),
a:focus {
  outline: 2px solid #8dc5ff;
  outline-offset: 2px;
}

/* Skip to content link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #8dc5ff;
  color: #0e1117;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  border-radius: 4px;
}

.skip-link:focus {
  top: 6px;
}

/* Enhanced section transitions */
.section-content {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.section-content.active {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .section-content {
    transition: none;
    opacity: 1;
    transform: translateY(0);
  }
}

/* Error state styling */
.error-state {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
}

/* Fallback for when CDN resources fail */
.cdn-fallback {
  display: none;
}

body.cdn-failed .cdn-fallback {
  display: block;
}

body.cdn-failed [data-requires-cdn] {
  display: none;
}