/**
 * AIBM Video Library and responsive video popup.
 *
 * @author Sameer Ali N
 */

.aibm-videos {
	padding: 120px 0;
	background: #f8fafc;
}

.aibm-videos,
#aibm-video-dialog {
	font-family: var(--aibm-font-body, "Spoof", "Inter", sans-serif);
}

.aibm-videos *,
#aibm-video-dialog * {
	box-sizing: border-box;
}

.aibm-videos .aibm-videos__heading {
	margin: 0 0 56px;
	color: #091424;
	font-family: inherit;
	font-size: 40px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.aibm-videos__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

.aibm-video-card {
	min-width: 0;
	margin: 0;
	border-radius: 42px;
	box-shadow: 0 12px 32px rgba(15, 19, 150, 0.12);
}

.aibm-videos .aibm-video-card__link {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-height: 520px;
	height: 100%;
	padding: 280px 24px 24px;
	overflow: hidden;
	border-radius: 42px;
	background: #091424;
	color: #fff;
	text-decoration: none;
}

.aibm-video-card__image,
.aibm-video-card__overlay {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.aibm-videos .aibm-video-card__image {
	z-index: -2;
	display: block;
	max-width: none;
	object-fit: cover;
	transform: scale(1);
	transition: transform 1.2s cubic-bezier(0.2, 0.65, 0.3, 1);
}

.aibm-video-card__overlay {
	z-index: -1;
	background: rgba(9, 20, 36, 0.4);
	pointer-events: none;
}

.aibm-video-card__play {
	position: absolute;
	top: 165px;
	left: 50%;
	display: block;
	width: 64px;
	height: 64px;
	transform: translateX(-50%);
}

.aibm-video-card__play img {
	display: block;
	width: 64px;
	height: 64px;
	object-fit: contain;
}

.aibm-video-card__caption {
	width: 100%;
	min-height: 132px;
	padding: 20px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 20px;
	background: rgba(255, 255, 255, 0.12);
	-webkit-backdrop-filter: blur(24px);
	backdrop-filter: blur(24px);
}

.aibm-videos .aibm-video-card__title {
	margin: 0 0 8px;
	color: #fff;
	font-family: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 26px;
	letter-spacing: 0;
}

.aibm-videos .aibm-video-card__description {
	margin: 0;
	color: rgba(255, 255, 255, 0.85);
	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 20px;
}

.aibm-video-card__link:focus-visible {
	outline: 3px solid #0f1396;
	outline-offset: 6px;
}

@media (hover: hover) and (pointer: fine) {
	.aibm-video-card__link:hover .aibm-video-card__image {
		transform: scale(1.20);
	}
}

/* Native dialog supplies modal focus containment and Escape handling. */

#aibm-video-dialog {
	width: calc(100% - 40px);
	max-width: 880px;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	margin: auto;
	padding: 0;
	overflow: auto;
	overscroll-behavior: contain;
	border: 0;
	border-radius: 16px;
	background: #121214;
	color: #f4f4f5;
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
	color-scheme: dark;
}

#aibm-video-dialog:not([open]) {
	display: none;
}

#aibm-video-dialog::backdrop {
	background: rgba(0, 0, 0, 0.76);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

#aibm-video-dialog[open] {
	animation: aibm-player-enter 0.22s ease-out;
}

#aibm-video-dialog [hidden] {
	display: none !important;
}

.aibm-player__panel {
	padding: 24px;
}

.aibm-player__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 28px;
}

#aibm-video-dialog .aibm-player__title {
	min-width: 0;
	margin: 0;
	color: #f4f4f5;
	font-family: inherit;
	font-size: 18px;
	font-weight: 700;
	line-height: 26px;
	overflow-wrap: anywhere;
}

.aibm-player__stage {
	position: relative;
	overflow: hidden;
	border-radius: 12px;
	background: #000;
}

