/* Responsive spacing and overflow safeguards — v18 */
:root {
  --page-gutter: clamp(16px, 3.5vw, 48px);
  --section-space: clamp(58px, 7vw, 108px);
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

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

.wrap,
.daily-shell,
.weekly-shell,
.community-shell,
.gallery-shell,
.sai-shell,
.page-shell {
  width: min(1360px, calc(100% - (2 * var(--page-gutter)))) !important;
  margin-inline: auto !important;
}

/* Prevent long labels, emails and links from pushing cards off-screen. */
main, section, article, .wrap, .card, [class*="-card"], [class*="-panel"] {
  min-width: 0;
}

p, a, h1, h2, h3, h4, li, label {
  overflow-wrap: break-word;
}

@media (max-width: 1180px) {
  .nav-wrap { gap: 18px !important; }
  .main-nav { gap: 18px !important; }
  .brand { min-width: 0; }
}

@media (max-width: 980px) {
  .site-header { position: sticky; top: 0; }
  .nav-wrap { padding-block: 10px; }
  .main-nav {
    width: 100%;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    padding: 22px var(--page-gutter) 26px !important;
  }

  .hero-copy,
  .contact-hero-inner,
  .donate-hero-content,
  .sponsor-hero-inner,
  .pooja-hero-inner,
  .ps-hero-inner {
    padding-inline: 0 !important;
  }

  .intro-grid,
  .seva-grid,
  .recognition-grid,
  .contact-layout,
  .contact-grid,
  .gallery-layout {
    gap: clamp(28px, 5vw, 54px) !important;
  }
}

@media (max-width: 760px) {
  :root { --page-gutter: 18px; }

  section,
  .contact-section,
  .donate-section,
  .sponsor-section,
  .pooja-section,
  .ps-section,
  .daily-schedule,
  .weekly-schedule,
  .community-section,
  .gallery-section {
    padding-block: clamp(54px, 12vw, 76px) !important;
  }

  .brand img { width: min(240px, calc(100vw - 88px)) !important; }
  .nav-wrap { min-height: 82px !important; }
  .main-nav { top: 82px !important; }

  .hero h1,
  .contact-hero h1,
  .donate-hero h1,
  .sponsor-hero h1,
  .pooja-hero h1,
  .ps-hero h1,
  .sai-hero h1 {
    font-size: clamp(42px, 13vw, 58px) !important;
    line-height: 1.02 !important;
  }

  .hero-copy,
  .contact-hero-inner,
  .donate-hero-content,
  .sponsor-hero-inner,
  .pooja-hero-inner,
  .ps-hero-inner {
    width: 100% !important;
    padding-top: 68px !important;
    padding-bottom: 88px !important;
  }

  .hero-actions,
  .donate-actions {
    align-items: stretch !important;
    gap: 12px !important;
  }

  .hero-actions .btn,
  .donate-actions .donate-btn {
    width: 100%;
  }

  .quick-card,
  .guru-card,
  .impact-card-body,
  .method-card,
  .contact-card,
  .sponsor-card-body,
  .pooja-card-body,
  .ps-card-body,
  .daily-highlight,
  .schedule-group,
  .event-card,
  .community-card,
  .leader-body {
    padding: 20px 18px !important;
  }

  .contact-form-wrap { padding: 36px 18px !important; }
  .contact-info-card { padding: 24px 18px !important; }

  .checkout-panel {
    width: calc(100% - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    padding: 22px 16px !important;
    border-radius: 16px !important;
  }

  .cart-drawer { width: min(100%, 420px) !important; }
  .cart-head, .cart-foot { padding-inline: 18px !important; }
  .cart-items { padding-inline: 18px !important; }

  .gallery-grid,
  .photo-grid,
  .sponsor-grid,
  .pooja-grid,
  .ps-grid,
  .impact-grid,
  .methods-grid,
  .contact-grid {
    grid-template-columns: 1fr !important;
  }

  .gallery-grid { grid-auto-rows: auto !important; }
  .gallery-grid figure,
  .gallery-grid .gallery-large { grid-row: auto !important; }
  .gallery-grid img { min-height: 240px; }

  .footer-grid { gap: 30px !important; }
  footer { padding-top: 52px !important; }
  .copyright { margin-top: 30px !important; }
}

@media (max-width: 420px) {
  :root { --page-gutter: 14px; }

  body { font-size: 16px; }
  .brand img { width: min(218px, calc(100vw - 78px)) !important; }
  .menu-toggle { flex: 0 0 42px; }

  .quick-card,
  .guru-card,
  .method-card,
  .contact-card,
  .sponsor-card-body,
  .pooja-card-body,
  .ps-card-body,
  .event-card,
  .community-card {
    padding-inline: 16px !important;
  }

  .ornament { width: min(100%, 300px) !important; }
  .stats { display: grid !important; grid-template-columns: 1fr !important; }
}
