/* =========================================================
   RESPONSIVE YOUTUBE IFRAMES
   Shared by "More Materials..." and "See Our Work in Action"
   ========================================================= */

.video-section-container {
    width: min(94%, 1440px);
    max-width: 1440px;
    margin-inline: auto;
}

.youtube-section,
.materials-section {
    padding-block: clamp(3rem, 5vw, 5.5rem);
}

.youtube-section .section-heading,
.materials-section .section-heading {
    margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.youtube-grid,
.materials-video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 1.7vw, 1.75rem);
    align-items: start;
}

.youtube-video,
.materials-video-card {
    min-width: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 26px rgba(12, 13, 50, 0.12);
}

.responsive-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #0c0d32;
}

.responsive-video-frame iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Desktop: two videos on the first row and one large video below. */
.youtube-grid > .youtube-video:nth-child(3) {
    grid-column: 1 / -1;
}

.youtube-grid > .youtube-video:nth-child(3) .responsive-video-frame {
    aspect-ratio: 21 / 9;
}

/* Keep the third video large on desktop, with comfortable spacing. */
@media (min-width: 1200px) {
    .youtube-grid,
    .materials-video-grid {
        gap: 24px;
    }

    .youtube-video,
    .materials-video-card {
        border-radius: 14px;
    }

    .youtube-grid > .youtube-video:nth-child(3) .responsive-video-frame {
        aspect-ratio: 21 / 8;
    }
}

/* Tablet: two videos at the top and one wide video underneath. */
@media (min-width: 601px) and (max-width: 1000px) {
    .video-section-container {
        width: min(94%, 900px);
    }

    .youtube-grid,
    .materials-video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .youtube-grid > .youtube-video:nth-child(3) {
        grid-column: 1 / -1;
    }

    .youtube-grid > .youtube-video:nth-child(3) .responsive-video-frame {
        aspect-ratio: 16 / 9;
    }
}

/* Mobile: one full-width video at a time. */
@media (max-width: 600px) {
    .video-section-container {
        width: calc(100% - 32px);
    }

    .youtube-grid,
    .materials-video-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .youtube-video,
    .materials-video-card {
        border-radius: 10px;
    }

    .youtube-grid > .youtube-video:nth-child(3) {
        grid-column: auto;
    }

    .youtube-grid > .youtube-video:nth-child(3) .responsive-video-frame {
        aspect-ratio: 16 / 9;
    }
}

.materials-video-caption {
    padding: 1rem 1.1rem 1.2rem;
}

.materials-video-caption h3 {
    margin: 0 0 0.5rem;
    color: #0c0d32;
    font-size: clamp(1.05rem, 1.4vw, 1.3rem);
    line-height: 1.3;
}

.materials-video-caption a {
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: none;
}

.materials-video-caption a:hover,
.materials-video-caption a:focus-visible {
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    .youtube-video,
    .materials-video-card {
        scroll-behavior: auto;
    }
}

/* =========================================================
   RESPONSIVE INTRODUCTION YOUTUBE VIDEO
   The wrapper controls the size; the iframe fills it.
========================================================= */

.intro-image {
    width: 100%;
    min-width: 0;
    align-self: center;
}

.intro-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 0;
    overflow: hidden;
    border-radius: 14px;
    background: #0c0d32;
    box-shadow: 0 12px 32px rgba(12, 13, 50, 0.16);
}

.intro-video-frame iframe {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Larger video area on wide desktop screens. */
@media (min-width: 1200px) {
    .intro-video-frame {
        aspect-ratio: 16 / 9;
        border-radius: 16px;
    }
}

/* Tablet: keep the video wide and within the intro column. */
@media (min-width: 601px) and (max-width: 1000px) {
    .intro-image {
        width: 100%;
    }

    .intro-video-frame {
        aspect-ratio: 16 / 9;
        border-radius: 12px;
    }
}

/* Mobile: use the full available column width without overflow. */
@media (max-width: 600px) {
    .intro-image {
        width: 100%;
        max-width: 100%;
    }

    .intro-video-frame {
        width: 100%;
        aspect-ratio: 16 / 9;
        border-radius: 10px;
    }
}

/* =========================================================
   LARGER INTRO VIDEO ON DESKTOP AND TABLET
========================================================= */
@media (min-width: 1001px) {
    .intro-grid {
        grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
        gap: clamp(32px, 4vw, 56px);
    }

    .intro-image {
        width: 100%;
        min-width: 0;
    }

    .intro-video-frame {
        width: 100%;
        aspect-ratio: 16 / 9;
    }
}

@media (min-width: 601px) and (max-width: 1000px) {
    .intro-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .intro-image {
        width: 100%;
        max-width: 100%;
    }

    .intro-video-frame {
        width: 100%;
        aspect-ratio: 16 / 9;
        border-radius: 14px;
    }
}
