/* ============================================================
   MileMethod — Mobile fixes
   Single override stylesheet, included AFTER each page's <style>.
   Targets: <= 900px (tablet) and <= 640px (phone).
   ============================================================ */

/* ---------- Global mobile-safety primitives ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, svg { max-width: 100%; height: auto; }

/* iOS Safari + Android Chrome both glitch hard on
   background-attachment: fixed (especially with gradient stacks
   and pinch-zoom). Force scroll on mobile so parallax-style
   sections render without jitter and don't crop. */
@media (max-width: 900px) {
  .solution-section,
  .dina-section,
  .commitment-section,
  .cta-banner-wrap {
    background-attachment: scroll, scroll !important;
  }
}

/* ---------- Hamburger / mobile nav UI (injected by mobile-nav.js) ---------- */
.mm-hamburger {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  margin: -0.5rem;
  cursor: pointer;
  color: var(--foreground, #111);
  align-items: center;
  justify-content: center;
  /* >= 44px tap target */
  width: 44px;
  height: 44px;
}
.mm-hamburger svg { width: 24px; height: 24px; display: block; }

/* On dark hero-overlay pages (homepage, results, case-studies) the
   header is initially hidden and slides in on scroll. The hamburger
   should mirror that: above the fold show it on the dark hero;
   on the about page the header is always visible. */
.site-header .mm-hamburger { color: inherit; }

/* Mobile nav drawer */
.mm-nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--background, #fff);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  visibility: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mm-nav-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}
.mm-nav-drawer__top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.mm-nav-drawer__brand {
  font-family: var(--font-serif, system-ui);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.mm-nav-drawer__close {
  width: 44px; height: 44px;
  border: none; background: none;
  font-size: 1.75rem; line-height: 1;
  color: var(--foreground, #111);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.mm-nav-drawer__links {
  display: flex; flex-direction: column;
  padding: 0.5rem 0 1.5rem;
  flex: 1;
}
.mm-nav-drawer__links > a,
.mm-nav-drawer__links > button {
  display: flex; align-items: center;
  padding: 1rem 1.5rem;
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--foreground, #111);
  border: none; background: none;
  text-align: left; width: 100%;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in oklab, var(--border, #e5e7eb) 60%, transparent);
  min-height: 56px;
}
.mm-nav-drawer__group {
  border-bottom: 1px solid color-mix(in oklab, var(--border, #e5e7eb) 60%, transparent);
}
.mm-nav-drawer__group > summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  font-size: 1.0625rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  min-height: 56px;
}
.mm-nav-drawer__group > summary::-webkit-details-marker { display: none; }
.mm-nav-drawer__group > summary::after {
  content: "+";
  font-size: 1.25rem; font-weight: 400;
  color: var(--muted-foreground, #6b7280);
  transition: transform 0.2s;
}
.mm-nav-drawer__group[open] > summary::after { content: "−"; }
.mm-nav-drawer__group__items {
  display: flex; flex-direction: column;
  padding: 0 0 0.5rem;
}
.mm-nav-drawer__group__items a {
  padding: 0.75rem 2.5rem;
  font-size: 0.9375rem;
  color: var(--muted-foreground, #6b7280);
  display: block;
  min-height: 44px;
}
.mm-nav-drawer__cta-row {
  display: flex; flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border, #e5e7eb);
}
.mm-nav-drawer__cta-row .btn-outline,
.mm-nav-drawer__cta-row .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 0.875rem 1.25rem;
  font-size: 1rem;
  min-height: 48px;
}

/* Show the hamburger and force the header chrome to be visible on mobile.
   On dark-overlay pages the header is transform-hidden until scrolled —
   we override that on mobile so the hamburger is always reachable. */
@media (max-width: 900px) {
  .mm-hamburger { display: inline-flex; }

  .site-header {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    background: color-mix(in oklab, var(--background, #fff) 88%, transparent) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border, #e5e7eb);
  }
  .header-inner { padding: 0.75rem 1.25rem !important; }
  .header-inner .logo { font-size: 1.25rem; }
}

/* Lock scroll while drawer is open */
body.mm-no-scroll { overflow: hidden; }

/* ---------- Page-specific mobile patches ---------- */

@media (max-width: 900px) {
  /* index.html — hero device stack */
  .hero-section { padding-top: 5rem !important; }
  .devices-stack { max-width: 100% !important; padding: 0 0.5rem; }
  .iph { right: -0.5rem !important; bottom: -1rem !important; width: 30% !important; }
  .hero-content .grid-2 { gap: 2.5rem !important; }
  .hero-content h1 { font-size: clamp(1.75rem, 7vw, 2.5rem) !important; }

  /* Calculator card — was 80% width, cramped padding on phones */
  .calc-card { width: 100% !important; padding: 1.5rem 1.25rem !important; }
  .calc-option { padding: 0.875rem 1rem !important; min-height: 48px; }

  /* CTA banner */
  .cta-banner { padding: 2rem 1.25rem !important; }
  .cta-btn { padding: 0.875rem 1.5rem !important; font-size: 0.9375rem !important; }

  /* Modal */
  .modal-card { padding: 1.75rem 1.5rem 1.25rem !important; }

  /* Pricing — make sure popular plan doesn't overflow */
  .plan-card { padding: 1.75rem 1.5rem 3rem !important; }
  .plan-card.popular .plan-name { font-size: 2rem !important; }

  /* Case-study cards — readable on small screens */
  .cs-card { padding: 1.5rem !important; }
  .cs-highlights { grid-template-columns: repeat(2, 1fr) !important; }

  /* About page timeline — tighten left rail, give text room */
  .intro__photo { min-height: auto !important; }
  .tl-photo, .tl-collage__tile--full,
  .tl-collage__tile--wide { aspect-ratio: 16/10; }

  /* Calculator results — example cards stack cleanly */
  .examples-card { padding: 1.5rem 1.25rem !important; }

  /* Footer */
  .footer-inner { padding: 3rem 1.5rem !important; gap: 2.5rem !important; }
  .footer-links--grid { grid-template-columns: 1fr !important; }
}

/* Extra tightening for true phone widths */
@media (max-width: 640px) {
  .section { padding: 4rem 1.25rem !important; }
  .proof-inner { padding: 1.5rem 1rem !important; gap: 1rem !important; }
  .proof-number { font-size: 1.5rem !important; }
  .proof-label { font-size: 0.6875rem !important; letter-spacing: 0.12em !important; }

  /* Pricing toggle row wraps on tiny screens */
  .billing-toggle { flex-direction: column; gap: 0.5rem !important; }

  /* Devices stack: iPhone overlap dominates the layout on narrow viewports.
     Hide the inset iPhone to let the MacBook breathe. */
  .iph { display: none !important; }
  .devices-stack { max-width: 22rem; }
}

/* Ensure all tap-able buttons hit 44px minimum on touch devices */
@media (hover: none) and (pointer: coarse) {
  a.btn-outline, a.btn-primary, button.cta-btn, a.cta-btn,
  .plan-cta, .footer-sub-btn, .calc-submit {
    min-height: 44px;
  }
}

/* ---------- Client Results: center IG card thumbnails on mobile ---------- */
@media (max-width: 900px) {
  .ig-card img.ig-card__thumb {
    object-fit: cover !important;
    object-position: center !important;
  }
}

/* ---------- About page: mobile-only overrides ---------- */
@media (max-width: 900px) {
  /* Hide the vertical blue trunk line — it overlaps text/images on mobile */
  .trunk, .trunk::after { display: none !important; }

  /* "Trevor flights" hero photo: fit to screen width */
  .tl-flights, .tl-flights img {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    object-fit: contain !important;
  }
}
