/* ===== snk-counters.css — event-page "Top counters" section =====
   Mockups: docs/superpowers/mockups/event-counters/

   Scope: the auto-injected counters section on /events/<id>/<slug>.
   Colour comes ONLY from snk-theme.css tokens + a per-boss --type accent
   (rr_type_color() for raids, Dynamax red for Max/Gmax bosses), so the block
   themes itself from its own content and follows light/dark automatically.

   The public site sets a global body{line-height:26px}; every small-text rule
   below therefore states an explicit line-height so that never bleeds in.
   ================================================================= */

.snk-ctr-sec{
  --type: var(--snk-accent);          /* overridden inline per boss */
  margin: 0;
}

/* ---------- section header: "Top counters ........ via Pokébattler" ---------- */
.snk-ctr-head{
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .9rem;
  font-size: .95rem; font-weight: 800; line-height: 1.3;
  letter-spacing: .01em; color: var(--snk-text);
}
.snk-ctr-head::before{
  content: ""; flex: none;
  width: .3rem; height: 1.05rem; border-radius: 3px;
  background: var(--type);
}
.snk-ctr-head .src{
  margin-left: auto;
  font-size: .68rem; font-weight: 700; line-height: 1.2;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--snk-text-muted);
}

/* ---------- boss switcher (only rendered when the event has >1 boss) ---------- */
.snk-ctr-bosses{
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin: 0 0 .8rem; padding: 0; list-style: none;
}
.snk-ctr-chip{
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .7rem .3rem .35rem;
  border: 1px solid var(--snk-border-strong); border-radius: 999px;
  background: var(--snk-surface);
  font-size: .78rem; font-weight: 700; line-height: 1.2;
  color: var(--snk-ink-600);
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease, background-color .12s ease;
}
.snk-ctr-chip img{ width: 26px; height: 26px; object-fit: contain; }
.snk-ctr-chip:hover{ border-color: var(--chip, var(--snk-accent)); color: var(--snk-text); }
.snk-ctr-chip[aria-selected="true"]{
  border-color: var(--chip, var(--type));
  background: color-mix(in srgb, var(--chip, var(--type)) 12%, var(--snk-surface));
  color: var(--snk-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chip, var(--type)) 35%, transparent);
}
.snk-ctr-chip:focus-visible{ outline: 2px solid var(--snk-accent); outline-offset: 2px; }

/* ---------- boss header card ---------- */
.snk-ctr-boss{
  display: flex; align-items: center; gap: .9rem;
  padding: .75rem .9rem;
  margin: 0 0 .9rem;
  border: 1px solid var(--snk-border);
  border-left: 3px solid var(--type);
  border-radius: 12px;
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--type) 10%, var(--snk-surface)) 0%,
      var(--snk-surface) 62%);
}
/* Group size is the block's single most actionable fact — "how many of us do we
   need?" — so it gets its own right-aligned stat instead of a meta chip. */
.snk-ctr-need{
  margin-left: auto; flex: none;
  padding-left: .9rem;
  border-left: 1px solid var(--snk-border);
  text-align: right;
}
.snk-ctr-need .n{
  display: flex; align-items: baseline; justify-content: flex-end; gap: .15rem;
  font-size: 1.35rem; font-weight: 800; line-height: 1.1;
  color: var(--snk-text); font-variant-numeric: tabular-nums;
}
.snk-ctr-need .n .approx{ font-size: .85rem; font-weight: 700; color: var(--snk-ink-300); }
.snk-ctr-need .l{
  display: flex; align-items: center; justify-content: flex-end; gap: .25rem;
  margin-top: .1rem;
  font-size: .66rem; font-weight: 700; line-height: 1.25;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--snk-text-muted);
}
.snk-ctr-need .l svg{ width: 12px; height: 12px; }
.snk-ctr-boss-pic{
  position: relative;
  flex: none;
  width: 68px; height: 68px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%,
    color-mix(in srgb, var(--type) 26%, transparent),
    transparent 72%);
}
.snk-ctr-boss-pic img{ width: 60px; height: 60px; object-fit: contain; }

/* Shadow treatment — ported verbatim from the graphics engine
   (engine.css.php:240,244,271) so a Shadow boss reads the same on the page as
   it does in the infographic: violet disc tint + sprite glow + the icon badge. */
