/* BD IT HOME Matrimony v16: minimal filter drawer behavior correction.
 * Mobile: the action buttons follow the last filter field (not sticky);
 * the offcanvas and its backdrop stop above the site's existing bottom nav.
 * Desktop-site / compact desktop layout below this block is unchanged.
 */
@media screen and (max-width: 919.98px) {
  /* The site's independently supplied mobile bottom navigation occupies
     approximately 86px. Keep this area outside both Bootstrap offcanvas and
     its backdrop, so its existing navigation remains visible and tappable. */
  body.bdh-theme {
    --bdh-filter-nav-clearance: calc(86px + env(safe-area-inset-bottom, 0px));
  }
  body.bdh-theme .bdh-filter-sidebar.offcanvas-lg {
    z-index: 100030!important;
    top: 0!important;
    bottom: auto!important;
    height: calc(100vh - var(--bdh-filter-nav-clearance))!important;
    height: calc(100dvh - var(--bdh-filter-nav-clearance))!important;
    max-height: calc(100dvh - var(--bdh-filter-nav-clearance))!important;
    overflow-x: hidden!important;
    overflow-y: auto!important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  body.bdh-theme:has(.bdh-filter-sidebar.offcanvas-lg.show) .offcanvas-backdrop.show,
  body.bdh-theme:has(.bdh-filter-sidebar.offcanvas-lg.showing) .offcanvas-backdrop.show {
    z-index: 100020!important;
    top: 0!important;
    bottom: auto!important;
    height: calc(100vh - var(--bdh-filter-nav-clearance))!important;
    height: calc(100dvh - var(--bdh-filter-nav-clearance))!important;
    max-height: calc(100dvh - var(--bdh-filter-nav-clearance))!important;
  }
  body.bdh-theme .bdh-filter-sidebar.offcanvas-lg .bdh-filter-form {
    padding-bottom: 12px!important;
  }
  /* The final actions are normal form content: scroll down to find them.
     Main theme CSS used sticky; v15 additionally pinned them 86px higher. */
  body.bdh-theme .bdh-filter-sidebar.offcanvas-lg .bdh-filter-actions {
    position: static!important;
    bottom: auto!important;
    top: auto!important;
    z-index: auto!important;
    margin: 0!important;
    background: #fff!important;
    border-top: 1px solid #eadce1!important;
    box-shadow: none!important;
  }
}

/* Chrome/Android "Desktop site" commonly uses a virtual viewport around
 * 980 CSS pixels. Earlier theme media queries treated that as a phone for the
 * navigation/offcanvas. Here it remains a compact *desktop* (two columns),
 * while real phone-width mobile layout is left completely unchanged. */
@media screen and (min-width: 920px) and (max-width: 1024px) {
  body.bdh-theme .bdh-header-inner {
    display: flex!important;
    align-items: center!important;
    flex-wrap: nowrap!important;
    gap: 12px!important;
    min-height: 76px!important;
    position: relative!important;
  }
  body.bdh-theme .bdh-brand {
    flex: 0 0 auto!important;
    max-width: 155px;
    z-index: 3;
  }
  body.bdh-theme .bdh-brand-text strong {font-size: 13px!important;}
  body.bdh-theme .bdh-brand-text small {font-size: 10px!important;}
  body.bdh-theme .bdh-nav-toggle {display: none!important;}
  body.bdh-theme .bdh-header .bdh-nav,
  body.home.bdh-theme .bdh-header .bdh-nav {
    display: block!important;
    position: static!important;
    width: auto!important;
    min-width: 0!important;
    height: auto!important;
    padding: 0!important;
    margin: 0 auto!important;
    border: 0!important;
    border-radius: 0!important;
    background: transparent!important;
    box-shadow: none!important;
    backdrop-filter: none!important;
    opacity: 1!important;
    visibility: visible!important;
    pointer-events: auto!important;
    transform: none!important;
    z-index: 2!important;
  }
  body.bdh-theme .bdh-header .bdh-menu {
    display: flex!important;
    flex-flow: row nowrap!important;
    align-items: center!important;
    gap: 9px!important;
    padding: 0!important;
    margin: 0!important;
  }
  body.bdh-theme .bdh-header .bdh-menu li {
    display: block!important;
    width: auto!important;
  }
  body.bdh-theme .bdh-header .bdh-menu a {
    display: block!important;
    white-space: nowrap!important;
    min-height: 0!important;
    padding: 6px 0!important;
    font-size: 11px!important;
    line-height: 1.55!important;
    border: 0!important;
    border-radius: 0!important;
    background: transparent!important;
    box-shadow: none!important;
  }
  body.bdh-theme .bdh-header .bdh-menu a:after {display:none!important;}
  body.bdh-theme .bdh-header .bdh-header-actions {
    display:flex!important;
    flex:0 0 auto!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    margin:0!important;
    gap:5px!important;
    z-index:3;
  }
  body.bdh-theme .bdh-header-actions .bdh-lang-pill {
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-height:36px!important;
    min-width:38px!important;
    padding:5px 6px!important;
    font-size:11px!important;
  }
  body.bdh-theme .bdh-header-actions > a.bdh-header-login,
  body.bdh-theme .bdh-header-actions > a.bdh-btn-primary {
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    flex:0 0 auto!important;
    min-width:0!important;
    min-height:36px!important;
    max-width:none!important;
    padding:6px 8px!important;
    font-size:11px!important;
    line-height:1.35!important;
    white-space:nowrap!important;
  }
  /* The filter appears as a normal sticky desktop sidebar at ~980px,
     not a hidden/bootstrap mobile offcanvas. */
  body.bdh-theme .bdh-archive-search-shell {
    display:grid!important;
    grid-template-columns:minmax(245px, 28%) minmax(0, 1fr)!important;
    align-items:start!important;
    gap:18px!important;
  }
  body.bdh-theme .bdh-filter-sidebar.offcanvas-lg {
    display:block!important;
    position:sticky!important;
    top:94px!important;
    bottom:auto!important;
    left:auto!important;
    right:auto!important;
    width:100%!important;
    min-width:0!important;
    height:auto!important;
    max-height:calc(100vh - 112px)!important;
    padding:0!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    transform:none!important;
    visibility:visible!important;
    opacity:1!important;
    box-shadow:none!important;
    background:transparent!important;
    border:0!important;
    z-index:1!important;
  }
  /* A 270px desktop sidebar cannot fit three Bengali labels side-by-side. */
  body.bdh-theme .bdh-filter-sidebar .bdh-filter-type {
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:7px!important;
  }
  body.bdh-theme .bdh-filter-sidebar .bdh-filter-type > span {
    grid-column:1!important;
  }
  body.bdh-theme .bdh-filter-sidebar .bdh-filter-type > label {
    min-height:38px!important;
    justify-content:flex-start!important;
    text-align:left!important;
    white-space:normal!important;
    overflow-wrap:normal!important;
  }
  body.bdh-theme .bdh-filter-sidebar .bdh-filter-type > label b {
    font-size:12px!important;
    line-height:1.45!important;
  }
  body.bdh-theme .bdh-filter-sidebar .offcanvas-header,
  body.bdh-theme .bdh-mobile-filter-btn {
    display:none!important;
  }
  body.bdh-theme .bdh-filter-sidebar .bdh-filter-form {
    width:100%!important;
    height:auto!important;
    padding-bottom:0!important;
    border:1px solid var(--bdh-border)!important;
    border-radius:16px!important;
  }
  body.bdh-theme .bdh-filter-sidebar .bdh-filter-actions {
    position:sticky!important;
    bottom:0!important;
    padding:12px!important;
    margin-bottom:0!important;
  }
  /* Keep the site's central desktop sections aligned in the 980px layout. */
  body.bdh-theme .bdh-hero-inner {grid-template-columns:1.12fr .88fr!important;}
  body.home.bdh-theme .bdh-home-hero-inner {
    display:grid!important;
    grid-template-columns:minmax(0,1.05fr) minmax(300px,.95fr)!important;
    gap:20px!important;
    align-items:center!important;
    text-align:left!important;
  }
  body.home.bdh-theme .bdh-home-hero-copy {text-align:left!important;}
  body.home.bdh-theme .bdh-home-hero-visual {max-width:none!important;}
  body.home.bdh-theme .bdh-home-stat-grid {grid-template-columns:repeat(4,minmax(0,1fr))!important;}
  body.home.bdh-theme .bdh-home-step-grid {grid-template-columns:repeat(4,minmax(0,1fr))!important;}
  body.home.bdh-theme .bdh-home-package-grid {grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.bdh-theme .bdh-footer-grid {grid-template-columns:repeat(4,minmax(0,1fr))!important;}
  body.bdh-theme .bdh-package-grid {grid-template-columns:repeat(3,minmax(0,1fr))!important;}
  body.bdh-theme .bdh-package-tier-grid {
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:12px!important;
  }
  body.bdh-theme .bdh-package-portal-card {padding:16px!important;}
  body.bdh-theme .bdh-package-portal-card h3 {font-size:19px!important;}
  body.bdh-theme .bdh-package-portal-price strong {font-size:28px!important;}
  body.bdh-theme .bdh-package-payment-form {grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  body.bdh-theme .bdh-profile-layout {
    grid-template-columns:minmax(0,1fr) 280px!important;
  }
}
