/**
 * Food26 Video Player
 *
 * Contents
 * 1. Variables and layout (chapters beside or below)
 * 2. Frame, poster, play button, length, privacy note
 * 3. Chapters
 * 4. Responsive, reduced motion
 *
 * The chapters follow the section's text colour (currentColor), so the widget works on dark and light sections.
 * Colours read the Food26 Design Scheme (--inoforest-color-*, --inoforest-custom-*) with the design's values as
 * fallbacks. Rules use two classes; the Style tab's controls use three (or set the variables).
 */

/* 1. Variables and layout ----------------------------------------------------------- */
/* Fills its column unless Advanced → Width says otherwise: in a wrapping container (Elementor's default on phones) the
 * 16:9 frame would otherwise be measured too short and the chapters would spill out of the widget. */
.elementor-widget-food26-video-player:not([class*="elementor-widget__width-"]) {
	width: 100%;
}

.food26-video-player {
	--food26-vp-primary: var(--inoforest-color-primary, #b23a1e);
	--food26-vp-dark: var(--inoforest-custom-dark, #22150f);
	--food26-vp-radius: 26px;
	--food26-vp-gap: 24px;
	--food26-vp-side: 340px;
	--food26-vp-shade: color-mix(in srgb, var(--food26-vp-dark) 30%, transparent);
	--food26-vp-shade-hover: color-mix(in srgb, var(--food26-vp-dark) 15%, transparent);
	--food26-vp-play: 96px;
	--food26-vp-play-icon: 44px;
	--food26-vp-ring-width: 12px;
	--food26-vp-ring: color-mix(in srgb, #fff 22%, transparent);
	--food26-vp-chapter-hover: color-mix(in srgb, currentColor 10%, transparent);
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--food26-vp-gap);
}

.food26-video-player[data-chapters="side"] {
	grid-template-columns: minmax(0, 1fr) var(--food26-vp-side);
}

/* 2. Frame and poster ------------------------------------------------------------------ */
.food26-video-player .food26-video-player__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--food26-vp-dark);
	border-radius: var(--food26-vp-radius);
}

/* A locked video (1.2.0): the frame takes the card's height on phones. */
.food26-video-player .food26-video-player__frame--locked {
	aspect-ratio: auto;
}

.food26-video-player__frame :is(iframe, video) {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.food26-video-player .food26-video-player__poster {
	position: absolute;
	inset: 0;
	display: block;
	color: #fff;
	text-decoration: none;
}

.food26-video-player .food26-video-player__poster[hidden] {
	display: none;
}

.food26-video-player .food26-video-player__poster img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
}

.food26-video-player__poster::after {
	position: absolute;
	inset: 0;
	content: "";
	background: var(--food26-vp-shade);
	transition: background-color 0.3s ease;
}

.food26-video-player__poster:hover::after,
.food26-video-player__poster:focus-visible::after {
	background: var(--food26-vp-shade-hover);
}

.food26-video-player .food26-video-player__play {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: grid;
	place-items: center;
	width: var(--food26-vp-play);
	height: var(--food26-vp-play);
	margin: auto;
	font-size: var(--food26-vp-play-icon);
	color: #fff;
	background: var(--food26-vp-primary);
	border-radius: 50%;
	box-shadow: 0 0 0 var(--food26-vp-ring-width) var(--food26-vp-ring);
	transition: scale 0.3s ease;
}

.food26-video-player__play svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.food26-video-player__poster:hover .food26-video-player__play,
.food26-video-player__poster:focus-visible .food26-video-player__play {
	scale: 1.08;
}

.food26-video-player__poster:focus-visible {
	outline: 3px solid var(--food26-vp-primary);
	outline-offset: -3px;
}

.food26-video-player .food26-video-player__duration {
	position: absolute;
	inset-block-start: 16px;
	inset-inline-end: 16px;
	z-index: 1;
	padding: 4px 10px;
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1.7;
	color: #fff;
	background: color-mix(in srgb, var(--food26-vp-dark) 82%, transparent);
	border-radius: 6px;
}

.food26-video-player .food26-video-player__privacy {
	position: absolute;
	inset-block-end: 14px;
	inset-inline: 16px;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.8rem;
	line-height: 1.7;
	color: #fff;
}

.food26-video-player__privacy svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* 3. Chapters ------------------------------------------------------------------------------ */
.food26-video-player .food26-video-player__chapters {
	position: relative;
	min-width: 0;
}

.food26-video-player .food26-video-player__chapters-inner {
	display: flex;
	flex-direction: column;
	padding: 22px;
	overflow: hidden;
	background: color-mix(in srgb, currentColor 6%, transparent);
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: var(--food26-vp-radius);
}

/* Beside the player: as tall as the player, the list scrolls. */
.food26-video-player[data-chapters="side"] .food26-video-player__chapters {
	min-height: 260px;
}

.food26-video-player[data-chapters="side"] .food26-video-player__chapters-inner {
	position: absolute;
	inset: 0;
}

.food26-video-player .food26-video-player__chapters-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
	padding: 0;
	font-family: var(--inoforest-font-heading-family, inherit);
	font-size: 1.3rem;
	font-weight: 600;
	line-height: 1.15;
	color: inherit;
}

.food26-video-player__chapters-title svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.food26-video-player .food26-video-player__chapter-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 4px;
	margin: 0 -8px;
	padding: 0;
	list-style: none;
}

.food26-video-player[data-chapters="side"] .food26-video-player__chapter-list {
	display: block;
	flex: 1;
	overflow-y: auto;
}

.food26-video-player .food26-video-player__chapter-list li {
	margin: 0;
	padding: 0;
}

.food26-video-player .food26-video-player__chapter {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 12px;
	padding: 9px 8px;
	color: inherit;
	text-decoration: none;
	border-radius: 10px;
	transition: background-color 0.3s ease;
}

.food26-video-player .food26-video-player__chapter:hover,
.food26-video-player .food26-video-player__chapter:focus-visible,
.food26-video-player .food26-video-player__chapter[aria-current="true"] {
	color: inherit;
	background: var(--food26-vp-chapter-hover);
}

.food26-video-player .food26-video-player__time {
	min-width: 52px;
	padding: 3px 8px;
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 1.7;
	text-align: center;
	color: #fff;
	background: var(--food26-vp-primary);
	border-radius: 6px;
}

.food26-video-player .food26-video-player__chapter-title {
	font-size: 0.925rem;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.food26-video-player__hint {
	margin: 0;
}

/* 4. Responsive, reduced motion -------------------------------------------------------------- */
@media (max-width: 1199px) {
	.food26-video-player[data-chapters="side"] {
		grid-template-columns: minmax(0, 1fr);
	}

	.food26-video-player[data-chapters="side"] .food26-video-player__chapters {
		min-height: 0;
	}

	.food26-video-player[data-chapters="side"] .food26-video-player__chapters-inner {
		position: static;
	}

	.food26-video-player[data-chapters="side"] .food26-video-player__chapter-list {
		display: grid;
		overflow: visible;
	}
}

@media (max-width: 767px) {
	.food26-video-player {
		--food26-vp-play: 68px;
		--food26-vp-play-icon: 32px;
		--food26-vp-ring-width: 8px;
	}

	.food26-video-player .food26-video-player__privacy {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.food26-video-player__poster::after,
	.food26-video-player .food26-video-player__play,
	.food26-video-player .food26-video-player__chapter {
		transition: none;
	}
}
