/* Stalzone Clan Manager — visual polish layer.
 *
 * All effects are additive: none of them alter existing markup or
 * styles.  Elements NOT tagged with any polish class render exactly as
 * before.  The only auto-behavior is the JS half applying `.reveal` to
 * `.stat` / `.rd-card` / `.card` on load — a fade-in animation, cheap
 * to reverse if it ever conflicts.
 *
 * Everything respects prefers-reduced-motion.
 */

/* ---- 1. Scroll fade-in reveal (opt-in via `.reveal`) ---------------- */
/* We only hide when JS is present — if scripts are disabled or fail
   before adding the class, elements stay visible by default. */
html.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 480ms ease-out, transform 480ms ease-out;
  will-change: opacity, transform;
}
html.js .reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ---- 2. Animated number counter (opt-in via `.count-up`) ------------ */
.count-up {
  font-variant-numeric: tabular-nums;
  transition: color 220ms ease;
}
.count-up.counting {
  color: #d5b46a; /* subtle amber glow while counting */
}

/* ---- 3. Skeleton shimmer (opt-in via `.shimmer` block, use for
   loading placeholders).  Sweep an opaque band across a translucent
   base row. */
.shimmer {
  position: relative;
  overflow: hidden;
  background: rgba(80, 82, 60, 0.28);
  border-radius: 4px;
  min-height: 14px;
}
.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(213, 180, 106, 0.18) 50%,
    transparent 100%);
  transform: translateX(-100%);
  animation: szcm-shimmer 1.4s linear infinite;
}
@keyframes szcm-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---- 4. Border trail on hover (opt-in via `.shimmer-border`).
   Subtle amber conic-gradient border that rotates while hovered.
   Uses @property so the angle can be animated. */
@property --szcm-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.shimmer-border {
  position: relative;
  isolation: isolate;
}
.shimmer-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--szcm-angle),
    transparent 0deg,
    rgba(213, 180, 106, 0.65) 40deg,
    transparent 90deg,
    transparent 270deg,
    rgba(213, 180, 106, 0.65) 320deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
  z-index: -1;
}
.shimmer-border:hover::before,
.shimmer-border:focus-within::before {
  opacity: 1;
  animation: szcm-border-spin 3.2s linear infinite;
}
@keyframes szcm-border-spin {
  to { --szcm-angle: 360deg; }
}

/* ---- 5. Text Roll on the site header (applied by JS to `.brand a`) --- */
/* Each character in the brand link becomes a `.tr-char` span that flips
   into place with a small 3D rotation on load.  The `.brand-x` accent
   class is preserved per-char so the amber letter still stands out. */
.text-roll {
  display: inline-block;
  perspective: 480px;
}
.text-roll .tr-char {
  display: inline-block;
  opacity: 0;
  transform: rotateX(-90deg);
  transform-origin: center bottom;
  animation: szcm-tr-in 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform, opacity;
}
@keyframes szcm-tr-in {
  0%   { opacity: 0; transform: rotateX(-90deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: rotateX(0deg); }
}

/* ---- 6. Sliding pill indicator under nav tabs on hover -------------- */
/* JS adds a `.tab-pill` element inside each `nav.tabs` and repositions
   it on tab hover.  On mouseleave the pill fades out — the pill is a
   HOVER indicator, not an active-state indicator (site CSS already
   styles the active tab). */
nav.tabs {
  position: relative;
}
nav.tabs > a {
  position: relative;
  z-index: 1;
}
nav.tabs .tab-pill {
  position: absolute;
  top: 0; left: 0;
  border-radius: 8px;
  background: rgba(213, 180, 106, 0.12);
  border: 1px solid rgba(213, 180, 106, 0.35);
  box-shadow: 0 4px 12px rgba(213, 180, 106, 0.08);
  transition:
    transform 300ms cubic-bezier(0.4, 0, 0.2, 1),
    width     300ms cubic-bezier(0.4, 0, 0.2, 1),
    height    300ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity   180ms ease;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
}
nav.tabs.pill-visible .tab-pill {
  opacity: 1;
}

/* ---- 7. Tilt card on hover (applied by JS to `.clan-card`) ---------- */
/* Adds a subtle 3D tilt as the mouse moves over the card.  The
   transform is applied inline by JS; the CSS just adds a snappy
   transition back to rest and a slight elevation shadow to sell the
   depth. */
.tilt {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 220ms ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.tilt:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Reduced motion — turn every polish animation off. */
@media (prefers-reduced-motion: reduce) {
  html.js .reveal,
  html.js .reveal.in-view {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .count-up.counting { color: inherit !important; }
  .shimmer::after,
  .shimmer-border:hover::before,
  .shimmer-border:focus-within::before {
    animation: none !important;
  }
  .text-roll .tr-char { opacity: 1 !important; transform: none !important; animation: none !important; }
  nav.tabs .tab-pill { transition: none !important; }
  .tilt { transition: none !important; }
}
