/* =====================================================================
   TeraVision Shop — invitation à installer l'application
   ===================================================================== */

/* Le bloc est écrit dans la page mais inerte : sans cette règle, l'attribut
   [hidden] serait battu par le display d'auteur et la fenêtre s'afficherait
   à tout le monde, y compris quand le script ne tourne pas. */
.pwa[hidden] { display: none !important; }

.pwa {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 700px) { .pwa { align-items: center; } }

.pwa__voile {
  position: absolute; inset: 0;
  background: rgba(8, 24, 16, .62);
  backdrop-filter: blur(4px);
  animation: pwaVoile .3s var(--ease) both;
}
@keyframes pwaVoile { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------ La carte ---------------------------- */
.pwa__box {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto;
  background: #fff;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -20px 60px rgba(8, 24, 16, .35);
  animation: pwaMonte .42s var(--ease-back) both .06s;
}
@media (min-width: 700px) {
  .pwa__box { border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(8, 24, 16, .4); }
}
/* Une feuille qui monte du bas sur mobile, un dialogue qui apparaît sur grand écran */
@keyframes pwaMonte {
  from { opacity: 0; transform: translateY(40px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.pwa__x {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .18); color: #fff;
  transition: background .2s, transform .2s;
}
.pwa__x:hover { background: rgba(255, 255, 255, .34); transform: rotate(90deg); }
.pwa__x .ico { width: 16px; height: 16px; }

/* ------------------------------ Illustration ------------------------ */
.pwa__art {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--green-900), var(--green) 62%, #0E8038);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 0 0;
}
/* Halo qui respire derrière le téléphone */
.pwa__glow {
  position: absolute; left: 50%; top: 44%; width: 260px; height: 260px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(245, 197, 24, .34), transparent 62%);
  animation: pwaRespire 3.6s ease-in-out infinite;
}
@keyframes pwaRespire {
  0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: .9;  transform: translate(-50%, -50%) scale(1.14); }
}

.pwa__scene { position: relative; display: block; width: 100%; height: 178px; }

/* Le téléphone flotte doucement */
.pwa__phone { animation: pwaFlotte 4.2s ease-in-out infinite; transform-origin: 120px 86px; }
@keyframes pwaFlotte {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-6px) rotate(-1.2deg); }
}

/* L'icône vient se poser sur l'écran, puis reste */
.pwa__icone { animation: pwaPose .9s var(--ease-back) both .45s; transform-origin: 120px 82px; }
@keyframes pwaPose {
  from { opacity: 0; transform: translateY(-26px) scale(.55) rotate(-12deg); }
  to   { opacity: 1; transform: none; }
}

.pwa__etoiles path, .pwa__etoiles circle { transform-box: fill-box; transform-origin: center; }
.pwa__e1 { animation: pwaScintille 2.4s ease-in-out infinite .2s; }
.pwa__e2 { animation: pwaScintille 2.9s ease-in-out infinite .9s; }
.pwa__e3 { animation: pwaScintille 2.2s ease-in-out infinite 1.4s; }
.pwa__e4 { animation: pwaScintille 3.1s ease-in-out infinite .6s; }
@keyframes pwaScintille {
  0%, 100% { opacity: .25; transform: scale(.7); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* ------------------------------ Le texte ---------------------------- */
/* La marge basse tient compte de la barre de geste des iPhone : sans elle,
 le bouton « Plus tard » se retrouve sous le trait du bas. */
.pwa__txt { padding: 20px 22px calc(22px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 700px) { .pwa__txt { padding-bottom: 22px; } }

.pwa__eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--green-soft); color: var(--green);
  font-family: var(--ff-title); font-size: 11px; font-weight: 800;
  letter-spacing: .09em; text-transform: uppercase;
}
.pwa__eyebrow .ico { width: 13px; height: 13px; }

.pwa__titre {
  margin: 12px 0 0;
  font-family: var(--ff-title); font-size: 24px; font-weight: 800;
  line-height: 1.2; letter-spacing: -.02em; color: var(--ink);
}
.pwa__sous { margin: 8px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); }

.pwa__plus { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.pwa__plus li {
  display: flex; align-items: center; gap: 11px;
  font-size: 13.8px; line-height: 1.45; color: var(--ink-2);
  animation: pwaEntre .4s var(--ease) both;
}
.pwa__plus li:nth-child(1) { animation-delay: .30s; }
.pwa__plus li:nth-child(2) { animation-delay: .40s; }
.pwa__plus li:nth-child(3) { animation-delay: .50s; }
@keyframes pwaEntre { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

.pwa__plus li > span {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green-soft); color: var(--green);
}
.pwa__plus li .ico { width: 15px; height: 15px; }

/* ------------------------------ iPhone ------------------------------ */
.pwa__ios {
  margin-top: 16px; padding: 13px 15px;
  border-radius: var(--r-md); background: var(--cream);
  font-size: 13.5px; line-height: 1.6; color: var(--ink-2);
}
.pwa__ios p { margin: 0; }
.pwa__ios-i {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-sm);
  background: #fff; box-shadow: var(--sh-1); color: var(--green);
  font-family: var(--ff-title); font-size: 12.5px;
}
.pwa__ios-i .ico { width: 13px; height: 13px; }

/* ------------------------------ Les boutons ------------------------- */
.pwa__actions { display: grid; gap: 9px; margin-top: 20px; }
.pwa__go { width: 100%; justify-content: center; }
/* La flèche pointe vers le bas : on installe, on ne partage pas */
.pwa__go-i { display: inline-flex; transform: rotate(180deg); }
.pwa__later { width: 100%; justify-content: center; --btn-fg: var(--muted); }
.pwa__later:hover { --btn-fg: var(--ink); }

/* Quand le téléphone ne peut pas installer seul, le bouton n'a pas lieu d'être */
.pwa.is-ios .pwa__go { display: none; }

/* ------------------------------ Sobriété demandée ------------------- */
@media (prefers-reduced-motion: reduce) {
  .pwa__voile, .pwa__box, .pwa__glow, .pwa__phone,
  .pwa__icone, .pwa__etoiles > *, .pwa__plus li { animation: none; }
}

/* Le rappel discret du pied de page */
.footer__pwa { color: inherit; opacity: .8; text-decoration: underline; transition: opacity .2s; }
.footer__pwa:hover { opacity: 1; }
.footer__pwa[hidden] { display: none !important; }
