/* Responsive Design - Mobile First Approach */
/* Modern Rust Affiliate Site */

/* Base Mobile Styles (320px+) */
@media (max-width: 767.98px) {
  /* Typography adjustments */
  :root {
    --font-size-6xl: 2.5rem;
    --font-size-5xl: 2rem;
    --font-size-4xl: 1.75rem;
    --font-size-3xl: 1.5rem;
    --space-24: 4rem;
    --space-20: 3rem;
    --space-16: 2.5rem;
  }

  /* Container */
  .container {
    padding: 0 var(--space-4);
  }

  /* Header */
  .main-nav {
    padding: var(--space-3) 0;
  }

  .nav-content {
    position: relative;
  }

  .logo a {
    font-size: var(--font-size-lg);
  }

  .logo-icon {
    width: 35px;
    height: 35px;
    margin-right: var(--space-2);
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-top: var(--space-4);
    flex-direction: column;
    gap: var(--space-4);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-menu a {
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
  }

  .nav-menu a:hover {
    background: rgba(0, 212, 255, 0.1);
  }

  .nav-cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    width: 30px;
    height: 30px;
    cursor: pointer;
    z-index: 1001;
  }

  .nav-toggle span {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }

  /* Hero Section */
  .hero {
    min-height: 100vh;
    padding: var(--space-20) 0 var(--space-12);
    text-align: center;
  }

  .hero-title {
    font-size: var(--font-size-4xl);
    line-height: 1.2;
    margin-bottom: var(--space-6);
  }

  .hero-description {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-8);
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-6);
    margin-bottom: var(--space-10);
  }

  .stat-divider {
    display: none;
  }

  .hero-cta {
    flex-direction: column;
    gap: var(--space-4);
    align-items: center;
  }

  .btn-large {
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-size-base);
    width: 100%;
    max-width: 280px;
  }

  /* Featured Sites */
  .featured-sites {
    padding: var(--space-16) 0;
  }

  .section-title {
    font-size: var(--font-size-3xl);
    line-height: 1.3;
  }

  .section-description {
    font-size: var(--font-size-base);
  }

  .sites-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-12);
  }

  .site-card {
    padding: var(--space-6);
  }

  .card-header {
    margin-bottom: var(--space-5);
  }

  .site-badge {
    font-size: 10px;
    padding: var(--space-1) var(--space-2);
  }

  .logo-bg {
    width: 50px;
    height: 50px;
  }

  .site-name {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-2);
  }

  .site-features {
    gap: var(--space-2);
    margin-bottom: var(--space-5);
  }

  .feature-tag {
    padding: var(--space-2);
    font-size: var(--font-size-xs);
  }

  .bonus-highlight {
    padding: var(--space-3);
  }

  /* How It Works */
  .how-it-works {
    padding: var(--space-16) 0;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    max-width: none;
  }

  .step-arrow {
    display: none;
  }

  .step-card {
    padding: var(--space-6);
  }

  .step-icon {
    width: 50px;
    height: 50px;
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-3);
  }

  .step-card h3 {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-2);
  }

  /* Trust Section */
  .trust-section {
    padding: var(--space-16) 0;
  }

  .trust-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-8);
  }

  .trust-features {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .trust-feature {
    padding: var(--space-5);
  }

  .feature-icon {
    width: 40px;
    height: 40px;
    font-size: var(--font-size-base);
    margin-bottom: var(--space-3);
  }

  .feature-content h4 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-1);
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    padding: var(--space-12) 0;
    text-align: center;
  }

  .footer-links {
    flex-direction: column;
    gap: var(--space-8);
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .footer-badges {
    justify-content: center;
  }

  /* Utilities */
  .cursor-dot,
  .cursor-outline {
    display: none;
  }

  .floating-shapes {
    display: none;
  }

  .scroll-to-top {
    bottom: 20px !important;
    right: 20px !important;
    width: 45px !important;
    height: 45px !important;
  }
}

