/* ============================================================
   landscape.css — Landscape phone layout fix (Path 1)
   ============================================================
   Loaded by index.html and all 14 inner pages.

   Single source of truth for the landscape phone layout.
   Only fires on short landscape screens (phones). Tablets and
   desktops are untouched.

   Strategy: apply mobile-like single-column layout, then center
   content within the wide landscape viewport.

   Many selectors are home-page-specific (#hero, #problem, .pillar,
   .conditions-grid, etc.). On inner pages they're inert — no harm.
   The shared rules (nav, footer, body text size, padding) apply
   to every page.
   ============================================================ */

/* ----- Global iOS Safari fix (applies always, all viewports) -----
   Disables iOS auto-text-scaling that inflates multi-line text in narrow
   flex containers. Without this, long wrapping symptom items and FAQ
   questions render at ~2x size in landscape on iPhone Safari while short
   items render correctly. This affects every page that loads landscape.css. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ----- iOS Safari safe-area handling (Apr 15 2026) -----
   Pairs with viewport-fit=cover meta tag added to all 15 HTML pages.
   Without these rules, Safari's bottom toolbar overlays the bottom of the
   viewport, making footer links unreliable to tap and leaving a phantom
   white bar between content and toolbar.

   env(safe-area-inset-*) returns 0 on browsers that don't support it,
   so this is a graceful no-op on Android/desktop. */

/* Footer — add bottom padding to clear the iOS Safari toolbar overlay zone.
   Combined value: existing 28px design padding + device safe-area inset. */
footer {
  padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important;
}

/* Mobile drawer (slide-out menu on inner pages) — respect safe areas
   so menu items aren't hidden under the toolbar/home indicator. */
