/**
 * Video Showcase Block - Child Theme Override Styles
 *
 * The child theme override replaces the plugin block entirely, so ALL styles
 * must be defined here — plugin's style.css does not load for overridden blocks.
 */

/* =============================================
   LAYOUT - ported from plugin style.css
   ============================================= */

.video-showcase-container {
    margin: 0 auto;
}

/* Default Layout: Video Below Content */
.video-placement-vidbelow .video-showcase-content {
    align-items: center;

    --row-gap: var(--space-lg);
}

.video-placement-vidbelow .section-header {
    margin-bottom: var(--space-md);
}

/* Side-by-Side Layouts
   NOTE: .row applies --row-gap via the `gap` shorthand, which sets BOTH
   row-gap and column-gap. A large column-gap (--space-3xl = up to 96px)
   eats into the two columns' available width and causes content to overflow
   or get cut off at intermediate viewport sizes. Set row-gap and column-gap
   separately and cap the column-gap (matches the .row-gap-* utility pattern). */
.video-placement-vidleft .video-showcase-content,
.video-placement-vidright .video-showcase-content {
    row-gap: var(--space-lg);
    column-gap: min(var(--space-3xl), 6%);
    text-align: left;
}

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

/* Video Left: Text on Right */
.video-placement-vidleft .video-text-content {
    order: 2;
}

.video-placement-vidleft .video-column {
    order: 1;
}

/* Video Right: Text on Left */
.video-placement-vidright .video-text-content {
    order: 1;
}

.video-placement-vidright .video-column {
    order: 2;
}

/* Centered subtitle for vidbelow layout */
.video-placement-vidbelow .video-text-content {
    max-width: var(--max-width-content-xl);
    margin-inline: auto;
}

.video-placement-vidbelow .video-showcase-subtitle {
    max-width: var(--max-width-content-md);
    margin-inline: auto;
}

.video-placement-vidleft .video-showcase-subtitle,
.video-placement-vidright .video-showcase-subtitle {
    max-width: 88%;
    margin-left: 0;
}

.video-showcase-description {
    row-gap: var(--space-xs);
    display: flex;
    flex-direction: column;
}

.video-showcase-description blockquote {
    margin-top: 0;
}

.video-showcase-cta {
    margin-top: var(--space-lg);
}

.video-placement-vidbelow .video-showcase-description {
    max-width: var(--max-width-content-md);
    margin-inline: auto;
}

/* Video Wrapper */
.video-wrapper {
    width: 100%;
    max-width: 100%;
    position: relative;
    display: block;
    line-height: 0;
    box-sizing: border-box;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
}

.video-placement-vidbelow .video-wrapper {
    max-width: var(--container-sm);
    margin: 0 auto;
}

/* Video Player */
.video-player {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-card);
    background-color: var(--color-black);
    box-sizing: border-box;
    object-fit: cover;
}

.video-placement-vidbelow .video-player {
    aspect-ratio: 16 / 9;
}

.video-placement-vidbelow .video-player {
    max-height: 600px;
    object-fit: contain;
}

/* Video Preview Image */
.video-preview-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-card);
    object-fit: cover;
    cursor: pointer;
    box-sizing: border-box;
}

/* Force 16:9 only for vidbelow (full-width) layout */
.video-placement-vidbelow .video-preview-image {
    aspect-ratio: 16 / 9;
}

.video-placement-vidbelow .video-preview-image {
    max-height: 600px;
    object-fit: cover;
}

/* Embed container */
.video-placement-vidbelow .video-embed-container {
    max-height: 600px;
}

/* Play button overlay */
.video-wrapper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90px;
    height: 90px;
    background-image: url('play-button.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    z-index: 3;
    opacity: 1;
    transition: opacity var(--transition-base), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.video-wrapper:has(.video-preview-image)::after,
.video-wrapper:has(.video-player[poster])::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 20%);
    border-radius: var(--radius-card);
    pointer-events: none;
    z-index: 1;
    opacity: 1;
    transition: opacity var(--transition-base);
}

.video-wrapper:hover::before {
    transform: translate(-50%, -50%) scale(1.15);
}

.video-playback-inline .video-wrapper.is-playing::before,
.video-playback-inline .video-wrapper:has(.video-player[autoplay])::before,
.video-playback-inline .video-wrapper:has(.video-player.has-played)::before {
    opacity: 0;
    display: none;
    pointer-events: none;
}

.video-playback-inline .video-wrapper.is-playing::after,
.video-playback-inline .video-wrapper:has(.video-player[autoplay])::after,
.video-playback-inline .video-wrapper:has(.video-player.has-played)::after {
    opacity: 0;
    display: none;
}

.video-playback-inline .video-wrapper.is-playing:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

.video-playback-modal .video-wrapper {
    cursor: pointer;
}

.video-playback-modal .video-wrapper::before {
    opacity: 1;
    pointer-events: auto;
}

.video-playback-modal .video-wrapper::after {
    opacity: 0.5;
}

.video-playback-modal .video-player {
    pointer-events: none;
}

/* Video Note */
.video-note-row {
    margin-top: var(--space-lg);
}

.video-note {
    font-size: var(--font-size-small);
    font-style: italic;
    text-align: center;
    margin: 0;
}

.video-placement-vidbelow .video-note {
    max-width: var(--container-md);
    margin-inline: auto;
}

.video-placement-vidleft .video-column > .video-note,
.video-placement-vidright .video-column > .video-note {
    text-align: center;
    margin-top: var(--space-lg);
}

