/* 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) {
  /* Hide desktop navigation on mobile */
  nav ul,
  .nav-links,
  #main-menu {
    display: none;
  }

  nav ul.active,
  .nav-links.active,
  #main-menu.active {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.98);
    z-index: 9998;
    padding: 1rem 0;
    margin: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  nav ul.active li,
  .nav-links.active li,
  #main-menu.active li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0;
  }

  nav ul.active a,
  .nav-links.active a,
  #main-menu.active a {
    display: block;
    padding: 1.25rem 1.5rem;
    color: white !important;
    font-size: 1.125rem;
    text-decoration: none;
    min-height: 56px;
    width: 100%;
    animation: none !important; /* Disable color animation in mobile menu */
  }

  nav ul.active a:hover,
  .nav-links.active a:hover,
  #main-menu.active a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #a5c916 !important;
  }

  .header-container {
    padding: 0.75rem 1rem;
  }

  .mobile-menu-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    font-size: 1.5rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #9acd32;
    cursor: pointer;
  }

  .mobile-menu-btn.active {
    color: #f59e0b;
  }

  /* 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;
  }

  /* Ensure logo doesn't shrink too much */
  .logo a {
    font-size: clamp(1.25rem, 4vw, 1.5rem) !important;
  }

  /* Header buy button adjustments */
  .header-buy-button {
    position: fixed;
    top: 10px;
    right: 60px;
    z-index: 10001;
    padding: 8px 16px;
    font-size: 0.875rem;
  }

  .header-buy-button a {
    padding: 10px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
}

/* ============================================
   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: 5rem 1rem 3rem;
    min-height: auto;
    text-align: center;
    background-attachment: scroll !important; /* Better performance on mobile */
  }

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

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

  .hero p,
  .hero-subtitle {
    font-size: clamp(1rem, 4vw, 1.125rem);
    margin-bottom: 2rem;
    line-height: 1.6;
  }

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

  .hero-buttons .btn {
    width: 100%;
    max-width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
  }

  /* Audience hero sections */
  .audience-hero {
    padding: 5rem 1rem 3rem !important;
  }

  .audience-hero h1 {
    font-size: clamp(1.5rem, 7vw, 2.25rem) !important;
    line-height: 1.3;
  }

  .audience-hero p {
    font-size: clamp(1rem, 4vw, 1.125rem) !important;
  }
}

/* ============================================
   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 !important; /* Prevents zoom on iOS */
    min-height: 44px;
    padding: 12px 16px;
    border-radius: 8px;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
  }

  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,
  .newsletter form {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .newsletter-form input,
  .newsletter form input {
    width: 100%;
    box-sizing: border-box;
  }

  .newsletter-form button,
  .newsletter form button {
    width: 100%;
    min-height: 44px;
  }

  /* Age guide forms */
  .age-guide-form,
  .guide-download-form {
    padding: 1.5rem 1rem !important;
  }

  .age-guide-form input,
  .guide-download-form input {
    width: 100%;
    box-sizing: border-box;
  }

  .age-guide-form button,
  .guide-download-form button {
    width: 100%;
    min-height: 44px;
  }

  /* CTA sections */
  .cta-group {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .cta-group .btn,
  .cta-group a {
    width: 100%;
    min-height: 44px;
    padding: 14px 24px;
  }

  .final-cta-section {
    padding: 3rem 1rem !important;
  }

  .final-cta-section h2 {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
  }
}

/* ============================================
   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 !important;
    gap: 2rem;
    text-align: center;
  }

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

  .footer-section h3,
  .footer-section h4 {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    margin-bottom: 1rem;
  }

  .footer-links-container {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

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

  .footer-links-column ul {
    list-style: none;
    padding: 0;
  }

  .footer-links-column a {
    padding: 0.75rem 1rem;
    display: block;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

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

  .footer-legal {
    flex-direction: column;
    gap: 1rem;
  }

  .footer-legal a {
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .social-links {
    justify-content: center;
    gap: 1rem;
  }
}

/* ============================================
   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 {
    position: fixed !important;
    bottom: 10px !important;
    left: 10px !important;
    z-index: 99999 !important;
    padding: 10px 16px;
    font-size: 0.875rem;
  }
  
  .header-buy-button {
    top: 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;
  }

  /* Audience pages mobile styles */
  .age-sections {
    padding: 2rem 0 !important;
  }

  .age-group {
    margin-bottom: 2rem;
    padding: 1.5rem 1rem;
  }

  .age-group h3 {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
    margin-bottom: 1rem;
  }

  .age-group ul {
    padding-left: 1.5rem;
  }

  .age-group li {
    margin-bottom: 0.75rem;
    font-size: 1rem;
  }

  .benefits-grid,
  .testimonials-grid,
  .unique-features {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }

  .benefit-card,
  .testimonial-card,
  .unique-feature {
    padding: 1.5rem;
  }

  .who-section,
  .unique-section,
  .testimonials-section {
    padding: 3rem 1rem !important;
  }

  .who-section h2,
  .unique-section h2,
  .testimonials-section h2 {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
    margin-bottom: 2rem;
  }

  /* Media preview section */
  .media-preview-section {
    padding: 3rem 1rem !important;
  }

  .media-preview-grid {
    grid-template-columns: 1fr !important;
  }

  .media-preview-card {
    padding: 1.5rem;
  }

  .audio-player audio,
  .video-player video {
    width: 100%;
    max-width: 100%;
  }

  /* Fixed buy button mobile */
  .fixed-buy-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    z-index: 99999 !important;
    padding: 12px 20px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .fixed-buy-button a {
    padding: 10px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

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

  section {
    padding: 3rem 1rem !important;
  }

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

  /* Tables */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Images */
  img {
    max-width: 100%;
    height: auto;
  }

  .book-cover,
  .author-image {
    max-width: 100%;
    margin: 0 auto;
    display: block;
  }
}

