/* Installable web app (xos.policy).
   Colours mirror xos.theme/less/variables.less:
   primary #2c3e81, secondary #ff8c00. */

.xos-pwa {
  position: fixed;
  left: 20px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 550;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font: inherit;
}

.xos-pwa[hidden],
.xos-pwa-sheet[hidden],
.xos-pwa-footer[hidden] {
  display: none !important;
}

.xos-pwa-sheet [hidden] {
  display: none !important;
}

.xos-pwa__pill {
  display: flex;
  align-items: stretch;
  background: #2c3e81;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .24);
  overflow: hidden;
}

.xos-pwa__main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 18px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.xos-pwa__main:focus-visible,
.xos-pwa__min:focus-visible,
.xos-pwa__close:focus-visible,
.xos-pwa-sheet__btn:focus-visible,
.xos-pwa-footer:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.xos-pwa__icon {
  display: flex;
}

.xos-pwa__icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.xos-pwa__label {
  white-space: nowrap;
}

.xos-pwa__min {
  width: 38px;
  min-height: 48px;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, .22);
  background: none;
  color: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.xos-pwa__close {
  width: 30px;
  height: 30px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.xos-pwa[data-state="collapsed"] .xos-pwa__label,
.xos-pwa[data-state="collapsed"] .xos-pwa__min,
.xos-pwa[data-state="collapsed"] .xos-pwa__close {
  display: none;
}

.xos-pwa[data-state="collapsed"] .xos-pwa__pill {
  border-radius: 50%;
}

.xos-pwa[data-state="collapsed"] .xos-pwa__main {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
}

.xos-pwa-sheet {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 12, 18, .55);
}

.xos-pwa-sheet__panel {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  color: #16181d;
  border-radius: 16px 16px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .28);
  font-size: 15px;
  line-height: 1.55;
}

.xos-pwa-sheet__title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.xos-pwa-sheet__text {
  margin: 0 0 14px;
  color: #4b5160;
}

.xos-pwa-sheet__steps {
  margin: 0 0 16px;
  padding-left: 20px;
  color: #4b5160;
}

.xos-pwa-sheet__steps li {
  margin-bottom: 6px;
}

.xos-pwa-sheet__warn {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4e5;
  color: #7a4a00;
  font-size: 13.5px;
}

.xos-pwa-sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xos-pwa-sheet__btn {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.xos-pwa-sheet__btn--primary {
  background: #2c3e81;
  color: #fff;
}

.xos-pwa-sheet__btn--ghost {
  background: #eef0f4;
  border-color: #d6dae1;
  color: #16181d;
}

.xos-pwa-footer {
  display: inline-block;
  margin: 12px 0 0;
  padding: 0;
  background: none;
  border: 0;
  color: #f8f8f8;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.xos-pwa-footer:hover,
.xos-pwa-footer:focus {
  color: #fff;
}

/* Installed: nothing to offer, no JS and no flash. */
@media all and (display-mode: standalone) {
  .xos-pwa,
  .xos-pwa-sheet,
  .xos-pwa-footer {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .xos-pwa {
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* The ad page keeps a fixed contact bar at the bottom (`.contact`, 1999). */
@media (max-width: 767px) {
  body:has(.contact) .xos-pwa {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .xos-pwa-sheet__panel {
    animation: xos-pwa-up .18s ease-out;
  }

  @keyframes xos-pwa-up {
    from {
      transform: translateY(12px);
      opacity: .6;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }
}
