/* ==========================================================================
   REAL SATHI / REAL Sathi — FINAL MOBILE RESPONSIVE OVERRIDE
   Loaded last on public pages. Visual/layout only; no PHP or DB logic.
   ========================================================================== */

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

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

.container {
  width: 100%;
}

@media (max-width: 991.98px) {
  .container {
    padding-left: 18px;
    padding-right: 18px;
  }

  /* Main navbar */
  .navbar-heritage {
    min-height: 68px;
    padding: 8px 0;
  }

  .navbar-heritage>.container {
    flex-wrap: wrap;
  }

  .navbar-heritage .navbar-brand {
    max-width: calc(100% - 58px);
    min-width: 0;
  }

  .navbar-heritage .brand-text-wrap {
    min-width: 0;
  }

  .navbar-heritage .brand-mark .marathi {
    font-size: 1rem;
  }

  .navbar-heritage .brand-tagline {
    font-size: .5rem;
    letter-spacing: .11em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar-heritage .navbar-toggler {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--brand-border, #e9e3f6);
    border-radius: 13px;
    background: rgba(255, 255, 255, .92);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .navbar-heritage .navbar-collapse {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, .98);
    border: 1px solid var(--brand-border, #e9e3f6);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(70, 50, 100, .12);
  }

  .navbar-heritage .navbar-nav {
    width: 100%;
    margin: 0 !important;
    gap: 3px;
  }

  .navbar-heritage .navbar-nav .nav-item {
    width: 100%;
  }

  .navbar-heritage .navbar-nav .nav-link {
    width: 100%;
    padding: 11px 13px;
    border-radius: 11px;
  }

  .navbar-heritage .navbar-collapse>.d-flex {
    width: 100%;
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  .navbar-heritage .language-nav-wrapper,
  .navbar-heritage .language-nav-btn,
  .navbar-heritage .navbar-collapse .btn-outline-heritage,
  .navbar-heritage .navbar-collapse .btn-heritage {
    width: 100%;
  }

  .navbar-heritage .language-nav-btn {
    justify-content: center;
  }

  /* General headings/sections */
  .section-pad {
    padding-top: 58px;
    padding-bottom: 58px;
  }

  .section-title,
  h1.display-5 {
    font-size: clamp(1.85rem, 7vw, 2.65rem);
    line-height: 1.15;
  }

  .page-header {
    padding-top: 95px !important;
  }

  .page-header .container {
    padding-top: 35px !important;
    padding-bottom: 35px !important;
  }

  /* Generic Bootstrap rows/forms */
  .row {
    --bs-gutter-x: 1rem;
  }

  .form-control,
  .form-select,
  input,
  select,
  textarea {
    max-width: 100%;
  }

  .btn {
    max-width: 100%;
  }

  /* Profile cards */
  .card-profile__image {
    height: 270px;
  }

  .card-profile__body {
    padding: 16px;
  }

  /* Long tags/text must not force horizontal overflow */
  .chip,
  .badge,
  .tag,
  .profile-tag {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Tables */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive>.table {
    min-width: 650px;
  }
}

@media (max-width: 767.98px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  body {
    font-size: 14px;
  }

  .eyebrow {
    font-size: .64rem;
    letter-spacing: 1.8px;
  }

  .section-lede,
  .lead {
    font-size: .92rem;
    line-height: 1.65;
  }

  /* Navbar */
  .navbar-heritage {
    min-height: 62px;
  }

  .navbar-heritage .arch-icon {
    width: 34px;
    height: 34px;
  }

  .navbar-heritage .brand-mark .marathi {
    font-size: .94rem;
  }

  .navbar-heritage .brand-tagline {
    font-size: .44rem;
    letter-spacing: .08em;
  }

  /* Hero */
  .hero {
    padding-top: 92px !important;
    padding-bottom: 34px !important;
  }

  .hero .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero-intro {
    text-align: center;
  }

  .hero h1 {
    font-size: clamp(2rem, 9vw, 2.75rem);
    line-height: 1.08;
  }

  .hero p {
    font-size: .93rem;
    line-height: 1.65;
  }

  .hero-actions,
  .hero-stat-row,
  .hero-trust-row {
    flex-wrap: wrap;
  }

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

  .hero-slider-wrap {
    width: calc(100% - 20px) !important;
    margin-top: 1.25rem !important;
  }

  .hero-photo-carousel.hero-photo-carousel--full {
    height: 285px !important;
    min-height: 285px;
    border-radius: 18px !important;
  }

  .hero-photo-carousel.hero-photo-carousel--full .swiper-slide img {
    object-position: center center;
  }

  .hero-slider-arrow {
    width: 34px !important;
    height: 34px !important;
  }

  .hero-slider-prev {
    left: 9px !important;
  }

  .hero-slider-next {
    right: 9px !important;
  }

  .hero-slide-caption {
    left: 13px !important;
    bottom: 13px !important;
    right: 55px;
    font-size: .85rem !important;
  }

  /* Homepage scrolling gallery */
  .gallery-strip-section {
    padding: 34px 0 40px !important;
  }

  .gallery-strip-heading {
    padding: 0 10px;
  }

  .photo-marquee-item {
    width: 150px !important;
    height: 105px !important;
    border-radius: 14px !important;
  }

  .photo-marquee-track {
    gap: 11px !important;
  }

  /* Generic cards/sections */
  .glass-card,
  .card-profile,
  .pricing-card,
  .testimonial-card,
  .story-card {
    border-radius: 17px;
  }

  .py-lg-6 {
    padding-top: 2.8rem !important;
    padding-bottom: 2.8rem !important;
  }

  /* Search/filter areas */
  .search-panel,
  .advanced-search,
  .filter-card,
  .search-filters {
    padding: 14px !important;
    border-radius: 16px !important;
  }

  /* Make action rows stack instead of overflowing */
  .d-flex.justify-content-between.align-items-center {
    gap: 12px;
    flex-wrap: wrap;
  }

  /* Contact/footer */
  .footer-heritage {
    padding-top: 42px;
  }

  .footer-heritage .row>[class*="col-"] {
    margin-bottom: 22px;
  }

  /* Prevent long URLs/emails/labels from breaking the viewport */
  a,
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  span,
  td,
  th,
  label {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 575.98px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .page-header {
    padding-top: 84px !important;
  }

  .page-header h1 {
    font-size: 1.85rem;
  }

  .page-header .glass-card {
    margin-top: 4px;
  }

  /* Profile listing: one clean card per row */
  .card-profile__image {
    height: 245px !important;
  }

  .card-profile__body h3 {
    font-size: 1.05rem;
  }

  /* Pricing */
  .pricing-card {
    padding: 18px !important;
  }

  /* Buttons become touch friendly */
  .btn {
    min-height: 42px;
  }

  /* Modal */
  .modal-dialog {
    margin: 10px;
  }

  .modal-content {
    border-radius: 18px;
  }
}

@media (max-width: 390px) {
  .navbar-heritage .brand-tagline {
    display: none;
  }

  .hero-photo-carousel.hero-photo-carousel--full {
    height: 250px !important;
    min-height: 250px;
  }

  .hero h1 {
    font-size: 1.9rem;
  }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Real Sathi homepage: stack newest-member profile cards vertically on phones */
@media (max-width: 767.98px) {
  #latest-profiles .members-wrap>.d-flex {
    display: block !important;
    width: 100%;
  }

  #latest-profiles #membersScroll.members-scroll {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 18px;
    overflow-x: visible !important;
    overflow-y: visible;
    padding: 0.4rem 0 1rem;
    scroll-snap-type: none;
  }

  #latest-profiles #membersScroll .member-card,
  #latest-profiles #membersScroll .member-card-modern {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: none !important;
    scroll-snap-align: none;
  }

  #latest-profiles #membersScroll .public-profile-card {
    width: 100%;
  }

  #latest-profiles #membersScroll .public-profile-card__media {
    height: min(112vw, 440px);
    min-height: 300px;
  }
}


/* Mobile navigation and responsive layout safety pass */
.mobile-page-back {
  display: none;
}

@media (max-width:767.98px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    min-width: 320px;
  }

  .mobile-page-back {
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 76px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(156, 43, 76, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .97);
    color: #9c2b4c;
    box-shadow: 0 5px 18px rgba(42, 24, 36, .16);
    font: 600 13px/1.1 Poppins, sans-serif;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-page-back i {
    font-size: 17px;
    line-height: 1;
  }

  .mobile-page-back:active {
    transform: translateY(1px);
    background: #fff5f8;
  }

  .mobile-page-back:focus-visible {
    outline: 3px solid rgba(156, 43, 76, .28);
    outline-offset: 2px;
  }

  body.is-home-page .mobile-page-back {
    display: none !important;
  }

  main,
  section,
  header,
  footer,
  .container,
  .container-fluid,
  .row,
  [class*="col-"],
  .card,
  .glass-card,
  .table-responsive {
    min-width: 0;
  }

  .row>* {
    min-width: 0;
  }

  .container,
  .container-fluid {
    max-width: 100%;
  }

  .modal-dialog {
    width: auto;
    max-width: calc(100vw - 20px);
  }

  .modal-body {
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
  }

  .dropdown-menu {
    max-width: calc(100vw - 24px);
  }

  input:not([type=checkbox]):not([type=radio]),
  select,
  textarea,
  .form-control,
  .form-select {
    min-height: 42px;
    font-size: 16px;
  }

  textarea,
  textarea.form-control {
    min-height: 100px;
  }

  input[type=checkbox],
  input[type=radio] {
    min-width: 18px;
    min-height: 18px;
  }

  .form-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  .form-check-input {
    flex: 0 0 auto;
    margin-top: .2em;
  }

  .form-check-label,
  .input-group>.form-control {
    min-width: 0;
  }

  .input-group {
    flex-wrap: nowrap;
    min-width: 0;
  }

  .dashboard-stats,
  .stats-grid,
  .profile-info-grid,
  .details-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .dashboard-content,
  .dashboard-main,
  .profile-content,
  .profile-details,
  .profile-preview,
  .membership-content {
    min-width: 0;
    max-width: 100%;
  }

  .profile-detail-row,
  .detail-row {
    flex-wrap: wrap;
    gap: 5px 10px;
  }

  .profile-detail-row>*,
  .detail-row>* {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .profile-actions,
  .profile-action-buttons,
  .dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .profile-actions .btn,
  .profile-action-buttons .btn {
    flex: 1 1 130px;
  }

  .table-responsive {
    max-width: 100%;
    overflow-x: auto;
  }

  table {
    max-width: 100%;
  }

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

  .card,
  .card-body,
  .modal-content,
  .accordion-body {
    overflow-wrap: anywhere;
  }
}

@media (max-width:575.98px) {
  .mobile-page-back {
    min-width: 68px;
    min-height: 40px;
    padding: 0 12px;
  }

  .hero-actions,
  .form-actions,
  .page-actions {
    width: 100%;
  }

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

  .card-profile__image {
    object-fit: cover;
  }

  .profile-header,
  .profile-heading,
  .section-heading-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
  }
}

@media print {
  .mobile-page-back {
    display: none !important;
  }
}