#aibm-video-dialog .aibm-player__video {
	display: block;
	width: 100%;
	height: auto;
	max-height: 55vh;
	max-height: 55dvh;
	aspect-ratio: 832 / 365;
	object-fit: contain;
	background: #000;
}

#aibm-video-dialog .aibm-player__status {
	position: absolute;
	right: 12px;
	bottom: 12px;
	left: 12px;
	width: fit-content;
	max-width: calc(100% - 24px);
	margin: 0 auto;
	padding: 8px 12px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-family: inherit;
	font-size: 13px;
	line-height: 20px;
	text-align: center;
	pointer-events: none;
}

#aibm-video-dialog .aibm-player__status:empty {
	display: none;
}

.aibm-player__controls {
	margin-top: 24px;
}

#aibm-video-dialog .aibm-player__seek {
	--aibm-progress: 0%;
	display: block;
	width: 100%;
	height: 20px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

#aibm-video-dialog .aibm-player__seek::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 99px;
	background: linear-gradient(
		to right,
		#38bdf8 0%,
		#38bdf8 var(--aibm-progress),
		#27272a var(--aibm-progress),
		#27272a 100%
	);
}

#aibm-video-dialog .aibm-player__seek::-moz-range-track {
	height: 4px;
	border: 0;
	border-radius: 99px;
	background: #27272a;
}

#aibm-video-dialog .aibm-player__seek::-moz-range-progress {
	height: 4px;
	border-radius: 99px;
	background: #38bdf8;
}

#aibm-video-dialog .aibm-player__seek::-webkit-slider-thumb {
	width: 12px;
	height: 12px;
	margin-top: -4px;
	border: 0;
	border-radius: 50%;
	background: #f4f4f5;
	box-shadow: 0 0 5px rgba(56, 189, 248, 0.7);
	-webkit-appearance: none;
	appearance: none;
}

#aibm-video-dialog .aibm-player__seek::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border: 0;
	border-radius: 50%;
	background: #f4f4f5;
	box-shadow: 0 0 5px rgba(56, 189, 248, 0.7);
}

#aibm-video-dialog .aibm-player__seek:disabled {
	cursor: default;
	opacity: 0.5;
}

.aibm-player__times {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 2px;
	color: #a1a1aa;
	font-family: "Inter", sans-serif;
	font-size: 11px;
	line-height: 16px;
	font-variant-numeric: tabular-nums;
}

.aibm-player__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 16px;
}

.aibm-player__group {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

#aibm-video-dialog .aibm-player__button {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	min-height: 38px;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 8px;
	background: #1c1c1f;
	color: #f4f4f5;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0;
	text-decoration: none;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
}

#aibm-video-dialog .aibm-player__button svg {
	display: block;
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

#aibm-video-dialog .aibm-player__close {
	width: 36px;
	height: 36px;
	min-height: 36px;
	border-color: #27272a;
	border-radius: 50%;
}

#aibm-video-dialog .aibm-player__round {
	width: 44px;
	height: 44px;
	border-color: #27272a;
	border-radius: 50%;
}

#aibm-video-dialog .aibm-player__leave {
	width: auto;
	padding: 0 16px;
	background: #ef4444;
	color: #fff;
}

#aibm-video-dialog .aibm-player__button:hover {
	background: #303035;
}

#aibm-video-dialog .aibm-player__leave:hover {
	background: #dc2626;
}

#aibm-video-dialog .aibm-player__volume {
	width: 64px;
	height: 20px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	accent-color: #38bdf8;
	cursor: pointer;
}

#aibm-video-dialog .aibm-player__speed {
	width: 72px;
	height: 38px;
	min-height: 38px;
	margin: 0;
	padding: 0 6px;
	border: 1px solid #27272a;
	border-radius: 8px;
	background-color: #1c1c1f;
	color: #f4f4f5;
	font-family: inherit;
	font-size: 13px;
	line-height: normal;
	cursor: pointer;
}

#aibm-video-dialog button:focus-visible,
#aibm-video-dialog input:focus-visible,
#aibm-video-dialog select:focus-visible {
	outline: 2px solid #38bdf8;
	outline-offset: 4px;
}

