/**
 * The video overlay panel.
 *
 * Tom's brief: the video fills the whole popup, caps at 700px wide, and stays
 * responsive. So the panel itself carries no padding or background — the video
 * IS the panel — and the frame holds a 16:9 box that shrinks with the viewport.
 *
 * Scoped through .vim-video-modal rather than styling .gb-overlay outright, so
 * any other overlay panel added later keeps GenerateBlocks' own appearance.
 *
 * @package generatepress_child
 */

/*
 * 🚨 Do not restyle .gb-overlay itself here.
 *
 * .gb-overlay--standard is the full-screen centring container: GenerateBlocks
 * gives it position:fixed with width:100% and height:100% and centres the panel
 * content with flexbox. An earlier version of this file set width:auto on it to
 * "let the video size the popup", which collapsed the container and left the
 * video stranded against the top left of the page instead of centred over a
 * backdrop. The panel already ships with padding:0 and background:none, so the
 * video fills it without any override at all — size the content, not the panel.
 */

.vim-video-modal {
	position: relative;
	width: min(700px, 92vw);
	max-width: 700px;
	margin-inline: auto;
	line-height: 0;
}

/*
 * The close control sits above the video rather than over it, so it never
 * covers the picture or YouTube's own controls. GB Pro closes the panel for any
 * element carrying data-gb-overlay-close, so this needs no script of its own.
 */
.vim-video-modal__close {
	position: absolute;
	right: 0;
	bottom: 100%;
	margin-bottom: 0.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.35rem;
	border: 0;
	background-color: transparent;
	color: var(--white);
	line-height: 0;
	cursor: pointer;
}

.vim-video-modal__close svg {
	width: 1.75rem;
	height: 1.75rem;
	display: block;
}

.vim-video-modal__close:hover {
	color: var(--accent);
}

.vim-video-modal__close:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

/*
 * aspect-ratio rather than a padding-top hack: it keeps the box 16:9 at every
 * width without a wrapper whose height has to be calculated.
 */
.vim-video-modal__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background-color: #000;
	overflow: hidden;
}

.vim-video-modal__iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

@media (max-width: 767px) {

	.vim-video-modal {
		width: min(700px, 94vw);
	}
}
