/**
 * ZelloSheet News Ticker
 *
 * @package ZelloSheet
 */

.news-ticker {
    width: 100%;
    background: #FFFFFF;
    color: #202124;
    border-top: 1px solid #F3C36C;
    border-bottom: 2px solid #F3C36C;
}

.news-ticker-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.news-ticker-label {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: var(--zs-ticker-vertical-padding, 4px) 15px;
    margin-left: -1px;
    background: #FE9A01;
    color: #202124;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.news-ticker-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.news-ticker-viewport {
    width: 100%;
    overflow: hidden;
}

.news-ticker-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation: zellosheet-news-scroll var(--zellosheet-ticker-duration, 10s) linear infinite;
    will-change: transform;
}

.news-ticker-sequence {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: max-content;
}

.news-ticker-item {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: var(--zs-ticker-vertical-padding, 4px) 42px var(--zs-ticker-vertical-padding, 4px) 0;
}

.news-ticker-item a,
.news-ticker-duplicate {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #202124;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.news-ticker-item a {
    transition: color 0.2s ease;
}

.news-ticker-item a:hover {
    color: #A85B00;
}

.news-ticker-item img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 4px;
}

.news-ticker-duplicate {
    color: #202124;
}

.news-ticker-toggle {
    display: inline-flex;
    align-self: center;
    flex-shrink: 0;
    width: 34px;
    min-height: calc(
        26px + var(--zs-ticker-vertical-padding, 4px) +
        var(--zs-ticker-vertical-padding, 4px)
    );
    align-items: center;
    justify-content: center;
    padding: var(--zs-ticker-vertical-padding, 4px) 0;
    border: 1px solid #303238;
    border-radius: 4px;
    background: #FFFFFF;
    color: #202124;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.news-ticker-toggle:hover {
    background: #FFF4E0;
    border-color: #A85B00;
}

.news-ticker-toggle:focus-visible {
    outline: 2px solid #A85B00;
    outline-offset: 3px;
}

.news-ticker-toggle[hidden] {
    display: none;
}

.news-ticker-datetime {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding: var(--zs-ticker-vertical-padding, 4px) 0 var(--zs-ticker-vertical-padding, 4px) 15px;
    border-left: 1px solid #E5E7EB;
    color: #202124;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.news-ticker-time {
    color: #A85B00;
    font-weight: 700;
}

/* Pause the animation when hovered, focused or manually paused. */

.news-ticker:hover .news-ticker-track,
.news-ticker:focus-within .news-ticker-track,
.news-ticker-track.is-paused {
    animation-play-state: paused;
}

@keyframes zellosheet-news-scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* Tablet layout. */

@media (max-width: 850px) {
    .news-ticker-inner {
        gap: 10px;
    }

    .news-ticker-label {
        padding-inline: 13px;
        font-size: 11px;
    }

    .news-ticker-item {
        padding-right: 28px;
    }

    .news-ticker-datetime {
        gap: 8px;
        padding-left: 10px;
        font-size: 12px;
    }

    .news-ticker-toggle {
        width: 30px;
    }

    .news-ticker-item img {
        width: 28px;
        height: 28px;
    }
}

/* Mobile layout. */

@media (max-width: 520px) {
    .news-ticker-inner {
        width: 100%;
        flex-wrap: wrap;
        gap: 0;
    }

    .news-ticker-label {
        padding-inline: 15px;
    }

    .news-ticker-content {
        padding: 0 12px;
    }

    .news-ticker-item {
        padding-right: 30px;
    }

    .news-ticker-item a,
    .news-ticker-duplicate {
        font-size: 13px;
    }

    .news-ticker-item img {
        width: 30px;
        height: 30px;
    }

    .news-ticker-toggle {
        margin: 0 10px;
    }

    .news-ticker-datetime {
        width: 100%;
        justify-content: flex-end;
        padding: var(--zs-ticker-vertical-padding, 4px) 15px;
        border-left: 0;
        border-top: 1px solid #E5E7EB;
    }
}

/* Accessibility: respect reduced-motion preferences. */

@media (prefers-reduced-motion: reduce) {
    .news-ticker-track {
        animation: none;
        width: 100%;
        flex-wrap: wrap;
        transform: none;
    }

    .news-ticker-sequence {
        width: 100%;
        flex-wrap: wrap;
    }

    .news-ticker-sequence[aria-hidden="true"] {
        display: none;
    }

    .news-ticker-viewport {
        overflow: visible;
    }

    .news-ticker-item {
        padding-block: var(--zs-ticker-vertical-padding, 4px);
        padding-inline: 15px;
        white-space: normal;
    }
}
