/*
Theme Name: JD Video Theme Inline V4
Theme URI: https://example.com/
Description: Versión independiente con reproductor móvil integrado sin controles nativos ni pantalla completa.
Version: 4.1.0
Text Domain: jd-video-inline-v4
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1e1e1e;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* === Header Moderno (VideoSphere style) === */
.site-header {
    background-color: #121212;
    padding: 10px 0;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 999;
}

.site-header .container {
    max-width: 1550px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
}

.site-title a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* === Menú de navegación === */
.main-navigation {
    display: flex;
    align-items: center;
}

.menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px;
}

.menu li a {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9em;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #0073aa;
}

/* === Contenedor del contenido === */
.content-container {
    max-width: 1550px;
    margin: 30px auto;
    padding: 0 20px;
}

.content-container h1 {
    font-size: 2.2em;
    margin-bottom: 20px;
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* === Cuadrícula de posts === */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

.post-card {
    background-color: #2d2d2d;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #333;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.post-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.post-title {
    padding: 12px 15px;
    font-size: 1em;
    font-weight: 500;
    color: #ffffff;
    text-align: left;
    border-top: 1px solid #333;
}

/* === Responsive ajustes === */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 12px;
    }

    .main-navigation {
        width: 100%;
        justify-content: center;
    }

    .menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .content-container {
        margin: 25px auto;
        padding: 0 15px;
    }

    .content-container h1 {
        font-size: 2em;
    }

    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 480px) {
    .post-image {
        height: 180px;
    }

    .post-title {
        font-size: 0.95em;
        padding: 10px;
    }
}

/* === Single Post === */
.single-post .post-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.single-post .post-header h1 {
    font-size: 2em;
    color: #ffffff;
    margin: 0;
}

.single-post .post-meta {
    font-size: 0.9em;
    color: #aaa;
    margin-top: 5px;
}

.single-post .post-content {
    margin: 20px 0;
    line-height: 1.6;
}

/* === Reproductor de video actualizado === */
.video-player-wrapper {
    position: relative;
    margin: 25px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16 / 9;
    padding: 0;
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-player-wrapper video {
    width: 100%;
    max-width: none;
    height: 100%;
    display: block;
    border-radius: 0;
    box-shadow: none;
    object-fit: contain;
    object-position: center;
    background-color: #000;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 20;
    width: clamp(190px, 60%, 500px);
    height: auto;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent url("play-button-blue.png") center / contain no-repeat;
    cursor: pointer;
    transform: translate(-50%, -50%);
    box-shadow: none;
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.44));
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.video-play-overlay span {
    display: none;
}

.video-play-overlay:hover {
    transform: translate(-50%, -50%) scale(1.04);
}

.video-play-overlay:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 6px;
}

.video-player-wrapper.is-playing .video-play-overlay {
    opacity: 0;
    pointer-events: none;
}

/* === Overlay de anuncios (nuevo código) === */
.video-ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.25); /* transparente como el ejemplo */
    z-index: 10;
    pointer-events: none; /* permite seguir usando los controles del video */
}

.video-ad-overlay script {
    pointer-events: auto; /* el script aún puede funcionar si genera clics */
}

/* === Responsive video === */
@media (max-width: 768px) {
    .video-player-wrapper {
        margin: 18px 0 24px;
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 0;
        max-height: 58vh;
        aspect-ratio: 16 / 9;
        padding: 0;
        border-radius: 8px;
    }

    .video-player-wrapper video {
        width: 100%;
        height: 100%;
        max-height: 58vh;
        object-fit: contain;
    }

    .video-play-overlay {
        width: clamp(120px, 42%, 240px);
    }
}

@media (max-width: 420px) {
    .video-player-wrapper,
    .video-player-wrapper video {
        max-height: 52vh;
    }
}

/* === Contenido de single post === */
.post-content-wrapper {
    max-width: 600px;
    margin: 20px auto;
    padding: 0 15px;
}

.post-content-wrapper .post-title {
    font-size: 2em;
    margin: 20px 0 10px;
    color: #ffffff;
    font-weight: 600;
}

.post-content-wrapper .post-meta {
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 20px;
}

.post-content-wrapper .post-content {
    margin: 20px 0;
    line-height: 1.6;
    color: #ffffff;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
}

@media (max-width: 768px) {
    .post-content-wrapper {
        max-width: 100%;
        padding: 0 10px;
    }

    .post-content-wrapper .post-title {
        font-size: 1.8em;
    }
}

@media (max-width: 480px) {
    .post-content-wrapper .post-title {
        font-size: 1.6em;
    }
}

