/* Hiệu ứng bổ sung (đợt so sánh tính năng): dùng cho trang profile và ô xem trước dashboard (fxpreview.js tự nạp file này).
   Chỉ dùng lớp riêng (anim-static, dfx-*, ifx-audio), không sửa luật cũ của profile.css. */

/* ===== Mở thẻ: Static — chớp nhiễu như TV bắt sóng rồi ổn định ===== */
.anim-static { animation: animStatic 1s linear; }
@keyframes animStatic {
  0% { opacity: 0; filter: contrast(3) brightness(2.2) grayscale(1); clip-path: inset(48% 0 48% 0); transform: scaleX(1.06); }
  10% { opacity: 1; clip-path: inset(30% 0 55% 0); transform: translateX(-6px) scaleX(1.04); box-shadow: 0 0 0 1px rgba(255, 255, 255, .5), 0 0 40px rgba(255, 255, 255, .35); }
  14% { box-shadow: none; }
  18% { opacity: .25; clip-path: inset(8% 0 72% 0); transform: translateX(8px); }
  28% { opacity: 1; filter: contrast(2.2) brightness(1.7) grayscale(.6); clip-path: inset(0 0 40% 0); transform: translateX(-4px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .45), 0 0 30px rgba(255, 255, 255, .3); }
  32% { box-shadow: none; }
  38% { opacity: .45; clip-path: inset(55% 0 0 0); transform: translateX(5px) skewX(4deg); }
  50% { opacity: 1; filter: contrast(1.6) brightness(1.35) grayscale(.3); clip-path: inset(0 0 0 0); transform: translateX(3px) skewX(-3deg); }
  60% { opacity: .7; transform: translateX(-2px); }
  72% { opacity: 1; filter: brightness(1.15); transform: none; }
  100% { opacity: 1; filter: none; clip-path: inset(0 0 0 0); transform: none; }
}

