/*
 * Living backgrounds and card/button personalities for the expressive
 * templates (config/profile-skins.php: 'effect' and 'anim').
 *
 * The .sig-fx layer sits behind everything, painted from the skin's own
 * tokens so every effect works in light and dark. Transform and opacity
 * only; reduced motion keeps the colour and stops the movement. The layer
 * never renders when the owner set their own background picture or video.
 */
.sig-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); pointer-events: none; }
.sig-fx i { position: absolute; display: block; }
body.has-fx { background: transparent; }

/* aurora: two soft ribbons of accent light drifting over the canvas. */
.sig-fx[data-fx=aurora] i { width: 70vmax; height: 70vmax; border-radius: 50%; filter: blur(70px); opacity: .5; }
.sig-fx[data-fx=aurora] i:nth-child(1) { background: radial-gradient(closest-side, var(--accent), transparent 70%); top: -25vmax; left: -15vmax; animation: fx-drift-a 26s ease-in-out infinite alternate; }
.sig-fx[data-fx=aurora] i:nth-child(2) { background: radial-gradient(closest-side, var(--accent-2), transparent 70%); bottom: -30vmax; right: -18vmax; animation: fx-drift-b 32s ease-in-out infinite alternate; }
.sig-fx[data-fx=aurora] i:nth-child(3) { display: none; }
@keyframes fx-drift-a { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.15); } }
@keyframes fx-drift-b { to { transform: translate3d(-12vmax, -8vmax, 0) scale(1.1); } }

/* mesh: a slow four-corner gradient wash, the whole page breathing colour. */
.sig-fx[data-fx=mesh] { background: linear-gradient(130deg, var(--bg), var(--surface-2), var(--bg), color-mix(in srgb, var(--accent) 24%, var(--bg))); background-size: 320% 320%; animation: fx-mesh 24s ease-in-out infinite alternate; }
.sig-fx[data-fx=mesh] i { display: none; }
@keyframes fx-mesh { to { background-position: 100% 100%; } }

/* grid: an arcade floor of accent lines sliding toward the horizon. */
.sig-fx[data-fx=grid] i:nth-child(1) { inset: 0; background:
  linear-gradient(color-mix(in srgb, var(--accent) 26%, transparent) 1px, transparent 1px),
  linear-gradient(90deg, color-mix(in srgb, var(--accent) 26%, transparent) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(to bottom, transparent 30%, #000 85%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 30%, #000 85%);
  animation: fx-grid 3.2s linear infinite; }
.sig-fx[data-fx=grid] i:nth-child(2) { inset: auto 0 0 0; height: 55%; background: radial-gradient(60% 90% at 50% 100%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 75%); }
.sig-fx[data-fx=grid] i:nth-child(3) { display: none; }
@keyframes fx-grid { to { transform: translateY(44px); } }

/* ember: warm sparks rising slowly, a fireside page. */
.sig-fx[data-fx=ember] i { width: 38vmax; height: 38vmax; border-radius: 50%; filter: blur(60px); opacity: .4; background: radial-gradient(closest-side, var(--accent), transparent 72%); }
.sig-fx[data-fx=ember] i:nth-child(1) { left: 8%; bottom: -30vmax; animation: fx-rise 18s ease-in infinite; }
.sig-fx[data-fx=ember] i:nth-child(2) { right: 4%; bottom: -34vmax; animation: fx-rise 24s ease-in 6s infinite; background: radial-gradient(closest-side, var(--accent-2), transparent 72%); }
.sig-fx[data-fx=ember] i:nth-child(3) { left: 46%; bottom: -36vmax; animation: fx-rise 30s ease-in 12s infinite; opacity: .3; }
@keyframes fx-rise { to { transform: translateY(-120vh); } }

/* wave: a tide of accent colour rolling along the foot of the page. */
.sig-fx[data-fx=wave] i { left: -60%; right: -60%; height: 46vmin; bottom: -24vmin; border-radius: 42%; background: color-mix(in srgb, var(--accent) 20%, transparent); animation: fx-wave 14s linear infinite; }
.sig-fx[data-fx=wave] i:nth-child(2) { bottom: -27vmin; animation-duration: 19s; animation-direction: reverse; background: color-mix(in srgb, var(--accent-2) 16%, transparent); }
.sig-fx[data-fx=wave] i:nth-child(3) { bottom: -30vmin; animation-duration: 25s; opacity: .6; }
@keyframes fx-wave { to { transform: rotate(360deg); } }

/* stripes: bold diagonal bands sweeping past, loud on purpose. */
.sig-fx[data-fx=stripes] i:nth-child(1) { inset: -50%; background: repeating-linear-gradient(118deg, transparent 0 90px, color-mix(in srgb, var(--accent) 12%, transparent) 90px 180px); animation: fx-stripes 36s linear infinite; }
.sig-fx[data-fx=stripes] i:nth-child(2), .sig-fx[data-fx=stripes] i:nth-child(3) { display: none; }
@keyframes fx-stripes { to { transform: translateX(254px); } }

/* ---- Card and button personalities (body[data-anim]) ------------------- */
/* tilt: cards lean toward the pointer's side on hover. */
body[data-anim=tilt] .id .card, body[data-anim=tilt] .id .links a { transition: transform .25s cubic-bezier(.2,.7,.2,1); }
body[data-anim=tilt] .id .card:hover, body[data-anim=tilt] .id .links a:hover { transform: perspective(700px) rotateX(1.6deg) rotateY(-1.6deg) translateY(-2px); }

/* float: everything bobs gently, a page that treads water. */
body[data-anim=float] .id .links a, body[data-anim=float] .id .btn.pop { animation: fx-float 5.5s ease-in-out infinite; }
body[data-anim=float] .id .links a:nth-child(2n) { animation-delay: 1.4s; }
body[data-anim=float] .id .links a:nth-child(3n) { animation-delay: 2.6s; }
@keyframes fx-float { 50% { transform: translateY(-4px); } }

/* glow: the main button breathes accent light; links flare on hover. */
body[data-anim=glow] .id .btn.pop { animation: fx-glow 3.2s ease-in-out infinite; }
body[data-anim=glow] .id .links a:hover { box-shadow: 0 0 0 1px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 45%, transparent); }
@keyframes fx-glow { 50% { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 55%, transparent); } }

/* ---- Still for anyone who asked for stillness --------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sig-fx i, .sig-fx { animation: none !important; }
  body[data-anim] .id .links a, body[data-anim] .id .btn.pop, body[data-anim] .id .card { animation: none !important; }
}
