/* Private popup and global mobile-card repair */

html,
body,
#root {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
video,
iframe,
svg {
  max-width: 100%;
}

.private-password-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  box-sizing: border-box !important;
  width: 100vw !important;
  width: 100dvw !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  padding:
    max(14px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left)) !important;
  display: grid !important;
  place-items: center !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  background: rgba(35, 10, 31, 0.68) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  backdrop-filter: blur(12px) !important;
}

.private-password-modal {
  position: relative !important;
  box-sizing: border-box !important;
  width: min(100%, 430px) !important;
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100vh - 28px) !important;
  max-height: calc(100dvh - 28px) !important;
  margin: auto !important;
  padding: clamp(22px, 5vw, 30px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: clamp(22px, 6vw, 30px) !important;
  touch-action: manipulation !important;
}

.private-password-modal h2 {
  max-width: 100% !important;
  margin-inline: auto !important;
  font-size: clamp(1.85rem, 8vw, 3rem) !important;
  line-height: 1.02 !important;
  overflow-wrap: anywhere !important;
}

.private-password-modal p {
  max-width: 100% !important;
  font-size: clamp(0.9rem, 3.7vw, 1rem) !important;
  overflow-wrap: anywhere !important;
}

.private-password-modal input {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 52px !important;
  font-size: 16px !important;
}

.private-password-close {
  top: 10px !important;
  right: 10px !important;
  width: 42px !important;
  height: 42px !important;
  flex: 0 0 42px !important;
}

.private-password-submit {
  width: 100% !important;
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

/* Keep all major site grids inside the viewport. */
.memory-grid,
.reasons-grid,
.reason-grid,
.hotel-grid,
.hotels-grid,
.tour-grid,
.tours-grid,
.coupon-grid,
.mini-envelope-grid,
.choice-grid,
.options-grid {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  grid-template-columns:
    repeat(auto-fit, minmax(min(100%, 250px), 1fr)) !important;
}

.memory-card,
.reason-card,
.hotel-card,
.tour-card,
.coupon-card,
.mini-envelope,
.choice-card,
.summary-card {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}

.memory-card > *,
.reason-card > *,
.hotel-card > *,
.tour-card > *,
.coupon-card > *,
.mini-envelope > *,
.choice-card > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

.hero-photo-frame,
.memory-image-wrap,
.memory-photo-shell,
.image-fallback-shell,
.photo-heart,
.heart-photo {
  max-width: 100% !important;
}

.hero-photo-frame img,
.memory-image-wrap img,
.memory-photo-shell img,
.photo-heart img,
.heart-photo img {
  display: block !important;
  max-width: 100% !important;
  object-fit: cover !important;
}

/* Locked SVG and real photo must occupy the same card space. */
body:not(.private-content-unlocked) img[src*="hero-photo.jpg"],
body:not(.private-content-unlocked) img[src*="memory-"],
body:not(.private-content-unlocked) img[src*="og-birthday.jpg"] {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

@media (max-width: 760px) {
  .private-password-backdrop {
    place-items: end center !important;
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left)) !important;
  }

  .private-password-modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
    margin: 0 !important;
    padding: 24px 16px 18px !important;
    border-radius: 26px 26px 18px 18px !important;
  }

  .private-password-icon {
    width: 56px !important;
    height: 56px !important;
    margin-bottom: 8px !important;
  }

  .memory-grid,
  .reasons-grid,
  .reason-grid,
  .hotel-grid,
  .hotels-grid,
  .tour-grid,
  .tours-grid,
  .coupon-grid,
  .mini-envelope-grid,
  .choice-grid,
  .options-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px !important;
  }

  .page-container,
  .section-shell,
  .section-shell > div {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .memory-card,
  .reason-card,
  .hotel-card,
  .tour-card,
  .coupon-card,
  .mini-envelope,
  .choice-card,
  .summary-card {
    margin-inline: auto !important;
  }
}

