/* ==========================================================================
   Landing Builder — Mobile & Responsive Enhancements
   Comprehensive mobile-first adjustments across all sections.
   Loaded after frontend.css.
   Breakpoints:
     - Large desktop  > 1440px
     - Desktop        1024px - 1440px
     - Tablet landscape 768px - 1024px
     - Tablet portrait  600px - 768px
     - Mobile           400px - 600px
     - Small mobile     < 400px
   ========================================================================== */

/* ============================================================
   TABLET LANDSCAPE (max-width: 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .wrap { padding: 0 20px; }
  .section-pad { padding: 80px 0; }

  /* Hero */
  .hero { padding: 60px 0 80px; }
  .hero-grid { gap: 40px; }
  .hero-visual { height: 480px; }

  /* Why */
  .why-visual { padding: 40px; }

  /* Diploma */
  .diploma-box { padding: 44px; }

  /* Final CTA */
  .final-cta { padding: 64px 36px; }

  /* Footer */
  footer { padding: 50px 0 24px; }
}

/* ============================================================
   TABLET PORTRAIT (max-width: 880px)
   ============================================================ */
@media (max-width: 880px) {
  /* Section spacing */
  .section-pad { padding: 64px 0; }
  .section-head { margin-bottom: 40px; }

  /* Hero */
  .hero { padding: 40px 0 60px; }
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero h1 { font-size: clamp(32px, 7vw, 48px); }
  .hero .lead { font-size: 16px; max-width: 100%; }
  .hero-visual { height: 380px; order: -1; }
  .hero-center { width: 200px; height: 200px; }
  .hero-center .material-icons { font-size: 90px; }
  .hero-blob { width: 320px; height: 320px; }
  .orbit-ring { width: 290px; height: 290px; }

  /* Float cards smaller on tablet */
  .float-card { padding: 14px 18px; gap: 10px; }
  .float-card .ico { width: 38px; height: 38px; }
  .float-card .ico .material-icons { font-size: 20px; }
  .float-card .ttl { font-size: 13px; }
  .float-card .sub { font-size: 11px; }
  .fc-1 { top: 10px; right: 20px; }
  .fc-2 { top: 150px; left: 0; }
  .fc-3 { top: 280px; right: 40px; }

  /* Why */
  .why-grid { grid-template-columns: 1fr; gap: 40px; }
  .why-visual { padding: 32px; }

  /* Features */
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .feature-card { padding: 22px 20px; }

  /* Trail */
  .trail-stops { grid-template-columns: 1fr; gap: 20px; }
  .stop::after { display: none; }

  /* Categories */
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }

  /* Courses */
  .course-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }

  /* Diploma */
  .diploma-box { grid-template-columns: 1fr; padding: 32px; gap: 30px; }
  .diploma-box h2 { font-size: 26px; }

  /* Pricing */
  .price-grid { grid-template-columns: 1fr; gap: 20px; max-width: 480px; margin: 30px auto 0; }
  .price-card.featured { transform: none; }
  .price-card.featured:hover { transform: translateY(-6px); }
  .price-card { padding: 28px 24px; }

  /* Passport */
  .cert-grid { grid-template-columns: 1fr; gap: 40px; }
  .passport-card { padding: 28px; }

  /* Testimonials */
  .testi-grid { grid-template-columns: repeat(2, 1fr); }

  /* FAQ */
  .faq-list { max-width: 100%; }
  summary { padding: 18px 20px; font-size: 15px; }
  details p { padding: 0 20px 18px; font-size: 14px; }

  /* Final CTA */
  .final-cta { padding: 56px 28px; }
  .final-cta p { font-size: 15px; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  footer { padding: 48px 0 24px; }

  /* Mobile nav dropdown — fix position to be relative to .nav */
  .nav { position: relative; }
  .nav-links.ldb-open {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    gap: 4px;
  }
  .nav-links.ldb-open a {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 15px;
  }
  .nav-links.ldb-open a:hover {
    background: var(--bg);
  }
}

