/**
 * Breaking News Ticker Animation
 * Replaces deprecated <marquee> tag with CSS keyframe animation
 */

/* Breaking news container */
#kp-breaking-news {
    position: relative;
}

/* Breaking news content animation */
.kp-breaking-ticker-animation {
    width: 100%;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.kp-breaking-ticker-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 25%,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.05) 30%
    );
    animation: breaking-news-stripes 4s linear infinite;
}

@keyframes breaking-news-stripes {
    0% { background-position: 0 0; }
    100% { background-position: -100% 0; }
}

/* Breaking news items */
.breaking-news-item a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breaking-news-item a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Focus styles for accessibility */
#kp-breaking-news:focus-within .breaking-news-item,
#kp-trending-topics:focus-within span {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only,
.sr-only-focusable {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus:not-sr-only {
    position: fixed !important;
    top: 5px;
    left: 5px;
    z-index: 10000;
    background: #d90000;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 1rem;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .kp-breaking-ticker-animation::before {
        animation: none;
    }

    .breaking-news-item a {
        transition: none;
    }

    #kp-social-icons a {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    #kp-breaking-news {
        border-top: 4px solid white;
        border-bottom: 4px solid white;
    }

    .breaking-news-item a:hover {
        color: yellow;
    }
}

/* Focus visible for keyboard navigation */
.breaking-news-item a:focus,
#kp-trending-topics a:focus,
#kp-social-icons a:focus {
    outline: 3px solid #f97316;
    outline-offset: 2px;
}

/* Skip link styling */
.sr-only:not(:focus):not(:active) {
    position: absolute !important;
    height: 1px !important;
    width: 1px !important;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
