/**
 * SoulSuite Wellness — Responsive Fixes (Phase 1)
 * Targets: iOS Safari, iPhone viewport, fixed heights, container overflows
 * Add AFTER landing-page.css in wp_enqueue_scripts (higher priority)
 * ---------------------------------------------------------------
 */

/* ============================================================
   1. GLOBAL iOS FIXES
   ============================================================ */

/* Prevent horizontal scroll on all devices */
html,
body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  /* Fix iOS rubber-band scroll and viewport height issues */
  -webkit-overflow-scrolling: touch;
}

/* Ensure all images are responsive by default */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Fix box-sizing universally (belt-and-suspenders) */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ============================================================
   2. HERO SECTION — iOS HEIGHT FIX
   Hero uses min-height: 100svh which is good, but iOS Safari
   has issues with 100vh. The ::before overlay also needs check.
   ============================================================ */

.hero-section {
  /* svh (small viewport height) is the safest unit for iOS */
  min-height: 100svh;
  /* Fallback for older iOS that doesn't support svh */
  min-height: -webkit-fill-available;
  /* Remove fixed padding on small screens; use min-height instead */
  padding: 80px 20px;
  /* background-attachment: fixed breaks on iOS — force scroll */
  background-attachment: scroll !important;
  background-size: cover !important;
  background-position: center center !important;
  /* Ensure content stacks properly */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Fix the overlay pseudo-element for iOS */
.hero-section::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

/* Hero content should never overflow its container */
.hero-content {
  width: 100%;
  max-width: 1200px;
  padding: 0 20px;
  margin: 0 auto;
}

/* ============================================================
   3. CONTAINER — Remove fixed padding on small screens
   ============================================================ */

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px; /* override the 40px default on mobile */
}

/* ============================================================
   4. BURNOUT & ABOUT SECTIONS — Remove min-width that breaks mobile
   The min-width: 600px on .burnout-text and .owner-info is the
   PRIMARY cause of horizontal overflow on iPhone.
   ============================================================ */

.burnout-text,
.owner-info {
  min-width: 0 !important; /* CRITICAL: kills the 600px min-width */
  width: 100%;
}

.burnout-content,
.owner-content {
  flex-wrap: wrap; /* allow columns to wrap */
}

/* Fix hardcoded image heights */
.burnout-image img,
.owner-image img {
  height: auto !important; /* override fixed px heights */
  max-height: 400px;
  object-fit: cover;
  width: 100%;
}

/* ============================================================
   5. TYPOGRAPHY — Prevent font overflow on narrow screens
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Hero title — clamp() scales fluidly without media query hacks */
.hero-title {
  font-size: clamp(1.2rem, 4vw, 2rem);
  line-height: 1.2;
}

.hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.5rem);
}

.hero-description,
.hero-description p {
  font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
}

/* ============================================================
   6. BUTTON — Full-width on very small screens, never overflow
   ============================================================ */

.hero-btn,
.primary-btn,
.secondary-btn {
  word-break: keep-all;
  white-space: normal;
  max-width: 100%;
}

/* ============================================================
   7. SERVICES GRID — Single column on mobile
   ============================================================ */

.services-grid {
  grid-template-columns: 1fr !important;
}

/* ============================================================
   8. SYSTEM RESET / MATRIX SECTION
   ============================================================ */

.system-reset-section {
  padding: 60px 20px;
}

.system-matrix-points {
  width: 100%;
}

.system-matrix-point {
  width: 100%;
  min-width: 0;
}

/* ============================================================
   9. HERO BACKGROUND IMAGE — Ensure bg image always renders
   The inline style from the customizer sets background-image,
   but overflow:hidden on .hero-section can clip it on iOS.
   ============================================================ */

