/* Paw Vibes — PWA install prompt (Mission APP 03) */

.pw-install-fab {
  position: fixed;
  z-index: 9395;
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  background: var(--cream, #F5EEE2);
  box-shadow:
    0 10px 32px rgba(58, 37, 26, 0.22),
    0 0 0 1px rgba(160, 114, 48, 0.18);
  animation: pw-install-fab-float 3.2s ease-in-out infinite;
  transition: box-shadow 0.24s ease, transform 0.24s ease, opacity 0.24s ease;
}

.pw-install-fab__logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 50%;
  object-fit: cover;
}

.pw-install-fab__ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(192, 144, 64, 0.42);
  animation: pw-install-fab-pulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

/* Install cue — luminous down arrow */
.pw-install-fab::after {
  content: '↓';
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 2;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.96);
  color: rgba(255, 248, 232, 0.98);
  border: 1px solid rgba(255, 235, 190, 0.55);
  font-family: var(--f-body, 'Source Sans 3', sans-serif);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 0 10px rgba(212, 175, 55, 0.9),
    0 0 22px rgba(201, 149, 42, 0.55),
    0 6px 14px rgba(0, 0, 0, 0.2);
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.95),
    0 0 14px rgba(212, 175, 55, 0.85);
  pointer-events: none;
  animation: pw-install-badge-nudge 3.6s ease-in-out infinite;
}

.pw-install-fab:focus-visible::after,
.pw-install-fab:hover::after {
  background: rgba(228, 196, 72, 0.98);
  border-color: rgba(255, 245, 210, 0.72);
  box-shadow:
    0 0 14px rgba(228, 196, 72, 0.95),
    0 0 28px rgba(212, 175, 55, 0.65),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.pw-install-fab::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.22) 0%, transparent 62%);
  filter: blur(2px);
  opacity: 0.95;
  z-index: 0;
  pointer-events: none;
}

@keyframes pw-install-badge-nudge {
  0%, 72%, 100% { transform: translateY(0); }
  78% { transform: translateY(-2px); }
  84% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .pw-install-fab::after { animation: none; }
}

.pw-install-fab:hover,
.pw-install-fab:focus-visible {
  animation: none;
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 14px 36px rgba(58, 37, 26, 0.28),
    0 0 0 2px rgba(192, 144, 64, 0.32);
  outline: none;
}

.pw-install-fab:hover .pw-install-fab__ring,
.pw-install-fab:focus-visible .pw-install-fab__ring {
  animation: none;
  border-color: rgba(192, 144, 64, 0.62);
}

.pw-install-fab--active {
  animation: none;
  transform: scale(0.96);
  box-shadow:
    0 6px 18px rgba(58, 37, 26, 0.2),
    0 0 0 2px rgba(192, 144, 64, 0.45);
}

@keyframes pw-install-fab-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes pw-install-fab-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@media (min-width: 960px) {
  .pw-install-fab {
    right: 20px;
    bottom: 150px;
  }
}