/* Enhanced Mobile Performance */
@media (max-width: 767.98px) {
  /* Disable resource-intensive features */
  .bg-animation,
  .floating-shapes {
    display: none !important;
  }
  
  /* Simplify shadows and effects */
  :root {
    --glow-primary: none;
    --glow-secondary: none;
    --glow-accent: none;
    --shadow-xl: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  /* Improve text readability */
  .container {
    padding: 0 1rem;
  }
  
  /* Better button spacing */
  .hero-cta .btn {
    width: 100%;
    max-width: 320px;
    margin-bottom: 1rem;
  }
  
  /* Optimize card performance */
  .blog-card,
  .site-card {
    will-change: auto;
    transform: none !important;
  }
  
  .blog-card:hover,
  .site-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-md);
  }
}

/* Tablet Styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023.98px) {
  /* Container */
  .container {
    padding: 0 var(--space-6);
  }

  /* Header */
  .nav-menu {
    gap: var(--space-6);
  }

  .nav-cta .btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
  }

  /* Hero */
  .hero-title {
    font-size: var(--font-size-5xl);
  }

  .hero-description {
    font-size: var(--font-size-lg);
  }

  .hero-stats {
    gap: var(--space-6);
  }

  .hero-cta {
    gap: var(--space-6);
  }

  /* Featured Sites */
  .sites-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }

  .site-card:first-child {
    grid-column: 1 / -1;
    max-width: 500px;
    margin: 0 auto;
  }

  /* How It Works */
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }

  .step-arrow {
    display: none;
  }

  /* Trust Section */
  .trust-features {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }

  .trust-feature:last-child {
    grid-column: 1 / -1;
    max-width: 400px;
    margin: 0 auto;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
  }

  .footer-links {
    gap: var(--space-8);
  }
}

/* Desktop Styles (1024px - 1439px) */
@media (min-width: 1024px) and (max-width: 1439.98px) {
  /* Container */
  .container {
    max-width: 1000px;
    padding: 0 var(--space-6);
  }

  /* Navigation */
  .nav-menu {
    gap: var(--space-6);
  }

  /* Featured Sites */
  .sites-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }

  .site-card.featured-card {
    grid-column: 1 / -1;
    max-width: 600px;
    margin: 0 auto;
  }

  /* How It Works */
  .steps-grid {
    max-width: 900px;
  }

  /* Trust Section */
  .trust-features {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }

  .sites-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .site-card.featured-card {
    grid-column: auto;
  }
}

/* Ultra Wide Screens (1920px+) */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }

  .hero-title {
    font-size: 4rem;
  }

  .section-title {
    font-size: 3.5rem;
  }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .logo-icon,
  .feature-icon,
  .step-icon {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Landscape Mobile Phones */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--space-12) 0 var(--space-8);
  }

  .hero-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-4);
  }

  .hero-stats {
    flex-direction: row;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }

  .stat-divider {
    display: block;
    width: 1px;
    height: 30px;
  }

  .hero-scroll-indicator {
    display: none;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .site-card:hover,
  .trust-feature:hover,
  .step-card:hover {
    transform: none;
    box-shadow: none;
  }

  /* Increase button sizes for better touch targets */
  .btn {
    min-height: 48px;
    padding: var(--space-4) var(--space-6);
  }

  .nav-menu a {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .social-link {
    width: 48px;
    height: 48px;
  }

  /* Remove cursor effects */
  .cursor-dot,
  .cursor-outline {
    display: none !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-behavior: auto !important;
  }

  .parallax-element {
    transform: none !important;
  }

  .floating-shapes {
    display: none;
  }

  .particle-field {
    display: none;
  }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
  /* Already optimized for dark mode by default */
}

/* Light Mode Support */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-primary: #e2e8f0;
    --border-secondary: #cbd5e1;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .nav-toggle,
  .hero-cta,
  .scroll-to-top,
  .floating-shapes,
  .particle-field,
  .cursor-dot,
  .cursor-outline,
  .footer-bottom {
    display: none !important;
  }

  .hero {
    min-height: auto;
    padding: var(--space-8) 0;
  }

  .site-card,
  .trust-feature,
  .step-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* Container Queries (Future-proofing) */
@supports (container-type: inline-size) {
  .sites-grid {
    container-type: inline-size;
  }

  @container (max-width: 600px) {
    .site-card {
      padding: var(--space-4);
    }
  }
}

/* Focus Styles for Accessibility */
.btn:focus,
.nav-menu a:focus,
.social-link:focus,
.nav-toggle:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Skip to Content Link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
}

.skip-to-content:focus {
  top: 6px;
}