.snk-ctr-boss-pic.is-shadow{
  background: radial-gradient(circle at 50% 40%,
    rgba(124, 46, 168, .30), rgba(74, 12, 118, .44) 60%, transparent 80%);
}
.snk-ctr-boss-pic.is-shadow img{
  filter: brightness(.86) saturate(.9)
          drop-shadow(0 0 7px rgba(124, 58, 237, .55))
          drop-shadow(0 6px 11px rgba(0, 0, 0, .4));
}
/* The engine's badge is #4a0e6b→#7b2ea8, but icon-shadow.png is itself a LIGHT
   purple glyph — on the engine's dark canvas that reads; on our light surface it
   is purple-on-purple and the badge looks empty. Darkened here so the glyph pops.
   Same badge, same icon, corrected contrast. */
.snk-ctr-boss-pic .sh-ico{
  position: absolute; top: -2px; left: -2px; z-index: 2;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: linear-gradient(135deg, #240536, #4a0e6b);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.snk-ctr-boss-pic .sh-ico img{ width: 13px; height: 13px; filter: none; }
/* Same glow on Shadow counter tiles — the text badge names it, the glow makes
   the row scannable without reading. */
.snk-ctr.is-shadow img.s{
  filter: brightness(.86) saturate(.9) drop-shadow(0 0 6px rgba(124, 58, 237, .5));
}
.snk-ctr-boss-txt{ min-width: 0; }
.snk-ctr-boss-nm{
  font-size: 1.05rem; font-weight: 800; line-height: 1.25;
  color: var(--snk-text);
}
.snk-ctr-boss-meta{
  display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
  margin-top: .3rem;
}
.snk-ctr-tier{
  display: inline-flex; align-items: center;
  padding: .12rem .45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--type) 18%, var(--snk-surface-3));
  border: 1px solid color-mix(in srgb, var(--type) 40%, transparent);
  font-size: .68rem; font-weight: 800; line-height: 1.35;
  letter-spacing: .02em; color: var(--snk-ink-700);
}
.snk-ctr-boss-meta .t{ display: inline-flex; gap: .2rem; }
.snk-ctr-boss-meta .t img{ width: 20px; height: 20px; }

/* ---------- counter grid ----------
   Five per row on desktop, stepping down to two on phones. Five is the
   engine's existing convention (engine.css.php:313), and it keeps a 10-counter
   list to two clean ranked rows with room for full names. */