@media (max-width: 959px) {
  .pw-install-fab {
    z-index: 10040;
    right: 14px;
    bottom: calc(var(--pw-bottom-nav-h, 68px) + 12px + env(safe-area-inset-bottom, 0px));
  }

  body.sticky-active .pw-install-fab {
    bottom: calc(126px + env(safe-area-inset-bottom, 0px));
  }

  .pw-install {
    z-index: 10030;
    left: 14px;
    right: 14px;
    width: auto;
    bottom: calc(var(--pw-bottom-nav-h, 68px) + 12px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  body.sticky-active .pw-install {
    bottom: calc(192px + env(safe-area-inset-bottom, 0px));
  }
}

body.floats-suppressed .pw-install-fab {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.pw-install-fab[hidden] {
  display: none !important;
}

.pw-install {
  position: fixed;
  z-index: 8980;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.pw-install--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.pw-install__card {
  position: relative;
  padding: 16px 16px 14px;
  background: var(--espresso, #3A251A);
  border: 1px solid rgba(222, 193, 129, 0.14);
  border-radius: 3px;
  box-shadow: 0 10px 36px rgba(26, 18, 12, 0.28);
}

.pw-install__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: rgba(246, 241, 232, 0.55);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.pw-install__close:hover,
.pw-install__close:focus-visible {
  color: var(--cream, #F5EEE2);
  background: rgba(222, 193, 129, 0.08);
  outline: 2px solid rgba(222, 193, 129, 0.45);
  outline-offset: 1px;
}

.pw-install__logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  margin-bottom: 10px;
}

.pw-install__title {
  margin: 0 0 6px;
  padding-right: 36px;
  font-family: var(--f-serif, Georgia, serif);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--cream, #F5EEE2);
}

.pw-install__text {
  margin: 0 0 14px;
  font-family: var(--f-body, 'Source Sans 3', sans-serif);
  font-size: 0.78rem;
  line-height: 1.55;
  color: rgba(246, 241, 232, 0.62);
}

.pw-install__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.pw-install__cta,
.pw-install__later {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 2px;
  font-family: var(--f-body, 'Source Sans 3', sans-serif);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pw-install__cta {
  flex: 1 1 auto;
  border: 1px solid rgba(222, 193, 129, 0.35);
  background: rgba(222, 193, 129, 0.14);
  color: var(--cream, #F5EEE2);
}

.pw-install__cta:hover,
.pw-install__cta:focus-visible {
  background: rgba(222, 193, 129, 0.22);
  border-color: rgba(222, 193, 129, 0.5);
  outline: none;
}

.pw-install__later {
  flex: 0 1 auto;
  border: 1px solid rgba(246, 241, 232, 0.12);
  background: transparent;
  color: rgba(246, 241, 232, 0.55);
}

.pw-install__later:hover,
.pw-install__later:focus-visible {
  color: var(--cream, #F5EEE2);
  border-color: rgba(246, 241, 232, 0.22);
  outline: none;
}

.pw-install__help {
  display: inline-block;
  min-height: 44px;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: rgba(222, 193, 129, 0.72);
  font-family: var(--f-body, 'Source Sans 3', sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.pw-install__help:hover,
.pw-install__help:focus-visible {
  color: var(--gold, #C09040);
  outline: none;
}

.f-install-link {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.f-install-link:hover {
  color: var(--gold);
  padding-left: 5px;
}

@media (min-width: 960px) {
  .pw-install {
    right: 20px;
    bottom: 216px;
    left: auto;
    width: min(340px, calc(100vw - 40px));
  }
}

.pw-bottom-nav {
  position: fixed;
  inset: auto 0 0;
  z-index: 9990;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(245, 238, 226, 0.96);
  border-top: 1px solid rgba(160, 114, 48, 0.16);
  box-shadow: 0 -8px 28px rgba(58, 37, 26, 0.12);
}

.pw-bottom-nav__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 6px;
  border-radius: 4px;
  font-family: var(--f-body, 'Source Sans 3', sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--espresso, #3A251A);
  text-decoration: none;
  background: rgba(249, 244, 234, 0.92);
  transition: transform 0.2s ease, background 0.2s ease;
}

.pw-bottom-nav__item:focus,
.pw-bottom-nav__item:hover,
.pw-bottom-nav__item.active {
  background: rgba(158, 125, 93, 0.14);
  transform: translateY(-1px);
}

.pw-install-ios {
  position: fixed;
  inset: 0;
  z-index: 100060;
  display: none;
  place-items: end center;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: rgba(39, 22, 16, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.pw-install-ios.pw-install-ios--open {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.pw-install-ios[hidden]:not(.pw-install-ios--open) {
  display: none !important;
}

body.pw-install-sheet-open {
  overflow: hidden;
}

.pw-install-ios__sheet {
  width: min(100%, 360px);
  padding: 20px 18px 16px;
  background: var(--cream, #F5EEE2);
  border: 1px solid var(--brand-line, rgba(160, 114, 48, 0.24));
  border-radius: 3px;
  text-align: center;
}

.pw-install-ios__sheet p {
  font-family: var(--f-body, 'Source Sans 3', sans-serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--espresso, #3A251A);
  margin: 0 0 16px;
}

@media (max-width: 959px) {
  .pw-install-ios__sheet {
    width: min(100%, calc(100vw - 28px));
    padding: 22px 18px 18px;
  }

  .pw-install-ios__sheet p {
    font-size: 1.02rem;
    line-height: 1.65;
    text-align: left;
  }

  .pw-install__text {
    font-size: 0.88rem;
    line-height: 1.6;
    color: rgba(246, 241, 232, 0.82);
  }

  .pw-install__help {
    font-size: 0.82rem;
    color: rgba(222, 193, 129, 0.92);
  }
}

.pw-install-ios__close {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--espresso, #3A251A);
  border-radius: 2px;
  background: var(--espresso, #3A251A);
  color: var(--cream, #F5EEE2);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

@media (min-width: 960px), (display-mode: standalone) and (min-width: 760px) {
  .pw-bottom-nav {
    display: none;
  }
}

@media (display-mode: standalone) {
  .pw-install,
  .pw-install-fab {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pw-install,
  .pw-install-ios,
  .pw-install-fab,
  .pw-install-fab__ring {
    transition: none;
    animation: none !important;
  }
}
