/* Hero modal orientation. Missing data-orientation = landscape (slider safe). */

.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__dialog {
	display: flex;
	justify-content: center;
	width: auto;
	max-width: calc(100vw - 2rem);
}

.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__panel {
	width: min(calc(80dvh * 9 / 16), calc(100vw - 2rem));
	max-width: min(calc(80dvh * 9 / 16), calc(100vw - 2rem));
	max-height: 80dvh;
	height: auto;
	aspect-ratio: 9 / 16;
	margin-inline: auto;
}

.yepx-hero-modal.has-playlist[data-orientation="portrait"] .yepx-hero-modal__panel {
	width: min(calc(80dvh * 9 / 16), calc(100vw - 2rem - 7rem));
	max-width: min(calc(80dvh * 9 / 16), calc(100vw - 2rem - 7rem));
}

.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__frame {
	width: 100%;
	height: 100%;
	aspect-ratio: 9 / 16;
}

.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__video {
	width: 100%;
	height: 100%;
	max-height: none;
	aspect-ratio: 9 / 16;
	object-fit: contain;
}

.yepx-hero-modal:not([data-orientation="portrait"]) .yepx-hero-modal__frame {
	aspect-ratio: 16 / 9;
}

@media (max-width: 767px) {
	.yepx-hero-modal:not([hidden]) {
		padding: 0.75rem;
		width: 100%;
		height: 100%;
		height: 100dvh;
		min-height: 100svh;
		z-index: var(--yepx-z-modal, 10050);
	}

	.yepx-hero-modal:not([hidden]) .yepx-hero-modal__backdrop {
		opacity: 1;
	}

	.yepx-hero-modal.is-open .yepx-hero-modal__dialog {
		width: min(100%, calc(100vw - 1.5rem));
		max-width: 100%;
		max-height: min(92dvh, 100svh);
		opacity: 1;
		transform: none;
	}

	.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__dialog,
	.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__panel {
		width: calc(min(80dvh, 80vh) * 9 / 16);
		max-width: calc(100vw - 2rem);
		max-height: 80dvh;
		height: min(80dvh, calc((100vw - 2rem) * 16 / 9));
		aspect-ratio: 9 / 16;
		margin-inline: auto;
	}

	.yepx-hero-modal.has-playlist[data-orientation="portrait"] .yepx-hero-modal__dialog,
	.yepx-hero-modal.has-playlist[data-orientation="portrait"] .yepx-hero-modal__panel {
		max-width: calc(100vw - 2rem - 7rem);
		width: min(calc(min(80dvh, 80vh) * 9 / 16), calc(100vw - 2rem - 7rem));
	}

	.yepx-hero-modal:not([data-orientation="portrait"]) .yepx-hero-modal__panel {
		width: 100%;
		max-width: 100%;
		max-height: min(92dvh, calc(100svh - 2rem));
	}

	.yepx-hero-modal:not([data-orientation="portrait"]) .yepx-hero-modal__frame {
		width: 100%;
		min-height: 12rem;
		aspect-ratio: 16 / 9;
	}

	.yepx-hero-modal:not([data-orientation="portrait"]) .yepx-hero-modal__iframe {
		width: 100%;
		height: 100%;
		min-height: 12rem;
	}

	.yepx-hero-modal:not([data-orientation="portrait"]) .yepx-hero-modal__video {
		width: 100%;
		min-height: 12rem;
		max-height: none;
		aspect-ratio: 16 / 9;
	}
}

/* Like close X: immediately outside the panel, not over the video. */
.yepx-hero-modal.has-playlist .yepx-hero-modal__dialog {
	overflow: visible;
}

.yepx-hero-modal__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #fff;
	color: #0b2c3d;
	cursor: pointer;
	font-size: 1.85rem;
	line-height: 1;
	transform: translateY(-50%);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
	pointer-events: auto;
	touch-action: manipulation;
}

.yepx-hero-modal__nav[hidden] {
	display: none !important;
}

.yepx-hero-modal__nav--next {
	right: 0;
	transform: translate(calc(100% + 12px), -50%);
}

.yepx-hero-modal__nav--prev {
	left: 0;
	transform: translate(calc(-100% - 12px), -50%);
}

.yepx-hero-modal__nav:focus-visible {
	outline: 3px solid var(--yepx-color-focus, #06baf3);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.yepx-hero-modal[data-orientation="portrait"] .yepx-hero-modal__panel {
		transition: none;
	}
	.yepx-hero-modal__nav,
	.yepx-hero-modal__nav--next,
	.yepx-hero-modal__nav--prev {
		transition: none;
	}
}