.mobile-drawer {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ----- Drawer focus ring fix (all viewports, all pages) -----
   When the drawer opens, JS calls .focus() on the first link (the wordmark).
   Safari shows its default focus outline → a box appears around ACUNATOMY®.
   Suppress the outline for non-keyboard focus, keep it for Tab-key users
   via :focus-visible. Also covers Safari's tap highlight.
   The brand link is suppressed entirely — it's the programmatic-focus target
   on drawer open, and Safari treats that as :focus-visible on iOS. */
.mobile-drawer a,
.mobile-drawer button { -webkit-tap-highlight-color: transparent; }
.mobile-drawer a:focus:not(:focus-visible),
.mobile-drawer button:focus:not(:focus-visible) { outline: none !important; }
.mobile-drawer a:focus-visible,
.mobile-drawer button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mobile-drawer-brand:focus,
.mobile-drawer-brand:focus-visible { outline: none !important; }

/* ----- Button :visited + sticky-hover fix (all viewports, all pages) -----
   Calendly link gets marked :visited after first tap. Without explicit
   :visited rules the text/background color can shift. Also, mobile Safari
   keeps :hover styles stuck after tapping a link that navigates away.
   Fix: lock :visited to default colors, disable hover color-flip on
   touch devices, use :active for momentary tap feedback instead. */
.nav-cta:visited { color: var(--gold) !important; background: var(--ink) !important; }
.btn-primary:visited { color: var(--gold) !important; background: var(--ink) !important; }
.btn-ghost:visited { color: var(--warm-gray) !important; border-bottom-color: var(--rule) !important; }
.cta-link-quiet:visited { color: var(--ink) !important; border-bottom-color: rgba(166,138,74,0.35) !important; }

@media (hover: none) {
  .nav-cta:hover { background: var(--ink) !important; color: var(--gold) !important; }
  .nav-cta:active { background: var(--gold) !important; color: var(--ivory) !important; }
  .btn-primary:hover { background: var(--ink) !important; color: var(--gold) !important; }
  .btn-primary:active { background: var(--gold) !important; color: var(--ivory) !important; }
  .btn-ghost:hover { color: var(--warm-gray) !important; border-color: var(--rule) !important; }
  .btn-ghost:active { color: var(--gold) !important; border-color: var(--gold) !important; }
}

@media (max-height: 500px) and (orientation: landscape) {
  /* Nav — wordmark hard-left, links with 24px gaps, BOOK A VISIT anchored far right.
     margin-left:auto on .nav-cta-wrap pushes it to the right edge, absorbing all
     leftover space between INSURANCE and BOOK A VISIT. Extra right padding clears scrollbar. */
  nav { padding: 10px calc(68px + env(safe-area-inset-right)) 10px env(safe-area-inset-left) !important; justify-content: flex-start !important; }
  nav.scrolled { padding: 8px calc(68px + env(safe-area-inset-right)) 8px env(safe-area-inset-left) !important; }
  .nav-brand { margin-top: 0 !important; margin-right: 16px !important; flex-shrink: 0 !important; }
  .nav-wordmark { font-size: 0.9rem !important; letter-spacing: 0.14em !important; }
  .nav-tagline { display: none !important; }
  .nav-phone { display: none !important; }
  .nav-links { gap: 18px !important; margin-right: 0 !important; flex-shrink: 0 !important; }
  .nav-links li { flex-shrink: 0 !important; }
  .nav-links a,
  .nav-conditions-trigger {
    font-size: 0.65rem !important;
    letter-spacing: 0.1em !important;
    white-space: nowrap !important;
  }
  .nav-cta {
    font-size: 0.65rem !important;
    letter-spacing: 0.1em !important;
    padding: 7px 14px !important;
    white-space: nowrap !important;
  }
  .nav-cta-wrap { gap: 0 !important; margin-top: 0 !important; margin-left: auto !important; padding-left: 12px !important; flex-shrink: 0 !important; }

  /* Collapse all multi-column sections to single column */
  #hero { grid-template-columns: 1fr !important; min-height: 0 !important; padding-top: 60px !important; }
  .hero-left { border-right: none !important; border-bottom: 1px solid var(--rule) !important; }
  #problem { grid-template-columns: 1fr !important; gap: 0 !important; }
  #about { grid-template-columns: 1fr !important; gap: 32px !important; align-items: start !important; }
  .treatment-cards { grid-template-columns: 1fr !important; gap: 1px !important; }
  .how-steps { grid-template-columns: 1fr !important; }
  .approach-methods { grid-template-columns: 1fr !important; }
  .acu-detail-grid { grid-template-columns: 1fr !important; }
  .conditions-grid { grid-template-columns: 1fr 1fr !important; }

  /* Center content in a ~640px column — wide horizontal padding */
  /* Sections with full-bleed backgrounds keep the background, content centers via padding */
  .hero-left, .hero-right {
    padding-left: 146px !important;
    padding-right: 146px !important;
    padding-top: 48px !important;
    padding-bottom: 48px !important;
  }
  #problem, #transformation, #how-it-works, #approach,
  #conditions, #about, #logistics, #cta {
    padding-left: 146px !important;
    padding-right: 146px !important;
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }
  footer {
    padding-left: 146px !important;
    padding-right: 146px !important;
  }

  /* Type — scale to mobile-appropriate sizes */
  .hero-headline { font-size: 2.4rem !important; margin-top: 18px !important; }
  .hero-subhead { font-size: 0.85rem !important; white-space: normal !important; }
  .hero-body, .hero-support { font-size: 0.85rem !important; }
  .problem-headline { font-size: 1.8rem !important; margin-bottom: 24px !important; text-align: center !important; }
  .problem-body { text-align: center !important; }
  .transformation-headline { font-size: 1.8rem !important; margin-bottom: 24px !important; }
  .how-heading { font-size: 1.6rem !important; margin-bottom: 32px !important; }
  .conditions-intro-head { font-size: 1.5rem !important; }
  .about-headline { font-size: 1.8rem !important; margin-bottom: 24px !important; text-align: center !important; }
  .about-body { text-align: center !important; }
  .logistics-head { font-size: 1.5rem !important; margin-bottom: 20px !important; }
  .cta-headline { font-size: 2rem !important; margin-bottom: 24px !important; }

  /* Body paragraphs */
  .problem-body, .transformation-body, .approach-body, .about-body,
  .method-desc, .step-body { font-size: 0.85rem !important; line-height: 1.75 !important; }

  /* Normalize ALL body text — <p> tags AND div-based text containers */
  section p,
  section [class*="-body"],
  section [class*="-desc"],
  section [class*="-text"]:not([class*="-title"]):not([class*="-label"]),
  section .pain-text, section .pillar-desc, section .step-desc, section .step-text,
  section .value-copy, section .info-text, section .info-value,
  section .method-desc, section .condition-desc,
  .problem-subtitle, .transformation-subtitle,
  .logistics-body, .conditions-intro-body, .about-body--intro {
    font-size: 0.85rem !important;
    line-height: 1.75 !important;
    text-align: center !important;
  }
  /* FAQ question text on inner pages — match portrait base size (0.72rem) */
  .condition-faq-item button span:first-child { font-size: 0.72rem !important; letter-spacing: 0.14em !important; }
  .condition-faq-answer p { font-size: 0.72rem !important; line-height: 1.95 !important; }
  /* Testimonial quotes — keep a touch bigger for visual weight */
  .carousel-slide p { font-size: 0.9rem !important; line-height: 1.7 !important; }

  /* Hero location line — hide dot, shrink text, stack on two lines if needed */
  .hero-location { display: block !important; text-align: center !important; }
  .hero-location .loc-dot { display: none !important; }
  .hero-location .loc-text {
    font-size: 0.58rem !important;
    letter-spacing: 0.18em !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
  }

  /* Approach "If it's been persistent, it's addressable" italic line */
  .conditions-intro-head { font-size: 1.3rem !important; }

  /* Gold callout box in Approach section — bump back up for visual weight */
  #approach > div > .reveal-delay-2 > p:first-child {
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }
  #approach > div > .reveal-delay-2 > p:last-child {
    font-size: 0.88rem !important;
  }

  /* Decorative watermark on #transformation — shrink it */
  #transformation::before { font-size: 6rem !important; }

  /* Testimonials — hide desktop grids, show mobile carousel in landscape */
  .reviews-desktop { display: none !important; }
  .reviews-carousel { display: block !important; }

  /* ----- Landscape revisions (Apr 14 2026, pass 2) ----- */

  /* (1) Hero loc-text — broad section [class*="-text"] selector at L855 was winning
     on specificity (0,0,3,1 vs 0,0,2,0). Add #hero prefix to override and shrink. */
  #hero .hero-location .loc-text {
    font-size: 0.5rem !important;
    letter-spacing: 0.16em !important;
    line-height: 1.5 !important;
    opacity: 0.7 !important;
  }

  /* (2) "Learn to live with it" — inline margin:-64px 0 0 0 pulls it ABOVE
     "The Problem" label. Override so it sits BELOW the label with breathing room. */
  #problem .problem-subtitle {
    margin: 28px 0 12px 0 !important;
  }
  /* And give the headline a touch of top margin so it doesn't crowd the subtitle */
  #problem .problem-headline {
    margin-top: 28px !important;
  }

  /* (3) Reviews carousel — center stars row, name, and conditions row.
     The quote <p> is already centered via the broad text rule. */
  .reviews-carousel .carousel-slide > div {
    text-align: center !important;
    justify-content: center !important;
  }

  /* (4) Hip & Glute — match portrait behavior: highlighted cell + MOST COMMON badge.
     Mirrors L533–536 for landscape viewport. */
  .conditions-grid .condition-type--desktop { display: none !important; }
  .conditions-grid .condition-type--mobile { display: block !important; }
  a[href="/conditions/hip-glute-pain"].condition-cell {
    background: var(--gold-pale) !important;
  }
  a[href="/conditions/hip-glute-pain"].condition-cell .condition-type--mobile {
    display: inline-block !important;
    background: var(--gold) !important;
    color: var(--ivory) !important;
    padding: 5px 12px !important;
    margin-top: 10px !important;
    font-size: 0.58rem !important;
    letter-spacing: 0.18em !important;
    border: none !important;
  }

  /* (5) Footer — force all 6 nav items onto one line. Mirrors portrait rule L518–520. */
  footer { padding-left: 60px !important; padding-right: 60px !important; }
  .footer-links {
    flex-wrap: nowrap !important;
    gap: 14px !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .footer-links li { flex-shrink: 0 !important; margin: 0 !important; padding: 0 !important; }
  .footer-links a {
    font-size: 0.5rem !important;
    letter-spacing: 0.08em !important;
    white-space: nowrap !important;
  }

  /* ----- Inner-page top spacing -----
     Inner pages have desktop padding-top values (120px on breadcrumb-bar,
     70px on .condition-hero) sized for the tall portrait nav. In landscape
     the nav is compact (~40px), so this leaves a huge empty band at the top.
     Pull breadcrumb and hero up close to the nav. */
  .breadcrumb-bar { padding-top: 56px !important; padding-bottom: 0 !important; }
  .condition-hero { padding-top: 24px !important; }
  .about-hero, .first-visit-hero { padding-top: 56px !important; }

  /* ----- Home-page-specific text bumps (Apr 15, pass 3) -----
     User flagged these specific spots as still too small in landscape.
     All selectors are home-page-only — inner pages have different structure
     (.symptom-text, .condition-faq, .treatment-card) and won't be affected.
     Target: ~1rem body, 0.95rem italic captions. */

  /* (1) Hero subhead "It keeps coming back. There's a reason." */
  #hero .hero-subhead { font-size: 1rem !important; }

  /* (2) Hero loc-text "FAIR LAWN, NJ · OUT-OF-NETWORK INSURANCE WELCOME"
     — bump up from 0.5rem (was too small to read) */
  #hero .hero-location .loc-text {
    font-size: 0.7rem !important;
    opacity: 0.85 !important;
  }

  /* (3) The Cycle / Misconception body in the bordered cards */
  #problem .pain-text { font-size: 1rem !important; line-height: 1.7 !important; }

  /* (4) "Learn to live with it" italic tagline */
  #problem .problem-subtitle { font-size: 1rem !important; }

  /* (5) "When your pain has been passed..." Combination block (4 inline-styled <p>s) */
  #difference p { font-size: 1rem !important; line-height: 1.6 !important; }

  /* (6) Approach gold-bordered callout — bump existing rule higher */
  #approach > div > .reveal-delay-2 > p:first-child {
    font-size: 1.15rem !important;
    line-height: 1.55 !important;
  }
  #approach > div > .reveal-delay-2 > p:last-child {
    font-size: 1rem !important;
  }

  /* (7) Transformation slash-through items + their gold replacements */
  #transformation .transformation-inner > .reveal-delay-2 p {
    font-size: 1rem !important;
    line-height: 1.6 !important;
  }

  /* (8) Stakes line "The longer it goes... who you are" */
  .stakes-line { font-size: 1rem !important; line-height: 1.7 !important; }

  /* (9) Compensating + compound prose lines */
  .compensating-line, .compound-line { font-size: 1rem !important; line-height: 1.65 !important; }

  /* (10) CTA "Begin Here" intro italic line ("Moving without calculating...") */
  #cta .cta-inner > p:not(.cta-label) { font-size: 0.95rem !important; line-height: 1.6 !important; }

  /* (11) Review carousel quotes — bump from 0.9 to 1rem */
  .carousel-slide p { font-size: 1rem !important; line-height: 1.7 !important; }

  /* ----- Inner condition page bumps (Apr 15, pass 4) -----
     User flagged these still-too-small spots on condition pages in landscape.
     All 12 condition pages share these uniform patterns. Targets via attribute
     selectors since the elements have no class names. */

  /* What's At Stake — body prose ("The longer your X stays locked...")
     The section is identifiable by its unique inline style. */
  section[style*="background: var(--ink)"][style*="rgba(166,138,74,0.15)"] p[style*="rgba(245,240,232,0.7)"] {
    font-size: 1rem !important;
    line-height: 1.65 !important;
  }

  /* Cochrane-style evidence callout — gold-left-bordered italic stat box.
     Appears on all 12 condition pages with the same wrapping div pattern. */
  div[style*="border-left:3px solid var(--gold)"] p {
    font-size: 1rem !important;
    line-height: 1.65 !important;
  }

  /* Transformation slash-through items + their gold replacements (condition pages).
     These <p> tags have inline font-size:1.1rem; in landscape the broad body
     rule was forcing them to 0.85rem. Restore to match desktop intent (1.1rem). */
  p[style*="text-decoration:line-through"],
  p[style*="text-decoration:line-through"] + p,
  p[style*="line-through"] ~ p[style*="color:var(--gold)"] {
    font-size: 1.1rem !important;
    line-height: 1.6 !important;
  }

  /* Inner condition page testimonial — single review block (Lisa M., etc.).
     Inline font-size:1.2rem was being forced to 0.85rem by the broad body rule.
     This is a separate element from the home-page carousel (.carousel-slide). */
  section[style*="background: var(--ink)"][style*="rgba(245,240,232,0.06)"] p[style*="font-style:italic"][style*="color:var(--ivory)"] {
    font-size: 1.05rem !important;
    line-height: 1.75 !important;
  }

  /* Condition-page CTA insurance line — fine-print metadata that was being
     bumped up to 0.85rem by the broad body rule. Shrink back to fine-print size. */
  .condition-cta p[style*="0.58rem"] {
    font-size: 0.65rem !important;
    letter-spacing: 0.1em !important;
    line-height: 1.6 !important;
  }

  /* Symptom items — gold dash stays left, text flexes to fill and centers.
     Mirrors portrait mobile behavior (each inner page line 394). */
  .symptom-item { align-items: flex-start !important; }
  .symptom-text { flex: 1 1 auto !important; text-align: center !important; }
}
