/* Shared Safari/iOS compatibility layer. Keep this file dependency-free. */
:root {
  --app-height: 100vh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: var(--app-height);
}

button,
[role="button"],
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: rgba(33, 106, 104, .14);
}

button,
input,
select,
textarea {
  max-width: 100%;
}

/* Safari needs the prefixed property through older supported releases. */
.nav,
.lp-nav {
  -webkit-backdrop-filter: blur(16px) saturate(120%);
}

/* Fixed dialogs must stay inside the visible area when the iOS keyboard opens. */
.wx-chat-modal,
.ai-prompt-modal {
  height: var(--app-height);
  padding-top: max(14px, var(--safe-top));
  padding-right: max(14px, var(--safe-right));
  padding-bottom: max(14px, var(--safe-bottom));
  padding-left: max(14px, var(--safe-left));
}

@supports (height: 100dvh) {
  :root { --app-height: 100dvh; }
}

@media (max-width: 860px) {
  /* Prevent Safari from zooming the whole page when a field receives focus. */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .shell,
  .wrap,
  .lp-nav-inner {
    padding-left: var(--safe-left) !important;
    padding-right: var(--safe-right) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