#aibm-video-dialog [data-aibm-paused="true"] .aibm-player__pause-icon,
#aibm-video-dialog [data-aibm-paused="false"] .aibm-player__play-icon,
#aibm-video-dialog [data-aibm-mute][aria-pressed="false"] .aibm-player__sound-off,
#aibm-video-dialog [data-aibm-mute][aria-pressed="true"] .aibm-player__sound-waves {
	display: none;
}

/*
 * Fullscreen. Browsers do not allow the <dialog> itself to go fullscreen,
 * so the panel inside it (title, video and controls) is shown fullscreen.
 */
#aibm-video-dialog .aibm-player__panel:fullscreen {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	padding: 24px;
	overflow: auto;
	background: #121214;
	color: #f4f4f5;
}

#aibm-video-dialog .aibm-player__panel:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	padding: 24px;
	overflow: auto;
	background: #121214;
	color: #f4f4f5;
}

#aibm-video-dialog .aibm-player__panel:fullscreen .aibm-player__stage {
	display: flex;
	flex: 1;
	min-height: 0;
	align-items: center;
	justify-content: center;
}

#aibm-video-dialog .aibm-player__panel:-webkit-full-screen .aibm-player__stage {
	display: flex;
	flex: 1;
	min-height: 0;
	align-items: center;
	justify-content: center;
}

#aibm-video-dialog .aibm-player__panel:fullscreen .aibm-player__video {
	width: 100%;
	height: 100%;
	max-height: none;
	aspect-ratio: auto;
}

#aibm-video-dialog .aibm-player__panel:-webkit-full-screen .aibm-player__video {
	width: 100%;
	height: 100%;
	max-height: none;
	aspect-ratio: auto;
}

@keyframes aibm-player-enter {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@media (max-width: 1099px) {
	.aibm-videos {
		padding: 88px 0;
	}

	.aibm-videos__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.aibm-videos .aibm-videos__heading {
		margin-bottom: 40px;
		font-size: 36px;
	}

	.aibm-videos .aibm-video-card__link {
		min-height: 480px;
		padding-top: 250px;
	}

	.aibm-video-card__play {
		top: 145px;
	}
}

@media (max-width: 767px) {
	.aibm-videos {
		padding: 64px 0;
	}

	.aibm-videos__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.aibm-videos .aibm-videos__heading {
		margin-bottom: 32px;
		font-size: 32px;
	}

	.aibm-video-card,
	.aibm-videos .aibm-video-card__link {
		border-radius: 32px;
	}

	.aibm-videos .aibm-video-card__link {
		min-height: 460px;
		padding: 240px 20px 20px;
	}

	.aibm-video-card__caption {
		padding: 18px;
	}

	.aibm-video-card__play {
		top: 135px;
	}

	#aibm-video-dialog {
		width: calc(100% - 24px);
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
	}

	.aibm-player__panel {
		padding: 16px;
	}

	.aibm-player__header {
		gap: 12px;
		margin-bottom: 20px;
	}

	#aibm-video-dialog .aibm-player__title {
		font-size: 16px;
		line-height: 22px;
	}

	#aibm-video-dialog .aibm-player__video {
		aspect-ratio: 16 / 9;
	}

	.aibm-player__controls {
		margin-top: 16px;
	}

	.aibm-player__toolbar {
		flex-wrap: wrap;
		gap: 12px;
	}

	.aibm-player__options {
		justify-content: flex-end;
		width: 100%;
	}

	#aibm-video-dialog .aibm-player__button,
	#aibm-video-dialog .aibm-player__speed {
		min-height: 44px;
		height: 44px;
	}

	#aibm-video-dialog .aibm-player__button {
		min-width: 44px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aibm-videos .aibm-video-card__image {
		transition: none;
	}

	.aibm-video-card__link:hover .aibm-video-card__image {
		transform: none;
	}

	#aibm-video-dialog[open] {
		animation: none;
	}
}
