/* Leguas Responsive Media 1.0.9 — lightbox estable + YouTube 16:9 normalizado en servidor. */

.entry-content figure,
.post-content figure,
.td-post-content figure,
.single-post-content figure,
.article-content figure,
.nota-content figure,
.wp-block-post-content figure,
.elementor-widget-theme-post-content figure,
article .content figure,
article .post-body figure,
.entry-content .wp-caption,
.post-content .wp-caption,
.td-post-content .wp-caption,
.single-post-content .wp-caption,
.article-content .wp-caption,
.nota-content .wp-caption,
.wp-block-post-content .wp-caption,
.elementor-widget-theme-post-content .wp-caption,
article .content .wp-caption,
article .post-body .wp-caption {
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
}

.entry-content img,
.post-content img,
.td-post-content img,
.single-post-content img,
.article-content img,
.nota-content img,
.wp-block-post-content img,
.elementor-widget-theme-post-content img,
article .content img,
article .post-body img {
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
}

.entry-content figcaption,
.post-content figcaption,
.td-post-content figcaption,
.single-post-content figcaption,
.article-content figcaption,
.nota-content figcaption,
.wp-block-post-content figcaption,
.elementor-widget-theme-post-content figcaption,
article .content figcaption,
article .post-body figcaption,
.entry-content .wp-caption-text,
.post-content .wp-caption-text,
.td-post-content .wp-caption-text,
.single-post-content .wp-caption-text,
.article-content .wp-caption-text,
.nota-content .wp-caption-text,
.wp-block-post-content .wp-caption-text,
.elementor-widget-theme-post-content .wp-caption-text,
article .content .wp-caption-text,
article .post-body .wp-caption-text {
    width: 100%;
    max-width: 100%;
    margin: 7px 0 0;
    padding: 0;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    font-size: 0.9em;
    line-height: 1.35;
    color: #666;
    text-align: left;
}

.lrm-zoomable-image { cursor: zoom-in; }
html.lrm-lightbox-open,
body.lrm-lightbox-open { overflow: hidden !important; }

.lrm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.94);
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    box-sizing: border-box;
}
.lrm-lightbox.is-open { display: flex; }

.lrm-lightbox__media {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: calc(100vh - 36px);
}

.lrm-lightbox__image {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100vw - 36px);
    max-height: calc(100vh - 36px);
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.lrm-lightbox__close,
.lrm-lightbox__close:hover,
.lrm-lightbox__close:focus,
.lrm-lightbox__close:focus-visible,
.lrm-lightbox__close:active {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 2;
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.lrm-lightbox__close img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: contain;
}
.lrm-lightbox__close-fallback { display:none; color:#fff; font:38px/1 Arial,sans-serif; }
.lrm-lightbox__close.is-fallback img { display:none; }
.lrm-lightbox__close.is-fallback .lrm-lightbox__close-fallback { display:block; }

.lrm-lightbox__caption {
    position: fixed;
    left: 50%;
    bottom: max(15px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 2147483001;
    width: min(900px, calc(100vw - 42px));
    max-height: 22vh;
    overflow: auto;
    color: #fff;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

.lrm-lightbox__rotate-hint {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    z-index: 2147483003;
    display: none;
    max-width: calc(100vw - 48px);
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(0,0,0,.68);
    color:#fff;
    font-size:14px;
    text-align:center;
    pointer-events:none;
}
.lrm-lightbox__rotate-hint.is-visible { display:block; animation:lrm-hint-fade 2.7s ease forwards; }
@keyframes lrm-hint-fade { 0%,70%{opacity:1} 100%{opacity:0} }

@media (max-width:767px) {
    .lrm-lightbox { padding: max(10px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
    .lrm-lightbox__media { max-height: calc(100vh - 20px); }
    .lrm-lightbox__image { max-width: calc(100vw - 16px); max-height: calc(100vh - 20px); }
    .lrm-lightbox__close,
    .lrm-lightbox__close:hover,
    .lrm-lightbox__close:focus,
    .lrm-lightbox__close:focus-visible,
    .lrm-lightbox__close:active { width:38px !important; height:38px !important; }
    .lrm-lightbox__caption { width:calc(100vw - 28px); font-size:13px; }
}


/* YouTube: proporción 16:9 estable sin JavaScript ni manipulación tardía del DOM. */
.lrm-youtube-block,
.lrm-youtube-shell {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.lrm-youtube-block figure.wp-block-embed,
.lrm-youtube-block .wp-block-embed,
.lrm-youtube-block .wp-block-embed__wrapper,
.lrm-youtube-shell {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

.lrm-youtube-block .wp-block-embed__wrapper,
.lrm-youtube-shell {
    position: relative !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
}

.lrm-youtube-block .wp-block-embed__wrapper::before,
.lrm-youtube-block .wp-block-embed__wrapper::after,
.lrm-youtube-shell::before,
.lrm-youtube-shell::after {
    content: none !important;
    display: none !important;
    padding: 0 !important;
}

/* Si el theme/FitVids agrega su wrapper, queda contenido dentro del rectángulo 16:9. */
.lrm-youtube-block .fluid-width-video-wrapper,
.lrm-youtube-shell .fluid-width-video-wrapper {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
}

.lrm-youtube-block iframe[src*="youtube.com"],
.lrm-youtube-block iframe[src*="youtube-nocookie.com"],
.lrm-youtube-shell iframe[src*="youtube.com"],
.lrm-youtube-shell iframe[src*="youtube-nocookie.com"] {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    aspect-ratio: 16 / 9 !important;
}

/* 1.0.9 — el contenedor ya es 16:9; ahora el contenido diferido/fachada de YouTube
   debe ocupar exactamente ese rectángulo también en iPhone y lazy-load. */
.lrm-youtube-block .wp-block-embed__wrapper > :not(script):not(style),
.lrm-youtube-shell > :not(script):not(style),
.lrm-youtube-block .wp-block-embed__wrapper .fluid-width-video-wrapper,
.lrm-youtube-shell .fluid-width-video-wrapper,
.lrm-youtube-block .wp-block-embed__wrapper .youtube-player,
.lrm-youtube-shell .youtube-player,
.lrm-youtube-block .wp-block-embed__wrapper .youtube-lazy-load,
.lrm-youtube-shell .youtube-lazy-load,
.lrm-youtube-block .wp-block-embed__wrapper .lazy-youtube,
.lrm-youtube-shell .lazy-youtube,
.lrm-youtube-block .wp-block-embed__wrapper lite-youtube,
.lrm-youtube-shell lite-youtube {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

/* Importante: no dependemos de src; Hummingbird/lazy-load puede dejar la URL en data-src. */
.lrm-youtube-block iframe,
.lrm-youtube-shell iframe,
.lrm-youtube-block iframe[data-src],
.lrm-youtube-shell iframe[data-src],
.lrm-youtube-block iframe[data-lazy-src],
.lrm-youtube-shell iframe[data-lazy-src] {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    aspect-ratio: 16 / 9 !important;
    transform: none !important;
}

/* Si el lazy-load usa una imagen/fachada local, evitamos el recorte tipo reel. */
.lrm-youtube-block .wp-block-embed__wrapper img,
.lrm-youtube-shell img,
.lrm-youtube-block .wp-block-embed__wrapper picture,
.lrm-youtube-shell picture,
.lrm-youtube-block .wp-block-embed__wrapper video,
.lrm-youtube-shell video {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    object-position: center center !important;
    background: #000 !important;
}
