/* =========================================================
   Senior Developer Improvements for Mine Drop
   Performance, UX, and Code Quality Enhancements
   ========================================================= */

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* Lazy loading optimization */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

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

/* Reduce motion for accessibility */
@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;
  }
}

/* ===== UX IMPROVEMENTS ===== */

/* Enhanced focus states for accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--diamond, #4fe7ff);
  outline-offset: 2px;
}

/* Better hover states */
.nav a {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced button interactions */
.btn-gold-big,
.btn-header,
.slot-btn {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-gold-big::before,
.btn-header::before,
.slot-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-gold-big:active::before,
.btn-header:active::before,
.slot-btn:active::before {
  width: 300px;
  height: 300px;
}

/* ===== PERFORMANCE & ANIMATIONS ===== */

/* GPU acceleration for smooth animations */
.hero,
.header,
.slot-machine,
.reel {
  transform: translateZ(0);
  will-change: transform;
}

/* Optimized animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply to content sections */
.content > * {
  animation: fadeInUp 0.6s ease-out forwards;
}

.content > *:nth-child(1) { animation-delay: 0.1s; }
.content > *:nth-child(2) { animation-delay: 0.2s; }
.content > *:nth-child(3) { animation-delay: 0.3s; }
.content > *:nth-child(4) { animation-delay: 0.4s; }

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Better mobile navigation */
@media (max-width: 768px) {
  .nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100vh;
    background: rgba(10, 14, 12, 0.98);
    flex-direction: column;
    justify-content: flex-start;
    padding: 80px 20px 20px;
    transition: left 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
  }
  
  .nav.active {
    left: 0;
  }
  
  .nav a {
    margin: 10px 0;
    font-size: 18px;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* Mobile menu toggle */
  .mobile-menu-toggle {
    display: block;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    margin: 2px 0;
    transition: all 0.3s ease;
  }
  
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
}

@media (min-width: 769px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* ===== CODE QUALITY IMPROVEMENTS ===== */

/* CSS Custom Properties for better maintainability */
:root {
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --border-radius-small: 8px;
  --border-radius-medium: 12px;
  --border-radius-large: 18px;
  --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Consistent spacing */
.section-spacing {
  margin: 60px 0;
}

.element-spacing {
  margin: 20px 0;
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* 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;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-gold-big,
  .btn-header,
  .slot-btn {
    border: 2px solid #000;
  }
  
  .nav a {
    border-bottom: 2px solid transparent;
  }
  
  .nav a:focus {
    border-bottom-color: #fff;
  }
}

/* ===== ERROR HANDLING & LOADING STATES ===== */

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

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

/* Error states */
.error {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 10px;
  border-radius: var(--border-radius-small);
}

/* ===== PERFORMANCE MONITORING ===== */

/* Debug mode for performance */
.debug-mode * {
  outline: 1px solid rgba(255, 0, 0, 0.3);
}

/* ===== ENHANCED TYPOGRAPHY ===== */

/* Better text rendering */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Improved readability */
.content {
  line-height: 1.7;
  max-width: 65ch; /* Optimal reading width */
}

/* ===== INTERACTIVE ELEMENTS ===== */

/* Enhanced slot machine */
.slot-machine {
  perspective: 1000px;
}

.reel {
  transform-style: preserve-3d;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.reel.spinning {
  animation: spin 0.1s linear infinite;
}

@keyframes spin {
  0% { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); }
  100% { -webkit-transform: rotateX(360deg); transform: rotateX(360deg); }
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */

/* Better responsive typography */
@media (max-width: 480px) {
  html { font-size: 14px; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }
}

@media (min-width: 1200px) {
  html { font-size: 18px; }
  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.8rem; }
  h3 { font-size: 1.4rem; }
}

/* ===== CROSS-BROWSER COMPATIBILITY ===== */

/* Firefox fixes */
@-moz-document url-prefix() {
  .btn-gold-big,
  .btn-header,
  .slot-btn {
    padding-bottom: 13px; /* Firefox button padding fix */
  }
}

/* Safari fixes */
@supports (-webkit-appearance: none) {
  .slot-machine {
    -webkit-transform: translateZ(0);
  }
}