/* ===== Mô tả: hiệu ứng chữ (fx6.js đặt --dfx = màu hiệu ứng đã làm sáng) ===== */
/* không dùng transform (ô xem trước căn giữa bằng transform), lệch chữ bằng thuộc tính translate */
.dfx-glitch { text-shadow: -1px 0 rgba(255, 42, 109, .6), 1px 0 rgba(45, 226, 230, .6); animation: dfxGlitch 3.2s steps(1, end) infinite; }
@keyframes dfxGlitch {
  0%, 84%, 100% { text-shadow: -1px 0 rgba(255, 42, 109, .6), 1px 0 rgba(45, 226, 230, .6); translate: 0 0; clip-path: none; }
  86% { text-shadow: -3px 0 #ff2a6d, 3px 0 #2de2e6; translate: 2px 0; }
  89% { text-shadow: 3px 0 #ff2a6d, -3px 0 #2de2e6; translate: -2px 0; clip-path: inset(15% 0 35% 0); }
  92% { text-shadow: -2px 0 #ff2a6d, 2px 0 #2de2e6; translate: 1px 0; clip-path: inset(50% 0 0 0); }
  95% { text-shadow: 4px 0 #ff2a6d, -4px 0 #2de2e6; translate: 0 0; clip-path: none; }
}
.dfx-neon { color: color-mix(in srgb, var(--dfx, #fff) 30%, #fff);
  text-shadow: 0 0 3px var(--dfx, #fff), 0 0 10px var(--dfx, #fff), 0 0 22px color-mix(in srgb, var(--dfx, #fff) 65%, transparent);
  animation: dfxNeon 7s linear infinite; }
@keyframes dfxNeon { 0%, 88%, 91%, 94%, 100% { opacity: 1; } 89%, 92.5% { opacity: .5; text-shadow: none; } }
.dfx-fuzzy { animation: dfxFuzz .16s steps(2, end) infinite; }
@keyframes dfxFuzz {
  0%, 100% { translate: .5px 0; text-shadow: 1px 0 1px color-mix(in srgb, var(--dfx, #fff) 70%, transparent), -1px 0 2px rgba(255, 255, 255, .45); }
  50% { translate: -.5px .4px; text-shadow: -1px .5px 1px color-mix(in srgb, var(--dfx, #fff) 70%, transparent), 1px -.5px 2px rgba(255, 255, 255, .45); }
}
.dfx-distort { filter: url(#bbfx-distort); text-shadow: 0 0 8px color-mix(in srgb, var(--dfx, #fff) 45%, transparent); }
.dfx-lightning { animation: dfxBolt 4.5s linear infinite; }
@keyframes dfxBolt {
  0%, 86%, 90%, 93%, 100% { text-shadow: 0 0 6px color-mix(in srgb, var(--dfx, #fff) 40%, transparent); filter: none; }
  87%, 91.5% { color: #fff; text-shadow: 0 0 4px #fff, 0 0 14px var(--dfx, #9cf), 0 0 28px var(--dfx, #9cf); filter: brightness(1.6); }
}
.desc.dfx-stars { position: relative; }
.dfx-stars .dstar { position: absolute; pointer-events: none; line-height: 1; color: var(--dfx, #fff); opacity: 0;
  text-shadow: 0 0 6px var(--dfx, #fff); animation: dfxTwinkle 3s ease-in-out infinite; }
@keyframes dfxTwinkle { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }
.dfx-scramble, .dfx-scramble2 { font-variant-numeric: tabular-nums; }

/* ===== Từng ô nhảy theo nhạc: fx2.js đặt --b0..--b3 (dải trầm → cao, 0..1) trên :root khi nhạc phát ===== */
.ifx-audio .links a, .ifx-audio .discord, .ifx-audio .gameCard, .ifx-audio .widget, .ifx-audio .rel, .ifx-audio .fxpLink {
  --lv: var(--b0, 0);
  transform: scale(calc(1 + var(--lv) * .1));
  box-shadow: 0 0 calc(var(--lv) * 22px) calc(var(--lv) * 2px) color-mix(in srgb, var(--fx, #fff) 70%, transparent);
  transition: transform .09s linear, box-shadow .09s linear; }
.ifx-audio .links a:nth-child(4n+2), .ifx-audio .fxpLink:nth-child(4n+2), .ifx-audio .widget:nth-child(4n+2) { --lv: var(--b1, 0); }
.ifx-audio .links a:nth-child(4n+3), .ifx-audio .fxpLink:nth-child(4n+3), .ifx-audio .widget:nth-child(4n+3) { --lv: var(--b2, 0); }
.ifx-audio .links a:nth-child(4n+4), .ifx-audio .fxpLink:nth-child(4n+4), .ifx-audio .widget:nth-child(4n+4) { --lv: var(--b3, 0); }
/* icon link: quầng sáng theo đúng hình icon (drop-shadow), không thành khung vuông */
.ifx-audio .links a, .ifx-audio .fxpLink { box-shadow: none;
  filter: drop-shadow(0 0 calc(var(--lv) * 12px) color-mix(in srgb, var(--fx, #fff) 85%, #fff)) brightness(calc(1 + var(--lv) * .35));
  transition: transform .09s linear, filter .09s linear; }
/* thẻ lớn (Discord, game, mối liên hệ) nảy nhẹ hơn để không đè lên phần bên cạnh */
.ifx-audio .discord, .ifx-audio .gameCard, .ifx-audio .rel { transform: scale(calc(1 + var(--lv) * .025)); }

@media (prefers-reduced-motion: reduce) {
  .anim-static, .dfx-glitch, .dfx-neon, .dfx-fuzzy, .dfx-lightning, .dfx-stars .dstar { animation: none !important; }
  .dfx-stars .dstar { opacity: .7; }
  .ifx-audio .links a, .ifx-audio .discord, .ifx-audio .gameCard, .ifx-audio .widget, .ifx-audio .rel, .ifx-audio .fxpLink { transform: none; box-shadow: none; }
}
