/* XPARO installable app (templates/pwa.html). html.xp-app is set when the
   site runs as the installed app (home-screen PWA or the Play Store app). */

/* ---------- feel like an app, not a web page ---------- */
html.xp-app {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.xp-app body {
  overscroll-behavior-y: none;            /* no rubber-band / pull-to-refresh on the whole app */
  -webkit-tap-highlight-color: transparent;
}
html.xp-app button,
html.xp-app nav,
html.xp-app .btn,
html.xp-app [role="button"] {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* install entry points stay hidden until pwa-app.js says installing is possible */
[data-pwa-install][hidden] {
  display: none !important;
}
/* anything that only makes sense in a browser tab */
html.xp-app .xp-hide-in-app,
html.xp-app [data-pwa-install] {
  display: none !important;
}

/* ---------- install sheet + toast ---------- */
.xp-pwa-sheet,
.xp-pwa-toast {
  --xp-pwa-bg: #ffffff;
  --xp-pwa-fg: #16181d;
  --xp-pwa-muted: #5b6070;
  --xp-pwa-line: rgba(0, 0, 0, 0.08);
  position: fixed;
  z-index: 2147483000;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px));
  box-sizing: border-box;
  background: var(--xp-pwa-bg);
  color: var(--xp-pwa-fg);
  border: 1px solid var(--xp-pwa-line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  animation: xp-pwa-in 0.22s ease-out;
}
@media (prefers-color-scheme: dark) {
  .xp-pwa-sheet,
  .xp-pwa-toast {
    --xp-pwa-bg: #1b1e25;
    --xp-pwa-fg: #f2f3f5;
    --xp-pwa-muted: #a3a8b5;
    --xp-pwa-line: rgba(255, 255, 255, 0.1);
  }
}
.xp-pwa-sheet {
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
}
.xp-pwa-sheet__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex: none;
}
.xp-pwa-sheet__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.xp-pwa-sheet__text span {
  color: var(--xp-pwa-muted);
  font-size: 13px;
}
.xp-pwa-sheet__actions {
  display: flex;
  gap: 8px;
  flex: none;
}
.xp-pwa-toast {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
}
.xp-pwa-btn {
  appearance: none;
  border: 1px solid var(--xp-pwa-line);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.xp-pwa-btn--primary {
  background: #ff7722;
  border-color: #ff7722;
  color: #fff;
}
.xp-pwa-btn:focus-visible {
  outline: 2px solid #ff7722;
  outline-offset: 2px;
}
@media (max-width: 420px) {
  .xp-pwa-sheet {
    flex-wrap: wrap;
  }
  .xp-pwa-sheet__actions {
    width: 100%;
    justify-content: flex-end;
  }
}
@keyframes xp-pwa-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .xp-pwa-sheet,
  .xp-pwa-toast {
    animation: none;
  }
}

/* ---------- page to page: a soft cross-fade instead of a hard flash ----------
   Same-origin navigations in browsers with cross-document view transitions
   (Chrome/Edge 126+, Safari 18.2+); others navigate exactly as before. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
}
