/*
 * Media Stats Updater — source chips for the merged sites charts.
 *
 * Enqueued on both templates when "Combine local and international sites" is
 * on. Plain CSS, not Tailwind: the theme compiles Tailwind at build time, so the
 * cards template cannot gain new utilities without a theme rebuild. Colours
 * are the theme's daisyUI tokens, with fallbacks for a theme that lacks them.
 *
 * Selectors are doubled (.osu-sites-chips .osu-sites-chip) to outrank the
 * theme's own button rules without reaching for !important.
 */

.osu-sites-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 4px;
}

/* No chips were built (nothing to filter, or the script failed): no gap. */
.osu-sites-chips:empty { display: none; }

.osu-sites-chips .osu-sites-chip,
.osu-sites-chips .osu-sites-reset {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid oklch(var(--bc, 93.8% 0.019 299) / 0.18);
    border-radius: 999px;
    background: oklch(var(--b1, 15% 0.03 300) / 0.6);
    color: oklch(var(--bc, 93.8% 0.019 299) / 0.85);
    font-family: var(--osu-mono, "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace);
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: none;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

.osu-sites-chips .osu-sites-chip[hidden],
.osu-sites-chips .osu-sites-reset[hidden] { display: none; }

.osu-sites-chips .osu-sites-chip:hover {
    border-color: oklch(var(--bc, 93.8% 0.019 299) / 0.4);
}

.osu-sites-chips .osu-sites-chip:focus-visible,
.osu-sites-chips .osu-sites-reset:focus-visible {
    outline: 2px solid oklch(var(--a, 77.7% 0.152 181.9));
    outline-offset: 2px;
}

.osu-sites-chip__value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: oklch(var(--bc, 93.8% 0.019 299));
}

/* Selected: the filtered colour, the same one the chart switches to. The
   script sets --osu-sites-filtered per chip row from the chart's own colour. */
.osu-sites-chips .osu-sites-chip.is-active {
    border-color: var(--osu-sites-filtered, oklch(var(--a, 77.7% 0.152 181.9)));
    background: color-mix(in oklch, var(--osu-sites-filtered, oklch(var(--a, 77.7% 0.152 181.9))) 16%, transparent);
    color: oklch(var(--bc, 93.8% 0.019 299));
}

/* Not selected while a filter is on: still clickable, visibly out. */
.osu-sites-chips .osu-sites-chip.is-dimmed { opacity: 0.55; }

.osu-sites-chips .osu-sites-chip--more {
    border-style: dashed;
}

.osu-sites-chips .osu-sites-reset {
    border-color: transparent;
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The cards template's chart holder; panels has .osu-panels__chart. */
.osu-sites-chart {
    position: relative;
    height: 240px;
}

/* An empty selection, said over the chart rather than as a flat zero line. */
.osu-sites-note {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 16px;
    text-align: center;
    font-family: var(--osu-mono, "JetBrains Mono", ui-monospace, monospace);
    font-size: 12px;
    color: oklch(var(--bc, 93.8% 0.019 299) / 0.7);
    pointer-events: none;
}

.osu-sites-note[hidden] { display: none; }

.osu-sites-total__mark {
    font-size: 0.6em;
    font-weight: 400;
    opacity: 0.8;
}
