/**
 * Hello Middleton - News Ticker Component
 * Breaking news ticker with smooth scroll animation
 * Mobile-optimized with touch-friendly interactions
 *
 * @requires tokens.css
 * @since 2.1.4
 */

/* ==========================================================================
   BASE TICKER STRUCTURE
   ========================================================================== */

.hm-ticker-wrap {
    display: flex;
    align-items: stretch;
    background: linear-gradient(135deg, #78350F 0%, #92400E 50%, #B45309 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(120, 53, 15, 0.2);
    margin-bottom: var(--space-4);
    /* Container width constraints */
    max-width: 1600px;
    width: 95%;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   TICKER LABEL (BREAKING badge)
   ========================================================================== */

.hm-ticker-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: rgba(0, 0, 0, 0.2);
    color: #FEF3C7;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.hm-ticker-icon {
    font-size: 1rem;
    animation: ticker-pulse 1.5s ease-in-out infinite;
}

@keyframes ticker-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* ==========================================================================
   TICKER CONTENT & TRACK (Scrolling area)
   ========================================================================== */

.hm-ticker-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    /* Fade edges for smooth visual */
    mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
}

.hm-ticker-track {
    display: flex;
    gap: var(--space-6);
    animation: ticker-scroll 60s linear infinite;
    width: max-content;
}

.hm-ticker-track:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ==========================================================================
   TICKER ITEMS (Individual news links)
   ========================================================================== */

.hm-ticker-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    color: #FFFBEB;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--duration-fast) var(--ease-out);
}

.hm-ticker-item:hover {
    color: #FEF3C7;
    text-shadow: 0 0 20px rgba(254, 243, 199, 0.5);
    opacity: 0.9;
}

.hm-ticker-source {
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    font-size: 0.6rem;
    font-weight: 500;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: #FDE68A;
    letter-spacing: 0.02em;
}

.hm-ticker-title {
    font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ==========================================================================
   RESPONSIVE - TABLET (max-width: 992px)
   ========================================================================== */

@media (max-width: 992px) {
    .hm-ticker-wrap {
        width: 100%;
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ==========================================================================
   RESPONSIVE - MOBILE (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .hm-ticker-wrap {
        border-radius: var(--radius-md);
        margin: 12px;
        width: calc(100% - 24px);
    }

    .hm-ticker-label {
        padding: var(--space-2) var(--space-3);
        font-size: 0.65rem;
    }

    /* Hide "BREAKING" text on mobile, keep icon */
    .hm-ticker-text {
        display: none;
    }

    .hm-ticker-track {
        animation-duration: 50s; /* Slower on mobile for readability */
    }

    .hm-ticker-item {
        padding: 10px 0;
        min-height: 44px; /* Touch-friendly target */
    }

    .hm-ticker-title {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .hm-ticker-source {
        font-size: 0.6rem;
        padding: 4px 8px;
    }
}

/* ==========================================================================
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ========================================================================== */

@media (max-width: 480px) {
    .hm-ticker-wrap {
        padding: 10px 16px;
        margin: 8px;
        width: calc(100% - 16px);
        background: var(--hm-bg-elevated, #fff);
    }

    .hm-ticker-label {
        font-size: 0.65rem;
        padding: 4px 10px;
        border-radius: 4px;
    }

    .hm-ticker-item {
        font-size: 0.8rem;
    }

    .hm-ticker-title {
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   ACCESSIBILITY - REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .hm-ticker-track {
        animation: none;
    }

    .hm-ticker-icon {
        animation: none;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .hm-ticker-wrap {
        display: none;
    }
}
