/* ============================================================
   wiki-stats.css?v=1 — SwagFunded wiki infographics kit (ws-*)
   Pairs with /js/wiki-stats.js. Reuses the global design tokens
   from style.css (gold/teal/surfaces/Cinzel/JetBrains-Mono).
   Components: ws-strip / ws-gauge / ws-bars / ws-radar / ws-meter
   / ws-badge / ws-spark / ws-rank / ws-kv.  Self-contained; drop a
   widget into any container. Animations respect reduced-motion.
   ============================================================ */

/* ---- panel + layout shells (optional wrappers) ---- */
.ws-panel{ background:var(--surface); border:1px solid var(--border-2); border-radius:var(--radius-lg); padding:1.15rem 1.25rem; box-shadow:var(--shadow-md); }
.ws-panel__h{ display:flex; align-items:center; gap:.45rem; font-family:var(--font-mono); font-size:.74rem; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); margin:0 0 1rem; }
.ws-panel__h .ws-note{ margin-left:auto; text-transform:none; letter-spacing:0; color:var(--text-faint); font-size:.66rem; }
.ws-grid{ display:grid; gap:.85rem; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); align-items:start; }
.ws-grid--wide{ grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); }
.ws-card{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:.85rem .9rem; min-width:0; }
.ws-card__h{ font-family:var(--font-mono); font-size:.64rem; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted); margin:0 0 .6rem; display:flex; align-items:center; gap:.35rem; }
.ws-card__h .ws-q{ margin-left:auto; color:var(--text-faint); cursor:help; }

/* ---- strip (count-up stat row) ---- */
.ws-strip{ display:grid; grid-template-columns:repeat(auto-fit,minmax(82px,1fr)); gap:.45rem; }
.ws-stat{ text-align:center; padding:.3rem .15rem; min-width:0; }
.ws-stat__v{ font-family:'Cinzel',var(--font-display); font-weight:700; font-size:1.32rem; line-height:1.05; color:var(--text-primary); font-variant-numeric:tabular-nums; word-break:break-word; }
.ws-stat__v--gold{ color:var(--gold); } .ws-stat__v--teal{ color:var(--teal); }
.ws-stat__v--green{ color:var(--green); } .ws-stat__v--purple{ color:var(--purple); } .ws-stat__v--red{ color:var(--red); }
.ws-stat__l{ margin-top:.28rem; font-family:var(--font-mono); font-size:.59rem; text-transform:uppercase; letter-spacing:.045em; color:var(--text-muted); line-height:1.25; }
.ws-stat__s{ font-size:.62rem; color:var(--text-faint); margin-top:.1rem; }

