/* ==========================================================================
   NEWS SECTION — Radar de Tecnologia (marquee)
   ========================================================================== */

.news-section {
    position: relative;
}

.news-section-inner {
    position: relative;
    display: flex;
    flex-direction: column;
}

.news-section--first {
    padding-top: calc(var(--header-height) + 10px);
    padding-bottom: 32px;
}

.news-section--first .news-marquee-viewport {
    margin-bottom: 18px;
}

.news-section-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
}

.news-section-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 14px;
}

.news-section-title .section-tag {
    margin-bottom: 0;
}

.news-section-title h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
    margin: 0;
}

.news-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.news-filter-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-body);
}

.news-filter-btn:hover,
.news-filter-btn.active {
    border-color: var(--border-hover);
    color: #fff;
    background: rgba(241, 163, 37, 0.12);
}

.news-marquee-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 4px 0 6px;
    border-radius: 16px;
}

.news-marquee-viewport::before,
.news-marquee-viewport::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 48px;
    z-index: 3;
    pointer-events: none;
}

.news-marquee-viewport::before {
    left: 0;
    background: linear-gradient(90deg, rgba(5, 5, 6, 0.92) 0%, transparent 100%);
}

.news-marquee-viewport::after {
    right: 0;
    background: linear-gradient(270deg, rgba(5, 5, 6, 0.92) 0%, transparent 100%);
}

.news-marquee-track {
    display: flex;
    width: max-content;
    animation: newsMarqueeScroll 75s linear infinite;
    will-change: transform;
}

.news-marquee-viewport:hover .news-marquee-track,
.news-marquee-viewport.is-paused .news-marquee-track {
    animation-play-state: paused;
}

@keyframes newsMarqueeScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.news-marquee-group {
    display: flex;
    gap: 16px;
    padding-right: 16px;
}

.news-card {
    width: 280px;
    min-height: 240px;
    flex-shrink: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow: hidden;
}

.news-thumb {
    margin: -16px -16px 2px;
    height: 130px;
    overflow: hidden;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.news-card:hover .news-thumb img {
    transform: scale(1.05);
}

.news-updated-badge {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.news-updated-badge:empty {
    display: none;
}

.news-see-all {
    color: var(--primary);
    border-color: rgba(241, 163, 37, 0.35);
    display: inline-flex;
    align-items: center;
}

.news-marquee-viewport:hover .news-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(241, 163, 37, 0.08);
    z-index: 1;
    position: relative;
}

.news-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.news-source {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 4px 10px;
    border-radius: 6px;
}

.news-source.canaltech { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.news-source.adrenaline { background: rgba(249, 115, 22, 0.14); color: #fb923c; }
.news-source.cdh { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.news-source.thn { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.news-source.bleeping { background: rgba(6, 182, 212, 0.13); color: #22d3ee; }
.news-source.tpu { background: rgba(34, 197, 94, 0.12); color: #4ade80; }

.news-lang-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.news-lang-badge.translated {
    background: rgba(241, 163, 37, 0.12);
    color: var(--primary);
}

.news-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.news-card h3 {
    font-size: 0.95rem;
    line-height: 1.35;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-original {
    font-size: 11px;
    color: rgba(156, 163, 175, 0.7);
    font-style: italic;
    border-left: 2px solid rgba(255, 255, 255, 0.08);
    padding-left: 10px;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    margin-top: auto;
}

.news-link:hover {
    color: var(--primary-hover);
}

/* Preview page extras */
.news-section--preview {
    padding-top: 24px;
}

.preview-banner {
    position: sticky;
    top: 0;
    z-index: 2000;
    background: linear-gradient(90deg, rgba(241, 163, 37, 0.15), rgba(239, 68, 68, 0.12));
    border-bottom: 1px solid rgba(241, 163, 37, 0.35);
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
}

.preview-banner strong { color: var(--primary); }
.preview-banner a { color: var(--primary-hover); text-decoration: underline; }

@media (max-width: 768px) {
    .news-section--first {
        padding-top: 28px;
        padding-bottom: 36px;
        z-index: 10;
        isolation: isolate;
        background: var(--bg-darker);
        overflow: hidden;
    }

    .news-section-inner {
        overflow: hidden;
    }

    /* Opção A: na home mobile, só Todas + Ver todas */
    .news-section--first .news-filters .news-filter-btn:not([data-filter="all"]):not(.news-see-all) {
        display: none;
    }

    .news-section--first .news-filters {
        width: auto;
        flex-wrap: wrap;
        overflow: visible;
        mask-image: none;
        -webkit-mask-image: none;
        gap: 8px;
    }

    /* Título e filtros acima dos cards no mobile */
    .news-section-bar {
        order: 1;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 12px;
    }

    .news-section--first .news-marquee-viewport {
        order: 2;
        margin-bottom: 0;
    }

    .news-section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .news-section-title h2 {
        font-size: clamp(1.1rem, 4vw, 1.25rem);
    }

    .news-filter-btn {
        flex-shrink: 0;
        font-size: 12px;
        padding: 7px 14px;
        white-space: nowrap;
    }

    /* Mobile: swipe manual */
    .news-marquee-viewport {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
        touch-action: pan-x;
        min-height: 200px;
    }

    .news-marquee-viewport::-webkit-scrollbar {
        display: none;
    }

    .news-marquee-track {
        animation: none !important;
    }

    .news-marquee-group:last-child {
        display: none;
    }

    .news-card {
        scroll-snap-align: center;
        width: min(268px, calc(100vw - 72px));
        min-height: 200px;
        padding: 14px;
    }

    .news-thumb {
        margin: -14px -14px 2px;
        height: 104px;
    }

    .news-card h3 {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }

    .news-card p {
        font-size: 11px;
        -webkit-line-clamp: 2;
    }

    .news-original {
        display: none;
    }

    .news-lang-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .news-link {
        font-size: 12px;
    }

    .news-marquee-viewport::before,
    .news-marquee-viewport::after {
        width: 16px;
    }

    .news-marquee-viewport:hover .news-card:hover {
        transform: none;
        box-shadow: none;
    }

    .news-card:active {
        border-color: var(--border-hover);
        transform: scale(0.98);
    }

    .news-marquee-viewport.is-loading {
        opacity: 0.72;
        pointer-events: none;
    }

    .news-empty-msg {
        color: var(--text-secondary);
        font-size: 14px;
        padding: 24px 8px;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .news-section--first {
        padding-bottom: 32px;
    }

    .news-card {
        width: min(252px, calc(100vw - 56px));
        min-height: 196px;
    }

    .news-source {
        font-size: 10px;
        padding: 3px 8px;
    }

    .news-marquee-group {
        gap: 12px;
        padding-right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-marquee-viewport {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 16px;
    }

    .news-marquee-viewport::before,
    .news-marquee-viewport::after {
        display: none;
    }

    .news-marquee-track {
        animation: none;
    }

    .news-marquee-group:last-child {
        display: none;
    }

    .news-card {
        scroll-snap-align: start;
    }
}
