/* ── Word cloud container ─────────────────────────────────────────────────
 * Starts invisible; JS adds .is-cloud-ready once words are positioned.
 * contain: layout style scopes reflow/paint to this subtree only. */
.wpex-taxonomy-filter {
    position: relative !important;
    display: block !important;
    width: 100%;
    max-width: 700px;
    height: 480px;
    margin: 0 auto;
    list-style: none;
    padding: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    contain: layout style;
}

.wpex-taxonomy-filter.is-cloud-ready {
    opacity: 1;
}

/* Each li is pinned by JS (left/top); static translate centres it on that point */
.wpex-taxonomy-filter li {
    position: absolute !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translate(-50%, -50%);
}

/* Each word bobs independently; standalone translate is composited on the GPU */
.wpex-taxonomy-filter li a {
    --rotation: 0deg;
    display: inline-block;
    text-decoration: none;
    white-space: nowrap;
    transform: rotate(var(--rotation));
    scale: 1;
    will-change: translate;
    transition: scale 0.2s ease, color 0.2s ease, opacity 0.3s ease;
    animation: tagBob var(--bob-dur, 5s) var(--bob-delay, 0s) ease-in-out infinite alternate;
}

/* Stagger bob so words drift at different rhythms */
.wpex-taxonomy-filter li:nth-child(2n) a { --bob-dur: 6.5s; --bob-delay: -0.5s; }
.wpex-taxonomy-filter li:nth-child(3n) a { --bob-dur: 4.8s; --bob-delay: -1.2s; }
.wpex-taxonomy-filter li:nth-child(4n) a { --bob-dur: 7.2s; --bob-delay: -2.1s; }
.wpex-taxonomy-filter li:nth-child(5n) a { --bob-dur: 5.5s; --bob-delay: -0.8s; }

@keyframes tagBob {
    from { translate: 0 0; }
    to   { translate: 0 -8px; }
}

/* Pause bob and dim all words on container hover; highlight the one under the cursor */
.wpex-taxonomy-filter:hover li a {
    animation-play-state: paused;
    opacity: 0.2 !important;
}

.wpex-taxonomy-filter li a:hover {
    opacity: 1 !important;
    scale: 1.15;
    color: #ff5722;
}

/* Current category highlight (category-archive mode) */
.wpex-taxonomy-filter li a.is-current {
    color: #ff5722;
    font-weight: bold;
    opacity: 1 !important;
}

/* ALL button (timeline-filter mode only) */
.wpex-taxonomy-filter li a[data-value=""] {
    font-weight: bold;
    text-transform: uppercase;
    border: 1px solid #ddd;
    padding: 2px 8px;
    border-radius: 4px;
}

/* ── Toggle (standalone /wordcloud page only) ─────────────────────────────── */
.iiss-wordcloud-wrap {
    text-align: center;
}

.iiss-wordcloud-toggle {
    display: inline-flex;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.iiss-toggle-btn {
    background: none;
    border: none;
    padding: 8px 28px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    transition: background 0.2s ease, color 0.2s ease;
}

.iiss-toggle-btn.active {
    background: #333;
    color: #fff;
}

.iiss-toggle-btn:hover:not(.active) {
    background: #f5f5f5;
}

/* ── Accessibility: respect reduced-motion preference ────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .wpex-taxonomy-filter li a {
        animation: none;
        will-change: auto;
    }
}
