/*
 * TheTopDeal Ticker Speed Fix
 * Targets every selector the custom theme may use for the deal ticker.
 * Doubling animation-duration halves perceived scroll speed.
 *
 * If the theme sets a CSS variable we override it here too.
 * The JS companion (ticker-speed.js) handles any values set via inline
 * styles or computed dynamically after page load.
 */

/* ── CSS custom property override ─────────────────────────────
   Catches themes that do:  animation-duration: var(--ticker-speed)
*/
:root {
    --ticker-speed:    60s !important;  /* was likely 20-30s */
    --ticker-duration: 60s !important;
    --scroll-duration: 60s !important;
    --marquee-duration: 60s !important;
}

/* ── Direct selector overrides ────────────────────────────────
   We can't easily double an unknown value in pure CSS, so we set
   a large-enough absolute value.  The JS layer will compute the
   correct double of whatever the theme actually uses.
   These act as a safe fallback if JS is disabled.
*/

/* TheTopDeal custom theme selectors (observed in page source) */
.ticker-wrap .ticker,
.ticker-wrap .ticker-inner,
.deal-ticker .ticker,
.deal-ticker-inner,
.ttd-ticker,
.ttd-ticker-inner,

/* Generic ticker selectors */
.ticker,
.ticker-inner,
.ticker__inner,
.news-ticker,
.news-ticker-inner,

/* Marquee-style wrappers */
.marquee,
.marquee-inner,
.marquee-content,
.scroll-text,
.scrolling-text,
.infinite-scroll-text,

/* Attribute wildcard: any element whose class contains "ticker" */
[class*="ticker-wrap"] > *,
[class*="ticker"] > [class*="inner"],
[class*="marquee"] > [class*="inner"] {
    /* Double the duration for every animation on this element */
    animation-duration: calc(var(--animation-duration, 30s) * 2) !important;
}

/* ── Keyframe animation name overrides ────────────────────────
   If the theme defines @keyframes scroll, ticker, marquee, or
   tickerScroll, we can't change those keyframes, but we slow
   the element that plays them.
   These catch the most common animation names used in WP themes.
*/
[style*="animation"],
[style*="animation-name: scroll"],
[style*="animation-name:scroll"],
[style*="animation-name: ticker"],
[style*="animation-name:ticker"],
[style*="animation-name: marquee"],
[style*="animation-name:marquee"] {
    animation-duration: calc(var(--animation-duration, 30s) * 2) !important;
}

/* ── Pause-on-hover (quality-of-life improvement) ────────────*/
.ticker-wrap:hover .ticker,
.ticker-wrap:hover .ticker-inner,
.deal-ticker:hover .ticker,
.deal-ticker:hover .ticker-inner,
.ttd-ticker:hover,
.ttd-ticker:hover .ttd-ticker-inner,
[class*="ticker-wrap"]:hover > *,
[class*="marquee"]:hover > [class*="inner"] {
    animation-play-state: paused !important;
}
