/**
 * CW Video (modal) — trigger + fullscreen overlay (portal to body in JS).
 * Last modified: 2026-04-17 (modal header + title; footer: Close video + fallback)
 *
 * @package CW_Elementor_Widgets
 */

.cw-video-modal-widget {
	position: relative;
	width: 100%;
	max-width: 100%;
}

/* Inline playback (no lightbox) */
.cw-video-modal-widget--inline .cw-video-modal-widget__inline {
	width: 100%;
}

.cw-video-modal-widget--inline .cw-video-modal-widget__inline-frame {
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	background-color: #000;
	background-image: var(--cw-video-inline-poster, none);
	background-size: cover;
	background-position: center;
	position: relative;
}

.cw-video-modal-widget--inline .cw-video-modal-widget__inline-video,
.cw-video-modal-widget--inline .cw-video-modal-widget__inline-iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	object-fit: contain;
	background: #000;
}

.cw-video-modal-widget__inline-fallback {
	display: inline-block;
	margin-top: 0.75rem;
	font-size: 0.85rem;
	color: inherit;
	opacity: 0.92;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cw-video-modal-widget__inline-fallback:hover,
.cw-video-modal-widget__inline-fallback:focus-visible {
	opacity: 1;
}

.cw-video-modal-widget__trigger {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 1rem;
	cursor: pointer;
	text-align: center;
	background-color: #0a0a0a;
	background-image: var(--cw-video-modal-poster, none);
	background-size: cover;
	background-position: center;
	aspect-ratio: 16 / 9;
	position: relative;
	overflow: hidden;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cw-video-modal-widget__trigger:hover,
.cw-video-modal-widget__trigger:focus-visible {
	border-color: rgba(255, 255, 255, 0.28);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
	outline: none;
}

.cw-video-modal-widget__trigger::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.65) 100%);
	pointer-events: none;
}

.cw-video-modal-widget__trigger-inner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	min-height: 100%;
	padding: 1.5rem;
}

/* Circle around play glyph — parity with cw-video-expl-cards__play-ring (video explination widget). */
.cw-video-modal-widget__play-ring {
	box-sizing: border-box;
	width: 4.25rem;
	height: 4.25rem;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	border: 2px solid rgba(255, 255, 255, 0.42);
	background: rgba(0, 0, 0, 0.35);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.cw-video-modal-widget__trigger:hover .cw-video-modal-widget__play-ring,
.cw-video-modal-widget__trigger:focus-visible .cw-video-modal-widget__play-ring {
	border-color: rgba(255, 255, 255, 0.58);
	background: rgba(0, 0, 0, 0.45);
}

.cw-video-modal-widget__play {
	width: 0;
	height: 0;
	margin-left: 0.2rem;
	border-style: solid;
	border-width: 0.85rem 0 0.85rem 1.35rem;
	border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.cw-video-modal-widget__label {
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.92);
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
	max-width: 90%;
}

/* Overlay: global selectors (moved to body by JS) */
.cw-video-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	box-sizing: border-box;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	padding: 2rem;
	margin: 0;
	width: 100%;
	min-height: 100vh;
	min-height: 100dvh;
	background: rgba(0, 0, 0, 0.88);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.cw-video-modal.is-open {
	display: flex;
}

.cw-video-modal__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 44px;
	height: 44px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	z-index: 2;
}

.cw-video-modal__close:hover,
.cw-video-modal__close:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.55);
	outline-offset: 2px;
}

.cw-video-modal__inner {
	position: relative;
	width: min(1200px, 96vw);
	max-width: 100%;
	padding-bottom: 0;
}

.cw-video-modal__header {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 0.75rem;
	padding: 0 0.25rem;
}

.cw-video-modal__title {
	margin: 0;
	font-size: clamp(1rem, 2.5vw, 1.35rem);
	font-weight: 600;
	color: #fff;
	text-align: center;
	line-height: 1.25;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cw-video-modal__frame {
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.2);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	background: #000;
	position: relative;
}

.cw-video-modal__iframe,
.cw-video-modal__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: none;
	object-fit: contain;
	background: #000;
}

.cw-video-modal__iframe.is-active,
.cw-video-modal__video.is-active {
	display: block;
}

.cw-video-modal__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.75rem 1rem;
	margin-top: 1rem;
	padding-bottom: 0.25rem;
}

.cw-video-modal__dismiss {
	appearance: none;
	margin: 0;
	padding: 0.5rem 1.15rem;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.4);
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.2;
}

.cw-video-modal__dismiss:hover,
.cw-video-modal__dismiss:focus-visible {
	background: rgba(255, 255, 255, 0.16);
	outline: 2px solid rgba(255, 255, 255, 0.55);
	outline-offset: 2px;
}

.cw-video-modal__fallback {
	background: rgba(0, 0, 0, 0.72);
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 999px;
	color: #fff;
	padding: 0.5rem 1rem;
	font-size: 0.85rem;
	text-decoration: none;
	display: none;
	align-items: center;
	justify-content: center;
	white-space: nowrap;
}

.cw-video-modal__fallback:hover,
.cw-video-modal__fallback:focus-visible {
	color: #fff;
	text-decoration: underline;
}

@media (max-width: 600px) {
	.cw-video-modal {
		padding: 1rem;
	}

	.cw-video-modal__fallback {
		font-size: 0.78rem;
		padding: 0.45rem 0.85rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cw-video-modal-widget__trigger {
		transition: none;
	}
}
