.video-post {
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 24px;
}

h4 { font-size: 18px; line-height: 22px; margin-bottom:12px; }

.widget_custom_html h4 { font-size: 14px; line-height: 18px; margin-bottom:12px; }

.video-container {
    max-width: 100%;
    margin: 0 auto;
    position: relative; /* Needed for absolute positioning of iframe */
}

.video-post * { box-sizing: border-box; } /* Reset any potential block-level spacing */

.youtube-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 0; /* Prevent extra margin */
}

.youtube-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block; /* Prevent inline-block spacing */
}

.video-container video {
    max-width: 100%;
    height: auto;
    display: block; /* Prevent inline-block spacing */
    margin: 0; /* Prevent extra margin */
}

.video-description {
    margin: 10px 0;
}

.widget_custom_html .video-description {
    display: none;
}

/* Override potential theme/Gutenberg spacing */
.video-container-youtube {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.video-post .wp-block-embed {
    margin: 0 !important;
}

/* Mobile-specific margin for video-container */
@media only screen and (max-width: 767px) {
    .video-container {
        margin-bottom: 1em;
    }
}

/* =========================
   VIDEO CONTAINER BASE
========================= */

.video-post {
    width: 100%;
    max-width: 100%;
}

.video-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* =========================
   YOUTUBE RESPONSIVE WRAPPER
========================= */

.yt-lazy,
.video-container-youtube {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #000;
}

/* fallback safety for older browsers */
@supports not (aspect-ratio: 16 / 9) {
    .yt-lazy,
    .video-container-youtube {
        padding-top: 56.25%;
        height: 0;
    }
}

/* =========================
   THUMBNAIL IMAGE
========================= */

.yt-lazy img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* fallback positioning */
@supports not (aspect-ratio: 16 / 9) {
    .yt-lazy img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

/* =========================
   IFRAME FIXES
========================= */

.yt-lazy iframe,
.video-container iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* fallback positioning */
@supports not (aspect-ratio: 16 / 9) {
    .yt-lazy iframe,
    .video-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* =========================
   PLAY BUTTON OVERLAY
========================= */

.yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;

    /* IMPORTANT: reset any theme interference */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* THE ACTUAL PLAY TRIANGLE */
.yt-play:before {
    content: "▶";
    color: white;
    font-size: 28px;
    line-height: 1;
    margin-left: 4px;
}
/* =========================
   SIDEBAR / FLEX FIX
========================= */

.video-post,
.video-container {
    min-width: 0;
}

/* common sidebar containers */
.sidebar,
.widget-area,
.aside {
    overflow: hidden;
}