/* ============================================================
   MOBILE (max-width: 600px)
   ============================================================ */
@media (max-width: 600px) {
  /* Wrap */
  .wrap { padding: 0 16px; }

  /* Section spacing */
  .section-pad { padding: 50px 0; }
  .section-head { margin-bottom: 32px; }
  .section-head h2 { font-size: clamp(24px, 6vw, 30px); }
  .section-head p { font-size: 15px; }

  /* Nav */
  .nav { padding: 14px 16px; }
  .logo { font-size: 18px; gap: 8px; }
  .logo-mark { width: 34px; height: 34px; }
  .logo-mark .material-icons { font-size: 19px; }
  .nav-cta { padding: 9px 18px; font-size: 13px; }
  .nav-cta .material-icons { font-size: 16px; }

  /* Hero */
  .hero { padding: 30px 0 50px; }
  .hero h1 { font-size: clamp(28px, 8vw, 36px); line-height: 1.2; }
  .hero .lead { font-size: 15px; margin-top: 18px; }
  .hero-ctas { gap: 10px; margin-top: 28px; }
  .btn-primary, .btn-secondary {
    padding: 13px 24px;
    font-size: 14px;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }
  .btn-primary .material-icons, .btn-secondary .material-icons { font-size: 18px; }
  .hero-stats { gap: 20px; margin-top: 32px; }
  .stat .num { font-size: 22px; }
  .stat .lbl { font-size: 12px; }

  /* Hero visual: smaller */
  .hero-visual { height: 320px; }
  .hero-center { width: 160px; height: 160px; }
  .hero-center .material-icons { font-size: 70px; }
  .hero-blob { width: 240px; height: 240px; }
  .orbit-ring { width: 230px; height: 230px; }
  .fc-1 { top: 0; right: 10px; }
  .fc-2 { top: 130px; left: 0; }
  .fc-3 { top: 240px; right: 20px; }

  /* Pills */
  .pill { font-size: 12px; padding: 6px 14px; margin-bottom: 14px; }

  /* Features */
  .features-grid { grid-template-columns: 1fr; gap: 14px; }
  .feature-card { padding: 20px 18px; }
  .feature-card .icon { width: 48px; height: 48px; margin-bottom: 14px; }
  .feature-card .icon .material-icons { font-size: 24px; }
  .feature-card h3 { font-size: 16px; }
  .feature-card p { font-size: 14px; }

  /* Trail */
  .trail-stops { grid-template-columns: 1fr; gap: 16px; }
  .stop { padding: 24px 20px; }
  .stop-num { width: 52px; height: 52px; font-size: 22px; }
  .stop h3 { font-size: 17px; }

  /* Categories */
  .cat-grid { grid-template-columns: 1fr; gap: 12px; }
  .cat-card { padding: 18px 16px; }

  /* Courses */
  .course-grid { grid-template-columns: 1fr; gap: 16px; }
  .course-thumb { height: 130px; padding: 16px; }
  .course-thumb .icon-bg { width: 48px; height: 48px; top: 14px; left: 14px; }
  .course-thumb .icon-bg .material-icons { font-size: 26px; }
  .course-thumb .badge { font-size: 11.5px; padding: 5px 12px; }
  .course-body { padding: 18px; }
  .course-body h3 { font-size: 15px; }
  .course-body p { font-size: 13px; margin-bottom: 14px; }
  .course-meta { font-size: 11.5px; padding-top: 14px; }

  /* Diploma */
  .diploma-box { padding: 24px; border-radius: 22px; }
  .diploma-box h2 { font-size: 22px; }
  .diploma-box p { font-size: 14px; }
  .diploma-list li { font-size: 13.5px; padding: 12px 14px; }
  .diploma-list li .check { width: 24px; height: 24px; }
  .diploma-list li .check .material-icons { font-size: 16px; }

  /* Pricing */
  .price-card { padding: 24px 20px; }
  .price-card h3 { font-size: 22px; }
  .price-amt { font-size: 36px; }

  /* Passport */
  .passport-card { padding: 24px; }
  .passport-head { margin-bottom: 22px; }
  .passport-head h3 { font-size: 17px; }
  .stamps { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stamp { font-size: 10.5px; padding: 8px; }
  .stamp b { font-size: 11.5px; }

  /* Testimonials */
  .testi-grid { grid-template-columns: 1fr; gap: 16px; }
  .testi-card { padding: 22px 20px; }
  .testi-card .quote .material-icons { font-size: 44px; }
  .testi-card p { font-size: 14px; margin: 22px 0 18px; }

  /* FAQ */
  summary { padding: 16px 18px; font-size: 14px; gap: 10px; }
  summary .plus { width: 30px; height: 30px; }
  summary .plus .material-icons { font-size: 18px; }
  details p { padding: 0 18px 16px; font-size: 13.5px; }

  /* Final CTA */
  .final-cta { padding: 44px 22px; border-radius: 22px; }
  .final-cta h2 { font-size: clamp(22px, 6vw, 28px); }
  .final-cta p { font-size: 14.5px; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-brand p { font-size: 13.5px; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
    padding-top: 20px;
  }
  .footer-bottom p { font-size: 12px; }

  /* Compare rows */
  .compare-row { padding: 14px 16px; gap: 12px; }
  .compare-row .ico { width: 40px; height: 40px; }
  .compare-row .body b { font-size: 14px; }
  .compare-row .body small { font-size: 12px; }
  .compare-row .tag { font-size: 11px; padding: 4px 10px; }
}

/* ============================================================
   SMALL MOBILE (max-width: 400px)
   ============================================================ */
@media (max-width: 400px) {
  /* Hero — hide middle float card for clarity */
  .hero-visual { height: 280px; }
  .hero-center { width: 140px; height: 140px; }
  .hero-center .material-icons { font-size: 60px; }
  .fc-2 { display: none; }

  /* Hero stats stack */
  .hero-stats {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }

  /* Hero CTAs stack */
  .hero-ctas {
    flex-direction: column;
    width: 100%;
  }
  .btn-primary, .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  /* Passport stamps 1 column */
  .stamps { grid-template-columns: 1fr; }

  /* Nav CTA shorter */
  .nav-cta { padding: 8px 14px; font-size: 12px; }
  .nav-cta .material-icons { display: none; }

  /* Pricing */
  .price-card { padding: 22px 18px; }
  .price-amt { font-size: 32px; }

  /* Final CTA */
  .final-cta { padding: 36px 18px; }

  /* Section spacing tighter */
  .section-pad { padding: 40px 0; }

  /* Logo text smaller */
  .logo { font-size: 16px; }
}

/* ============================================================
   EXTRA SMALL (max-width: 360px)
   ============================================================ */
@media (max-width: 360px) {
  .wrap { padding: 0 14px; }
  .hero h1 { font-size: 26px; }
  .hero .lead { font-size: 14px; }
  .section-head h2 { font-size: 22px; }

  /* Hide orbit ring on very small screens */
  .orbit-ring { display: none; }

  /* Reduce hero visual height */
  .hero-visual { height: 240px; }
  .hero-center { width: 120px; height: 120px; }
  .hero-center .material-icons { font-size: 52px; }

  /* Hide badge from course thumb to save space */
  .course-thumb .badge { display: none; }

  /* Footer brand description tighter */
  .footer-brand p { max-width: 100%; }
}

/* ============================================================
   LARGE DESKTOP (min-width: 1440px)
   ============================================================ */
@media (min-width: 1440px) {
  .wrap { max-width: 1320px; }
  .hero h1 { font-size: clamp(42px, 4vw, 68px); }
  .section-pad { padding: 120px 0; }
}

/* ============================================================
   EXTRA LARGE (min-width: 1920px)
   ============================================================ */
@media (min-width: 1920px) {
  .wrap { max-width: 1440px; }
  body { font-size: 17px; }
}

/* ============================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover transforms on touch devices to prevent sticky states */
  .feature-card:hover,
  .course-card:hover,
  .testi-card:hover,
  .price-card:hover,
  .cat-card:hover,
  .stop:hover,
  .stamp:hover,
  .compare-row:hover {
    transform: none;
  }

  /* Make tap targets bigger */
  .nav-links a { padding: 12px 8px; }
  .footer-col ul li { margin-bottom: 14px; }
  .footer-col ul a { display: inline-block; padding: 4px 0; }
  .socials a { width: 44px; height: 44px; }
  .socials .material-icons { font-size: 20px; }
  summary { min-height: 48px; }

  /* Slower float animations on touch to save battery */
  .fc-1, .fc-2, .fc-3 {
    animation-duration: 12s;
  }

  /* Larger tap area for price CTA */
  .price-cta { padding: 18px; }

  /* Larger course card tap area */
  .course-card { cursor: pointer; }

  /* Hide .arrow on cat-card since tap takes care of it */
  .cat-card .arrow { display: none; }
}

/* ============================================================
   REDUCED MOTION (accessibility)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fc-1, .fc-2, .fc-3,
  .hero-blob, .orbit-ring {
    animation: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto !important; }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ============================================================
   PRINT (clean printable version)
   ============================================================ */
@media print {
  header,
  .nav-toggle,
  .nav-cta,
  .hero-visual,
  .float-card,
  .orbit-ring,
  .hero-blob,
  .final-cta .btn-primary,
  .socials,
  .footer-bottom p:last-child {
    display: none !important;
  }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .section-pad { padding: 20px 0; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .feature-card, .cat-card, .course-card, .testi-card, .price-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  a { color: #000 !important; text-decoration: underline; }
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 10pt;
  }
}

/* ============================================================
   DARK MODE COMPATIBILITY (auto-detect)
   Note: This does NOT enable dark mode for the landing page —
   the landing page intentionally keeps its light design.
   This just prevents flash-of-wrong-color in browsers that
   prefer dark but where the page should still render light.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  /* Keep light theme — no overrides needed. The page is intentionally light. */
}

/* ============================================================
   SAFETY: prevent horizontal overflow on all viewports
   ============================================================ */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
img, video, svg, iframe {
  max-width: 100%;
  height: auto;
}
section, header, footer, .wrap, .hero-visual {
  max-width: 100%;
  box-sizing: border-box;
}

/* ============================================================
   VIEWPORT HEIGHT FIXES (mobile browser URL bar issue)
   Use 100dvh where supported, fallback to 100vh.
   ============================================================ */
@supports (height: 100dvh) {
  .hero-visual { min-height: auto; }
}

/* ============================================================
   FIX: long URLs and words should wrap on mobile
   ============================================================ */
p, h1, h2, h3, h4, li, a, span, b, small {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* But preserve code/mono spacing */
pre, code, .wp-block-code {
  overflow-wrap: normal;
  word-break: normal;
}

/* ============================================================
   SAFARI iOS FIXES
   - Fix 100vh issue (use -webkit-fill-available)
   - Fix input zoom (font-size: 16px on inputs)
   ============================================================ */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari specific */
  .hero-visual {
    height: 380px;
  }
  /* Prevent input zoom on iOS */
  input, select, textarea {
    font-size: 16px;
  }
}

/* ============================================================
   ANDROID CHROME FIXES
   - Fix viewport units
   ============================================================ */
@media (max-width: 600px) {
  /* Force minimum tap target size */
  button,
  .nav-cta,
  .btn-primary,
  .btn-secondary,
  .price-cta,
  .footer-col ul a,
  .socials a,
  .nav-links a {
    min-height: 44px;
    min-width: 44px;
  }
  /* But not for inline elements that shouldn't be that tall */
  .footer-col ul a,
  .nav-links a {
    min-height: 40px;
  }
}
