/* Plan card effects (plan-card-fx.mjs): spotlight and holo foil that follow
   the pointer, a 3D tilt, a running border (strongest on the Popular plan),
   a glint on the choose button, a beating heart and, from the module, heart
   rain, a Hearts count-up and a ring burst on choose. No sound.
   Self-themed: both palettes are set here, so no generated light twin is
   needed. */
.subscription-plan-card.plan-fx {
  --fx-x: 50%;
  --fx-y: 30%;
  --fx-rx: 0deg;
  --fx-ry: 0deg;
  --fx-lift: 0px;
  --fx-hue: 330;
  --fx-spot: rgba(255, 79, 160, .22);
  --fx-edge: rgba(255, 125, 190, .95);
  --fx-foil-blend: screen;
  --fx-foil-strength: .9;
  --fx-glare: rgba(255, 255, 255, .16);
  transform: perspective(1000px) translateY(var(--fx-lift)) rotateX(var(--fx-rx)) rotateY(var(--fx-ry));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease, border-color .2s ease;
  will-change: transform;
}
html[data-theme="light"] .subscription-plan-card.plan-fx {
  --fx-spot: rgba(214, 51, 127, .14);
  --fx-edge: rgba(194, 51, 122, .85);
  --fx-foil-blend: multiply;
  --fx-foil-strength: .35;
  --fx-glare: rgba(255, 255, 255, .55);
}
.subscription-plan-card.plan-fx[data-plan-card="creator"] { --fx-hue: 275; --fx-spot: rgba(167, 92, 255, .24); --fx-edge: rgba(196, 140, 255, .95); }
.subscription-plan-card.plan-fx[data-plan-card="pro"],
.subscription-plan-card.plan-fx[data-plan-card="proPlus"],
.subscription-plan-card.plan-fx[data-plan-card="power"] { --fx-hue: 200; --fx-spot: rgba(64, 160, 255, .22); --fx-edge: rgba(110, 205, 255, .95); }
.subscription-plan-card.plan-fx[data-plan-card^="business"],
.subscription-plan-card.plan-fx[data-plan-card="agency"] { --fx-hue: 38; --fx-spot: rgba(255, 183, 69, .2); --fx-edge: rgba(255, 205, 120, .95); }
.subscription-plan-card.plan-fx:hover,
.subscription-plan-card.plan-fx.fx-active { --fx-lift: -6px; }
.subscription-plan-card.plan-fx.fx-active { box-shadow: 0 26px 60px rgba(0, 0, 0, .42), 0 0 46px hsla(var(--fx-hue), 90%, 62%, .18); }

