/* =================================
   MOBILE OPTIMIZATION & FINAL POLISH
   Cross-site improvements and mobile-first enhancements
   ================================= */

/* Enhanced Mobile Navigation */
@media (max-width: 768px) {
  .navbar {
    background: rgba(10, 10, 11, 0.95) !important;
  }
  
  .nav-container {
    padding: 1rem 1.5rem !important;
    min-height: 70px !important;
  }
  
  .nav-logo {
    font-size: 1.25rem;
  }
  
  .nav-menu {
    background: rgba(10, 10, 11, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
    margin: 0 1rem !important;
    max-height: 70vh !important;
  }
  
  .nav-menu.active {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
  }
  
  .menu-toggle {
    padding: 0.75rem !important;
  }
}

/* Touch-friendly buttons */
@media (max-width: 768px) {
  .btn {
    min-height: 48px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  .btn-lg {
    min-height: 56px;
    padding: 1.25rem 2rem;
  }
  
  .tab-button,
  .tier-button,
  .sub-tab-button {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
  }
}

/* Improved text readability on mobile */
@media (max-width: 640px) {
  body {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  h1 {
    font-size: clamp(2rem, 8vw, 3rem) !important;
    line-height: 1.2 !important;
  }
  
  h2 {
    font-size: clamp(1.5rem, 6vw, 2.5rem) !important;
    line-height: 1.3 !important;
  }
  
  h3 {
    font-size: clamp(1.25rem, 5vw, 1.75rem) !important;
    line-height: 1.4 !important;
  }
  
  p {
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }
  
  .hero-subtitle,
  .page-subtitle,
  .section-subtitle {
    font-size: 1.125rem !important;
  }
}

/* Enhanced form inputs for mobile */
@media (max-width: 768px) {
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 48px;
    padding: 0.875rem 1rem;
  }
  
  .form-textarea {
    min-height: 120px;
  }
}

/* Grid responsiveness improvements */
@media (max-width: 1024px) {
  .container {
    padding: 0 1.5rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .section {
    padding: 3rem 0;
  }
  
  .page-hero {
    padding: 120px 0 60px !important;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 100px 0 60px !important;
  }
  
  .section {
    padding: 2.5rem 0;
  }
}

/* Improved card grids for mobile */
@media (max-width: 768px) {
  .features-grid,
  .products-preview,
  .use-case-grid,
  .journey-grid,
  .resources-grid,
  .team-grid,
  .investors-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
  
  .trust-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2rem;
  }
}

@media (max-width: 480px) {
  .trust-grid,
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Enhanced glass effects for better visibility */
.glass-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Smooth scroll improvements */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

/* Better focus states for accessibility */
.btn:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.nav-link:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Loading states */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
  .navbar,
  .footer,
  .scroll-indicator,
  .floating-elements,
  canvas {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .section {
    padding: 1rem 0 !important;
    page-break-inside: avoid;
  }
  
  .glass-card {
    background: white !important;
    border: 1px solid #ddd !important;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-indicator .wheel {
    animation: none;
  }
  
  .floating-elements {
    display: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-secondary: rgba(255, 255, 255, 0.9);
    --text-tertiary: rgba(255, 255, 255, 0.8);
  }
  
  .glass-card {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}
