/* ================================
   Mobile-First Optimizations
   Enhanced touch targets and mobile UX
   ================================ */

/* ============================================
   TOUCH TARGET OPTIMIZATION
   Minimum 44x44px for all interactive elements
   ============================================ */

@media (max-width: 768px) {
  /* Navigation Touch Targets */
  .nav-links a {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-4);
  }

  .theme-toggle {
    min-width: 48px;
    min-height: 48px;
    padding: var(--space-3);
  }

  .mobile-menu-toggle {
    min-width: 48px;
    min-height: 48px;
    padding: var(--space-3);
  }

  /* Card Touch Targets */
  .photo-card {
    min-height: 200px;
  }

  .work-card,
  .podcast-card {
    min-height: 160px;
    padding: var(--space-6);
  }

  /* Button Touch Targets */
  button,
  .button,
  a.button {
    min-height: 48px;
    padding: var(--space-3) var(--space-6);
  }

  /* Links in text */
  .podcast-link,
  .work-card-read-more,
  .view-all-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
  }

  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  textarea {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Back to top button */
  .back-to-top {
    min-width: 56px;
    min-height: 56px;
    font-size: 24px;
  }
}

/* ============================================
   MOBILE TYPOGRAPHY
   Optimized for readability
   ============================================ */

@media (max-width: 768px) {
  body {
    font-size: 1rem; /* 16px - prevents zoom */
    line-height: 1.6;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.75rem;
    line-height: 1.3;
  }

  h3 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: var(--space-4);
  }

  /* Better reading width on mobile */
  .hero-bio,
  .work-card-description,
  .podcast-card-description {
    max-width: 100%;
  }
}

/* ============================================
   MOBILE SPACING
   Proper breathing room
   ============================================ */

@media (max-width: 768px) {
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .section {
    padding: var(--space-12) 0;
  }

  /* Card spacing */
  .photo-grid-preview,
  .work-grid,
  .podcast-grid {
    gap: var(--space-4);
  }

  .preview-module {
    margin-bottom: var(--space-12);
  }

  /* Hero section */
  .hero {
    padding: var(--space-20) var(--space-4) var(--space-12);
  }

  .hero-bio p {
    margin-bottom: var(--space-4);
  }
}

/* ============================================
   MOBILE PERFORMANCE
   Reduce animations for better performance
   ============================================ */

@media (max-width: 768px) {
  /* Simplify hover effects on mobile (use :active instead) */
  .photo-card:hover,
  .work-card:hover,
  .podcast-card:hover {
    transform: none;
  }

  .photo-card:active,
  .work-card:active,
  .podcast-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* Disable complex animations */
  .photo-card::before,
  .work-card::before,
  .podcast-card::before {
    display: none;
  }

  /* Simplify shadows */
  .photo-card,
  .work-card,
  .podcast-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .photo-card:active,
  .work-card:active,
  .podcast-card:active {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }
}

/* ============================================
   MOBILE NAVIGATION
   Enhanced mobile menu
   ============================================ */

@media (max-width: 768px) {
  .mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background-color: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border);
    z-index: 45;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: var(--space-20) var(--space-6) var(--space-6);
  }

  .mobile-menu.active {
    right: 0;
  }

  .mobile-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    z-index: 40;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-menu-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .mobile-nav-links a {
    display: block;
    padding: var(--space-4);
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-md);
    transition: background-color 0.2s ease;
    min-height: 56px;
    display: flex;
    align-items: center;
  }

  .mobile-nav-links a:active {
    background-color: var(--color-bg-tertiary);
  }

  .mobile-nav-links a.active {
    background-color: var(--color-accent-primary);
    color: var(--color-text-inverse);
  }
}

/* ============================================
   MOBILE-SPECIFIC IMPROVEMENTS
   ============================================ */

@media (max-width: 640px) {
  /* Stack cards on small screens */
  .photo-grid-preview {
    grid-template-columns: 1fr;
  }

  /* Larger text for better readability */
  .hero-tag {
    font-size: 0.75rem;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  /* Reduce padding for more content */
  .work-card,
  .podcast-card {
    padding: var(--space-4);
  }

  .work-card-image {
    height: 180px;
  }

  /* Better image aspect ratios on mobile */
  .photo-card {
    aspect-ratio: 4 / 3;
  }
}

/* ============================================
   LANDSCAPE MOBILE
   Optimize for landscape orientation
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--space-12) var(--space-4);
  }

  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .hero-bio p {
    font-size: 0.9375rem;
  }

  .scroll-indicator {
    display: none;
  }
}

/* ============================================
   SAFE AREAS (iPhone Notch, etc.)
   ============================================ */

@supports (padding: max(0px)) {
  .header {
    padding-left: max(var(--space-4), env(safe-area-inset-left));
    padding-right: max(var(--space-4), env(safe-area-inset-right));
  }

  .mobile-menu {
    padding-right: max(var(--space-6), env(safe-area-inset-right));
  }

  .back-to-top {
    bottom: max(2rem, env(safe-area-inset-bottom) + 1rem);
    right: max(2rem, env(safe-area-inset-right) + 1rem);
  }
}

/* ============================================
   REDUCE MOTION
   Respect user 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 {
    animation: none;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   Better accessibility
   ============================================ */

@media (prefers-contrast: high) {
  .photo-card,
  .work-card,
  .podcast-card {
    border-width: 2px;
  }

  button,
  .button {
    border: 2px solid currentColor;
  }
}
