/* ==========================================================================
   Ratnavi Foundation - Responsive Breakpoints & Overrides
   ========================================================================== */

/* --------------------------------------------------------------------------
   Extra Large Devices (Large Desktops) - 1200px and up
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* --------------------------------------------------------------------------
   Large Devices (Desktops) - 992px to 1199px
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .container {
    max-width: 960px;
  }
  
  :root {
    --space-16: 3rem;
    --space-24: 4.5rem;
  }
  
  h1 { font-size: 3rem; }
  h2 { font-size: 2.5rem; }
}

/* --------------------------------------------------------------------------
   Medium Devices (Tablets) - 768px to 991px
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .container {
    max-width: 720px;
  }
  
  :root {
    --space-12: 2.5rem;
    --space-16: 2.5rem;
    --space-24: 3.5rem;
  }
  
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  
  /* Navigation handled by HeaderComponent in header.js */
  .mobile-menu-btn {
    display: flex;
  }
  
  /* Timeline */
  .timeline::before {
    left: 31px;
  }
  .timeline-item {
    width: 100%;
    padding-left: 70px;
    padding-right: 25px;
  }
  .timeline-item.right {
    left: 0;
  }
  .timeline-item::after {
    left: 21px;
  }
}

/* --------------------------------------------------------------------------
   Small Devices (Landscape Phones) - 576px to 767px
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .container {
    max-width: 540px;
  }
  
  :root {
    --space-8: 1.5rem;
    --space-12: 2rem;
    --space-16: 2rem;
    --space-24: 3rem;
  }
  
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.25rem; }

  .section-title {
    font-size: clamp(1.5rem, 5.5vw, 1.85rem) !important;
    line-height: 1.25 !important;
    margin-bottom: 0.5rem !important;
  }

  .section-subtitle {
    font-size: 0.78rem !important;
    letter-spacing: 0.8px !important;
  }

  .section-description {
    font-size: 0.925rem !important;
    line-height: 1.55 !important;
  }

  .card-title {
    font-size: 1.15rem !important;
  }
  
  .grid-cols-2 { grid-template-columns: 1fr; }
  .grid-cols-3 { grid-template-columns: 1fr; }
  .grid-cols-4 { grid-template-columns: 1fr; }
  
  /* Section title header with flex layout on mobile */
  .section-header-flex,
  .section-title.d-flex {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.85rem !important;
    margin-bottom: 1.75rem !important;
  }
  
  .section-header-btn,
  .section-title.d-flex .btn {
    width: auto !important;
    white-space: nowrap !important;
    border-radius: 50px !important;
    padding: 0.45rem 1.1rem !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    align-self: flex-start !important;
  }

  /* Ensure site header navigation remains horizontal row on mobile */
  .header-main .container,
  .header-topbar .container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0 !important;
    gap: 0 !important;
  }
  
  .d-flex.flex-wrap > * {
    flex: 1 1 100%;
  }

  /* Compact button styling for CTA section on mobile */
  .cta-section .cta-buttons,
  .cta-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .cta-section .btn,
  .cta-buttons .btn,
  .cta-buttons > * {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 0.55rem 1.15rem !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.3px !important;
    border-radius: 50px !important;
    white-space: nowrap !important;
  }
  
  .section-description {
    font-size: 1rem;
  }
  
  /* Mobile padding adjustments */
  .section, .section-padding-lg {
    padding-block: var(--space-12);
  }
  
  /* Footer */
  .footer-widget {
    margin-bottom: var(--space-8);
  }
}

/* --------------------------------------------------------------------------
   Extra Small Devices (Portrait Phones) - less than 576px
   -------------------------------------------------------------------------- */
@media (max-width: 575px) {
  :root {
    --space-6: 1rem;
  }
  
  h1 { font-size: 1.75rem; }
  
  .single-line-title {
    font-size: 1.4rem !important;
  }
  
  .card-footer .btn {
    width: 100% !important;
    margin-bottom: 0;
  }
  
  .card {
    padding: 1.25rem;
  }
  
  .flip-card {
    height: 350px;
  }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: white;
    color: black;
  }
  
  header, footer, .btn, .no-print {
    display: none !important;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
  
  .container {
    width: 100%;
    max-width: none;
    padding: 0;
  }
}

/* --------------------------------------------------------------------------
   CTA Section Seamless Footer Integration (Global Enforcement)
   -------------------------------------------------------------------------- */
.cta-section,
#cta-section {
  padding-top: 4.5rem !important;
  padding-bottom: 180px !important;
  margin-bottom: 0 !important;
  position: relative !important;
  overflow: visible !important;
}

.cta-section .container {
  padding-bottom: 50px !important;
}

.cta-section .cta-buttons,
.cta-buttons {
  margin-bottom: 2.5rem !important;
}

main,
main > *:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

#site-footer-container {
  margin-top: 0 !important;
  padding-top: 0 !important;
  background: transparent !important;
}

/* --------------------------------------------------------------------------
   Strict Mobile Horizontal Overflow Prevention (Prevent Side Scrolling)
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: clip !important;
  width: 100% !important;
  max-width: 100% !important;
  position: relative;
}

main,
header,
footer,
section,
.section,
#site-header-container,
#site-footer-container,
.site-footer,
.site-header {
  max-width: 100%;
  box-sizing: border-box !important;
}

@media (max-width: 991px) {
  html, body {
    overflow-x: clip !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  main, section, .section, .container {
    overflow-x: clip !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .m-roadmap-container,
  .m-roadmap-row,
  .advisory-container,
  .advisory-grid,
  .stagger-grid {
    max-width: 100% !important;
    overflow-x: clip !important;
    box-sizing: border-box !important;
  }

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

/* --------------------------------------------------------------------------
   Anti-Double Scrolling & Scroll Chaining Prevention (Mobile & Desktop)
   -------------------------------------------------------------------------- */
  .nav-menu,
  .gi-modal-overlay {
    overscroll-behavior: contain !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch;
  }

html.menu-open,
body.menu-open,
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  touch-action: none !important;
}

/* --------------------------------------------------------------------------
   Mobile Card Inner Scrolling Disabling (Disable inner scrollbars on cards)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .card,
  .card *,
  .report-card,
  .report-card *,
  .advisory-card,
  .team-frame-card,
  .sfa-float-card,
  .m-flag-card,
  .value-flip-card,
  .value-card-front,
  .value-card-back,
  .partner-card,
  .gallery-item-card,
  .stagger-item,
  .trust-badge,
  .faq-item,
  [class*="card"],
  [class*="card"] * {
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    min-height: min-content !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: auto !important;
  }
  
  .card-image-wrapper {
    height: auto !important;
  }

  .volunteer-avatar-wrapper {
    width: 92px !important;
    height: 92px !important;
    min-width: 92px !important;
    min-height: 92px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
  }

  .volunteer-avatar-img {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    aspect-ratio: 1 / 1 !important;
  }

  .author-img,
  .testimonial-author .author-img {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    min-height: 56px !important;
    max-width: 56px !important;
    max-height: 56px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    clip-path: circle(50% at 50% 50%) !important;
    -webkit-clip-path: circle(50% at 50% 50%) !important;
  }

  .card::-webkit-scrollbar,
  .report-card::-webkit-scrollbar,
  .advisory-card::-webkit-scrollbar,
  .team-frame-card::-webkit-scrollbar,
  .sfa-float-card::-webkit-scrollbar,
  .m-flag-card::-webkit-scrollbar,
  .value-flip-card::-webkit-scrollbar,
  [class*="card"]::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .value-flip-card {
    height: 270px !important;
  }


}
