/* ==========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ========================================== */

/* ==========================================
   BASE / MOBILE STYLES (< 640px)
   Applied by default
   ========================================== */

/* Mobile-optimized hero section */
@media (max-width: 640px) {
  #hero {
    min-height: 90vh;
    padding: var(--spacing-md) var(--spacing-sm);
  }

  .hero-image {
    width: 180px;
    height: 180px;
    box-shadow:
      0 15px 40px rgba(139, 92, 246, 0.25),
      0 0 0 6px rgba(139, 92, 246, 0.08);
    border: 3px solid var(--bg-white);
  }

  .brand-name {
    font-size: 2.5rem;
    letter-spacing: -0.01em;
  }

  .tagline {
    font-size: 0.9rem;
    padding: 0 var(--spacing-sm);
  }

  .scroll-indicator {
    bottom: var(--spacing-sm);
  }

  /* Apps section mobile */
  #apps {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .section-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
  }

  .apps-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    padding: 0;
  }

  .app-card {
    padding: 1.5rem;
    border-radius: 1.5rem;
  }

  .app-icon {
    width: 90px;
    height: 90px;
    margin-bottom: 1rem;
  }

  .app-name {
    font-size: 1.25rem;
  }

  .app-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .download-btn {
    padding: 0.65rem 1.75rem;
    font-size: 0.9rem;
  }

  /* Social section mobile */
  #social {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .social-links {
    gap: 1rem;
  }

  .social-btn {
    width: 50px;
    height: 50px;
  }

  .social-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Footer mobile */
  footer {
    padding: var(--spacing-sm);
    font-size: 0.8rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-sm);
  }

  .footer-links {
    justify-content: center;
    gap: var(--spacing-sm);
  }

  /* Reduce 3D effects on mobile for performance */
  .app-card:hover {
    transform: translateY(-8px);
  }

  .app-card:hover .app-icon {
    transform: scale(1.08);
  }

  /* Disable complex animations on mobile */
  .app-card::after,
  .app-card::before {
    display: none;
  }
}

/* ==========================================
   SMALL MOBILE (< 400px)
   ========================================== */
@media (max-width: 400px) {
  .hero-image {
    width: 160px;
    height: 160px;
  }

  .brand-name {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.85rem;
  }

  .app-card {
    padding: 1.25rem;
  }

  .app-icon {
    width: 80px;
    height: 80px;
  }

  .download-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.85rem;
  }
}

/* ==========================================
   TABLET / MEDIUM DEVICES (641px - 1024px)
   ========================================== */
@media (min-width: 641px) and (max-width: 1024px) {
  #hero {
    min-height: 95vh;
    padding: var(--spacing-lg) var(--spacing-md);
  }

  .hero-image {
    width: 220px;
    height: 220px;
  }

  .brand-name {
    font-size: 3rem;
  }

  .tagline {
    font-size: 1rem;
  }

  /* Apps grid - 2 columns on tablet */
  .apps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
    max-width: 900px;
  }

  .app-card {
    padding: 2rem;
  }

  .app-icon {
    width: 110px;
    height: 110px;
  }

  .section-title {
    font-size: 2.25rem;
  }

  /* Social section */
  .social-btn {
    width: 56px;
    height: 56px;
  }

  /* Enable most hover effects on tablet */
  .app-card:hover {
    transform: translateY(-10px) translateZ(15px);
  }

  .app-card:hover .app-icon {
    transform: scale(1.12) rotateY(6deg) rotateX(-4deg);
  }
}

/* ==========================================
   DESKTOP / LARGE DEVICES (1025px+)
   ========================================== */
@media (min-width: 1025px) {
  #hero {
    min-height: 100vh;
    padding: var(--spacing-xl) var(--spacing-md);
  }

  .hero-image {
    width: 280px;
    height: 280px;
  }

  .brand-name {
    font-size: 4rem;
  }

  .tagline {
    font-size: 1.125rem;
  }

  /* Apps grid - 3 columns on desktop */
  .apps-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    max-width: var(--max-width);
  }

  .app-card {
    padding: 2.5rem;
  }

  .app-icon {
    width: 120px;
    height: 120px;
  }

  .section-title {
    font-size: 2.5rem;
  }

  /* Full 3D effects on desktop */
  .app-card:hover {
    transform: translateY(-12px) translateZ(20px);
  }

  .app-card:hover .app-icon {
    transform: scale(1.15) rotateY(8deg) rotateX(-5deg);
  }

  /* Social buttons */
  .social-btn {
    width: 60px;
    height: 60px;
  }

  /* Enable all advanced effects */
  .app-card::after,
  .app-card::before {
    display: block;
  }
}