/* ---- gauge (SVG ring) ---- */
.ws-gauge{ text-align:center; }
.ws-gauge__ring{ position:relative; width:124px; height:124px; margin:0 auto; }
.ws-gauge__ring svg{ width:124px; height:124px; transform:rotate(-90deg); }
.ws-gauge__track{ fill:none; stroke:var(--surface-3); stroke-width:9; }
.ws-gauge__arc{ fill:none; stroke:var(--gold); stroke-width:9; stroke-linecap:round; transition:stroke-dashoffset 1.05s cubic-bezier(.16,1,.3,1); }
.ws-gauge__c{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; gap:1px; }
.ws-gauge__v{ font-family:'Cinzel',var(--font-display); font-weight:700; font-size:1.65rem; line-height:1; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.ws-gauge__u{ font-size:.78rem; color:var(--text-muted); align-self:flex-start; margin-top:.35rem; }
.ws-gauge__l{ margin-top:.45rem; font-family:var(--font-mono); font-size:.66rem; text-transform:uppercase; letter-spacing:.05em; color:var(--text-secondary); }
.ws-gauge__s{ font-size:.62rem; color:var(--text-faint); margin-top:.12rem; }

/* ---- bars (horizontal histogram) ---- */
.ws-bars{ display:flex; flex-direction:column; gap:.5rem; }
.ws-bar__top{ display:flex; align-items:baseline; gap:.5rem; font-size:.74rem; margin-bottom:.22rem; }
.ws-bar__label{ color:var(--text-secondary); display:flex; align-items:center; gap:.32rem; min-width:0; }
.ws-bar__label img{ width:16px; height:16px; object-fit:contain; image-rendering:pixelated; flex:0 0 auto; }
.ws-bar__val{ margin-left:auto; font-family:var(--font-mono); font-size:.72rem; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.ws-bar__sub{ color:var(--text-faint); font-family:var(--font-mono); font-size:.64rem; }
.ws-bar__track{ height:8px; border-radius:999px; background:var(--surface-3); overflow:hidden; }
.ws-bar__fill{ height:100%; width:0; border-radius:999px; background:var(--gold); transition:width 1s cubic-bezier(.16,1,.3,1); }

/* ---- radar (elemental polygon — the marquee) ---- */
.ws-radar{ text-align:center; }
.ws-radar__svg{ width:100%; max-width:300px; height:auto; overflow:visible; }
.ws-radar__grid{ fill:none; stroke:var(--border); stroke-width:1; opacity:.55; }
.ws-radar__spoke{ stroke:var(--border); stroke-width:1; opacity:.4; }
.ws-radar__base{ fill:none; stroke:var(--text-faint); stroke-width:1.2; stroke-dasharray:3 3; opacity:.8; }
.ws-radar__poly{ fill:rgba(245,200,66,.16); stroke:var(--gold); stroke-width:2; stroke-linejoin:round; opacity:0; transform:scale(.06); transition:transform .95s cubic-bezier(.16,1,.3,1), opacity .6s ease; }
.ws-radar__poly.is-in{ opacity:1; transform:scale(1); }
.ws-radar__dot{ fill:var(--text-muted); stroke:var(--surface); stroke-width:1.2; opacity:0; transition:opacity .5s ease .35s; }
.ws-radar__dot.is-in{ opacity:1; }
.ws-radar__dot--weak{ fill:var(--gold); } .ws-radar__dot--resist{ fill:var(--teal); } .ws-radar__dot--immune{ fill:var(--verified); }
.ws-radar__lbl{ fill:var(--text-secondary); font-family:var(--font-mono); font-size:9.5px; }
.ws-radar__lbl--weak{ fill:var(--gold); } .ws-radar__lbl--resist{ fill:var(--teal); } .ws-radar__lbl--immune{ fill:var(--verified); }
.ws-radar__note{ font-family:var(--font-mono); font-size:.62rem; color:var(--text-faint); margin-top:.5rem; }
.ws-radar__legend{ display:flex; flex-wrap:wrap; gap:.5rem .8rem; justify-content:center; margin-top:.55rem; font-family:var(--font-mono); font-size:.62rem; color:var(--text-muted); }
.ws-radar__legend i{ width:8px; height:8px; border-radius:999px; display:inline-block; margin-right:.3rem; vertical-align:middle; }

/* ---- meter (linear, with optional marker) ---- */
.ws-meter__top{ display:flex; align-items:baseline; gap:.5rem; font-size:.74rem; margin-bottom:.3rem; }
.ws-meter__top .k{ color:var(--text-secondary); } .ws-meter__top .v{ margin-left:auto; font-family:var(--font-mono); color:var(--text-primary); font-variant-numeric:tabular-nums; }
.ws-meter__track{ position:relative; height:9px; border-radius:999px; background:var(--surface-3); overflow:hidden; }
.ws-meter__fill{ position:absolute; left:0; top:0; bottom:0; width:0; border-radius:999px; background:linear-gradient(90deg,var(--teal),var(--gold)); transition:width 1s cubic-bezier(.16,1,.3,1); }
.ws-meter__ends{ display:flex; justify-content:space-between; margin-top:.25rem; font-family:var(--font-mono); font-size:.62rem; color:var(--text-faint); }

/* ---- badge (inline pill) ---- */
.ws-badge{ display:inline-flex; align-items:center; gap:.28rem; padding:.16rem .5rem; border-radius:999px; font-family:var(--font-mono); font-size:.66rem; font-weight:600; line-height:1.4; white-space:nowrap; border:1px solid transparent; }
.ws-badge--gold{ background:var(--gold-dim); color:var(--gold); border-color:rgba(245,200,66,.3); }
.ws-badge--teal{ background:var(--teal-dim); color:var(--teal); border-color:rgba(79,152,163,.3); }
.ws-badge--green{ background:var(--green-dim); color:var(--green); }
.ws-badge--red{ background:var(--red-dim); color:var(--red); }
.ws-badge--purple{ background:var(--purple-dim); color:var(--purple); }
.ws-badge--blue{ background:var(--verified-dim); color:var(--verified); }
.ws-badge--muted{ background:var(--surface-3); color:var(--text-muted); border-color:var(--border); }

/* ---- spark (mini line) ---- */
.ws-spark{ display:block; width:100%; height:38px; overflow:visible; }
.ws-spark__area{ fill:rgba(79,152,163,.14); stroke:none; }
.ws-spark__line{ fill:none; stroke:var(--teal); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.ws-spark__dot{ fill:var(--gold); }

/* ---- rank (#N of M + percentile) ---- */
.ws-rank__top{ display:flex; align-items:baseline; gap:.35rem; }
.ws-rank__hash{ font-family:'Cinzel',var(--font-display); font-weight:700; font-size:1.4rem; color:var(--gold); line-height:1; }
.ws-rank__of{ font-family:var(--font-mono); font-size:.7rem; color:var(--text-muted); }
.ws-rank__bar{ height:6px; border-radius:999px; background:var(--surface-3); overflow:hidden; margin:.45rem 0 .3rem; }
.ws-rank__fill{ height:100%; width:0; border-radius:999px; background:linear-gradient(90deg,var(--gold),var(--gold-hover)); transition:width 1s cubic-bezier(.16,1,.3,1); }
.ws-rank__l{ font-family:var(--font-mono); font-size:.62rem; color:var(--text-faint); }

/* ---- kv (key/value list) ---- */
.ws-kv{ margin:0; display:flex; flex-direction:column; gap:.2rem; }
.ws-kv > div{ display:flex; align-items:baseline; gap:.6rem; padding:.28rem 0; border-bottom:1px solid var(--divider); }
.ws-kv > div:last-child{ border-bottom:0; }
.ws-kv dt{ font-family:var(--font-mono); font-size:.66rem; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); }
.ws-kv dd{ margin:0 0 0 auto; font-size:.8rem; color:var(--text-primary); text-align:right; font-variant-numeric:tabular-nums; }
.ws-kv dd.is-gold{ color:var(--gold); } .ws-kv dd.is-teal{ color:var(--teal); }

@media (max-width:560px){
  .ws-stat__v{ font-size:1.15rem; }
  .ws-gauge__ring, .ws-gauge__ring svg{ width:110px; height:110px; }
}
@media (prefers-reduced-motion: reduce){
  .ws-gauge__arc, .ws-bar__fill, .ws-meter__fill, .ws-rank__fill, .ws-radar__poly, .ws-radar__dot{ transition:none !important; }
}
