/**
 * Antigravity Editorial & Discover Gatekeeper — hoja de estilos consolidada.
 *
 * Hasta la v2.10.0, este CSS se imprimía en 3 bloques <style> separados,
 * inline, en cada carga de página (content-components.php, trending-ticker.php,
 * sticky-share-bar.php): ~100 KB de HTML repetidos idénticos en TODAS las
 * noticias del sitio, sin ningún beneficio de caché entre pageviews. Un
 * lector de un medio de noticias ve muchos artículos por sesión, así que
 * repetir el mismo CSS en cada uno solo añade peso de página y tiempo de
 * parseo sin aportar nada.
 *
 * Desde la v2.11.0 se sirve como un único archivo externo, cacheable por el
 * navegador/CDN (con cache-busting vía el número de versión del plugin en la
 * query string), en vez de repetirse en cada respuesta HTML. El contenido y
 * los selectores son EXACTAMENTE los mismos de antes — cero cambios visuales
 * o de comportamiento — solo cambia el mecanismo de entrega.
 *
 * @package Antigravity Editorial Gatekeeper
 * @since 2.11.0
 */

/* =======================================================
   1. CAJA DE COMUNIDAD WHATSAPP DE NOTICIAS DE ÚLTIMA HORA
   ======================================================= */
.agy-wa-box {
    margin: 24px 0;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1px solid #bbf7d0;
    border-left: 5px solid #22c55e;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    min-height: 84px; /* Reserva de espacio anti-CLS */
}
.agy-wa-content {
    display: flex;
    align-items: center;
    gap: 12px;
}
.agy-wa-icon {
    width: 40px;
    height: 40px;
    background: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
}
.agy-wa-icon svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}
.agy-wa-text strong {
    display: block;
    color: #0f172a;
    font-size: 14.5px;
    line-height: 1.3;
    margin-bottom: 3px;
    font-weight: 700;
}
.agy-wa-text span {
    display: block;
    color: #475569;
    font-size: 12.5px;
    line-height: 1.35;
}
.agy-wa-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.agy-wa-btn-join {
    background: #22c55e;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 12.5px;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
    transition: transform 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}
.agy-wa-btn-join:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(34, 197, 94, 0.4);
}
.agy-wa-btn-share {
    background: #f1f5f9;
    color: #334155 !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 12px;
    padding: 7px 12px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}
.agy-wa-btn-share:hover {
    background: #e2e8f0;
    color: #0f172a !important;
}
.agy-google-btn {
    background: #ffffff;
    color: #1f2937 !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 12px;
    padding: 7px 13px;
    border-radius: 20px;
    border: 1px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}
.agy-google-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    color: #111827 !important;
}
.agy-google-btn:focus-visible,
.agy-wa-btn-join:focus-visible,
.agy-wa-btn-share:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.agy-google-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .agy-wa-box {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
    }
    .agy-wa-actions {
        width: 100%;
        margin-top: 4px;
        flex-wrap: wrap;
    }
    .agy-wa-btn-join, .agy-google-btn, .agy-wa-btn-share {
        flex: 1;
        justify-content: center;
        text-align: center;
    }
}

/* =======================================================
   2. INSIGNIA DE LECTURA, AUDIO TTS, ACTUALIZACIÓN Y BAJADA
   ======================================================= */
.agy-lead-deck {
    font-size: 18.5px !important;
    font-weight: 500 !important;
    line-height: 1.45 !important;
    color: #475569 !important;
    margin: 0 0 16px 0 !important;
    border: none !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.agy-reading-badge {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12.5px;
    color: #64748b;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    min-height: 36px;
}
.agy-rb-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #334155;
}
.agy-rb-time svg {
    width: 15px;
    height: 15px;
    fill: #64748b;
}
.agy-rb-audio {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 700;
    color: #065f46;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.2s ease, background 0.2s ease;
}
.agy-rb-audio:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #047857;
}
.agy-rb-audio.playing {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    animation: agy-audio-pulse 1.6s infinite;
}
.agy-rb-audio svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}
@keyframes agy-audio-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.97); }
}
.agy-rb-updated {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}
.agy-rb-updated svg {
    width: 12px;
    height: 12px;
    fill: #64748b;
}
.agy-rb-copy {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s ease;
    margin-left: auto;
}
.agy-rb-copy:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
}
.agy-rb-copy:focus-visible,
.agy-rb-audio:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.agy-rb-copy svg {
    width: 13px;
    height: 13px;
    fill: #475569;
}

