/**
 * Video tutorials: card facade and lightbox.
 *
 * Colours come from the Elementor kit's Global Colors, so the module follows
 * the site palette without repeating any hex value that lives there.
 *
 * Note on specificity: the kit paints every <button> as an accent CTA through
 * `.elementor-kit-16 button` (0,1,1). The facade's own button rules are
 * therefore scoped as `.nso-video__media .nso-video__trigger` (0,2,0) so they
 * win without a single !important.
 *
 * @package NightSkyOptics
 */

/* -------------------------------------------------------------------------
 * Card
 * ---------------------------------------------------------------------- */

.c-video-card {
	height: 100%;
	overflow: hidden;
	cursor: pointer;
	transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.c-video-card:hover,
.c-video-card:focus-within {
	border-color: var(--e-global-color-secondary, #69c5c2);
	box-shadow: 0 10px 26px rgba(44, 53, 75, 0.12);
	transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
	.c-video-card,
	.c-video-card:hover,
	.c-video-card:focus-within {
		transform: none;
		transition: none;
	}
}

.c-video-card__topic:not(:has(.elementor-heading-title)) {
	display: none;
}

.c-video-card__topic .elementor-heading-title {
	display: inline-block;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-size: 11px;
	line-height: 1.4;
}

.c-video-card__title .elementor-heading-title {
	display: block;
}

.c-video-card__description p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * Thumbnail facade
 * ---------------------------------------------------------------------- */

.nso-video__media {
	position: relative;
	width: 100%;
}

.nso-video__media .nso-video__trigger,
.nso-video__media .nso-video__frame {
	position: relative;
	display: block;
	width: 100%;
	min-width: 0;
	height: 0;
	margin: 0;
	padding: 0 0 56.25%; /* 16:9 */
	border: 0;
	border-radius: 0;
	overflow: hidden;
	background-color: var(--e-global-color-primary, #2c354b);
	background-image: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	text-align: left;
	white-space: normal;
	transition: none;
	-webkit-appearance: none;
	appearance: none;
}

.nso-video__media .nso-video__trigger {
	cursor: pointer;
}

.nso-video__media .nso-video__trigger:hover,
.nso-video__media .nso-video__trigger:focus,
.nso-video__media .nso-video__trigger:active {
	background-color: var(--e-global-color-primary, #2c354b);
	color: inherit;
	border: 0;
	box-shadow: none;
}

.nso-video__media .nso-video__trigger:focus-visible {
	outline: 3px solid var(--e-global-color-secondary, #69c5c2);
	outline-offset: -3px;
}

.nso-video__thumb {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.c-video-card:hover .nso-video__thumb,
.c-video-card:focus-within .nso-video__thumb {
	transform: scale(1.045);
}

@media (prefers-reduced-motion: reduce) {
	.nso-video__thumb,
	.c-video-card:hover .nso-video__thumb {
		transform: none;
		transition: none;
	}
}

.nso-video__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 58px;
	height: 58px;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.nso-video__play svg {
	display: block;
	width: 100%;
	height: 100%;
}

.nso-video__play circle {
	fill: rgba(20, 24, 35, 0.62);
	stroke: rgba(255, 255, 255, 0.9);
	stroke-width: 2;
	transition: fill 0.25s ease, stroke 0.25s ease;
}

.nso-video__play path {
	fill: #fff;
}

.nso-video__play svg {
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.c-video-card:hover .nso-video__play circle,
.c-video-card:focus-within .nso-video__play circle {
	fill: var(--e-global-color-secondary, #69c5c2);
}

.nso-video__duration {
	position: absolute;
	right: 10px;
	bottom: 10px;
	padding: 2px 7px;
	border-radius: 3px;
	background-color: rgba(0, 0, 0, 0.78);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.02em;
	pointer-events: none;
}

.nso-video__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	white-space: nowrap;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
}

/* -------------------------------------------------------------------------
 * Lightbox
 * ---------------------------------------------------------------------- */

html.nso-video-lightbox-open,
html.nso-video-lightbox-open body {
	overflow: hidden;
}

.nso-video-lightbox {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.nso-video-lightbox[hidden] {
	display: none;
}

.nso-video-lightbox .nso-video-lightbox__backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: rgba(20, 24, 35, 0.9);
	border: 0;
	cursor: pointer;
}

.nso-video-lightbox__inner {
	position: relative;
	width: 100%;
	max-width: 1120px;
}

.nso-video-lightbox__frame {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%;
	background-color: #000;
	border-radius: 8px;
	overflow: hidden;
}

.nso-video-lightbox__frame iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.nso-video-lightbox__title {
	margin: 14px 2px 0;
	color: #fff;
	font-size: 15px;
	line-height: 1.5;
	text-align: center;
	opacity: 0.85;
}

.nso-video-lightbox .nso-video-lightbox__close {
	position: absolute;
	top: -46px;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	min-width: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.14);
	background-image: none;
	color: #fff;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.nso-video-lightbox .nso-video-lightbox__close:hover,
.nso-video-lightbox .nso-video-lightbox__close:focus-visible {
	background-color: var(--e-global-color-secondary, #69c5c2);
	color: #fff;
}

.nso-video-lightbox__close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

@media (max-width: 767px) {
	.nso-video-lightbox {
		padding: 16px;
	}

	.nso-video-lightbox .nso-video-lightbox__close {
		top: -42px;
		width: 32px;
		height: 32px;
	}

	.nso-video__play {
		width: 48px;
		height: 48px;
	}
}
