/* Video facade — shared by _Layout and _MarketingLayout (guides), alongside js/video-embed.js */

/* Click-to-load, privacy-first (no YouTube request until play) */
.video-embed {
    position: relative;
    max-width: 960px;
    margin: var(--space-lg) auto 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    background: #000;
}

.video-embed-trigger {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    position: relative;
    line-height: 0;
}

.video-embed-poster {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.video-embed-trigger:hover .video-embed-poster,
.video-embed-trigger:focus-visible .video-embed-poster {
    transform: scale(1.02);
    opacity: 0.9;
}

.video-embed-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 74px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-blue);
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, background 0.25s ease;
}

.video-embed-play svg {
    margin-left: 3px; /* optically centre the triangle */
}

.video-embed-trigger:hover .video-embed-play,
.video-embed-trigger:focus-visible .video-embed-play {
    transform: translate(-50%, -50%) scale(1.08);
    background: #005a9e;
}

.video-embed-trigger:focus-visible {
    outline: 3px solid var(--primary-blue);
    outline-offset: 3px;
}

/* Video lightbox — the player opens large, styled like the screenshot lightbox (cards.css) */
.video-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 16px 16px; /* room above for the close button */
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.video-modal-backdrop.visible {
    opacity: 1;
}

.video-modal {
    position: relative;
    /* As wide as the screen allows, while the 16:9 player, caption and close button fit
       the height (phones in landscape included) */
    width: min(1280px, 90vw, calc((100vh - 9rem) * 16 / 9));
    cursor: default;
}

.video-modal-frame {
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.video-modal-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-modal-caption {
    margin-top: var(--space-sm);
    text-align: center;
}

.video-modal-caption h3 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    padding: 0.25rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.video-modal-close:hover,
.video-modal-close:focus-visible {
    color: #fff;
}

.video-modal-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .video-modal {
        width: min(100%, calc((100vh - 9rem) * 16 / 9));
    }
}

/* Two demos side by side on the product page */
.video-embed-pair {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    max-width: 1100px;
    margin: var(--space-lg) auto 0;
}

.video-embed-pair .video-embed {
    margin-top: 0;
    max-width: none;
}

.video-embed-pair figcaption,
.video-embed-caption {
    display: block;
    margin-top: var(--space-sm);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-800);
    text-align: center;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .video-embed-pair {
        grid-template-columns: 1fr;
    }
}

/* Three demos in a row (product and demo pages); stacked below desktop width,
   since two columns would leave the third orphaned */
.video-embed-pair.video-embed-trio {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
}

.video-embed-trio figure {
    margin: 0;
    scroll-margin-top: 90px; /* clear the sticky header when a card links to one demo */
}

@media (max-width: 1024px) {
    .video-embed-pair.video-embed-trio {
        grid-template-columns: 1fr;
        max-width: 640px;
    }
}
