/* Aevy motion layer: "check your email" screen after sign up, and the download progress card.
   Uses the site tokens, so it follows the light and dark themes. Motion is switched off for people who ask for reduced motion. */

/* ======================= Check your email ======================= */
.mx-back {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  opacity: 0; transition: opacity .35s var(--ease);
}
.mx-back.in { opacity: 1; }
.mx-back.out { opacity: 0; }
.mx-card {
  position: relative; width: min(440px, 100%); overflow: hidden; text-align: center;
  background: var(--surface); border: 1px solid var(--line2); border-radius: 20px;
  padding: 34px 28px 26px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .02) inset;
  transform: translateY(26px) scale(.96); opacity: 0;
  transition: transform .55s cubic-bezier(.2, 1.1, .3, 1), opacity .35s var(--ease);
}
.mx-back.in .mx-card { transform: none; opacity: 1; }
.mx-back.out .mx-card { transform: translateY(14px) scale(.98); }
.mx-card::before { /* soft glow behind the envelope */
  content: ""; position: absolute; left: 50%; top: -90px; width: 360px; height: 260px; transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent 72%);
  opacity: .8; pointer-events: none; animation: mxGlow 3.6s ease-in-out infinite;
}
@keyframes mxGlow { 50% { opacity: 1; transform: translateX(-50%) scale(1.08); } }

.mx-stage { position: relative; width: 150px; height: 130px; margin: 0 auto 10px; }
.mx-ring {
  position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%;
  border: 1.5px solid var(--accent-hi); opacity: 0; animation: mxRing 2.8s var(--ease) infinite;
}
.mx-ring:nth-child(2) { animation-delay: .9s; }
.mx-ring:nth-child(3) { animation-delay: 1.8s; }
@keyframes mxRing { 0% { transform: scale(.7); opacity: .0; } 15% { opacity: .55; } 100% { transform: scale(2.1); opacity: 0; } }

.mx-env { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: mxFly .9s cubic-bezier(.2, 1.15, .3, 1) both, mxFloat 3.4s ease-in-out 1s infinite; }
@keyframes mxFly { from { transform: translate(-90px, 34px) rotate(-14deg) scale(.5); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes mxFloat { 50% { transform: translateY(-5px); } }
.mx-env .body { fill: var(--surface3); stroke: var(--line3); stroke-width: 1.5; }
.mx-env .back { fill: color-mix(in srgb, var(--accent) 26%, var(--surface2)); stroke: var(--line3); stroke-width: 1.5; }
.mx-env .fold { fill: none; stroke: var(--line3); stroke-width: 1.5; stroke-linejoin: round; }
.mx-env .flap { fill: color-mix(in srgb, var(--accent) 22%, var(--surface3)); stroke: var(--line3); stroke-width: 1.5; stroke-linejoin: round; transform-box: fill-box; transform-origin: 50% 0; animation: mxFlap .7s cubic-bezier(.3, .9, .3, 1) .85s both; }
@keyframes mxFlap { 0% { transform: scaleY(1); } 100% { transform: scaleY(-1); } }
.mx-env .paper { fill: #fff; stroke: var(--line3); stroke-width: 1.2; animation: mxPaper .8s cubic-bezier(.2, 1.1, .3, 1) 1.15s both; }
@keyframes mxPaper { from { transform: translateY(26px); } to { transform: translateY(-20px); } }
.mx-env .ln { stroke: #c7ccd6; stroke-width: 2.4; stroke-linecap: round; animation: mxFade .4s ease 1.7s both; }
.mx-env .ln:nth-of-type(2) { animation-delay: 1.8s; }
@keyframes mxFade { from { opacity: 0; } }
.mx-tick { position: absolute; right: 8px; top: 2px; width: 38px; height: 38px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--ok) 70%, transparent); transform: scale(0); animation: mxPop .55s cubic-bezier(.2, 1.6, .4, 1) 1.8s both; }
.mx-tick svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 26; stroke-dashoffset: 26; animation: mxDraw .45s ease 2.1s forwards; }
@keyframes mxPop { to { transform: scale(1); } }
@keyframes mxDraw { to { stroke-dashoffset: 0; } }

.mx-spark { position: absolute; left: 50%; top: 52%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--c, var(--accent-hi)); opacity: 0; animation: mxSpark 1.1s cubic-bezier(.1, .8, .3, 1) 1.9s both; }
@keyframes mxSpark { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(.2); } }

.mx-h { margin: 6px 0 6px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; color: var(--text); opacity: 0; transform: translateY(8px); animation: mxUp .5s var(--ease) 1.2s forwards; }
.mx-p { margin: 0 auto; max-width: 340px; font-size: 14px; line-height: 1.55; color: var(--text2); opacity: 0; transform: translateY(8px); animation: mxUp .5s var(--ease) 1.32s forwards; }
.mx-p b { color: var(--text); font-weight: 600; word-break: break-all; }
@keyframes mxUp { to { opacity: 1; transform: none; } }

