/* VOLIQA V470H — POPUP SCROLL OWNERSHIP FIX
   The overlay is a fixed, non-scrolling viewport below the site header.
   The popup DIALOG itself is the one and only vertical scroll owner.
   This keeps the scrollbar inside the rounded popup on desktop and makes
   touch scrolling work on the whole dialog on mobile. Footer geometry is
   intentionally untouched. */

body.v13 :is(
  .v364-about-modal:not([hidden]),
  .v400-how-modal:not([hidden]),
  .v40-faq-modal:not([hidden]),
  .v24-help-modal:not([hidden]),
  .v48-sitemap-modal:not([hidden]),
  .v48-case-modal:not([hidden]),
  .v81-ai-modal:not([hidden]),
  .v339-analysis-modal:not([hidden]),
  #v347-cookie-modal:not([hidden]),
  .v113-legal-modal.is-open,
  .v13-modal.open,
  .v13-modal.is-open,
  .v13-modal[aria-hidden="false"]
){
  overflow:hidden!important;
  overscroll-behavior:none!important;
  align-items:center!important;
  justify-items:center!important;
  place-items:center!important;
  touch-action:none!important;
}

/* The dialog owns the scroll. The track therefore stays inside the popup. */
body.v13 :is(
  .v13-modalbox,
  .v364-about-dialog,
  .v400-how-dialog,
  .v40-faq-dialog,
  .v48-sitemap-dialog,
  .v48-case-dialog,
  .v81-ai-dialog,
  .v339-analysis-dialog,
  .v347-cookie-dialog,
  .v113-legal-dialog,
  .v24-help-dialog
){
  box-sizing:border-box!important;
  max-height:calc(100dvh - var(--v404-popup-header-bottom,92px) - 24px - env(safe-area-inset-bottom))!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
  scrollbar-gutter:stable!important;
  touch-action:pan-y!important;
  margin-top:0!important;
  margin-bottom:0!important;
}

/* Historical inner scrollers must not steal wheel/touch events. */
body.v13 :is(
  .v30-join-scroll,
  .v151-vlqa-scroll,
  .v123-donate-content,
  .v40-faq-content,
  .v366-about-content,
  .v400-how-grid,
  .v346-sitemap-grid
){
  max-height:none!important;
  overflow:visible!important;
  overscroll-behavior:auto!important;
  -webkit-overflow-scrolling:auto!important;
  touch-action:auto!important;
}

body.v13 .v30-join-modalbox{
  overflow-x:hidden!important;
  overflow-y:auto!important;
}

/* Make the popup heading/close control move as part of the dialog; do not
   create a second scrolling header strip. */
body.v13 :is(.v13-modalhead,.v48-sitemap-head,.v48-case-head){
  position:relative!important;
  top:auto!important;
}

/* Suppress native WebKit scrollbar arrow buttons and keep a thin track. */
body.v13 :is(
  .v13-modalbox,
  .v364-about-dialog,
  .v400-how-dialog,
  .v40-faq-dialog,
  .v48-sitemap-dialog,
  .v48-case-dialog,
  .v81-ai-dialog,
  .v339-analysis-dialog,
  .v347-cookie-dialog,
  .v113-legal-dialog,
  .v24-help-dialog
)::-webkit-scrollbar{width:9px;height:9px}
body.v13 :is(
  .v13-modalbox,
  .v364-about-dialog,
  .v400-how-dialog,
  .v40-faq-dialog,
  .v48-sitemap-dialog,
  .v48-case-dialog,
  .v81-ai-dialog,
  .v339-analysis-dialog,
  .v347-cookie-dialog,
  .v113-legal-dialog,
  .v24-help-dialog
)::-webkit-scrollbar-button{display:none!important;width:0!important;height:0!important}

@media(max-width:760px){
  body.v13 :is(
    .v364-about-modal:not([hidden]),
    .v400-how-modal:not([hidden]),
    .v40-faq-modal:not([hidden]),
    .v24-help-modal:not([hidden]),
    .v48-sitemap-modal:not([hidden]),
    .v48-case-modal:not([hidden]),
    .v81-ai-modal:not([hidden]),
    .v339-analysis-modal:not([hidden]),
    #v347-cookie-modal:not([hidden]),
    .v113-legal-modal.is-open,
    .v13-modal.open,
    .v13-modal.is-open,
    .v13-modal[aria-hidden="false"]
  ){
    padding:8px max(6px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))!important;
    align-items:start!important;
    place-items:start center!important;
  }

  body.v13 :is(
    .v13-modalbox,
    .v364-about-dialog,
    .v400-how-dialog,
    .v40-faq-dialog,
    .v48-sitemap-dialog,
    .v48-case-dialog,
    .v81-ai-dialog,
    .v339-analysis-dialog,
    .v347-cookie-dialog,
    .v113-legal-dialog,
    .v24-help-dialog
  ){
    width:100%!important;
    min-height:0!important;
    max-height:calc(100dvh - var(--v404-popup-header-bottom,92px) - 16px - env(safe-area-inset-bottom))!important;
    margin:0 auto!important;
  }
}