/* The layers sit above the card's art and its dark veil (z-index 1), and below its text (earlier in the card, so painted first). */
.subscription-plan-card.plan-fx > :not(.plan-fx-layer) { position: relative; z-index: 2; }
.plan-fx-layer { position: absolute !important; inset: 0; z-index: 2 !important; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.subscription-plan-card.plan-fx.fx-active .plan-fx-layer { opacity: 1; }
/* Hearts that float up behind the text (drawn by the module). */
.plan-fx-rain { width: 100%; height: 100%; }
/* Spotlight: a soft light under the pointer. */
.plan-fx-spot { background: radial-gradient(320px circle at var(--fx-x) var(--fx-y), var(--fx-spot), transparent 62%); }
/* Holo foil: a rainbow sheen and fine glitter that shift with the pointer. */
.plan-fx-foil {
  mix-blend-mode: var(--fx-foil-blend);
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1px 1px at 72% 34%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.4px 1.4px at 40% 72%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1px 1px at 86% 82%, rgba(255,255,255,.75), transparent 60%),
    linear-gradient(115deg, transparent 18%, hsla(320, 100%, 70%, .22) 30%, hsla(275, 100%, 72%, .22) 42%, hsla(190, 100%, 65%, .2) 54%, hsla(140, 90%, 65%, .14) 64%, transparent 78%);
  background-size: 120px 120px, 150px 150px, 110px 110px, 170px 170px, 260% 260%;
  background-position: 0 0, 0 0, 0 0, 0 0, var(--fx-x) var(--fx-y);
  -webkit-mask-image: radial-gradient(420px circle at var(--fx-x) var(--fx-y), #000 10%, transparent 70%);
  mask-image: radial-gradient(420px circle at var(--fx-x) var(--fx-y), #000 10%, transparent 70%);
}
.subscription-plan-card.plan-fx.fx-active .plan-fx-foil { opacity: var(--fx-foil-strength); }
/* Glare: a bright streak where the light hits the tilted card. */
.plan-fx-glare { background: radial-gradient(180px 120px at var(--fx-x) var(--fx-y), var(--fx-glare), transparent 70%); }
/* Edge light under the pointer, and a running light around the edge. */
@property --fx-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.plan-fx-edge, .plan-fx-run {
  padding: 1.5px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: 3 !important;
}
.plan-fx-edge { background: radial-gradient(260px circle at var(--fx-x) var(--fx-y), var(--fx-edge), transparent 62%); }
.plan-fx-run {
  background: conic-gradient(from var(--fx-angle), transparent 0 62%, hsla(var(--fx-hue), 100%, 70%, .9) 74%, #fff 79%, hsla(calc(var(--fx-hue) - 60), 100%, 68%, .9) 84%, transparent 92%);
  animation: plan-fx-run 3.6s linear infinite;
}
.subscription-plan-card.plan-fx[data-plan-card="creator"] .plan-fx-run { opacity: 1; animation-duration: 2.4s; padding: 2px; filter: drop-shadow(0 0 6px hsla(275, 100%, 70%, .75)); }
.subscription-plan-card.plan-fx[data-plan-card="creator"] { box-shadow: 0 0 34px rgba(150, 80, 255, .16); }
@keyframes plan-fx-run { to { --fx-angle: 360deg; } }

/* The heart in Monthly Hearts beats while the card is active. */
.plan-fx-heart { display: inline-block; color: hsl(var(--fx-hue), 95%, 68%); transform-origin: 50% 60%; }
.subscription-plan-card.plan-fx.fx-active .plan-fx-heart { animation: plan-fx-beat 1s ease-in-out infinite; }
@keyframes plan-fx-beat { 0%, 100% { transform: scale(1); } 18% { transform: scale(1.4); } 36% { transform: scale(.94); } 52% { transform: scale(1.18); } }
.plan-fx-count { font-variant-numeric: tabular-nums; }

/* Choose button: a glint now and then, faster on hover; Popular breathes. */
.subscription-plan-card.plan-fx .primary-button.subscription-select { position: relative; overflow: hidden; isolation: isolate; }
.subscription-plan-card.plan-fx .primary-button.subscription-select::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: -70%; width: 45%; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-20deg);
  animation: plan-fx-glint 3.4s ease-in-out infinite;
}
.subscription-plan-card.plan-fx .primary-button.subscription-select:hover::after { animation-duration: .95s; }
.subscription-plan-card.plan-fx[data-plan-card="creator"] .primary-button.subscription-select { animation: plan-fx-breathe 2.4s ease-in-out infinite; }
@keyframes plan-fx-glint { 0%, 62% { left: -70%; } 100% { left: 135%; } }
@keyframes plan-fx-breathe { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 79, 160, 0); } 50% { box-shadow: 0 0 26px 3px rgba(255, 79, 160, .5); } }

/* Choose: the card jumps; the module draws the rings and hearts. */
.subscription-plan-card.plan-fx.fx-chosen { animation: plan-fx-chosen .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes plan-fx-chosen { 35% { transform: perspective(1000px) translateY(-14px) scale(1.03); } }
.plan-fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483000; }

@media (prefers-reduced-motion: reduce) {
  .subscription-plan-card.plan-fx { transform: none !important; transition: none; }
  .plan-fx-run, .plan-fx-heart, .subscription-plan-card.plan-fx .primary-button.subscription-select,
  .subscription-plan-card.plan-fx .primary-button.subscription-select::after, .subscription-plan-card.plan-fx.fx-chosen { animation: none !important; }
  .plan-fx-canvas, .plan-fx-rain { display: none; }
}