/* =======================================================
   3. CAJA DE PUNTOS CLAVE / EN SÍNTESIS (RPP / CNN)
   Soporta .agy-key-points (automático) y .agy-editorial-keypoints (pipeline)
   ======================================================= */
.agy-key-points,
.agy-editorial-keypoints {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 18px 0 24px 0;
    box-sizing: border-box;
    min-height: 80px; /* Reserva de espacio anti-CLS */
}
.agy-kp-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
}
.agy-kp-icon {
    font-size: 15px;
}
.agy-kp-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #1e3a8a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.agy-kp-list,
.agy-editorial-keypoints ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}
.agy-kp-list li,
.agy-editorial-keypoints ul li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.agy-kp-list li:last-child,
.agy-editorial-keypoints ul li:last-child {
    margin-bottom: 0;
}
.agy-kp-list li::before,
.agy-editorial-keypoints ul li::before {
    content: "•";
    position: absolute;
    left: 2px;
    top: -1px;
    color: #2563eb;
    font-size: 18px;
    font-weight: 900;
}

/* =======================================================
   4. CAJA "LEA TAMBIÉN" (IN-ARTICLE RELATED POST)
   ======================================================= */
.agy-lt-box {
    margin: 26px 0;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    transition: transform 0.2s ease, background 0.2s ease;
}
.agy-lt-box:hover {
    background: #f1f5f9;
    border-left-color: #1d4ed8;
    transform: translateX(3px);
}
.agy-lt-tag {
    background: #2563eb;
    color: #ffffff !important;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}
.agy-lt-link {
    color: #0f172a !important;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none !important;
}
.agy-lt-link:hover {
    color: #2563eb !important;
    text-decoration: underline !important;
}
@media (max-width: 768px) {
    .agy-lt-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px 14px;
        margin: 20px 0;
    }
    .agy-lt-link {
        font-size: 14px;
    }
}

/* =======================================================
   5. CHIPS DE TEMAS RELACIONADOS (PRIMICIAS / EL UNIVERSO)
   ======================================================= */
