/**
 * ETDH hero modal video
 *
 * Optional play button overlaid on the case-study hero that opens the full
 * video in a full-screen modal. Mirrors the home-page intro styling.
 *
 * Stacking note: the hero template puts the shortcode widget at z-index:1 and
 * .hero-top / .hero-bottom at z-index:2, so anything the shortcode outputs is
 * trapped *below* the title. The accompanying JS therefore moves the play
 * button up to the .main-grid.hero container (so it can sit above the title)
 * and moves the modal to <body> (so it escapes the hero stacking context).
 */

/* Shared button styling (play + close).
   The !important rules override the theme/Elementor default <button> box
   (background, border, radius, shadow) so the buttons are just icon + label. */
.etdh-video-button,
button.etdh-video-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    padding: 0;
    background: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none;
    color: #fff !important;
    fill: currentColor;
    display: flex;
    flex-direction: column;
    gap: var(--space-xxs, 0.25rem);
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    font-weight: 500;
    line-height: 1.1;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.etdh-video-button:hover,
.etdh-video-button:focus-visible {
    background: none !important;
    color: var(--rtsl-red, #e6332a) !important;
}

.etdh-video-button svg {
    display: block;
    width: auto;
    height: auto;
}

.etdh-video-button svg path {
    fill: currentColor;
}

/* Play button — promoted above the hero title layer and centered over the hero.
   The JS moves it to be a direct child of .main-grid.hero (position: relative). */
#play-video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6; /* above .hero-top / .hero-bottom (z-index: 2) */
    padding: 1rem; /* roomy, fully-clickable hit area — transparent, no visible box */
    filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.5));
}

#play-video:hover,
#play-video:focus-visible {
    transform: translate(-50%, -50%) scale(1.05);
}

#play-video .etdh-video-icon {
    width: 6rem;
    height: 6rem;
}

/* Full-screen modal — JS moves it to <body> so it sits above all page content. */
.etdh-video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
}

.etdh-video-modal .etdh-video-frame,
.etdh-video-modal iframe,
.etdh-video-modal video {
    width: 90dvw;
    height: 50.625dvw; /* 16:9 */
    max-height: 85dvh;
    max-width: calc(85dvh * 16 / 9);
    border: 0;
    background: #000;
}

.etdh-video-modal .etdh-video-oembed iframe {
    width: 100%;
    height: 100%;
}

#close-video {
    position: absolute;
    right: var(--space-s, 1.5rem);
    top: var(--space-s, 1.5rem);
    z-index: 100; /* above the iframe/video inside the modal */
}

#close-video svg {
    width: 1.75rem;
    height: 1.75rem;
}

/* Keep the close button clear of the WP admin bar for logged-in editors */
body.admin-bar #close-video {
    top: calc(32px + var(--space-s, 1.5rem));
}

@media (max-width: 782px) {
    body.admin-bar #close-video {
        top: calc(46px + var(--space-s, 1.5rem));
    }
}
