/* Publicidad — Villa Mantero Noticias v1.0
   Usa las mismas medidas (bordes, sombras, tipografías) que las tarjetas .noticia */

.ad-card {
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.ad-label {
    display: block;
    padding: 5px 12px 4px;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
    line-height: 1.2;
}

.ad-link { display: block; text-decoration: none; }

.ad-media {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    background: #f1f5f9;
}

/* ---------- Banner superior (portada) ----------
   Piezas: escritorio 1200x250 · celular 960x300 */
.ad-top { margin: 0 0 20px; }
.ad-top .ad-media { aspect-ratio: 1200 / 250; }

/* ---------- Tarjeta dentro de la grilla ----------
   Pieza cuadrada 1080x1080 (la misma que usás en Instagram/Canva) */
.ad-infeed { display: flex; flex-direction: column; }
.ad-infeed .ad-link { flex: 1; }
.ad-infeed .ad-media { aspect-ratio: 1 / 1; height: 100%; }

/* Noticias que se retiran para que la publicidad no agrande la grilla */
.ad-trim { display: none !important; }

/* ---------- Dentro de la nota ---------- */
.ad-slot { margin: 24px 0; }
.ad-slot:empty { display: none; }
.ad-nota { max-width: 460px; margin: 26px auto; }
.ad-nota .ad-media { aspect-ratio: 1 / 1; }

/* ---------- Popup ---------- */
.ad-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;            /* por encima del header (1000) y del menú lateral (998/999) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(3, 13, 24, 0.62);
    opacity: 0;
    transition: opacity .25s ease;
}
.ad-popup.visible { opacity: 1; }

.ad-popup-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
    transform: translateY(10px) scale(.98);
    transition: transform .25s ease;
}
.ad-popup.visible .ad-popup-box { transform: none; }

.ad-popup-box .ad-label { padding-right: 56px; }
.ad-popup-box .ad-media { max-height: calc(88vh - 60px); object-fit: contain; background: #fff; }

.ad-popup-close {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 2;
    width: 44px;                /* objetivo táctil cómodo */
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}
.ad-popup-close:hover,
.ad-popup-close:focus-visible { background: #0f172a; outline: 2px solid #3695D3; outline-offset: 2px; }

.ad-popup-timer {
    display: block;
    padding: 6px 12px 8px;
    font-size: .75rem;
    color: #64748b;
    text-align: center;
}

@media (max-width: 768px) {
    .ad-top .ad-media { aspect-ratio: 960 / 300; }
    .ad-top { margin-bottom: 16px; }
    .ad-slot { margin: 18px 0; }
    .ad-popup { padding: 12px; }
    .ad-popup-box { max-width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
    .ad-popup, .ad-popup-box { transition: none; }
}
