/* Native document snapping preserves wheel, touch, keyboard and momentum scrolling. */
html:has(body.home-page) {
  scroll-snap-type: y mandatory;
  scroll-padding-top: var(--home-snap-header, 56px);
}
.home-page .v6-hero,
.home-page .v6-rsvp,
.home-page .v6-statement,
.home-page .home-featured-directory,
.home-page > footer {
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  scroll-margin-top: 0;
}
@media (min-width: 801px) and (not ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .home-page .v6-statement,
  .home-page .home-featured-directory,
  .home-page .v6-rsvp {
    box-sizing: border-box;
    min-height: calc(100dvh - var(--home-snap-header, 56px));
  }
}
@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .home-page .v6-statement,
  .home-page .home-featured-directory { scroll-snap-align: none; }
  .home-page .mobile-intro-directory {
    scroll-snap-align: start; scroll-snap-stop: normal; scroll-margin-top: 0;
    height: auto; min-height: var(--mobile-screen);
  }
}
html:has(body.home-page.navigation-open) { scroll-snap-type: none; }
@media (prefers-reduced-motion: reduce) {
  html:has(body.home-page) { scroll-behavior: auto; scroll-snap-type: y proximity; }
}

/* Travel chapters use the same native settling as the homepage. */
html:has(body.travel-compact-page) {
  scroll-snap-type: y mandatory;
  scroll-padding-top: var(--home-snap-header, 56px);
}
.travel-compact-page main > section,
.travel-compact-page > footer {
  scroll-snap-align: start; scroll-snap-stop: normal; scroll-margin-top: 0;
}
/* Oversized chapters retain native within-section scrolling. */
@media (min-width: 801px) and (not ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .travel-compact-page main > section {
    box-sizing: border-box;
    min-height: calc(100dvh - var(--home-snap-header, 56px));
  }
}
html:has(body.travel-compact-page.navigation-open) { scroll-snap-type: none; }
@media (prefers-reduced-motion: reduce) {
  html:has(body.travel-compact-page) { scroll-behavior: auto; scroll-snap-type: y proximity; }
}

/* Desktop momentum must stop at each chapter rather than passing over it. */
@media (min-width: 801px) and (not ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .home-page .v6-hero,
  .home-page .v6-statement,
  .home-page .home-featured-directory,
  .home-page .v6-rsvp,
  .travel-compact-page main > section {
    scroll-snap-stop: always;
  }
}

/* The final mobile chapter needs a full viewport to reach its snap anchor. */
@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .travel-compact-page .travel-booking-compact {
    height: auto;
    min-height: calc(100dvh - var(--home-snap-header, var(--mobile-header-height)));
    scroll-margin-top: 0;
  }
  .travel-compact-page > footer { scroll-snap-align: end; }
}

/* These noninteractive anchors receive focus only to announce the destination. */
.travel-compact-page #included-heading[tabindex="-1"]:focus,
.travel-compact-page #book[tabindex="-1"]:focus { outline: none; }

/* Fit the final invitation and footer to the current viewport as browser UI changes. */
@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .home-page .v6-rsvp {
    box-sizing: border-box;
    height: calc(100dvh - var(--home-snap-header, 56px) - var(--home-snap-footer, var(--mobile-footer-height)));
    min-height: 0;
    scroll-snap-align: start;
  }
  .home-page > footer { scroll-snap-align: none; }
}

/* Continue the directory's ivory beneath Safari's translucent bottom controls. */
@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .home-page .mobile-intro-directory {
    /* Safari paints underneath its bottom controls beyond the visible viewport.
       Keep a full, stable large viewport plus the bottom safe area in ivory.
       Reserve the browser controls, letting the photo grid fill the remaining height. */
    height: calc(100lvh + env(safe-area-inset-bottom, 0px));
    min-height: calc(100lvh + env(safe-area-inset-bottom, 0px));
    padding-bottom: calc(18px + max(0px, 100lvh - 100svh) + env(safe-area-inset-bottom, 0px));
  }
}

@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  /* Retain the requested firm mobile chapter snapping. */
  html:has(body.home-page):not(:has(body.navigation-open)) {
    scroll-snap-type: y mandatory;
  }
  /* Keep the next photograph below Safari's translucent toolbar. */
  .travel-compact-page .travel-value {
    box-sizing: border-box;
    height: 100lvh;
    min-height: 100lvh;
    padding-bottom: calc(16px + var(--home-snap-header, 56px) + max(0px, 100lvh - 100dvh));
  }
}

/* JS keeps firm mobile destinations, with a controlled post-gesture transition. */
@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  html.home-touch-settling:has(body.home-page) {
    scroll-snap-type: none !important;
    scroll-behavior: auto !important;
  }
}

@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  .home-page .v6-hero,
  .home-page .mobile-intro-directory { scroll-snap-stop: always; }
}

@media ((max-width: 800px) or ((max-width: 1000px) and (max-height: 500px) and (pointer: coarse) and (hover: none))) {
  html.home-upward-free:has(body.home-page) {
    scroll-snap-type: none !important;
    scroll-behavior: auto !important;
  }
}