/* === Botón de Telegram === */
.telegram-button-wrapper {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.telegram-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #2481c8, #1b6fae);
    color: #ffffff;
    text-decoration: none;
    padding: 12px 26px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.telegram-button:hover {
    background: linear-gradient(135deg, #2b8fd7, #237abf);
    transform: translateY(-1px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
}

.telegram-icon img {
    width: 28px;
    height: 28px;
    margin-right: 6px;
    vertical-align: middle;
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.2));
    transition: transform 0.3s ease;
}

.telegram-button:hover .telegram-icon img {
    transform: scale(1.05) rotate(4deg);
}

.video-social-preview {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* === Diseño editorial renovado === */
.single-layout {
    width: min(100% - 28px, 920px);
    margin: 42px auto 70px;
}

.article-card {
    background: #ffffff;
    color: #202124;
    border-radius: 18px;
    padding: clamp(22px, 4vw, 52px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.article-header {
    max-width: 760px;
    margin: 0 auto 30px;
}

.article-category {
    margin-bottom: 10px;
    color: #1769aa;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.article-category a { color: inherit; text-decoration: none; }

.article-title,
.article-card .post-title {
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    color: #16181d;
    font-size: clamp(2rem, 5vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: -.035em;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #70757a;
    font-size: .92rem;
}

.article-featured-image,
.article-featured-image img {
    width: 100%;
    margin: 0;
}

.article-featured-image img {
    display: block;
    height: auto;
    max-height: 560px;
    object-fit: cover;
    border-radius: 14px;
}

.article-content {
    max-width: 740px;
    margin: 34px auto 0;
    color: #2c3038;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.08rem, 2vw, 1.18rem);
    line-height: 1.82;
    word-break: normal;
    overflow-wrap: anywhere;
}

.article-content p {
    margin: 0 0 1.45em !important;
}

.article-content p:empty { display: none; }
.article-content h2,
.article-content h3,
.article-content h4 {
    color: #17191f;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    line-height: 1.25;
    margin: 1.8em 0 .7em;
}
.article-content h2 { font-size: 1.75em; }
.article-content h3 { font-size: 1.4em; }
.article-content ul,
.article-content ol { margin: 0 0 1.5em 1.4em; }
.article-content li { margin-bottom: .55em; }
.article-content img { max-width: 100%; height: auto; border-radius: 10px; }
.article-content a { color: #0b63ce; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-content blockquote {
    margin: 1.6em 0;
    padding: 1em 1.3em;
    border-left: 4px solid #0b63ce;
    background: #f3f6fb;
    color: #3c4452;
}

.article-ad {
    width: 100%;
    max-width: 760px;
    min-height: 0;
    margin: 30px auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
    text-align: center;
    transition: opacity .18s ease;
}
.article-ad-content { width: 100%; min-height: 0; }
.article-ad-content iframe,
.article-ad-content img,
.article-ad-content video,
.article-ad-content object,
.article-ad-content embed { max-width: 100%; }
.article-ad-content ins { margin-inline: auto; }
.article-ad[class*="article-ad-inside_"] { margin-top: 2.1em; margin-bottom: 2.1em; }

/* Compatibilidad publicitaria: no se ocultan ni se redimensionan los
   contenedores generados por redes externas. Algunas plataformas, como Adskeeper,
   necesitan conservar el tamaño inicial para poder renderizar el widget. */
.article-ad-content [data-type="_mgwidget"] { width: 100%; }
.article-ad-content iframe { border: 0; }

.article-card .video-player-wrapper {
    max-width: 820px;
    margin: 28px auto;
}

@media (max-width: 640px) {
    .single-layout { width: min(100% - 16px, 920px); margin-top: 16px; }
    .article-card { border-radius: 12px; padding: 20px 16px 30px; }
    .article-title, .article-card .post-title { font-size: 2rem; }
    .article-content { font-size: 1.04rem; line-height: 1.72; }
    .article-ad { margin: 24px auto; padding: 8px; border-radius: 8px; }
}

/* Controles propios: evitan que iOS abra el reproductor nativo a pantalla completa. */
.video-custom-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,.88), rgba(0,0,0,.42));
    color: #fff;
}
.video-control-button {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}
.video-progress {
    flex: 1 1 auto;
    min-width: 70px;
    accent-color: #fff;
}
.video-time {
    flex: 0 0 auto;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.video-player-wrapper.is-playing .video-play-overlay {
    display: none;
}
@media (max-width: 480px) {
    .video-custom-controls { gap: 7px; padding: 7px 8px; }
    .video-control-button { flex-basis: 34px; width: 34px; height: 34px; font-size: 15px; }
    .video-time { font-size: 11px; }
}


/* Reproducción móvil blindada: el visitante ve un canvas y no el elemento video nativo. */
.video-inline-canvas {
    display: none;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
    touch-action: manipulation;
}
.video-player-wrapper.canvas-video-mode .video-inline-canvas {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
}
.video-player-wrapper.canvas-video-mode video {
    position: absolute !important;
    left: -2px !important;
    bottom: -2px !important;
    z-index: -1 !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    min-height: 1px !important;
    max-width: 1px !important;
    max-height: 1px !important;
    opacity: 0.01 !important;
    pointer-events: none !important;
}
.video-player-wrapper.canvas-video-mode .video-play-overlay,
.video-player-wrapper.canvas-video-mode .video-custom-controls {
    z-index: 30;
}
