/* ============================================================
   MOBILE APP SHELL — native-app feel for the public site on phones.
   Structure:
     1. GLOBAL foundations — every public page, <=768px
     2. HOME — swipeable curated rails
   All rules are guarded to <=768px so desktop is never affected.
   ============================================================ */

@media (max-width: 768px) {

  /* ========================================================
     1 · GLOBAL APP FOUNDATIONS
     ======================================================== */

  /* Kill the blue tap flash; enable smooth in-page scrolling */
  html { scroll-behavior: smooth; }
  body, body * { -webkit-tap-highlight-color: transparent; }

  /* Momentum + no scrollbar on any horizontal scroller */
  [class*="scroll"], [class*="carousel"], [class*="-rail"],
  .qv-tabs, .td-section-nav, .itin-timeline {
    -webkit-overflow-scrolling: touch;
  }

  /* Press feedback — transform only, so it can't break layout even if broad */
  a, button, [role="button"], .btn, .w-btn,
  [class*="-card"], .dep-chip, .qv-tab, .chip {
    transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease;
  }
  .btn:active, .w-btn:active, button:active, [role="button"]:active,
  .pkg-card:active, .tour-card:active, .trip-card:active, .hotel-card:active,
  .hp-card:active, .hp-tour-card:active, .hp-dest-card:active, .hp-blog-card:active,
  .fresh-trip-card:active, .act-card:active, .dest-card:active {
    transform: scale(.975);
  }

  /* Compact frosted top app-bar (all pages) */
  .hdr {
    height: 56px !important;
    background: color-mix(in srgb, var(--paper, #F9F5EC) 84%, transparent) !important;
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(0,0,0,.05) !important;
    box-shadow: none !important;
    transition: box-shadow .25s ease, background .25s ease;
  }
  .hdr.is-scrolled {
    box-shadow: 0 6px 20px rgba(27,41,33,.08) !important;
    background: color-mix(in srgb, var(--paper, #F9F5EC) 94%, transparent) !important;
  }
  .hdr-inner { padding: 0 16px !important; }
  .hdr-logo-img { height: 30px !important; }
  .hdr-icon-btn, .hdr-burger {
    /* 44px, not 40: this is the accessible minimum touch target, and these are
       the only controls in the mobile header. */
    width: 44px !important; height: 44px !important;
    border-radius: 12px !important;
    background: rgba(0,0,0,.04) !important;
    border: 1px solid rgba(0,0,0,.06) !important;
    box-shadow: none !important;
  }

  /* Honour the notch / home-indicator on the floating tab bar */
  .mobile-bottom-nav { padding-bottom: env(safe-area-inset-bottom) !important; }

  /* ---- Perfect-fit net: nothing may push past the viewport ---- */
  body { overflow-x: clip; }                 /* clip (not hidden) keeps position:sticky working */
  img, video, iframe, canvas { max-width: 100%; }
  table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  pre, code { max-width: 100%; overflow-x: auto; }

  /* ---- Subtle native page-enter fade (opacity only, transform-free
          so it never breaks fixed/sticky children) ---- */
  @media (prefers-reduced-motion: no-preference) {
    main.site-main { animation: appPageIn .30s ease both; }
    @keyframes appPageIn { from { opacity: 0; } to { opacity: 1; } }
  }

  /* Consistent card corners across the product surfaces */
  .pkg-card, .tour-card, .trip-card, .hotel-card, .act-card,
  .hp-card, .hp-tour-card, .fresh-trip-card, .hp-blog-card, .dest-card {
    border-radius: 18px !important;
  }

  /* Reduced-motion: drop the press-scale + smooth scroll */
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    a, button, [role="button"], [class*="-card"], .btn, .w-btn { transition: none !important; }
    .btn:active, button:active, [class*="-card"]:active { transform: none !important; }
  }

  /* ========================================================
     2 · HOME — swipeable curated rails
     Scoped high enough to beat home.css's grid rules.
     ======================================================== */

  body.page-home [data-page="home"] .hp-panel-title,
  body.page-home [data-page="home"] .hp-fw-title {
    font-size: clamp(23px, 6.4vw, 28px) !important;
    line-height: 1.14 !important;
    text-wrap: balance;
  }

  /* the 2-row grids otherwise collapse to one column and stack every
     card vertically (4000px+); turn each into an edge-to-edge rail */
  body.page-home [data-page="home"] .hp-2row-grid {
    display: flex !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    overflow-x: auto !important;
    gap: 14px !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 4px 16px 14px !important;
    margin: 0 -16px !important;
    scroll-padding-left: 16px;
    scrollbar-width: none;
  }
  body.page-home [data-page="home"] .hp-2row-grid::-webkit-scrollbar { display: none; }
  body.page-home [data-page="home"] .hp-2row-grid > * {
    flex: 0 0 78% !important;
    max-width: 300px;
    min-width: 0;
    scroll-snap-align: start;
  }

  /* already-flex rails: unify snap + hide scrollbar */
  body.page-home [data-page="home"] .hp-dest-scroll,
  body.page-home [data-page="home"] .hp-blogs-grid.side-scroll,
  body.page-home [data-page="home"] .hp-rev-grid {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  body.page-home [data-page="home"] .hp-dest-scroll::-webkit-scrollbar,
  body.page-home [data-page="home"] .hp-blogs-grid.side-scroll::-webkit-scrollbar,
  body.page-home [data-page="home"] .hp-rev-grid::-webkit-scrollbar { display: none; }
}

/* =============================================================================
   MOBILE INPUT ERGONOMICS
   Loaded after travel.min.css deliberately: that file sets
       input[type="text"], … { font-size: 0.95rem }
   which computes to 15.2px and beat app.css's 16px mobile rule. iOS Safari
   auto-zooms any focused control under 16px, so every tap on the 4-step booking
   form lurched the page. 16px is the threshold that stops the zoom — it is not
   a stylistic choice.
   ============================================================================= */
@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;   /* beats travel.min.css's 0.95rem */
  }

  /* Comfortable hit area on the same controls. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select {
    min-height: 44px;
  }

  /* The drawer close button is targeted by ID in travel.min.css
     (`.hdr-drawer-close-btn, #hdr-drawer-close { width:38px }`), and an ID beats
     any class selector — so matching that specificity is the only way to raise
     it without an !important war. */
  /* travel.min.css ships `#hdr-drawer-close { width:38px !important }` — an ID
     AND !important — and app.css sets 38px !important too. Three stylesheets
     already fight over this one button, so matching that weight is the only way
     to raise it. (Symptom of the wider stylesheet-layering problem, not a
     pattern to copy.) */
  #hdr-drawer-close,
  .hdr-drawer-close-btn {
    width: 44px !important;
    height: 44px !important;
  }

  /* Off-canvas drawer links measured 40px tall. They are only on screen while
     the drawer is open, but they are the primary mobile navigation when it is. */
  .hdr-drawer-sub-link,
  .hdr-drawer-link,
  .hdr-drawer-group-toggle {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* The fixed bottom chrome (nav + price bar) is taller than the padding the
     page reserved, so the last field sat underneath it. Reserve the real
     height, plus the home-indicator inset on notched devices. */
  body {
    padding-bottom: calc(140px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* =============================================================================
     3 · MOBILE TOUCH TARGETS & FITTS' LAW ENFORCEMENT
     ============================================================================= */
  button,
  a.btn,
  .btn,
  .w-btn,
  .hdr-icon-btn,
  .chip,
  .dep-chip,
  .qv-tab,
  .tour-card-cta,
  .nav-pill,
  .filter-pill,
  .sort-option,
  .booking-bar-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
  }

  /* Filter checkboxes & radio touch hitboxes */
  input[type="checkbox"],
  input[type="radio"] {
    width: 22px !important;
    height: 22px !important;
    cursor: pointer;
    touch-action: manipulation;
  }
  label:has(input[type="checkbox"]),
  label:has(input[type="radio"]) {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    touch-action: manipulation;
  }

  /* =============================================================================
     4 · MOBILE MODALS & BOTTOM SHEETS
     ============================================================================= */
  .modal-overlay,
  .qv-backdrop,
  .filter-modal-backdrop {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.65) !important;
  }

  .modal-content,
  .qv-modal,
  .filter-drawer {
    border-radius: 24px 24px 0 0 !important;
    max-height: calc(90vh - env(safe-area-inset-top, 0px)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Sticky bottom booking bar on tour detail pages */
  .tour-sticky-bar,
  .booking-sticky-bar {
    position: fixed !important;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
    right: 12px !important;
    z-index: 1000 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 20px !important;
    padding: 10px 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  /* =============================================================================
     5 · PERFECT MOBILE TYPOGRAPHY & OVERFLOW SAFEGUARDS
     ============================================================================= */
  body {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Responsive Headings — prevent oversized titles on phones */
  h1, .h1, .hero-title, .tour-title, .hp-h1, .page-header-title {
    font-size: clamp(20px, 5.5vw, 26px) !important;
    line-height: 1.2 !important;
    letter-spacing: -0.015em !important;
    text-wrap: balance !important;
    word-break: break-word !important;
    max-width: 100% !important;
  }

  h2, .h2, .section-title, .hp-panel-title, .hp-fw-title {
    font-size: clamp(17px, 4.5vw, 21px) !important;
    line-height: 1.25 !important;
    letter-spacing: -0.01em !important;
    text-wrap: balance !important;
    word-break: break-word !important;
  }

  h3, .h3, .tour-card-title, .pkg-card-title, .card-title {
    font-size: clamp(14.5px, 4vw, 17px) !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }

  h4, .h4, .sub-title {
    font-size: clamp(13px, 3.6vw, 15px) !important;
    line-height: 1.35 !important;
  }

  /* Subtitles & Descriptions */
  .hero-sub, .page-sub, .section-sub, .tour-subtitle {
    font-size: clamp(13px, 3.6vw, 14.5px) !important;
    line-height: 1.4 !important;
    text-wrap: pretty !important;
  }

  /* Clamp long card descriptions to 2 lines */
  .tour-card-desc, .pkg-desc, .hp-blog-excerpt, .act-card-desc {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  /* Badges & Chips — clip nicely without pushing layout */
  .badge, .chip, .dep-chip, .pill, .tag, .tour-badge {
    max-width: 100% !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    font-size: 11px !important;
    padding: 3px 8px !important;
    box-sizing: border-box !important;
  }

  /* Price formatting on cards & booking bar */
  .price-val, .tour-price, .pkg-price, .strike-price {
    font-size: clamp(15px, 4.2vw, 19px) !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  /* Tables & data grids */
  table, td, th {
    font-size: 12.5px !important;
    line-height: 1.3 !important;
    word-break: normal !important;
  }
}


