/**
 * Cross-device CSS fullscreen / overlay fallback.
 * Paired with js/dg-fullscreen.js — feature detection, no device-brand hacks.
 *
 * IMPORTANT: do NOT set touch-action:none on body — that breaks Leaflet pan/zoom
 * and chat thread scrolling on Android Chrome / Samsung Internet.
 */

html.dg-fs-lock,
html.dg-fs-lock body,
body.dg-fs-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
  /* Keep default touch-action so map/chat gestures still work. */
}

/* Portaled element: escape parent transform / clip / stacking */
.dg-fs-fallback {
  position: fixed !important;
  /* Prefer visualViewport box when JS sets --dg-fs-vv-*; else full layout viewport. */
  top: var(--dg-fs-vv-top, 0px) !important;
  left: var(--dg-fs-vv-left, 0px) !important;
  right: auto !important;
  bottom: auto !important;
  width: var(--dg-fs-vv-width, 100vw) !important;
  width: var(--dg-fs-vv-width, 100dvw) !important;
  height: var(--dg-fs-vv-height, 100vh) !important;
  height: var(--dg-fs-vv-height, 100dvh) !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transform: none !important;
  filter: none !important;
  perspective: none !important;
  z-index: 10080 !important;
  box-sizing: border-box !important;
  /* Full-bleed by default; pages that need safe-area pad their chrome, not the shell. */
  padding: 0 !important;
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
}

@supports not (height: 100dvh) {
  .dg-fs-fallback {
    height: var(--dg-fs-vv-height, 100vh) !important;
  }
}

/* Image / media overlay host */
.dg-fs-overlay,
.dg-fs-fallback.dg-fs-overlay {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(8, 10, 12, 0.94);
  touch-action: manipulation;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px)) !important;
}

.dg-fs-placeholder {
  display: none !important;
}
