/* Motion layer — text reveals, spotlight, tilt, glare, star border, sparks, reveal-on-scroll.
   Progressive: without JS or with reduced motion the UI stays complete and static. */

/* ---------------------------------------------------------------- split / blur text (word level: Persian letters stay joined) */
.blur-text .w { display: inline-block; opacity: 0; filter: blur(12px); transform: translateY(-16px);
  animation: blurIn .8s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--i) * 95ms + 80ms); white-space: pre; }
@keyframes blurIn { 60% { filter: blur(2px); opacity: .8; transform: translateY(2px); } to { opacity: 1; filter: blur(0); transform: none; } }

/* ---------------------------------------------------------------- gradient & shiny text */
.gradient-text { background: linear-gradient(90deg, var(--gold-2), #ffffff 25%, var(--gold) 50%, var(--violet) 75%, var(--gold-2));
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  animation: gradientFlow 8s linear infinite; }
[data-theme="ivory"] .gradient-text { background-image: linear-gradient(90deg, #8a6a2e, #0c1526 25%, #b08a44 50%, #5b4bd6 75%, #8a6a2e); }
.blur-text.gradient-text .w { -webkit-text-fill-color: transparent; background: inherit; background-size: inherit; -webkit-background-clip: text; background-clip: text; animation: blurIn .8s cubic-bezier(.2,.7,.2,1) forwards, gradientFlow 8s linear infinite; animation-delay: calc(var(--i) * 95ms + 80ms), 0s; }
@keyframes gradientFlow { from { background-position: 0% 50%; } to { background-position: 300% 50%; } }
.shiny { position: relative; }
.shiny::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%); background-size: 250% 100%;
  mix-blend-mode: overlay; animation: shine 3.8s linear infinite; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* ---------------------------------------------------------------- aurora behind page heads */
.aurora { position: absolute; inset: -60px -40px -20px; z-index: -1; overflow: hidden; pointer-events: none;
  mask-image: radial-gradient(ellipse 55% 75% at 50% 45%, #000 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 55% 75% at 50% 45%, #000 25%, transparent 75%); }
.aurora span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; animation: drift 16s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { width: 380px; height: 240px; background: #d6b06a; left: 28%; top: 5%; opacity: .32; }
.aurora span:nth-child(2) { width: 320px; height: 220px; background: #8c7cff; left: 50%; top: 22%; opacity: .3; animation-duration: 21s; animation-delay: -6s; }
.aurora span:nth-child(3) { width: 260px; height: 190px; background: #4fd1e8; left: 18%; top: 32%; opacity: .22; animation-duration: 25s; animation-delay: -12s; }
[data-theme="ivory"] .aurora span { opacity: .28; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(70px, -25px) scale(1.18); } 100% { transform: translate(-60px, 30px) scale(.9); } }
.login-art .aurora { inset: 0; mask-image: none; -webkit-mask-image: none; }
.login-art .aurora span { filter: blur(70px); }
.login-art > *:not(.aurora) { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- spotlight */
.spot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(214,176,106,.14), transparent 45%);
  opacity: 0; transition: opacity .35s; }
.spot:hover::after { opacity: 1; }
.spot > * { position: relative; z-index: 1; }
.kpi.spot > .num, .kpi.spot > .lbl, .kpi.spot > .ic { z-index: 1; }

/* animated gradient edge that follows the cursor (cards already use ::before for their static edge) */
.edge-glow { position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px; z-index: 2;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(243,220,166,.9), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s; }
.spot:hover > .edge-glow { opacity: 1; }

/* ---------------------------------------------------------------- tilt + glare */
.tilt { transform-style: preserve-3d; will-change: transform; }
.tilt.tilting { transition: transform .08s linear, box-shadow .3s, border-color .3s !important; }
.tilt .mono { transform: translateZ(30px); }
.glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; overflow: hidden; }
.glare::before { content: ""; position: absolute; width: 60%; height: 200%; top: -50%; left: -80%; transform: rotate(25deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent); transition: left .9s cubic-bezier(.2,.7,.2,1); }
.dcard:hover .glare::before, .ecard:hover .glare::before { left: 130%; }

/* ---------------------------------------------------------------- star border (rotating light around important cards) */
.glow-border::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1.5px; z-index: 2;
  background: conic-gradient(from var(--ang, 0deg), transparent 0 62%, #f3dca6 76%, #d6b06a 82%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 4.5s linear infinite; filter: drop-shadow(0 0 6px rgba(214,176,106,.8)); opacity: 1 !important; }
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --ang: 360deg; } }

/* ---------------------------------------------------------------- reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(4px); }
.reveal.in { opacity: 1; transform: none; filter: none;
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1), filter .7s; transition-delay: calc(var(--d, 0) * 60ms); }
.reveal.in.settled { transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .3s, border-color .3s; transition-delay: 0s; }

/* ---------------------------------------------------------------- magnet */
.magnet { transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .25s, background .2s; will-change: transform; }

/* ---------------------------------------------------------------- click spark */
.spark { position: fixed; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; z-index: 999;
  background: radial-gradient(circle, #fff, #f3dca6 40%, #d6b06a); box-shadow: 0 0 10px #d6b06a; animation: sparkOut .65s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes sparkOut { to { transform: translate(var(--sx), var(--sy)) scale(.1); opacity: 0; } }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); background: rgba(255,255,255,.35); animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ---------------------------------------------------------------- page enter */
.content { animation: pageIn .5s cubic-bezier(.2,.7,.2,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }
body.leaving .content { opacity: 0; transform: translateY(-6px); transition: opacity .18s, transform .18s; }

/* ---------------------------------------------------------------- cursor halo (desktop) */
.cursor-halo { position: fixed; width: 420px; height: 420px; border-radius: 50%; pointer-events: none; z-index: -1;
  background: radial-gradient(circle, rgba(214,176,106,.10), transparent 60%); transform: translate(-50%, -50%); transition: opacity .4s; }
[data-theme="ivory"] .cursor-halo { background: radial-gradient(circle, rgba(176,138,68,.10), transparent 60%); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .blur-text .w { opacity: 1 !important; transform: none !important; filter: none !important; }
  #bg-canvas, .cursor-halo { display: none; }
}
@media (hover: none) { .tilt { transform: none !important; } .cursor-halo { display: none; } }
