/* PWA install invite — bottom sheet on phones, floating card from 640px. */

html:has(.ins[open]) { overflow: hidden; }

.ins {
  position: fixed; inset: 0;
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  margin: 0; padding: 0; border: 0;
  background: transparent; color: var(--color-white);
  display: none; align-items: flex-end; justify-content: center;
  font-family: var(--font-numeric);
  overflow: hidden;
}
.ins[open] { display: flex; }
.ins::backdrop {
  background: radial-gradient(120% 80% at 50% 100%, rgba(253, 238, 0, .10), transparent 60%), rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
}

.ins__panel { display: none; }
.ins[data-variant="prompt"] [data-for="prompt"],
.ins[data-variant="ios"] [data-for="ios"],
.ins[data-variant="manual"] [data-for="manual"] { display: block; }
.ins[data-variant="manual"] .ins__panel[data-for="manual"] { animation: ins-rise 420ms cubic-bezier(.16, 1, .3, 1) both; }

/* ── Sheet ─────────────────────────────────── */
.ins__sheet {
  position: relative; isolation: isolate; overflow: hidden;
  width: 100%; max-width: 440px; max-height: calc(100% - 24px); overflow-y: auto;
  padding: 14px 22px calc(22px + env(safe-area-inset-bottom));
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 38%),
    linear-gradient(180deg, #171717 0%, #0c0c0c 100%);
  border: 1px solid rgba(255, 255, 255, .08); border-bottom: 0;
  border-radius: 30px 30px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
  scrollbar-width: none;
}
.ins__sheet::-webkit-scrollbar { display: none; }
/* Hairline of brand yellow along the top edge. */
.ins__sheet::before {
  content: ''; position: absolute; inset: 0 18% auto; height: 1px; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(253, 238, 0, .9), transparent);
}
.ins__glow {
  position: absolute; z-index: -1; inset: -140px -20% auto; height: 320px;
  background: radial-gradient(closest-side, rgba(253, 238, 0, .30), rgba(253, 238, 0, .08) 55%, transparent);
  pointer-events: none;
}
.ins__grip {
  display: block; width: 40px; height: 5px; margin: 0 auto 6px;
  border-radius: 99px; background: rgba(255, 255, 255, .18);
}
.ins__close {
  position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%;
  background: rgba(255, 255, 255, .06); color: var(--color-gray-400);
  cursor: pointer; transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.ins__close:hover { background: rgba(255, 255, 255, .12); color: var(--color-white); transform: rotate(90deg); }

/* ── Hero icon ─────────────────────────────── */
.ins__hero { position: relative; width: 96px; height: 96px; margin: 26px auto 24px; }
.ins__icon {
  position: relative; z-index: 1; display: block; width: 96px; height: 96px; overflow: hidden;
  border-radius: 26px; background: var(--color-yellow-500);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 14px 34px rgba(253, 238, 0, .32), 0 4px 10px rgba(0, 0, 0, .5);
}
.ins__icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Glossy sweep across the icon. */
.ins__icon::after {
  content: ''; position: absolute; inset: -40% auto -40% -60%; width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-20deg) translateX(-200%);
}
.ins__ring {
  position: absolute; inset: -10px; border-radius: 34px;
  border: 1px solid rgba(253, 238, 0, .35); opacity: 0;
}

/* ── Copy ──────────────────────────────────── */
.ins__eyebrow {
  display: inline-block; margin-bottom: 8px; padding: 3px 12px;
  font-size: 12px; font-weight: 700; color: var(--color-yellow-500);
  background: rgba(253, 238, 0, .10); border: 1px solid rgba(253, 238, 0, .22); border-radius: 99px;
}
.ins__title { font-size: 22px; font-weight: 700; line-height: 1.45; letter-spacing: -.01em; }
.ins__text {
  max-width: 340px; margin: 8px auto 0;
  font-size: 14px; line-height: 1.85; color: var(--color-gray-400);
}