.mx-steps { list-style: none; margin: 20px 0 0; padding: 0; text-align: left; display: grid; gap: 8px; }
.mx-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); font-size: 13.5px; color: var(--text2); opacity: 0; transform: translateX(-10px); animation: mxStep .5s var(--ease) forwards; animation-delay: calc(1.5s + var(--i) * .14s); }
@keyframes mxStep { to { opacity: 1; transform: none; } }
.mx-steps .n { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 11.5px var(--mono); color: var(--muted); background: var(--surface3); }
.mx-steps li.ok .n { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.mx-steps li.now { border-color: color-mix(in srgb, var(--accent) 55%, var(--line2)); color: var(--text); }
.mx-steps li.now .n { background: var(--accent); color: var(--accent-ink); animation: mxBeat 1.8s ease-in-out infinite; }
@keyframes mxBeat { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); } 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } }

.mx-acts { display: grid; gap: 8px; margin-top: 18px; opacity: 0; animation: mxUp .5s var(--ease) 2s forwards; }
.mx-acts .btn { justify-content: center; width: 100%; }
.mx-link { background: none; border: 0; padding: 8px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.mx-link:hover:not(:disabled) { color: var(--text); }
.mx-link:disabled { cursor: default; opacity: .8; }
.mx-note { min-height: 18px; margin: 2px 0 0; font-size: 12.5px; color: var(--ok); }
.mx-note.bad { color: var(--danger); }

/* ======================= Download card ======================= */
.dx {
  position: fixed; z-index: 250; left: 50%; bottom: max(24px, env(safe-area-inset-bottom));
  width: min(380px, calc(100% - 28px)); transform: translate(-50%, 30px) scale(.97); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line2); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .7);
  transition: transform .5s cubic-bezier(.2, 1.1, .3, 1), opacity .3s var(--ease), border-color .4s;
  overflow: hidden;
}
.dx.show { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: auto; }
.dx::after { /* shimmer while working */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent-hi) 14%, transparent) 50%, transparent 70%);
  transform: translateX(-100%); animation: dxShine 1.6s linear infinite;
}
.dx.done::after, .dx.fail::after { display: none; }
@keyframes dxShine { to { transform: translateX(100%); } }
.dx.done { border-color: color-mix(in srgb, var(--ok) 55%, var(--line2)); }
.dx.fail { border-color: color-mix(in srgb, var(--danger) 55%, var(--line2)); }

.dx-ic { position: relative; flex: none; width: 46px; height: 46px; }
.dx-ic > svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; }
.dx-track { fill: none; stroke: var(--surface3); stroke-width: 3.5; }
.dx-arc { fill: none; stroke: var(--accent-hi); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 126; stroke-dashoffset: 126; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .25s linear, stroke .3s; }
.dx.done .dx-arc { stroke: var(--ok); }
.dx.fail .dx-arc { stroke: var(--danger); }
.dx-ic .dx-arrow { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; animation: dxBob 1.1s ease-in-out infinite; }
@keyframes dxBob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
.dx-ic .dx-check { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 28; stroke-dashoffset: 28; }
.dx.done .dx-arrow, .dx.fail .dx-arrow { display: none; }
.dx.done .dx-check { animation: mxDraw .5s ease .1s forwards; }
.dx.done .dx-ic { animation: dxPop .6s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes dxPop { 0% { transform: scale(.8); } 100% { transform: scale(1); } }
.dx-ic .dx-x { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; display: none; fill: none; stroke: var(--danger); stroke-width: 2.6; stroke-linecap: round; }
.dx.fail .dx-x { display: block; }

.dx-tx { position: relative; flex: 1; min-width: 0; }
.dx-t { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dx-s { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; font: 500 12px var(--mono); color: var(--muted); }
.dx-s b { color: var(--text2); font-weight: 500; font-variant-numeric: tabular-nums; }
.dx-bar { height: 4px; margin-top: 8px; border-radius: 4px; background: var(--surface3); overflow: hidden; }
.dx-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width .25s linear, background .3s; }
.dx.done .dx-bar i { background: var(--ok); }
.dx.fail .dx-bar i { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .mx-card, .mx-back, .mx-env, .mx-env *, .mx-ring, .mx-spark, .mx-h, .mx-p, .mx-steps li, .mx-acts, .mx-tick, .mx-tick svg, .mx-card::before, .dx, .dx::after, .dx-arrow, .dx-check {
    animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
  .mx-ring { display: none; }
}
