/* Mobile Optimization Styles */
/* Comprehensive mobile-first optimizations for maxmiles.us */

/* ============================================
   MOBILE TYPOGRAPHY & SCALING
   ============================================ */
@media (max-width: 768px) {
  html {
    font-size: 16px; /* Prevent zoom on iOS */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }

  body {
    font-size: 1rem;
    line-height: 1.6;
  }

  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1.2;
    margin-bottom: 1rem;
  }

  h2 {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    line-height: 1.3;
    margin-bottom: 1rem;
  }

  h3 {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
    line-height: 1.4;
    margin-bottom: 0.875rem;
  }

  h4 {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
  }

  p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1rem;
  }
}

/* ============================================
   TOUCH TARGETS (Minimum 44x44px)
   ============================================ */
@media (max-width: 768px) {
  /* Buttons */
  .btn,
  button,
  input[type="submit"],
  input[type="button"],
  a.btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 24px;
    font-size: 1rem;
    touch-action: manipulation;
  }

  /* Navigation links */
  nav a,
  .nav-links a,
  .footer-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 12px 16px;
  }

  /* Social media icons */
  .social-links a,
  .social-link {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Purchase buttons */
  .purchase-options button,
  .purchase-options a {
    min-height: 48px;
    padding: 14px 20px;
  }

  /* Fixed buy button */
  .fixed-buy-button,
  .header-buy-button {
    min-width: 120px;
    min-height: 44px;
  }
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */
@media (max-width: 768px) {
  .header-container {
    padding: 0.75rem 1rem;
  }

  .mobile-menu-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile menu overlay */
  .mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-menu ul {
    padding: 2rem 1rem;
    list-style: none;
  }

  .mobile-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-menu a {
    display: block;
    padding: 1.25rem 1rem;
    color: white;
    font-size: 1.125rem;
    text-decoration: none;
    min-height: 56px;
  }
}

/* ============================================
   MOBILE LAYOUTS & GRIDS
   ============================================ */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
    max-width: 100%;
  }

  /* Grid adjustments */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* About section */
  .about-content {
    flex-direction: column;
    gap: 2rem;
  }

  .about-img {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
  }

  /* Books section */
  .books-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* Testimonials */
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   MOBILE HERO SECTION
   ============================================ */
@media (max-width: 768px) {
  .hero {
    padding: 6rem 1rem 4rem;
    min-height: auto;
    text-align: center;
  }

  .hero-content {
    max-width: 100%;
    padding: 0 1rem;
  }

  .hero h1 {
    font-size: clamp(2rem, 8vw, 2.5rem);
    margin-bottom: 1.5rem;
  }

  .hero p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================
   MOBILE FORMS
   ============================================ */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 8px;
    -webkit-appearance: none;
    appearance: none;
  }

  textarea {
    min-height: 120px;
    resize: vertical;
  }

  .form-group {
    margin-bottom: 1.5rem;
  }

  .form-group label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: block;
  }

  /* Newsletter form */
  .newsletter-form {
    flex-direction: column;
    gap: 1rem;
  }

  .newsletter-form input {
    width: 100%;
  }

  .newsletter-form button {
    width: 100%;
  }
}

/* ============================================
   MOBILE IMAGES
   ============================================ */
@media (max-width: 768px) {
  img {
    max-width: 100%;
    height: auto;
    display: block;
  }

  /* Responsive images */
  .book-cover,
  .author-image,
  .hero-image {
    width: 100%;
    height: auto;
  }

  /* Newsletter images */
  .newsletter-hero-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
  }
}

/* ============================================
   MOBILE SPACING & PADDING
   ============================================ */
@media (max-width: 768px) {
  section {
    padding: 3rem 0;
  }

  .section-title {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    margin-bottom: 2rem;
    padding: 0 1rem;
  }

  /* Cards */
  .card,
  .book-card,
  .testimonial-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }

  /* FAQ */
  .faq-item {
    margin-bottom: 1rem;
  }

  .faq-question {
    padding: 1rem;
    font-size: 1rem;
  }
}

/* ============================================
   MOBILE FOOTER
   ============================================ */
@media (max-width: 768px) {
  .site-footer {
    padding: 3rem 1rem 2rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-section {
    margin-bottom: 2rem;
  }

  .footer-links-column {
    margin-bottom: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
    padding-top: 2rem;
  }
}

/* ============================================
   MOBILE PERFORMANCE
   ============================================ */
@media (max-width: 768px) {
  /* Reduce animations on mobile for better performance */
  * {
    -webkit-tap-highlight-color: transparent;
  }

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

  /* Optimize transitions */
  * {
    transition-duration: 0.2s;
  }
}

/* ============================================
   SMALL MOBILE (320px - 480px)
   ============================================ */
@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 0.75rem;
  }

  h1 {
    font-size: clamp(1.75rem, 10vw, 2.25rem);
  }

  h2 {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

  section {
    padding: 2rem 0;
  }

  .btn {
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  /* Header adjustments */
  .header-container {
    padding: 0.5rem 0.75rem;
  }

  .logo a {
    font-size: 1.25rem;
  }

  /* Fixed buttons */
  .fixed-buy-button,
  .header-buy-button {
    bottom: 10px;
    right: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
  }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    padding: 4rem 1rem 3rem;
    min-height: auto;
  }

  .mobile-menu {
    padding-top: 1rem;
  }
}

/* ============================================
   TABLET OPTIMIZATIONS (768px - 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 0 2rem;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    font-size: clamp(2.5rem, 5vw, 3rem);
  }

  h2 {
    font-size: clamp(2rem, 4vw, 2.5rem);
  }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
@media (max-width: 768px) {
  /* Focus states for touch */
  a:focus,
  button:focus,
  input:focus,
  textarea:focus,
  select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* Skip to content link */
  .skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
  }

  .skip-to-content:focus {
    top: 0;
  }
}

/* ============================================
   MOBILE-SPECIFIC UTILITIES
   ============================================ */
@media (max-width: 768px) {
  .mobile-hide {
    display: none !important;
  }

  .mobile-show {
    display: block !important;
  }

  .mobile-full-width {
    width: 100% !important;
    max-width: 100% !important;
  }

  .mobile-center {
    text-align: center !important;
  }

  .mobile-no-padding {
    padding: 0 !important;
  }

  .mobile-reduced-padding {
    padding: 1rem !important;
  }
}

