/* =========================================================
   Mobile responsive pass — applies at 760px and below.
   Single source of truth so we don't fight rules in 9 files.
   ========================================================= */

@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  body { font-size: 15px; }

  /* ---------- Section padding ---------- */
  .section { padding: 56px 20px !important; }
  .section-head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .section-head .meta { font-size: 12px; }
  .title { font-size: clamp(32px, 9vw, 48px) !important; line-height: 1.1; }
  .eyebrow { font-size: 10px; }

  /* ---------- Nav ---------- */
  .nav {
    padding: 14px 16px !important;
    gap: 10px;
  }
  .nav-mark { font-size: 14px; }
  .nav-links {
    gap: 18px !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1 1 0;
    min-width: 0;            /* lets the flex item shrink below content width so it scrolls */
    justify-content: flex-start;
    padding: 4px 16px;        /* breathing room on either side under the fade mask */
    margin: 0 -4px;
    scroll-snap-type: x proximity;
    touch-action: pan-x;
    mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-link {
    font-size: 11px !important;
    letter-spacing: 0.08em !important;
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: center;
  }
  .nav-cta { display: none; }
  /* Free up scroll real estate on narrow phones — date is in the hero anyway */
  .nav-date { display: none; }

  /* ---------- Hero ---------- */
  .hero { min-height: auto !important; padding: 88px 20px 56px !important; }
  .hero-names { font-size: clamp(48px, 14vw, 88px) !important; line-height: 0.95 !important; gap: 4px !important; }
  .hero-names .amp { font-size: 0.5em !important; }
  .hero-meta { flex-direction: column; gap: 8px !important; }
  .meta-line { font-size: 12px !important; }
  .hero-tagline { margin-top: 32px !important; }
  .tagline-text { font-size: 16px !important; line-height: 1.55 !important; }
  .hero-frames, .couple-strip {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .hero-frames > *, .couple-strip > * {
    width: 100% !important;
    max-width: 100% !important;
  }
  .floating-rsvp, .rsvp-float, .floating-cta {
    bottom: 16px !important;
    right: 16px !important;
    left: 16px !important;
    width: auto !important;
    font-size: 13px !important;
  }

  /* ---------- Plan / Itinerary ---------- */
  .plan-grid, .plan-layout, .bento-grid, .day-grid, .day-layout {
    grid-template-columns: 1fr !important;
    display: grid !important;
    gap: 20px !important;
  }
  .bento, .calendar, .map-card, .summary-card {
    width: 100% !important;
    min-width: 0 !important;
  }
  .cal-summary, .summary-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .cal-summary .btn, .summary-actions .btn { width: 100%; }
  .leaflet-container, #plan-map { height: 320px !important; }
  .map-stop-row, .map-stop { flex-wrap: wrap; }
  .reco-card { padding: 14px !important; }
  .ai-row, .custom-search .ai-row { flex-direction: column; gap: 8px; }
  .ai-row > * { width: 100%; }

  /* ---------- RSVP ---------- */
  .rsvp-card, .rsvp-shell { padding: 28px 20px !important; }
  .rsvp-q { font-size: 22px !important; line-height: 1.3 !important; }
  .rsvp-input-large { font-size: 22px !important; }
  .rsvp-choices { flex-direction: column !important; gap: 10px !important; }
  .rsvp-choice { width: 100% !important; padding: 22px !important; }
  .rsvp-stepper { gap: 18px !important; }
  .stepper-num { font-size: 56px !important; }
  .rsvp-actions { flex-direction: column-reverse !important; gap: 8px !important; }
  .rsvp-actions .btn { width: 100%; }

  /* ---------- Recipes ---------- */
  .recipe-grid, .recipes-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .venue-strip {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .recipe-filters { flex-wrap: wrap; gap: 8px; }
  .filter-chip { font-size: 11px !important; padding: 8px 14px !important; }
  .recipe-modal-content {
    flex-direction: column !important;
    max-height: 92vh !important;
    width: 95vw !important;
  }
  .recipe-modal-img, .recipe-modal-body { width: 100% !important; }

  /* ---------- Dances ---------- */
  .dances-grid, .dance-grid, .dances-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .dance-tile, .dance-card { width: 100% !important; }
  .dance-video, .dance-frame { aspect-ratio: 16 / 9 !important; height: auto !important; }

  /* ---------- Music ---------- */
  .music-shell, .music-grid, .music-layout {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .vinyl, .vinyl-shell, .turntable {
    width: min(82vw, 360px) !important;
    height: min(82vw, 360px) !important;
    margin: 0 auto !important;
  }
  .request-form, .song-form { width: 100% !important; }
  .now-playing-strip { flex-wrap: wrap; gap: 8px; }

  /* ---------- Gallery ---------- */
  .gallery-top {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .qr-card { width: 100% !important; }
  .qr-info { max-width: none !important; }
  .masonry { column-count: 1 !important; }
  .lightbox { padding: 16px !important; }
  .lb-stage { max-width: 92vw !important; max-height: 88vh !important; }
  .lb-prev { left: 8px !important; }
  .lb-next { right: 8px !important; }
  .lb-close { top: 12px !important; right: 12px !important; }
  .gallery-empty { padding: 48px 20px !important; }

  /* ---------- Footer ---------- */
  .site-foot {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding: 56px 24px 40px !important;
    margin-top: 32px !important;
  }
  .foot-mark .serif { font-size: 40px !important; }
  .foot-tagline { font-size: 14px !important; }
  .foot-bottom {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start !important;
  }

  /* ---------- Villa illustration ---------- */
  .villa, .villa-stage { transform: scale(0.7) !important; transform-origin: center top; }

  /* ---------- Tap targets ---------- */
  button, .btn, .filter-chip, .nav-link, .reco-card, .dance-tile {
    min-height: 40px;
  }
}

/* Slightly tighter still on very narrow phones */
@media (max-width: 380px) {
  .section { padding: 48px 16px !important; }
  .hero-names { font-size: 44px !important; }
  .nav-mark { font-size: 12px; }
  .nav-link { font-size: 10px !important; }
  .stepper-num { font-size: 48px !important; }
}

/* =========================================================
   Phone (portrait) only — kill anything that overflows the viewport
   on the X axis. Tablets (>= 768px) and landscape phones (>= 700px)
   are unaffected.
   ========================================================= */
@media (max-width: 640px) {
  /* `clip` is stronger than `hidden`: it doesn't create a scroll context, so
     no touch gesture can ever pull the page sideways. */
  html, body {
    overflow-x: clip !important;
    overflow-y: auto;
    max-width: 100vw;
  }

  /* The background video sat off to the right at 38vw — kill it on phones. */
  .bg-video,
  .bg-orb,
  .bg-orb-2 {
    display: none !important;
  }

  /* Keep the olive-leaf SVGs but pull them inward so their bulk sits on-screen.
     Anything that still pokes past the edge gets clipped by `overflow: clip`
     on the layer container. */
  .olive-deco-layer {
    position: absolute;
    inset: 0 0 auto 0;
    width: 100%;
    overflow-x: clip;
    pointer-events: none;
  }
  .olive-deco-layer img {
    width: 130px !important;
    opacity: 0.14 !important;
  }
  /* Left-anchored leaves: tuck mostly on-screen. */
  .olive-deco-layer img[style*="left:"] {
    left: -18px !important;
  }
  /* Right-anchored leaves: same on the other side. */
  .olive-deco-layer img[style*="right:"] {
    right: -18px !important;
  }
}
