/*
 * RESPONSIVE LAYOUT
 * -----------------
 * The artwork, animation, and theme remain in style.css. This file owns only
 * sizing, safe areas, text wrapping, and responsive behavior.
 *
 * Each slide defines a text box with --text-box-top, --text-box-bottom, and
 * --text-box-width. Overflow is clipped to the box and longer copy scrolls
 * inside it, keeping text clear of the surrounding illustration.
 */

:root {
  --page-gutter: clamp(0.75rem, 4cqw, 1.1rem);
  --text-box-width: 20rem;
  --text-box-top: clamp(7.5rem, 24cqh, 11.5rem);
  --text-box-bottom: clamp(2rem, 7cqh, 3.75rem);
  --text-box-gap: clamp(0.12rem, 0.55cqh, 0.3rem);
}

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body {
  min-width: 0;
}

:where(h1, h2, h3, p, span) {
  max-inline-size: 100%;
}

:where(.hosts-title, .detail-val, .unit-heading, .unit-names, .dates-pill-badge) {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.mobile-frame {
  isolation: isolate;
}

.story-page {
  --text-box-width: 19.375rem;
  --text-box-top: clamp(7.5rem, 24cqh, 11.875rem);
  --text-box-bottom: clamp(2.5rem, 7cqh, 3.75rem);
  --text-box-gap: clamp(0.12rem, 0.55cqh, 0.3rem);
}

.hosts-title {
  white-space: normal;
}

/* Copy stays in a bounded, independently scrollable reading area. */
.page-content-flow,
.page-cover .page-content-flow,
.page-event .page-content-flow {
  position: absolute;
  inset-inline: 0;
  top: var(--text-box-top);
  bottom: var(--text-box-bottom);
  width: calc(100% - (2 * var(--page-gutter)));
  height: auto;
  max-width: var(--text-box-width);
  box-sizing: border-box;
  margin-inline: auto;
  padding: clamp(0.45rem, 1.7cqh, 0.75rem) clamp(0.55rem, 2.5cqw, 0.85rem);
  gap: var(--text-box-gap);
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(142, 86, 6, 0.35) transparent;
  scrollbar-gutter: stable both-edges;
}

.page-content-flow::-webkit-scrollbar {
  display: block;
  width: 3px;
}

.page-content-flow::-webkit-scrollbar-thumb {
  background: rgba(142, 86, 6, 0.35);
  border-radius: 999px;
}

/* Slide-specific safe areas. Keep these together for easy visual tuning. */
.page-cover {
  --text-box-width: 20.5rem;
  --text-box-top: clamp(6.5rem, 16cqh, 10rem);
  --text-box-bottom: clamp(1.25rem, 3.5cqh, 2rem);
  --text-box-gap: clamp(0.08rem, 0.35cqh, 0.2rem);
}

.page-mahapujan {
  --text-box-top: clamp(8.75rem, 26cqh, 12.75rem);
  /* The coconut and puja items occupy the lower part of this artwork. */
  --text-box-bottom: clamp(7.25rem, 31cqh, 13.5rem);
}

.page-paat {
  --text-box-top: clamp(9rem, 28cqh, 13.75rem);
  --text-box-bottom: clamp(3rem, 9cqh, 5rem);
}

.page-haldi {
  --text-box-top: clamp(8.5rem, 27cqh, 13.25rem);
  --text-box-bottom: clamp(9.5rem, 25cqh, 12.75rem);
}

.page-sangeet {
  --text-box-top: clamp(9.75rem, 31cqh, 15.5rem);
  --text-box-bottom: clamp(10rem, 30cqh, 13.5rem);
}

.page-wedding {
  --text-box-top: clamp(8rem, 26cqh, 12.75rem);
  --text-box-bottom: clamp(8.75rem, 25cqh, 12.5rem);
}

.page-families {
  --page-gutter: clamp(1.25rem, 7cqw, 1.75rem);
  --text-box-width: 22rem;
  --text-box-top: clamp(4.5rem, 12cqh, 6.5rem);
  --text-box-bottom: clamp(1rem, 3cqh, 1.75rem);
  --text-box-gap: clamp(0.2rem, 0.65cqh, 0.4rem);
}

.page-ending {
  --text-box-width: 20.5rem;
  --text-box-top: clamp(6.5rem, 18cqh, 9rem);
  --text-box-bottom: clamp(10rem, 34cqh, 15rem);
}

.page-details {
  --text-box-width: 21rem;
  --text-box-top: clamp(3.25rem, 8cqh, 5rem);
  --text-box-bottom: clamp(0.75rem, 2cqh, 1.25rem);
  --text-box-gap: clamp(0.18rem, 0.55cqh, 0.35rem);
}

.scrollable-family-content {
  padding: clamp(0.45rem, 1.7cqh, 0.75rem) clamp(0.5rem, 2.5cqw, 0.8rem) !important;
}

.family-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.25rem, 0.8cqh, 0.5rem) clamp(0.4rem, 2cqw, 0.7rem);
}

.page-families .family-unit {
  padding-inline: clamp(0.2rem, 1cqw, 0.35rem);
  padding-bottom: clamp(0.25rem, 0.7cqh, 0.4rem);
}

@container (max-width: 350px) {
  .family-grid {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }

  .family-grid .family-unit {
    grid-area: auto !important;
  }

  .hosts-title {
    font-size: 0.8rem;
  }

  .groom-royal-name,
  .bride-royal-name {
    font-size: clamp(1.8rem, 11cqw, 2.15rem);
  }
}

@container (max-height: 620px) {
  .story-page {
    --text-box-gap: 0.08rem;
  }

  .page-content-flow,
  .page-cover .page-content-flow,
  .page-event .page-content-flow {
    padding-block: 0.4rem;
  }

  .event-subtitle-italics,
  .event-divine-prelude {
    font-size: 0.78rem;
  }

  .page-sangeet .event-theme-header,
  .page-sangeet .detail-label {
    font-size: 0.62rem;
  }

  .page-sangeet .event-main-title {
    font-size: 0.95rem;
    margin-block: 0.03rem;
  }

  .page-sangeet .event-subtitle-italics {
    font-size: 0.72rem;
    margin-bottom: 0;
  }

  .page-sangeet .detail-val {
    font-size: 0.76rem;
    line-height: 1.2;
  }

  .page-sangeet .highlight-venue {
    font-size: 0.82rem;
  }

  .page-sangeet .gold-accent-divider {
    margin-block: 0.08rem 0.12rem;
  }
}

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