:root {
  --mfx-fast: 140ms;
  --mfx-base: 220ms;
  --mfx-panel: 260ms;
  --mfx-stagger: 50ms;
  --mfx-ease-out: cubic-bezier(.16, 1, .3, 1);
  --mfx-ease-in: cubic-bezier(.7, 0, .84, 0);
}

@property --mfx-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* Stagger items are only hidden after JS has installed the observer. */
html.mfx-enabled .mfx-stagger-item:not(.mfx-in) {
  opacity: 0;
  transform: translateY(8px);
}
html.mfx-enabled .mfx-stagger-item.mfx-in {
  animation: mfx-card-in var(--mfx-base) var(--mfx-ease-out) forwards;
  animation-delay: calc(var(--mfx-i, 0) * var(--mfx-stagger));
  will-change: opacity, transform;
}
@keyframes mfx-card-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Subscription drawer: edge glow only while open. */
.sub-ovl.on .sub-panel {
  position: relative;
  isolation: isolate;
}
.sub-ovl.on .sub-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--mfx-angle, 0deg),
    transparent 0 62%, #8ec5ff 72%, #d9ecff 78%, transparent 88%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: mfx-edge 3.2s linear infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes mfx-edge {
  to { --mfx-angle: 360deg; }
}

html.mfx-paused .mfx-stagger-item.mfx-in,
html.mfx-paused .sub-ovl.on .sub-panel::before {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  html.mfx-enabled .mfx-stagger-item {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .sub-ovl.on .sub-panel::before {
    animation: none !important;
    background: #8ec5ff;
  }
}

/* Existing in-app low-power switch is mirrored by JS as data-mfx-low. */
html.perf-low .mfx-stagger-item,
html[data-mfx-low="1"] .mfx-stagger-item {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}
html.perf-low .sub-ovl.on .sub-panel::before,
html[data-mfx-low="1"] .sub-ovl.on .sub-panel::before {
  animation: none !important;
  background: #8ec5ff;
}