/* ── Perks ─────────────────────────────────── */
.ins__perks, .ins__steps {
  list-style: none; margin: 20px 0 0; padding: 6px;
  display: flex; flex-direction: column; gap: 2px; text-align: start;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .06); border-radius: 20px;
}
.ins__perk, .ins__step {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  font-size: 14px; color: var(--color-white); border-radius: 14px;
}
.ins__perk-ic {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center;
  color: var(--color-black); background: linear-gradient(145deg, #FFF566, var(--color-yellow-500) 60%, #E6D800);
  border-radius: 11px; box-shadow: 0 4px 12px rgba(253, 238, 0, .22);
}

/* ── iOS steps ─────────────────────────────── */
.ins__step-n {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: var(--color-black);
  background: var(--color-yellow-500); border-radius: 50%;
}
.ins__step-t { flex: 1; line-height: 1.7; }
.ins__step-t b { color: var(--color-yellow-500); font-weight: 700; }
.ins__step-ic {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  color: #0A84FF; background: rgba(255, 255, 255, .07); border-radius: 10px;
}

/* ── Actions ───────────────────────────────── */
.ins__actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.ins__btn {
  position: relative; overflow: hidden;
  height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 16px; cursor: pointer;
  font-family: var(--font-numeric); font-size: 16px; font-weight: 700;
  transition: transform 160ms ease, box-shadow 200ms ease, background 200ms ease, color 200ms ease;
}
.ins__btn:active { transform: scale(.97); }
.ins__btn--primary {
  color: var(--color-black);
  background: linear-gradient(180deg, #FFF566 0%, var(--color-yellow-500) 55%, #E9DA00 100%);
  box-shadow: 0 10px 28px rgba(253, 238, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.ins__btn--primary:hover { box-shadow: 0 14px 36px rgba(253, 238, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .6); }
/* Shimmer that crosses the primary button now and then. */
.ins__btn--primary::after {
  content: ''; position: absolute; inset: 0 auto 0 -40%; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
  transform: skewX(-20deg) translateX(-150%);
}
.ins__btn--ghost { height: 46px; color: var(--color-gray-400); background: transparent; font-weight: 400; font-size: 14px; }
.ins__btn--ghost:hover { color: var(--color-white); background: rgba(255, 255, 255, .05); }
.ins__btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .85); outline-offset: 3px; }

/* ── Tablet / desktop: floating card ───────── */
@media (min-width: 640px) {
  .ins { align-items: center; }
  .ins__sheet {
    padding: 26px 30px 28px; max-height: calc(100% - 48px);
    border-bottom: 1px solid rgba(255, 255, 255, .08); border-radius: 32px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, .7), 0 0 0 1px rgba(253, 238, 0, .06), inset 0 1px 0 rgba(255, 255, 255, .08);
  }
  .ins__grip { display: none; }
}

/* ── Motion ────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .ins[open]::backdrop { animation: ins-fade 380ms ease both; }
  .ins[open] .ins__sheet { animation: ins-up 620ms cubic-bezier(.16, 1, .3, 1) both; }
  .ins[open] .ins__icon { animation: ins-pop 760ms cubic-bezier(.34, 1.56, .64, 1) 140ms both, ins-float 4.5s ease-in-out 1.2s infinite; }
  .ins[open] .ins__icon::after { animation: ins-sweep 3.6s ease-in-out 900ms infinite; }
  .ins[open] .ins__ring { animation: ins-ripple 2.8s ease-out 700ms infinite; }
  .ins[open] .ins__ring--2 { animation-delay: 2.1s; }
  .ins[open] .ins__glow { animation: ins-breathe 5s ease-in-out infinite; }
  .ins[open] :is(.ins__eyebrow, .ins__title, .ins__text, .ins__perk, .ins__step, .ins__actions) {
    animation: ins-rise 560ms cubic-bezier(.16, 1, .3, 1) both;
  }
  .ins[open] .ins__eyebrow { animation-delay: 180ms; }
  .ins[open] .ins__title { animation-delay: 230ms; }
  .ins[open] .ins__text { animation-delay: 280ms; }
  .ins[open] :is(.ins__perk, .ins__step):nth-child(1) { animation-delay: 340ms; }
  .ins[open] :is(.ins__perk, .ins__step):nth-child(2) { animation-delay: 400ms; }
  .ins[open] :is(.ins__perk, .ins__step):nth-child(3) { animation-delay: 460ms; }
  .ins[open] .ins__actions { animation-delay: 520ms; }
  .ins[open] .ins__btn--primary::after { animation: ins-shimmer 3.2s ease-in-out 1.4s infinite; }

  .ins.is-closing::backdrop { animation: ins-fade 320ms ease reverse both; }
  .ins.is-closing .ins__sheet { animation: ins-down 320ms cubic-bezier(.7, 0, .84, 0) both; }

  @media (min-width: 640px) {
    .ins[open] .ins__sheet { animation-name: ins-zoom; }
    .ins.is-closing .ins__sheet { animation-name: ins-zoom-out; }
  }
}

@keyframes ins-fade { from { opacity: 0; } }
@keyframes ins-up { from { transform: translateY(100%); } }
@keyframes ins-down { to { transform: translateY(100%); } }
@keyframes ins-zoom { from { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes ins-zoom-out { to { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes ins-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes ins-pop { from { opacity: 0; transform: scale(.4) rotate(-14deg); } }
@keyframes ins-float { 50% { transform: translateY(-5px) rotate(-2deg); } }
@keyframes ins-sweep { 0%, 55% { transform: skewX(-20deg) translateX(-200%); } 85%, 100% { transform: skewX(-20deg) translateX(500%); } }
@keyframes ins-ripple { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.35); } }
@keyframes ins-breathe { 50% { opacity: .65; transform: scale(1.06); } }
@keyframes ins-shimmer { 0%, 60% { transform: skewX(-20deg) translateX(-150%); } 90%, 100% { transform: skewX(-20deg) translateX(600%); } }