.agy-topic-chips {
    margin: 28px 0 20px 0;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.agy-tc-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.agy-tc-label svg {
    width: 13px;
    height: 13px;
    fill: #64748b;
}
.agy-tc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.agy-tc-pill {
    background: #f1f5f9;
    color: #1e293b !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, background 0.2s ease;
    display: inline-block;
}
.agy-tc-pill:hover {
    background: #2563eb;
    color: #ffffff !important;
    border-color: #2563eb;
    transform: translateY(-1px);
}

/* =======================================================
   6. CONTENEDORES PUBLICITARIOS Y ANTI-CLS ADSENSE
   ======================================================= */
.agy-inarticle-ad {
    margin: 24px auto;
    text-align: center;
    clear: both;
    max-width: 100%;
    overflow: hidden;
}
.agy-ad-label {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
ins.adsbygoogle[data-ad-status="unfilled"] {
    display: none !important;
}
.agy-inarticle-ad:has(> ins.adsbygoogle[data-ad-status="unfilled"]) {
    display: none !important;
}

/* =======================================================
   7. TENDENCIAS BAR (ESTILO MODERNO PRENSA DIGITAL)
   ======================================================= */
#agy-trending-bar-wrap {
    width: 100%;
    background: #090d16;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 6px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    box-sizing: border-box;
    display: none; /* Se activa vía JS */
    z-index: 99;
    position: relative;
}
.agy-trending-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.agy-trending-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fbbf24;
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
    padding-right: 12px;
    border-right: 1px solid rgba(255,255,255,0.15);
    margin-right: 12px;
    flex-shrink: 0;
}
.agy-trending-pulse {
    width: 7px;
    height: 7px;
    background: #ef4444;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: agyPulseAnim 1.8s infinite;
}
@keyframes agyPulseAnim {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.agy-trending-items {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.agy-trending-items::-webkit-scrollbar {
    display: none;
}
.agy-trending-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e2e8f0 !important;
    text-decoration: none !important;
    padding: 4px 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}
.agy-trending-pill .agy-pill-icon {
    font-size: 11px;
    color: #fbbf24;
    transition: transform 0.2s ease, color 0.2s ease;
}
.agy-trending-pill:hover .agy-pill-icon {
    transform: scale(1.15);
    color: #ffffff;
}
.agy-trending-pill:hover {
    color: #ffffff !important;
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
}

/* =======================================================
   8. BARRA FLOTANTE MÓVIL DE COMPARTIR Y TOAST NOTIFICATION
   ======================================================= */
:root {
    --agy-bottom-offset: 0px;
}
#agy-mobile-share-bar {
    display: none;
}
@media (max-width: 768px) {
    #agy-mobile-share-bar {
        display: flex !important;
        position: fixed;
        bottom: var(--agy-bottom-offset, 0px);
        left: 0;
        right: 0;
        min-height: 52px;
        height: auto;
        background: rgba(15, 23, 42, 0.96);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        z-index: 9999;
        align-items: center;
        justify-content: space-around;
        padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
        box-sizing: border-box;
        transition: transform 0.25s ease;
    }
    .agy-ms-label {
        color: #94a3b8;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 2px;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        display: none;
    }
    @media (min-width: 420px) {
        .agy-ms-label {
            display: inline-block;
        }
    }
    .agy-ms-btn {
        width: 38px;
        height: 38px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none !important;
        border: none;
        cursor: pointer;
        transition: transform 0.15s ease, background-color 0.2s ease;
        padding: 0;
        color: #ffffff !important;
        -webkit-tap-highlight-color: transparent;
    }
    .agy-ms-btn:focus-visible {
        outline: 2px solid #38bdf8;
        outline-offset: 2px;
    }
    .agy-ms-btn:active {
        transform: scale(0.92);
    }
    .agy-ms-btn svg {
        width: 19px;
        height: 19px;
        fill: #ffffff;
        pointer-events: none;
    }
    .agy-ms-wa { background: #22c55e; }
    .agy-ms-wa:hover { background: #16a34a; }
    .agy-ms-fb { background: #1877f2; }
    .agy-ms-fb:hover { background: #166fe5; }
    .agy-ms-x  { background: #000000; border: 1px solid rgba(255,255,255,0.25); }
    .agy-ms-x:hover  { background: #1a1a1a; }
    .agy-ms-tg { background: #0284c7; }
    .agy-ms-tg:hover { background: #0369a1; }
    .agy-ms-li { background: #0a66c2; }
    .agy-ms-li:hover { background: #084e96; }
    .agy-ms-share { background: #7c3aed; }
    .agy-ms-share:hover { background: #6d28d9; }
    .agy-ms-copy { background: #475569; }
    .agy-ms-copy:hover { background: #334155; }
    body.single-post, body.single {
        padding-bottom: calc(60px + var(--agy-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    }
}

#agy-copy-toast {
    visibility: hidden;
    min-width: 240px;
    background-color: #0f172a;
    color: #f8fafc;
    text-align: center;
    border-radius: 20px;
    border: 1px solid #334155;
    padding: 10px 18px;
    position: fixed;
    z-index: 1000000;
    left: 50%;
    bottom: 70px;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#agy-copy-toast.show {
    visibility: visible;
    opacity: 1;
}
