/* /wiki/waxmods (templates/wiki_waxmods.html, static/wiki-waxmods.js): the class picker, the filters and the Waxmod
   cards. Loaded on that page only, after wiki.css. Rarity colours are wiki.css's (the game's item rarities). */

/* the page uses the full width: no right-hand table of contents (the inline one stays) */
.wiki-layout.is-wide { grid-template-columns: 250px minmax(0, 1fr); }
.wiki-layout.is-wide .wiki-toc { display: none; }
.wiki-layout.is-wide .wiki-content article { max-width: 1060px; }
.wiki-layout.is-wide .wiki-inline-toc { display: block; }

.wm { --wm-common: #d1d4d2; --wm-uncommon: #74dd73; --wm-rare: #6cbaff; --wm-epic: #d994f3; --wm-legendary: #ffca53; --wm-prismatic: #effbff; margin: 18px 0 8px; }
.wm .rarity-common { --rc: var(--wm-common); }
.wm .rarity-uncommon { --rc: var(--wm-uncommon); }
.wm .rarity-rare { --rc: var(--wm-rare); }
.wm .rarity-epic { --rc: var(--wm-epic); }
.wm .rarity-legendary { --rc: var(--wm-legendary); }
.wm .rarity-prismatic { --rc: #c9b8ff; }

/* ---- class picker: one emblem per class ---- */
.wm-classes ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.wiki-content .wm-classes li { margin: 0; }
.wm-class { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; padding: 10px 2px 9px; border: 1px solid var(--wx-line-2); border-radius: var(--wx-radius-md); background: linear-gradient(170deg, rgba(40, 34, 64, 0.62), rgba(16, 16, 30, 0.8)); color: var(--wx-text-2); text-align: center; transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease; }
.wm-class img { width: 50px; height: 50px; object-fit: contain; filter: grayscale(0.55) brightness(0.86) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55)); transition: filter 0.15s ease, transform 0.15s ease; }
.wm-class span { max-width: 100%; font-size: 11.5px; font-weight: 700; line-height: 1.2; overflow-wrap: normal; word-break: normal; letter-spacing: -0.01em; }
.wm-class small { color: var(--wx-dim); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wm-class:hover { border-color: var(--wx-line-accent); color: var(--wx-text); transform: translateY(-2px); }
.wm-class:hover img { filter: grayscale(0) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.55)); transform: scale(1.06); }
.wm-class.is-current { border-color: var(--wx-teal-line); background: radial-gradient(ellipse 80% 60% at 50% 35%, rgba(128, 212, 210, 0.2), transparent 75%), linear-gradient(170deg, rgba(62, 36, 106, 0.85), rgba(26, 24, 50, 0.92)); box-shadow: 0 0 0 1px var(--wx-teal-line), 0 10px 26px rgba(80, 200, 200, 0.14); color: var(--wx-teal-hi); }
.wm-class.is-current img { filter: drop-shadow(0 0 12px rgba(128, 212, 210, 0.45)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
.wm-class.is-current small { color: var(--wx-teal); }

/* ---- filters ---- */
.wm-filters { display: grid; gap: 12px; margin: 18px 0 10px; padding: 16px 18px; border: 1px solid var(--wx-line-2); border-radius: var(--wx-radius); background: var(--wx-glass); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28); }
.wm-filter-head { display: grid; grid-template-columns: auto auto minmax(220px, 1fr); align-items: center; gap: 14px; }
.wm-class-logo { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 0 14px rgba(128, 212, 210, 0.35)); }
.wiki-content .wm-class-title h3 { margin: 0; font: 700 24px/1.15 var(--wx-display); }
.wiki-content .wm-status { margin: 3px 0 0; color: var(--wx-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.wm-status strong { color: var(--wx-teal-hi); }
.wm-search { position: relative; justify-self: end; width: min(100%, 360px); }
.wm-search svg { position: absolute; top: 50%; left: 13px; color: var(--wx-muted); transform: translateY(-50%); pointer-events: none; }
.wm-search input { width: 100%; height: 42px; min-height: 0; padding-left: 40px; border-radius: 999px; }
.wm-filters fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.wm-filters legend { float: left; margin-right: 6px; color: var(--wx-teal); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.wm-kit-option, .wm-chip { position: relative; display: inline-flex; }
.wm-kit-option input, .wm-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.wm-kit-option span, .wm-chip span { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 13px; border: 1px solid var(--wx-line-2); border-radius: 999px; background: rgba(14, 12, 28, 0.6); color: var(--wx-text-2); font-size: 13px; font-weight: 650; white-space: nowrap; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.wm-kit-option small, .wm-chip small { color: var(--wx-dim); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wm-kit-option:hover span, .wm-chip:hover span { border-color: var(--wx-line-3); color: var(--wx-text); }
.wm-kit-option input:checked + span { border-color: var(--wx-teal-line); background: var(--wx-teal-bg); color: var(--wx-teal-hi); }
.wm-kit-option input:checked + span small { color: var(--wx-teal); }
.wm-kit-option input:focus-visible + span, .wm-chip input:focus-visible + span { outline: 2px solid var(--wx-focus); outline-offset: 2px; }
.wm-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px var(--rc); }
.wm-chip.rarity-prismatic i { background: conic-gradient(#aeece7, #e8b8eb, #f4dea6, #aeece7); }
.wm-chip input:checked + span { border-color: var(--rc); background: color-mix(in srgb, var(--rc) 16%, rgba(14, 12, 28, 0.7)); color: var(--rc); }
.wm-chip.rarity-prismatic input:checked + span { color: #effbff; text-shadow: -1px 0 #85dce3, 1px 0 #efb9e0; }
.wm-chip input:checked + span small { color: inherit; opacity: 0.85; }
.wm-chip.is-zero span, .wm-kit-option.is-zero span { opacity: 0.5; }
.wm-actions { display: flex; align-items: center; gap: 16px; }
.wm-actions:not(:has(> :not([hidden]))) { display: none; }
.wm-reset { font-size: 13px; font-weight: 650; }
.wm-reset:hover { text-decoration: underline; text-underline-offset: 3px; }
.wm.is-live .wm-apply { display: none; }

/* ---- results: one group per rarity ---- */
.wm-group { margin: 22px 0 6px; }
.wiki-content .wm-group-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid color-mix(in srgb, var(--rc) 35%, transparent); color: var(--rc); font: 700 18px/1.2 var(--wx-display); }
.wm-group-title small { color: var(--wx-muted); font: 700 12px var(--wx-font); }
.wm-group.rarity-prismatic .wm-group-title span { color: #effbff; text-shadow: -1px 0 #85dce3, 1px 0 #efb9e0; }
.wm-group.rarity-prismatic .wm-group-title { border-image: linear-gradient(90deg, #aeece7, #e8b8eb, #f4dea6, transparent) 1; }
.wm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

.wm-card { display: flex; gap: 14px; align-items: flex-start; min-width: 0; padding: 14px 16px 15px 14px; border: 1px solid var(--wx-line-2); border-left: 3px solid var(--rc); border-radius: var(--wx-radius-md); background: linear-gradient(100deg, color-mix(in srgb, var(--rc) 9%, transparent), transparent 45%), linear-gradient(165deg, rgba(40, 34, 64, 0.72), rgba(18, 18, 34, 0.84)); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.wm-card:hover { border-color: color-mix(in srgb, var(--rc) 55%, transparent); border-left-color: var(--rc); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32), 0 0 22px color-mix(in srgb, var(--rc) 12%, transparent); }
.wm-card.rarity-prismatic { border-left-color: transparent; border-image: linear-gradient(180deg, #aeece7, #e8b8eb, #f4dea6) 0 0 0 1; background: linear-gradient(100deg, rgba(174, 236, 231, 0.08), rgba(232, 184, 235, 0.05) 30%, transparent 55%), linear-gradient(165deg, rgba(40, 34, 64, 0.72), rgba(18, 18, 34, 0.84)); }
.wm-art { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 12px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.wm-body { flex: 1; min-width: 0; }
.wiki-content .wm-name { margin: 0; color: var(--rc); font-size: 16px; line-height: 1.3; }
.wiki-content .wm-card.rarity-prismatic .wm-name { color: #effbff; text-shadow: -1px 0 #85dce3, 1px 0 #efb9e0; }
.wiki-content .wm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.wm-tags span { padding: 1px 8px; border: 1px solid var(--wx-line-2); border-radius: 999px; background: rgba(10, 9, 22, 0.55); color: var(--wx-text-2); font-size: 11.5px; font-weight: 700; }
.wm-tags .wm-rarity { border-color: color-mix(in srgb, var(--rc) 45%, transparent); color: var(--rc); }
.wm-card.rarity-prismatic .wm-tags .wm-rarity { border-color: rgba(232, 184, 235, 0.5); color: #effbff; }
.wiki-content .wm-spell { margin: 0 0 4px; color: var(--wx-muted); font-size: 12.5px; }
.wm-spell b { color: var(--wx-violet-hi); font-weight: 700; }
.wiki-content .wm-effect { margin: 0; color: var(--wx-text); font-size: 14px; line-height: 1.55; }
.wiki-content .wm-note { margin: 6px 0 0; color: var(--wx-muted); font-size: 12px; font-style: italic; }
.wm-port { margin-top: 10px; border-top: 1px dashed var(--wx-line-2); }
.wm-port > summary { padding: 8px 0 2px; color: var(--wx-muted); font-size: 12.5px; list-style: none; cursor: pointer; }
.wm-port > summary::-webkit-details-marker { display: none; }
.wm-port > summary::before { content: "›"; display: inline-block; margin-right: 6px; color: var(--wx-teal); font-weight: 800; transition: transform 0.15s ease; }
.wm-port[open] > summary::before { transform: rotate(90deg); }
.wm-port > summary:hover { color: var(--wx-text-2); }
.wm-port .wm-kit { color: var(--wx-teal-hi); font-weight: 700; }
.wm-port .wm-effect { padding: 4px 0 2px 14px; font-size: 13.5px; }
.wm-port .wm-note { padding-left: 14px; }
/* a port shown alone (its kit is selected): the card's own text */
.wm-port.is-solo { margin-top: 0; border-top: 0; }
.wm-port.is-solo > summary { padding-top: 0; cursor: default; }
.wm-port.is-solo > summary::before { display: none; }
.wm-port.is-solo .wm-effect, .wm-port.is-solo .wm-note { padding-left: 0; font-size: 14px; }

.wm-empty { display: grid; justify-items: center; gap: 10px; margin: 26px 0; padding: 34px 20px; border: 1px dashed var(--wx-line-2); border-radius: var(--wx-radius-md); text-align: center; }
.wm-empty img { width: 72px; height: 72px; opacity: 0.75; }
.wiki-content .wm-empty p { margin: 0; color: var(--wx-text-2); }

/* a card's link to its latest change on /wiki/waxmods-history */
.wiki-content .wm-changed { margin: 8px 0 0; font-size: 12px; }
.wm-changed a { color: var(--wx-teal); font-weight: 650; }
.wm-changed a:hover { color: var(--wx-teal-hi); text-decoration: underline; text-underline-offset: 3px; }
.wm-card:target { border-color: var(--rc); box-shadow: 0 0 0 1px var(--rc), 0 0 26px color-mix(in srgb, var(--rc) 22%, transparent); }

/* ---- /wiki/waxmods-history (templates/wiki_waxmods.html: wiki-waxmods-history*) ---- */
.wmh-classes { margin: 14px 0 4px; }
.wmh-classes ul { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.wmh-classes .wm-class.is-zero { opacity: 0.45; }
.wmh-all { display: grid; place-items: center; width: 50px; height: 50px; color: var(--wx-teal); font-size: 26px; }
.wmh-list { display: grid; gap: 10px; margin-top: 14px; --wm-common: #d1d4d2; --wm-uncommon: #74dd73; --wm-rare: #6cbaff; --wm-epic: #d994f3; --wm-legendary: #ffca53; }
.wmh-entry.rarity-common { --rc: var(--wm-common); }
.wmh-entry.rarity-uncommon { --rc: var(--wm-uncommon); }
.wmh-entry.rarity-rare { --rc: var(--wm-rare); }
.wmh-entry.rarity-epic { --rc: var(--wm-epic); }
.wmh-entry.rarity-legendary { --rc: var(--wm-legendary); }
.wmh-entry.rarity-prismatic { --rc: #c9b8ff; }
.wmh-entry { display: flex; gap: 12px; align-items: flex-start; min-width: 0; padding: 12px 14px; border: 1px solid var(--wx-line-2); border-left: 3px solid var(--rc); border-radius: var(--wx-radius-md); background: linear-gradient(100deg, color-mix(in srgb, var(--rc) 8%, transparent), transparent 40%), linear-gradient(165deg, rgba(40, 34, 64, 0.6), rgba(18, 18, 34, 0.8)); scroll-margin-top: calc(var(--header-height, 64px) + 12px); }
.wmh-entry:target { border-color: var(--rc); box-shadow: 0 0 0 1px var(--rc), 0 0 26px color-mix(in srgb, var(--rc) 22%, transparent); }
.wmh-entry .wm-art { flex-basis: 48px; width: 48px; height: 48px; border-radius: 10px; }
.wiki-content .wmh-entry .wm-name { margin: 0; font-size: 15.5px; }
.wmh-entry .wm-name a { color: var(--rc); }
.wmh-entry.rarity-prismatic .wm-name a { color: #effbff; text-shadow: -1px 0 #85dce3, 1px 0 #efb9e0; }
.wmh-entry .wm-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.wiki-content .wmh-entry .wm-tags { margin: 4px 0 6px; }
.wm-class-tag { display: inline-flex; align-items: center; gap: 5px; }
.wm-class-tag img { width: 16px; height: 16px; object-fit: contain; }
.wmh-line { padding: 7px 0 2px; border-top: 1px dashed var(--wx-line-2); }
.wmh-line:first-of-type { border-top: 0; padding-top: 2px; }
.wiki-content .wmh-kit { margin: 0 0 3px; color: var(--wx-teal-hi); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.wiki-content .wmh-old { margin: 0 0 3px; color: var(--wx-dim); font-size: 13px; line-height: 1.5; }
.wmh-old del { text-decoration-color: color-mix(in srgb, #ff8a8a 70%, transparent); }
.wiki-content .wmh-new { margin: 0; color: var(--wx-text); font-size: 14px; line-height: 1.55; }
.wmh-new::before { content: "→ "; color: var(--wx-teal); font-weight: 800; }
.wiki-content .wmh-note { margin: 4px 0 0; color: var(--wx-muted); font-size: 13px; font-style: italic; }
.wiki-content .wmh-note.is-removed { color: #ffb4a8; font-style: normal; }
.wiki-content .wmh-empty { margin: 12px 0 0; color: var(--wx-muted); font-size: 13px; }

/* ---- smaller screens ---- */
@media (min-width: 1229px) {
  .wm-filters { position: sticky; top: calc(var(--header-height) + 8px); z-index: 4; background: linear-gradient(160deg, rgba(46, 34, 78, 0.96), rgba(20, 20, 38, 0.97) 62%, rgba(16, 22, 34, 0.97)); }
}
@media (max-width: 900px) {
  .wm-filter-head { grid-template-columns: auto 1fr; }
  .wm-search { grid-column: 1 / -1; justify-self: stretch; width: 100%; }
}
@media (max-width: 800px) {
  /* one swipeable row of classes */
  .wm-classes { margin-inline: -22px; }
  .wm-classes ul { display: flex; gap: 8px; padding: 2px 22px 10px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent); }
  .wm-classes li { flex: 0 0 82px; scroll-snap-align: center; }
  .wm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wm-classes { margin-inline: -16px; }
  .wm-classes ul { padding-inline: 16px; }
  .wm-filters { padding: 14px; }
  .wm-filters fieldset { flex-wrap: nowrap; overflow-x: auto; margin-right: -14px; padding: 2px 14px 4px 0; scrollbar-width: none; }
  .wm-filters fieldset::-webkit-scrollbar { display: none; }
  .wm-filters legend { float: none; flex: none; }
  .wm-card { padding: 12px 12px 13px 11px; gap: 11px; }
  .wm-art { flex-basis: 52px; width: 52px; height: 52px; }
  .wmh-entry { padding: 10px 11px; gap: 10px; }
  .wmh-entry .wm-art { flex-basis: 40px; width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .wm-class, .wm-class img, .wm-card { transition: none; }
  .wm-class:hover { transform: none; }
  .wm-class:hover img { transform: none; }
}