.hero-section {
  /* Ensure the section itself is the positioning context */
  position: relative;
  /* Prevent clipping the background on iOS */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* When a background image is set via inline style, make sure
   it wins over the ::before overlay opacity */
.hero-section[style*="background-image"] {
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-attachment: scroll !important; /* never fixed on mobile */
}

/* ============================================================
   10. HERO DESCRIPTION — Mobile short version
   Add data-mobile-text attribute on the <p> OR use CSS to
   truncate with a "show more" feel. We hide the long desktop
   text on mobile and show a condensed version via ::before.
   SIMPLER approach: just control font-size + max lines on mobile.
   ============================================================ */

/* Desktop: full description shown */
.hero-description .hero-desc-mobile {
  display: none;
}
.hero-description .hero-desc-desktop {
  display: block;
}

/* Mobile: swap to short version */
@media screen and (max-width: 768px) {
  .hero-description .hero-desc-desktop {
    display: none;
  }
  .hero-description .hero-desc-mobile {
    display: block;
    color: #fcfffd;
    font-family: 'Inter', sans-serif;
    font-size: 16px !important;
    line-height: 1.6;
    max-width: 680px;
    margin: 0 auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* ============================================================
   11. MEDIA QUERIES — Clean overrides for mobile breakpoints
   ============================================================ */

/* Tablets and large phones (≤ 1024px) */
@media screen and (max-width: 1024px) {
  .burnout-content,
  .owner-content {
    flex-direction: column;
    gap: 2rem;
  }

  .owner-image,
  .burnout-image {
    max-width: 100%;
    flex: none;
  }

  .burnout-text,
  .owner-info {
    flex: none;
    width: 100%;
    min-width: 0 !important;
  }
}

/* Standard mobile (≤ 768px) */
@media screen and (max-width: 768px) {
  .container,
  .burnout-section .container,
  .system-reset-section .container {
    padding: 0 16px;
  }

  /* ── Hero: exact sizes you specified ── */
  .hero-section {
    padding: 60px 0 !important;
    min-height: 150vh !important;
  }

  .hero-title {
    font-size: 28px !important;
    line-height: 1.2;
    margin-bottom: 0.8rem;
  }

  .hero-subtitle {
    font-size: 18px !important;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
  }

  /* The <p> inside .hero-description (desktop version when shown) */
  .hero-description,
  .hero-description p {
    font-size: 16px !important;
  }

  .hero-logo .home-logo,
  .hero-logo img {
    width: 180px;
    max-width: 60vw;
    height: auto;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .hero-btn {
    width: 100%;
    max-width: 320px;
    padding: 14px 24px;
    font-size: 14px;
    text-align: center;
  }

  /* Remove justify on mobile — reads poorly in narrow columns */
  .burnout-text p,
  .owner-bio p {
    text-align: left;
  }

  .about-owner,
  .burnout-section {
    padding: 50px 0;
  }

  .owner-info {
    padding: 24px 16px;
  }

  .burnout-text {
    padding: 24px 16px;
  }

  /* Services */
  .service-card {
    min-height: auto !important;
    padding: 24px 16px;
  }
}

/* Small phones (≤ 480px) */
@media screen and (max-width: 480px) {
  .hero-section {
    padding: 50px 12px !important;
  }

  .hero-title {
    font-size: 26px !important;
  }

  .hero-logo .home-logo,
  .hero-logo img {
    width: 150px;
    max-width: 55vw;
  }

  .hero-btn {
    font-size: 13px;
    padding: 12px 20px;
    letter-spacing: 0.5px;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .owner-image img,
  .burnout-image img {
    max-height: 280px;
  }

  /* System reset matrix */
  .system-matrix-point {
    padding: 14px 12px;
  }

  .system-reset-section .reset-title {
    font-size: 1.4rem;
  }
}

/* ============================================================
   10. iOS SAFARI — SPECIFIC PATCHES
   ============================================================ */

/* Fix -webkit-fill-available for iOS address bar compensation */
@supports (-webkit-touch-callout: none) {
  .hero-section {
    /* iOS Safari reports incorrect 100vh — use fill-available */
    min-height: -webkit-fill-available;
  }
}

/* Disable background-attachment: fixed completely on touch devices
   (parallax with fixed BG is broken on all iOS versions) */
@media (hover: none) and (pointer: coarse) {
  .hero-section,
  .burnout-section,
  .about-owner,
  .system-reset-section {
    background-attachment: scroll !important;
  }
}

/* NOTE: Gradient text rule removed — -webkit-text-fill-color: transparent without
   a matching background gradient makes text invisible on Chrome/Firefox/desktop.
   Only apply background-clip: text on elements that already have a gradient background. */

/* Prevent tap highlight flash on buttons */
.hero-btn,
.primary-btn,
.service-btn {
  -webkit-tap-highlight-color: transparent;
}