.snk-ctr-grid{ display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
@media (max-width: 991.98px){ .snk-ctr-grid{ grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 767.98px){ .snk-ctr-grid{ grid-template-columns: repeat(3, 1fr); } }
.snk-ctr{
  position: relative;
  display: block; text-decoration: none;
  padding: .5rem .4rem .45rem;
  border: 1px solid var(--snk-border); border-radius: 10px;
  background: var(--snk-surface);
  text-align: center;
  transition: border-color .12s ease, transform .12s ease;
}
.snk-ctr:hover{ border-color: var(--type); transform: translateY(-1px); }
.snk-ctr:focus-visible{ outline: 2px solid var(--snk-accent); outline-offset: 2px; }
.snk-ctr img.s{ width: 52px; height: 52px; object-fit: contain; }
.snk-ctr .nm{
  font-size: .73rem; font-weight: 700; line-height: 1.15;
  margin-top: .1rem; color: var(--snk-text);
}
.snk-ctr .mv{
  font-size: .65rem; font-weight: 500; line-height: 1.15;
  margin-top: .15rem; color: var(--snk-text-muted);
}
.snk-ctr-t{ display: flex; justify-content: center; gap: .2rem; margin-top: .2rem; }
.snk-ctr-t img{ width: 18px; height: 18px; }

/* rank + badges */
.snk-ctr-rank{
  position: absolute; top: .3rem; right: .35rem;
  font-size: .6rem; font-weight: 800; line-height: 1;
  color: var(--snk-ink-300);
  font-variant-numeric: tabular-nums;
}
.snk-ctr-badges{
  position: absolute; top: .3rem; left: .3rem;
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
}
.snk-ctr-b{
  font-size: .55rem; font-weight: 900; line-height: 1;
  letter-spacing: .03em; text-transform: uppercase;
  color: #fff; border-radius: 5px; padding: .12rem .28rem;
}
.snk-ctr-b.sh{ background: #7c3aed; }
.snk-ctr-b.mg{ background: #7b2ff7; }
.snk-ctr-b.gx{ background: #b14ef0; }

/* Relative-power bar.
   Deliberately NOT type-accented. The bar carries data, and some type colours
   (electric #f3d23b, ice #75d0c1) fall well below a readable contrast on the
   light surface — a yellow bar on #f6f8fb is decoration, not information. The
   type accent keeps the chrome (header rule, boss wash, tier chip, hover); the
   bar keeps the brand accent, which is legible in both themes. Identity and
   legibility are separate jobs. */
.snk-ctr-str{
  margin-top: .35rem; height: .3rem;
  border-radius: 3px; background: var(--snk-surface-3);
  border: 1px solid var(--snk-border-subtle);
  overflow: hidden;
}
.snk-ctr-str > span{
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--snk-accent), var(--snk-accent-2));
}

/* ---------- mechanic note + Super Mega shield split ----------
   Rendered only where the battle type changes what you bring: the Super Mega
   shield rule (warning) and the Max-Battle allowlist / Shadow enrage (info). */
.snk-ctr-note{
  display: flex; align-items: flex-start; gap: .5rem;
  margin: 0 0 .8rem; padding: .55rem .7rem;
  border: 1px solid color-mix(in srgb, var(--snk-warning) 38%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--snk-warning) 12%, var(--snk-surface));
  font-size: .78rem; font-weight: 600; line-height: 1.35;
  color: var(--snk-ink-700);
}
.snk-ctr-note svg{ width: 15px; height: 15px; flex: none; margin-top: .1rem; color: var(--snk-warning); }
.snk-ctr-note.is-info{
  border-color: color-mix(in srgb, var(--type) 32%, transparent);
  background: color-mix(in srgb, var(--type) 9%, var(--snk-surface));
}
.snk-ctr-note.is-info svg{ color: var(--type); }
.snk-ctr-sub{
  display: flex; align-items: center; gap: .4rem;
  margin: .9rem 0 .5rem;
  font-size: .7rem; font-weight: 800; line-height: 1.3;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--snk-ink-600);
}
.snk-ctr-note + .snk-ctr-sub,
.snk-ctr-sub:first-child{ margin-top: 0; }
.snk-ctr-sub .warn{
  font-weight: 700; text-transform: none; letter-spacing: 0;
  color: var(--snk-warning);
}

/* ---------- empty / skeleton ---------- */
.snk-ctr-empty{
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .7rem .8rem;
  border: 1px solid var(--snk-border); border-radius: 10px;
  background: var(--snk-surface-3);
  font-size: .8rem; font-weight: 600; line-height: 1.4;
  color: var(--snk-ink-600);
}
.snk-ctr-empty svg{ width: 15px; height: 15px; flex: none; margin-top: .15rem; color: var(--snk-text-muted); }

.snk-ctr-skel .sk{
  border-radius: 10px;
  background: linear-gradient(90deg,
    var(--snk-surface-3) 25%,
    var(--snk-border-subtle) 37%,
    var(--snk-surface-3) 63%);
  background-size: 400% 100%;
  animation: snk-ctr-shim 1.3s ease-in-out infinite;
}
.snk-ctr-skel .sk-boss{ height: 86px; margin-bottom: .9rem; }
.snk-ctr-skel .sk-tile{ height: 132px; }
@keyframes snk-ctr-shim{ 0%{ background-position: 100% 50% } 100%{ background-position: 0 50% } }
@media (prefers-reduced-motion: reduce){
  .snk-ctr-skel .sk{ animation: none; }
  .snk-ctr{ transition: none; }
}

/* ---------- mobile ---------- */
@media (max-width: 575.98px){
  .snk-ctr-grid{ grid-template-columns: repeat(2, 1fr); gap: .4rem; }
  .snk-ctr img.s{ width: 48px; height: 48px; }
  .snk-ctr-boss{ gap: .7rem; padding: .65rem .7rem; }
  .snk-ctr-boss-pic{ width: 54px; height: 54px; }
  .snk-ctr-boss-pic img{ width: 48px; height: 48px; }
  .snk-ctr-boss-nm{ font-size: .95rem; }
  .snk-ctr-need{ padding-left: .6rem; }
  .snk-ctr-need .n{ font-size: 1.15rem; }
  .snk-ctr-need .l{ font-size: .6rem; }
  /* The switcher becomes a swipeable rail rather than wrapping to three rows. */
  .snk-ctr-bosses{ flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -.25rem; padding-inline: .25rem; }
  .snk-ctr-bosses::-webkit-scrollbar{ display: none; }
  .snk-ctr-chip{ flex: none; }
}
