/* ============================================================
   LUNARAE HEALING — Mobile comfort layer
   Loaded AFTER each page's own styles. Only applies to phones /
   touch devices; desktop layout is untouched.
   ============================================================ */

/* ---- Global safety nets (all sizes, harmless on desktop) ---- */
html { -webkit-tap-highlight-color: rgba(201, 169, 110, 0.18); }
img, video, svg, canvas { max-width: 100%; }
body { overflow-wrap: break-word; }

/* Keep anchor jumps from hiding under the fixed nav */
section[id], [id].section { scroll-margin-top: 72px; }

/* Visible keyboard focus (also helps switch-control users) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold, #C9A96E);
  outline-offset: 3px;
}

/* ---- Scrollable table wrapper (used on packages.html) ------- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.table-scroll .compare-table { margin-top: 0; min-width: 760px; }
.table-scroll__hint { display: none; }

/* ---- Phones & small tablets ---------------------------------- */
@media (max-width: 768px) {

  /* Hero: use the *visible* viewport height (iOS/Android URL bar) */
  .hero { min-height: 100vh; min-height: 100svh; }

  /* Comfortable side padding everywhere */
  .container, .container--narrow, .nav__inner { padding-left: 20px; padding-right: 20px; }
  .section, .story, .wishlist, .community, .contribute, .receive, .wall,
  .compare-section { padding-top: 64px; padding-bottom: 64px; }
  .section-sub { margin-bottom: 40px; }

  /* Navigation: bigger tap target, respects notches */
  .nav__inner { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  .nav__hamburger {
    min-width: 44px; min-height: 44px;
    align-items: center; justify-content: center;
    margin-right: -8px;
  }
  .nav__back { min-height: 44px; font-size: 11px; }

  /* Full-screen menu: scrolls on short phones / landscape, bigger targets */
  .mobile-menu {
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 88px 24px calc(40px + env(safe-area-inset-bottom));
  }
  .mobile-menu ul { gap: 4px; margin: auto; width: 100%; }
  .mobile-menu ul a {
    display: block;
    font-size: clamp(1.6rem, 7vw, 2.1rem);
    padding: 10px 0;
    min-height: 48px;
  }
  .mobile-menu__close {
    top: 14px; right: 14px;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
  }

  /* Buttons: full-width, thumb-friendly, allowed to wrap */
  .btn { min-height: 48px; white-space: normal; text-align: center; justify-content: center; padding: 14px 24px; }
  .hero__actions, .hero__cta-group { width: 100%; }
  .hero__actions .btn, .hero__cta-group .btn { width: 100%; max-width: 360px; }
  .hero__scroll, .scroll-hint { display: none; }   /* clutter on phones */

  /* Forms: 16px stops iOS zooming in on tap; roomy fields */
  input, select, textarea,
  .form-group input, .form-group textarea {
    font-size: 16px !important;
    min-height: 48px;
    border-radius: 6px;
  }
  textarea { min-height: 110px; }
  select { padding-right: 32px; }
  input[type="checkbox"], input[type="radio"] { min-width: 22px; min-height: 22px; }
  .checkbox-label { font-size: 0.9rem; }

  /* Text that was tiny on a phone */
  .section-label, .hero__eyebrow, .pay-box__label { font-size: 11px; }
  .nav__links a, .footer__nav a { font-size: 12px; }
  .footer__nav a { padding: 8px 4px; display: inline-block; }
  .contact__info-label, .pay-box__sub, .wish-card__badge,
  .wish-card__cost, .closing__attr { font-size: 11px; }
  .field-error { font-size: 0.85rem; }

  /* FAQ rows: easier to tap */
  .faq__question { min-height: 56px; padding-top: 18px; padding-bottom: 18px; }

  /* Floating widgets: keep clear of content & home-indicator */
  .sound-player { bottom: calc(16px + env(safe-area-inset-bottom)); right: 12px; }
  .sound-player__btn { width: 44px; height: 44px; }
  .sound-player__tooltip { display: none; }   /* would stack above the pill and collide with WhatsApp */
  .whatsapp-btn {
    bottom: calc(92px + env(safe-area-inset-bottom));
    right: 12px;
    width: 52px; height: 52px;
    max-width: 52px;           /* no hover-expand on touch */
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .whatsapp-btn:hover { max-width: 52px; }
  .whatsapp-btn__label { display: none; }
  .toast { left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); text-align: center; }

  /* Wide cards in circle.html: never force 2 columns */
  .wish-card { padding: 28px 22px 24px; }
  .story__ring-wrap { max-width: 100%; }
  .pay-box { padding: 32px 20px; }

  /* Section dividers feel tighter */
  .closing { padding: 80px 20px; }

  /* Comparison table: swipe sideways instead of vanishing */
  .table-scroll {
    margin-left: -20px; margin-right: -20px; width: calc(100% + 40px);
    padding: 0 20px 8px;
  }
  .table-scroll__hint {
    display: block;
    font-family: var(--font-caps, sans-serif);
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-light, #8C7E70);
    margin: 16px 0 8px;
  }
  .table-scroll .compare-table th:first-child,
  .table-scroll .compare-table td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--ivory, #FAF7F2);
    min-width: 150px;
    box-shadow: 1px 0 0 var(--sand, #EDE6D8);
  }
  .table-scroll .compare-table th { font-size: 11px; white-space: nowrap; }
}

/* ---- Small phones -------------------------------------------- */
@media (max-width: 400px) {
  .container, .container--narrow, .nav__inner { padding-left: 16px; padding-right: 16px; }
  .nav__logo-main { font-size: 12px; letter-spacing: 0.14em; }
  .hero__headline { font-size: clamp(1.9rem, 9vw, 2.2rem) !important; }
  .section-title { font-size: clamp(1.6rem, 7.5vw, 1.9rem); }
  .table-scroll { margin-left: -16px; margin-right: -16px; width: calc(100% + 32px); padding: 0 16px 8px; }
}

/* ---- Touch devices: no sticky hover effects ------------------ */
@media (hover: none) {
  .btn:hover, .btn--primary:hover, .btn--ghost:hover,
  .wish-card:hover, .cert-display:hover, .cert-card:hover,
  .nav__cta:hover, .sound-player__btn:hover {
    transform: none;
  }
  .cert-card:hover .cert-card__img { transform: none; }
  .contact__wa-prompt:hover { letter-spacing: inherit; }
  .nav__links a::after { display: none; }
}

/* ---- Landscape phones: hero shouldn't force a tall screen ---- */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: auto; padding-top: 96px; padding-bottom: 56px; }
  .mobile-menu ul a { font-size: 1.4rem; padding: 6px 0; min-height: 40px; }
}

/* ---- Respect "reduce motion" (also saves phone battery) ------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .fade-up { opacity: 1; transform: none; }
}