@media (max-width: 380px) {
  .private-password-modal {
    padding: 22px 13px 15px !important;
  }

  .private-password-modal h2 {
    padding-inline: 25px !important;
    font-size: clamp(1.65rem, 10vw, 2.25rem) !important;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .private-password-backdrop {
    place-items: center !important;
    padding: 8px !important;
  }

  .private-password-modal {
    width: min(94vw, 560px) !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 18px !important;
  }

  .private-password-icon {
    width: 44px !important;
    height: 44px !important;
    margin-bottom: 5px !important;
  }

  .private-password-modal h2 {
    margin-block: 4px 7px !important;
    font-size: 1.8rem !important;
  }

  .private-password-modal p {
    margin-bottom: 12px !important;
  }
}

/* MEMORY_MOBILE_SLIDER_FINAL_START */

/*
  Requested gallery behavior:
  - Desktop: 3 cards per row
  - Tablet: 2 cards per row
  - Mobile: one horizontal swipe card at a time
*/

/* Desktop */
@media (min-width: 921px) {
  html body .memory-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    gap: clamp(18px, 2vw, 28px) !important;
    width: 100% !important;
    margin-inline: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html body .memory-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html body .carousel-indicators {
    display: none !important;
  }
}

/* Tablet */
@media (min-width: 761px) and (max-width: 920px) {
  html body .memory-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    gap: 20px !important;
    width: 100% !important;
    margin-inline: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html body .memory-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html body .carousel-indicators {
    display: none !important;
  }
}

/* Mobile horizontal snap slider */
@media (max-width: 760px) {
  html body .memories-section {
    overflow-x: clip !important;
  }

  html body .memory-grid {
    display: grid !important;
    grid-template-columns: none !important;
    grid-template-rows: minmax(0, auto) !important;
    grid-auto-flow: column !important;
    grid-auto-columns: min(86vw, 360px) !important;
    align-items: stretch !important;
    gap: 15px !important;
    width: auto !important;
    max-width: none !important;
    margin-inline: -14px !important;
    padding: 16px 14px 24px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding-inline: 14px !important;
    overscroll-behavior-inline: contain !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    touch-action: pan-x pan-y !important;
  }

  html body .memory-grid::-webkit-scrollbar {
    display: none !important;
  }

  html body .memory-card {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    scroll-snap-align: center !important;
    scroll-snap-stop: always !important;
    transform: none !important;
  }

  html body .carousel-indicators {
    display: flex !important;
    width: 100% !important;
    min-height: 28px !important;
    margin: 1px auto 0 !important;
    padding: 5px 0 !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
  }

  html body .carousel-indicators span {
    display: block !important;
    width: 8px !important;
    height: 8px !important;
    flex: 0 0 8px !important;
    border-radius: 999px !important;
    background: rgba(192, 67, 132, 0.28) !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transition:
      width 180ms ease,
      background-color 180ms ease,
      transform 180ms ease !important;
  }

  html body .carousel-indicators span.active {
    width: 24px !important;
    flex-basis: 24px !important;
    background: linear-gradient(90deg, #ff4fa3, #a855f7) !important;
    transform: scaleY(1.08) !important;
  }
}

@media (max-width: 380px) {
  html body .memory-grid {
    grid-auto-columns: calc(100vw - 34px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .memory-grid {
    scroll-behavior: auto !important;
  }

  html body .carousel-indicators span {
    transition: none !important;
  }
}

/* MEMORY_MOBILE_SLIDER_FINAL_END */

/* COUPON_MOBILE_SLIDER_FIX_START */

/*
  Keep the original coupon carousel behavior, but on phones show exactly
  one complete coupon at a time. The next locked coupon must not peek in
  from either side.
*/

@media (max-width: 760px) {
  html body #coupons,
  html body .coupon-section,
  html body .coupons-section {
    max-width: 100% !important;
    overflow-x: clip !important;
  }

  html body .coupon-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 0 !important;

    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    margin: 0 !important;
    padding: 8px 0 22px !important;

    overflow-x: auto !important;
    overflow-y: visible !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding-inline: 0 !important;
    overscroll-behavior-inline: contain !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    touch-action: pan-x pan-y !important;
  }

  html body .coupon-grid::-webkit-scrollbar {
    display: none !important;
  }

  html body .coupon-grid > .coupon-card,
  html body .coupon-grid > button,
  html body .coupon-grid > article {
    box-sizing: border-box !important;
    flex: 0 0 100% !important;

    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;

    margin: 0 !important;
    scroll-snap-align: start !important;
    scroll-snap-stop: always !important;
    transform: none !important;
  }

  html body .coupon-card {
    overflow: hidden !important;
  }

  html body .coupon-card > * {
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 390px) {
  html body .coupon-grid {
    padding-inline: 0 !important;
  }

  html body .coupon-grid > .coupon-card,
  html body .coupon-grid > button,
  html body .coupon-grid > article {
    border-radius: clamp(22px, 7vw, 30px) !important;
  }
}

/* COUPON_MOBILE_SLIDER_FIX_END */
