/* ============================================================
   SkinSignal / css / finish-live.css
   THE LIVING EDGE, one component for the whole site (js/finish-live.js
   puts a <span class="fxe"><i></i></span> into each host):
     - every Sign in with Steam button (.cta--steam, the header's
       .auth__signin): a Doppler Sapphire rim travelling clockwise,
       brighter on hover and focus
     - any card or panel marked data-fx="<finish>": a finish-lit edge
       travelling clockwise, slow, each one offset so neighbours are
       never in step
   HOW IT MOVES: the span is the host's own outline (border-radius
   inherited), cut to a thin ring by a mask; inside it one square,
   exactly the host's diagonal, carries a conic gradient (the finish's
   two tones as a single comet) and ROTATES. Transform only: nothing
   animates a background, a border or a shadow.
   IT RESTS: paused while off screen (.is-off) and while the tab is
   hidden (html.fx-hidden); under reduced motion it stands still, the
   comet parked at the top right.
   The finishes are the dashboard's (js/hall-bands.js tones, the
   rarity materials): gold is prestige's alone.
   ============================================================ */
.fxe {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: var(--fxw, 1.5px);
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.78;
  transition: opacity 0.25s ease;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.fxe > i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--fxd, 480px);
  height: var(--fxd, 480px);
  margin: calc(var(--fxd, 480px) / -2) 0 0 calc(var(--fxd, 480px) / -2);
  background: conic-gradient(from 0turn,
    rgba(var(--fa), 0) 0turn, rgba(var(--fa), 0) 0.56turn,
    rgba(var(--fa), 0.9) 0.76turn, rgb(var(--fb)) 0.86turn,
    rgba(var(--fb), 0) 0.96turn, rgba(var(--fa), 0) 1turn);
  animation: fxeSpin var(--fxs, 16s) linear infinite;
  animation-delay: calc(var(--fxk, 0) * var(--fxs, 16s) * -1);
  will-change: transform;
}
@keyframes fxeSpin { to { transform: rotate(1turn); } }
.fxe.is-off > i,
.fx-hidden .fxe > i { animation-play-state: paused; }
:hover > .fxe,
:focus-visible > .fxe,
:focus-within > .fxe { opacity: 1; }

/* ---------- The finishes (tone a, tone b) ---------- */
[data-fx] { --fa: 170, 178, 192; --fb: 230, 236, 244; }
[data-fx="gold"]          { --fa: 196, 142, 40;  --fb: 255, 222, 140; }
[data-fx="sapphire"]      { --fa: 62, 104, 206;  --fb: 130, 180, 255; }
[data-fx="emerald"]       { --fa: 38, 150, 100;  --fb: 130, 235, 180; }
[data-fx="case-hardened"] { --fa: 104, 136, 176; --fb: 214, 176, 96; }
[data-fx="doppler"]       { --fa: 112, 92, 204;  --fb: 214, 128, 236; }
[data-fx="damascus"]      { --fa: 140, 150, 166; --fb: 236, 240, 248; }
[data-fx="ruby"]          { --fa: 160, 30, 58;   --fb: 255, 112, 132; }
[data-fx="fade"]          { --fa: 206, 112, 168; --fb: 255, 206, 120; }

/* ---------- The Steam door: Doppler Sapphire, two comets ---------- */
.cta--steam,
.auth__signin { --fa: 61, 127, 255; --fb: 150, 215, 255; --fxs: 9s; }
.cta--steam > .fxe,
.auth__signin > .fxe { --fxw: 2px; opacity: 0.85; }
.cta--steam > .fxe > i,
.auth__signin > .fxe > i {
  background: conic-gradient(from 0turn,
    rgba(110, 96, 255, 0) 0turn, rgba(110, 96, 255, 0.55) 0.1turn,
    rgb(150, 205, 255) 0.24turn, rgb(236, 248, 255) 0.29turn, rgba(150, 215, 255, 0) 0.36turn,
    rgba(61, 127, 255, 0) 0.5turn, rgba(110, 96, 255, 0.55) 0.6turn,
    rgb(150, 205, 255) 0.74turn, rgb(236, 248, 255) 0.79turn, rgba(150, 215, 255, 0) 0.86turn, rgba(110, 96, 255, 0) 1turn);
}
.cta--steam:hover > .fxe,
.cta--steam:focus-visible > .fxe,
.auth__signin:hover > .fxe,
.auth__signin:focus-visible > .fxe { --fxw: 2.5px; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .fxe > i { animation: none; transform: rotate(0.12turn); }
  .fxe { transition: none; }
}

/* ============================================================
   THE RARITY RIM, the dashboard's FX_RIM (css/dash-free.css .fxr) for
   every page: a thin ring cut from the rarity's own finish tile round a
   calling card, a white light travelling round it while it is looked
   at. js/finish-live.js gives one to every calling card inside a
   [data-rims] section, its rarity read from the card's own file path.
   Nothing on the art: the ring sits on the card's edge only.
   ============================================================ */
@keyframes ffrRun { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
[data-rim="legendary"] { --rt: url(/assets/finishes/finish-emerald.webp);        --rs: 22, 150, 105; }
[data-rim="epic"]      { --rt: url(/assets/finishes/finish-doppler.webp);        --rs: 146, 100, 238; }
[data-rim="rare"]      { --rt: url(/assets/finishes/finish-sapphire.webp);       --rs: 70, 130, 255; }
[data-rim="common"]    { --rt: url(/assets/finishes/finish-damascus-steel.webp); --rs: 196, 204, 216; }
[data-rim="rank"]      { --rt: url(/assets/finishes/finish-case-hardened.webp);  --rs: 122, 150, 190; }
.ffr {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  padding: 1.5px;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.ffr__tex { position: absolute; left: -96px; top: -96px; right: 0; bottom: 0; display: block; background: linear-gradient(rgba(var(--rs, 196, 204, 216), 0.28), rgba(255, 255, 255, 0.1)), var(--rt, none) 0 0 / 96px 96px, rgb(var(--rs, 196, 204, 216)); }
.ffr__run { position: absolute; left: 50%; top: 50%; display: block; width: 140%; aspect-ratio: 1; background: conic-gradient(from 0deg, rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0) 270deg, rgba(255, 255, 255, 0.3) 326deg, rgba(255, 255, 255, 0.95) 356deg, rgba(255, 255, 255, 0) 360deg); opacity: 0; transform: translate(-50%, -50%); transition: opacity 0.22s ease; }
[data-rim]:hover > .ffr .ffr__run,
[data-rim]:focus-visible > .ffr .ffr__run,
a:hover [data-rim] > .ffr .ffr__run,
button:hover [data-rim] > .ffr .ffr__run { opacity: 1; animation: ffrRun 2.8s linear infinite; }
[data-rim] { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 12px -4px rgba(var(--rs, 196, 204, 216), 0.6); }
@media (prefers-reduced-motion: reduce) {
  [data-rim]:hover > .ffr .ffr__run,
  [data-rim]:focus-visible > .ffr .ffr__run { animation: none; }
}
