/* Loren'S Mobile Readiness — Phase 1
   Passive on normal browser/PWA. Native-only behavior is scoped by html.lorens-native-shell. */

:root{
  --lorens-safe-top: env(safe-area-inset-top, 0px);
  --lorens-safe-right: env(safe-area-inset-right, 0px);
  --lorens-safe-bottom: env(safe-area-inset-bottom, 0px);
  --lorens-safe-left: env(safe-area-inset-left, 0px);
  --lorens-vvh: 100dvh;
  --lorens-keyboard-height: 0px;
}

/* Native container markers are intentionally no-op visually unless required. */
html.lorens-native-shell,
html.lorens-native-shell body{
  min-height:100%;
  overscroll-behavior-x:none;
}

/* Edge-to-edge safe-area support only when running inside native shell. */
html.lorens-native-shell .site-nav,
html.lorens-native-shell .brandbar{
  padding-left:max(var(--lorens-safe-left), 0px);
  padding-right:max(var(--lorens-safe-right), 0px);
}

html.lorens-native-shell .bottombar{
  padding-left:max(var(--lorens-safe-left), 0px);
  padding-right:max(var(--lorens-safe-right), 0px);
  padding-bottom:max(var(--lorens-safe-bottom), 0px);
}

/* Native keyboard: keep active form controls visible without changing current PWA behavior. */
html.lorens-native-shell.lorens-keyboard-open .bottombar{
  visibility:hidden;
  pointer-events:none;
}

html.lorens-native-shell input,
html.lorens-native-shell textarea,
html.lorens-native-shell select{
  scroll-margin-bottom:calc(var(--lorens-keyboard-height) + 28px);
}

/* iOS native/PWA touch polish. */
html.lorens-ios button,
html.lorens-ios a,
html.lorens-ios input,
html.lorens-ios select,
html.lorens-ios textarea{
  -webkit-tap-highlight-color:transparent;
}

/* Prevent text-size surprises after orientation changes. */
html.lorens-ios,
html.lorens-android{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

/* Keep fixed UI from leaking outside device safe areas in a native webview. */
html.lorens-native-shell .modal-backdrop,
html.lorens-native-shell .ad-popup-backdrop{
  padding-left:max(var(--lorens-safe-left), 0px);
  padding-right:max(var(--lorens-safe-right), 0px);
}

/* Reduced motion remains respected when embedded in native shell. */
@media(prefers-reduced-motion:reduce){
  html.lorens-native-shell *,
  html.lorens-native-shell *::before,
  html.lorens-native-shell *::after{
    scroll-behavior:auto!important;
  }
}
