/* ═══════════════════════════════════════════════════
   MOBILE POLISH — site-wide mobile UX layer
   Loaded after page-specific CSS so it can refine.
   Pure additions, never overrides layout.
   ═══════════════════════════════════════════════════ */

/* ── Native smooth scroll, but only when motion is OK ── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ── Touch responsiveness baseline ── */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
.cta-btn,
.btn,
a[role="button"],
a.cta-btn,
input[type="submit"],
input[type="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── Tap feedback on primary CTAs ──
   Press-to-confirm via subtle scale, never bounce.
   Quintic ease-out matches the perf phase aesthetic. */
@media (hover: none) and (pointer: coarse) {
  .cta-btn,
  .btn,
  button.cta-btn,
  a.cta-btn,
  .hero__cta a,
  .pricing__cta,
  .bai-promo-image-link,
  .afd-tour__scroll-nav-cta,
  .afd-tour__cta-primary,
  .afd-tour__cta-secondary {
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 220ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  .cta-btn:active,
  .btn:active,
  button.cta-btn:active,
  a.cta-btn:active,
  .hero__cta a:active,
  .pricing__cta:active,
  .bai-promo-image-link:active,
  .afd-tour__scroll-nav-cta:active,
  .afd-tour__cta-primary:active,
  .afd-tour__cta-secondary:active {
    transform: scale(0.97);
    opacity: 0.92;
  }
}

/* ── Minimum tap target on small screens (WCAG 2.5.5) ── */
@media (max-width: 768px) {
  .site-header__nav a,
  .site-header__home,
  .site-footer a,
  nav a,
  .ticker-item a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Stop pinch-zoom-style horizontal scroll caused by oversized media */
  body { overflow-x: hidden; }
  img, video, picture { max-width: 100%; height: auto; }
}

/* ── Lift focus-visible site-wide for keyboard / a11y ── */
:focus-visible {
  outline: 2px solid #f5f5f7;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Smooth reveal of any element with .reveal that hasn't been wired
   by a per-page script. Idempotent: only acts if no opacity is set. ── */
@media (prefers-reduced-motion: no-preference) {
  .reveal:not(.is-visible):not([style*="opacity"]) {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Mobile-only typography tightening ── */
@media (max-width: 480px) {
  h1, h2, h3 { letter-spacing: -0.012em; }
  p { text-wrap: pretty; }
}

/* ── Lazy-image fade so cards don't pop in ── */
@media (prefers-reduced-motion: no-preference) {
  img[loading="lazy"] {
    transition: opacity 400ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* ── Better mobile scroll containers ── */
.ticker-track,
[class*="scroll-x"],
[class*="-scroll"] {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