/* ==========================================
   LARGE DESKTOP (1400px+)
   ========================================== */
@media (min-width: 1400px) {
  .hero-image {
    width: 300px;
    height: 300px;
  }

  .brand-name {
    font-size: 4.5rem;
  }

  .tagline {
    font-size: 1.25rem;
  }

  #apps,
  #social {
    padding: 8rem var(--spacing-md);
  }

  .apps-grid {
    gap: 4rem;
  }

  .section-title {
    font-size: 3rem;
    margin-bottom: 5rem;
  }
}

/* ==========================================
   ULTRA-WIDE SCREENS (1920px+)
   ========================================== */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }

  .apps-grid {
    max-width: 1400px;
  }
}

/* ==========================================
   LANDSCAPE ORIENTATION
   ========================================== */
@media (orientation: landscape) and (max-height: 600px) {
  #hero {
    min-height: auto;
    padding: 3rem var(--spacing-md);
  }

  .hero-image {
    width: 150px;
    height: 150px;
  }

  .brand-name {
    font-size: 2.5rem;
  }

  .tagline {
    font-size: 0.9rem;
  }

  .scroll-indicator {
    display: none;
  }
}

/* ==========================================
   TOUCH DEVICES
   ========================================== */
@media (hover: none) and (pointer: coarse) {
  /* Optimize for touch interactions */
  .download-btn,
  .social-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Use active states instead of hover */
  .app-card:active {
    transform: translateY(-8px);
    box-shadow:
      0 20px 40px -10px rgba(139, 92, 246, 0.25),
      0 10px 20px -8px rgba(139, 92, 246, 0.15);
  }

  .social-btn:active {
    transform: scale(1.1);
  }

  .download-btn:active {
    transform: translateY(-2px) scale(1.02);
  }

  /* Disable hover-only effects */
  .app-card:hover .app-icon {
    transform: none;
  }

  .app-card::after,
  .app-card::before {
    display: none;
  }
}

/* ==========================================
   HIGH RESOLUTION DISPLAYS
   ========================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Enhance for retina displays */
  .hero-image,
  .app-icon {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
  * {
    animation: none !important;
    transition: none !important;
  }

  #hero {
    min-height: auto;
    page-break-after: always;
  }

  .scroll-indicator {
    display: none;
  }

  .app-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .download-btn,
  .social-btn {
    display: none;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ==========================================
   ACCESSIBILITY - KEYBOARD NAVIGATION
   ========================================== */
@media (prefers-reduced-motion: no-preference) {
  /* Enable smooth focus transitions */
  a:focus-visible,
  button:focus-visible {
    transition: outline-offset 0.2s ease;
  }
}

/* ==========================================
   DARK MODE SUPPORT (Optional)
   ========================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-light: #9CA3AF;
    --bg-white: #111827;
    --bg-gray: #1F2937;
    --bg-light-gray: #374151;
  }

  .app-card {
    background: #1F2937;
    border: 1px solid #374151;
  }

  .hero-image {
    border-color: #1F2937;
    box-shadow:
      0 20px 60px rgba(139, 92, 246, 0.4),
      0 0 0 8px rgba(139, 92, 246, 0.15);
  }

  footer {
    border-top-color: #374151;
  }

  /* Adjust shadows for dark mode */
  .app-card:hover {
    box-shadow:
      0 25px 50px -12px rgba(139, 92, 246, 0.4),
      0 15px 30px -10px rgba(139, 92, 246, 0.2);
  }
}

/* ==========================================
   CONTRAST PREFERENCES
   ========================================== */
@media (prefers-contrast: high) {
  .app-card {
    border: 2px solid var(--primary-purple);
  }

  .download-btn {
    border: 2px solid var(--bg-white);
  }

  a:focus-visible,
  button:focus-visible {
    outline-width: 4px;
  }
}

/* ==========================================
   CONTAINER QUERIES (Modern Browsers)
   ========================================== */
@supports (container-type: inline-size) {
  .apps-grid {
    container-type: inline-size;
  }

  @container (max-width: 700px) {
    .app-card {
      padding: 1.5rem;
    }
  }
}
