/* ============================================================
   TuVes.pe - Custom CSS (complementa Tailwind)
   ============================================================ */

/* -- Reset & Base ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Quitar subrayado global en anchors dentro del layout */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
a.no-underline:hover { text-decoration: none; }

/* -- Colores custom para categorías ------------------------- */
:root {
    --cat-politica:        #dc2626;
    --cat-deportes:        #16a34a;
    --cat-novelas:         #7c3aed;
    --cat-farandula:       #ea580c;
    --cat-tecnologia:      #2563eb;
    --cat-internacional:   #374151;
    --cat-economia:        #15803d;
    --cat-entretenimiento: #c2410c;
}

/* -- Breaking News Marquee ---------------------------------- */
.breaking-news-bar {
    position: relative;
    z-index: 60;
}

.marquee-wrapper {
    overflow: hidden;
    flex: 1;
}

.marquee-track {
    display: inline-block;
    white-space: nowrap;
    animation: marquee-scroll 40s linear infinite;
}

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

@keyframes marquee-scroll {
    0%   { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* -- Scroll progress bar de lectura ------------------------ */
.read-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #dc2626, #ea580c);
    z-index: 9999;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

/* -- TTS Player --------------------------------------------- */
.tts-btn {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.tts-progress {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Párrafo siendo leído - resaltado */
.tts-highlight {
    background-color: rgba(220, 38, 38, 0.08);
    border-radius: 4px;
    outline: 2px solid rgba(220, 38, 38, 0.2);
    transition: background-color 0.3s ease;
}

/* -- Cards - Hover effects ---------------------------------- */
.news-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.10);
}

/* -- Artículo - Tipografía de contenido --------------------- */
.article-content {
    font-family: 'Merriweather', ui-serif, Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.85;
    color: #1f2937;
}

.article-content p {
    margin-bottom: 1.4em;
}

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 900;
    margin-top: 2em;
    margin-bottom: 0.6em;
    color: #111827;
    line-height: 1.3;
}

.article-content h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #1f2937;
}

.article-content a {
    color: #dc2626;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.article-content a:hover {
    color: #b91c1c;
}

.article-content ul,
.article-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.2em;
}

.article-content li {
    margin-bottom: 0.4em;
}

.article-content blockquote {
    border-left: 4px solid #dc2626;
    padding-left: 1em;
    font-style: italic;
    color: #6b7280;
    margin: 1.5em 0;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em auto;
    display: block;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.9rem;
}

.article-content th,
.article-content td {
    border: 1px solid #e5e7eb;
    padding: 0.5em 0.75em;
    text-align: left;
}

.article-content th {
    background: #f9fafb;
    font-weight: 700;
}

.article-content strong {
    font-weight: 800;
    color: #111827;
}

/* -- Resumen artículo (blockquote) -------------------------- */
.article-summary {
    font-family: 'Merriweather', serif;
}

/* -- Búsqueda - highlight ----------------------------------- */
mark.search-highlight {
    background-color: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    font-style: normal;
}

/* -- Skeleton loading --------------------------------------- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -- Lazy loading images ------------------------------------ */
.lazy-img {
    /* Visible por defecto; sólo se oculta durante carga de data-src */
    opacity: 1;
    transition: opacity 0.4s ease;
}

.lazy-img.lazy-loading {
    opacity: 0;
}

.lazy-img.lazy-loaded {
    opacity: 1;
}

/* -- Paginación --------------------------------------------- */
.pagination-btn {
    transition: all 0.15s ease;
}

/* -- Share buttons ------------------------------------------ */
.share-btn {
    transition: all 0.15s ease;
    cursor: pointer;
}

/* -- Responsive ajustes ------------------------------------- */
@media (max-width: 640px) {
    .article-content {
        font-size: 0.97rem;
        line-height: 1.75;
    }

    .article-content h2 {
        font-size: 1.25rem;
    }

    .article-content h3 {
        font-size: 1.1rem;
    }
}

/* -- Scrollbar oculto (para nav horizontal) ---------------- */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* -- Line clamp cross-browser ------------------------------- */
.line-clamp-1 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.line-clamp-2 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.line-clamp-3 { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* -- AdSense banners placeholder --------------------------- */
.adsense-banner {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* -- Animaciones de categoría badge ------------------------ */
@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}

/* -- Nav categorias (color dinamico via --cat-color de BD) -- */
.tv-cat-link {
    display:inline-flex;align-items:center;padding:0 14px;height:42px;
    color:#d1d5db;font-size:.8125rem;font-weight:600;white-space:nowrap;
    border-bottom:3px solid var(--cat-color,#9ca3af);
    transition:background-color .15s,color .15s;
    text-decoration:none;
}
.tv-cat-link:hover {
    background-color:var(--cat-color,#9ca3af);
    color:#fff;
}
.tv-cat-active {
    background-color:var(--cat-color,#9ca3af) !important;
    color:#fff !important;
}
.tv-top-link {
    display:inline-flex;align-items:center;gap:5px;padding:0 12px;height:42px;
    color:#9ca3af;font-size:.8125rem;font-weight:600;white-space:nowrap;
    transition:color .15s;text-decoration:none;
}
.tv-top-link:hover { color:#fff; }