/* Video Placeholder */
.video-placeholder {
    background: var(--brand-gradient);
    border-radius: var(--radius-card);
    padding: var(--space-3xl);
    min-height: var(--dimension-hero-height);
    position: relative;
    box-shadow: var(--shadow-lg);
}

/* Transcript */
.video-transcript-link {
    margin-top: var(--space-md);
    text-align: center;
    width: 100%;
}

.transcript-link {
    display: inline-flex;
    align-items: center;
    row-gap: var(--space-xs);
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--font-size-small);
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.transcript-link:hover,
.transcript-link:focus {
    color: var(--color-link-hover);
    background-color: var(--color-bg-secondary);
    text-decoration: underline;
}

/* Keyboard focus */
.video-wrapper[role="button"]:focus {
    outline: 3px solid var(--color-accent);
    outline-offset: 4px;
    border-radius: var(--radius-card);
}

.video-wrapper[role="button"]:focus:not(:focus-visible) {
    outline: none;
}

/* =============================================
   CHILD THEME: CENTERED HEADER ABOVE COLUMNS
   ============================================= */

.video-showcase-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.video-showcase-section-header.section-header {
    max-width: var(--max-width-content-xl);
    margin-inline: auto;
    margin-bottom: var(--space-sm);
}

.video-showcase-section-header .video-showcase-subtitle {
    max-width: var(--max-width-content-md);
    margin-inline: auto;
}

.video-placement-vidleft .video-text-content,
.video-placement-vidright .video-text-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* =============================================
   STICKY VIDEO
   ============================================= */

@media (width > 1024px) {
    main:has(.video-showcase.video-sticky-enabled) {
        overflow-x: visible !important;
    }

    .video-showcase.video-sticky-enabled {
        overflow: visible !important;
        contain: none !important;
    }

    .video-showcase.video-sticky-enabled .container,
    .video-showcase.video-sticky-enabled .video-showcase-content {
        overflow: visible !important;
        contain: none !important;
    }

    .video-showcase.video-sticky-enabled .video-showcase-content {
        display: flex !important;
        flex-wrap: nowrap;
    }

    .video-showcase:not(.video-placement-vidbelow).video-sticky-enabled .video-text-content {
        flex: 0 0 calc(50% - 48px);
        max-width: calc(50% - 48px);
    }

    .video-showcase.video-sticky-enabled .video-column {
        flex: 0 0 calc(50% - 48px);
        width: calc(50% - 48px);
        max-width: calc(50% - 48px);
        max-height: calc(100vh - var(--sticky-element-top-offset) - 40px);
        overflow-y: auto;
    }

    .video-showcase.video-sticky-enabled.video-placement-vidleft .video-column,
    .video-showcase.video-sticky-enabled.video-placement-vidright .video-column {
        position: sticky;
        align-self: flex-start;
        top: calc(var(--header-height) + var(--announcement-bar-height) + var(--sticky-element-top-offset));
        z-index: 10;
        will-change: transform;
    }

    .admin-bar .video-showcase.video-sticky-enabled.video-placement-vidleft .video-column,
    .admin-bar .video-showcase.video-sticky-enabled.video-placement-vidright .video-column {
        top: calc(var(--header-height) + var(--announcement-bar-height) + 32px + var(--sticky-element-top-offset));
    }
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (width <= 1024px) {
    /* Columns stack — column-gap collapses, but keep vertical space between
       the stacked image and content via row-gap. */
    .video-placement-vidleft .video-showcase-content,
    .video-placement-vidright .video-showcase-content {
        row-gap: var(--space-xl);
        column-gap: 0;
    }

    .video-showcase.video-sticky-enabled .video-column {
        position: static;
        align-self: auto;
        max-height: none;
    }

    .video-placement-vidleft .video-text-content,
    .video-placement-vidright .video-text-content {
        order: 1;
    }

    .video-placement-vidleft .video-column,
    .video-placement-vidright .video-column {
        order: 2;
    }

    /* When the columns stack, the video spans the full content width, which
       makes the thumbnail oversized. Cap the stacked media width and center it,
       and force a 16:9 frame so tall posters don't blow up vertically. */
    .video-placement-vidleft .video-wrapper,
    .video-placement-vidright .video-wrapper {
        max-width: var(--container-sm);
        margin-inline: auto;
    }

    .video-placement-vidleft .video-preview-image,
    .video-placement-vidright .video-preview-image,
    .video-placement-vidleft .video-player,
    .video-placement-vidright .video-player {
        aspect-ratio: 16 / 9;
        object-fit: cover;
    }
}

@media (width <= 768px) {
    .video-placement-vidleft .video-showcase-content,
    .video-placement-vidright .video-showcase-content {
        row-gap: var(--space-lg);
        column-gap: 0;
    }

    .video-showcase-content .section-header {
        margin-bottom: var(--space-md);
    }

    .video-placement-vidleft .video-showcase-subtitle,
    .video-placement-vidright .video-showcase-subtitle {
        max-width: 100%;
    }

    .video-showcase-subtitle {
        font-size: var(--font-size-body);
        margin-bottom: var(--space-xl);
    }

    .video-placeholder {
        padding: var(--space-2xl) var(--space-lg);
        min-height: 300px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .video-wrapper::before,
    .video-wrapper::after {
        transition: none;
    }

    .video-wrapper:hover::before {
        transform: translate(-50%, -50%) scale(1);
    }
}
