/* Eric Brand – video sound player 1.0.2 */

.eb-video-sound {
	--eb-vsp-pad: var(--wp--preset--spacing--60, 2.5rem);
	--eb-vsp-accent: var(--wp--preset--color--primary, #f58023);
	--eb-vsp-bar-h: 2.75rem;
}

/* Room for the bar under the section title */
.eb-video-sound .wp-block-cover__inner-container {
	padding-bottom: calc(var(--eb-vsp-bar-h) + var(--wp--preset--spacing--30, 1.5rem));
}

.eb-video-sound.eb-vsp-idle { cursor: none; }

.eb-vsp {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	color: var(--wp--preset--color--white, #fff);
	font-family: var(--wp--preset--font-family--roboto, 'Roboto', system-ui, sans-serif);
	-webkit-tap-highlight-color: transparent;
}

.eb-vsp__shade {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 45%;
	z-index: 1; /* above the picture, below the section title (same level, earlier in the DOM) */
	pointer-events: none;
	background: linear-gradient(to top, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .25) 45%, rgba(0, 0, 0, 0) 100%);
	transition: opacity .5s ease;
}

/* ---------- Bar ---------- */

.eb-vsp__bar {
	position: absolute;
	left: var(--eb-vsp-pad);
	right: var(--eb-vsp-pad);
	bottom: calc(var(--eb-vsp-pad) * .55);
	display: flex;
	align-items: center;
	gap: clamp(.5rem, .3rem + .8vw, 1.125rem);
	pointer-events: auto;
	transition: opacity .45s ease, transform .45s ease;
}

.eb-vsp__btn {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: var(--eb-vsp-bar-h);
	height: var(--eb-vsp-bar-h);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background-color .25s ease, border-color .25s ease, transform .2s ease;
}
.eb-vsp__btn:hover { background: rgba(255, 255, 255, .14); }
.eb-vsp__btn:active { transform: scale(.94); }
.eb-vsp__btn svg { display: block; width: 1.25rem; height: 1.25rem; fill: currentColor; }

.eb-vsp__play {
	position: relative;
	border: 1px solid rgba(255, 255, 255, .7);
	background: rgba(255, 255, 255, .08);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
.eb-vsp__play:hover { background: var(--wp--preset--color--white, #fff); color: var(--wp--preset--color--black, #303030); border-color: transparent; }

.eb-vsp__i-pause,
.eb-vsp.is-playing .eb-vsp__i-play { display: none; }
.eb-vsp.is-playing .eb-vsp__i-pause { display: block; }
.eb-vsp__i-play, .eb-vsp__i-pause { line-height: 0; }

/* Loading ring around the play button */
.eb-vsp__play::after {
	content: "";
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 1.5px solid transparent;
	border-top-color: var(--eb-vsp-accent);
	opacity: 0;
	transition: opacity .2s;
}
.eb-vsp.is-loading .eb-vsp__play::after { opacity: 1; animation: eb-vsp-spin .9s linear infinite; }
@keyframes eb-vsp-spin { to { transform: rotate(360deg); } }

/* ---------- Seek bar ---------- */

.eb-vsp__progress {
	position: relative;
	flex: 1 1 auto;
	min-width: 4rem;
	height: var(--eb-vsp-bar-h);
	display: flex;
	align-items: center;
	cursor: pointer;
	touch-action: none;
	outline: none;
}
.eb-vsp__track {
	position: relative;
	width: 100%;
	height: 2px;
	border-radius: 2px;
	background: rgba(255, 255, 255, .28);
	overflow: hidden;
	transition: height .2s ease;
}
.eb-vsp__buffer,
.eb-vsp__fill {
	position: absolute;
	inset: 0;
	transform: scaleX(0);
	transform-origin: 0 50%;
}
.eb-vsp__buffer { background: rgba(255, 255, 255, .3); }
.eb-vsp__fill { background: var(--wp--preset--color--white, #fff); }
.eb-vsp__thumb {
	position: absolute;
	top: 50%;
	left: 0;
	width: 12px;
	height: 12px;
	margin: -6px 0 0 -6px;
	border-radius: 50%;
	background: var(--wp--preset--color--white, #fff);
	box-shadow: 0 0 0 4px rgba(255, 255, 255, .18);
	transform: scale(0);
	transition: transform .2s ease;
	pointer-events: none;
}
.eb-vsp__progress:hover .eb-vsp__track,
.eb-vsp__progress:focus-visible .eb-vsp__track,
.eb-vsp.is-seeking .eb-vsp__track { height: 4px; }
.eb-vsp__progress:hover .eb-vsp__thumb,
.eb-vsp__progress:focus-visible .eb-vsp__thumb,
.eb-vsp.is-seeking .eb-vsp__thumb { transform: scale(1); }

/* ---------- Time ---------- */

.eb-vsp__time {
	flex: 0 0 auto;
	font-size: var(--wp--preset--font-size--x-small, .75rem);
	letter-spacing: .12em;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	text-transform: uppercase;
}
.eb-vsp__sep { margin: 0 .45em; opacity: .5; }
.eb-vsp__dur { opacity: .7; }

/* ---------- Volume ---------- */

.eb-vsp__volume { display: flex; align-items: center; flex: 0 0 auto; }
.eb-vsp__i-muted,
.eb-vsp.is-muted .eb-vsp__i-sound { display: none; }
.eb-vsp.is-muted .eb-vsp__i-muted { display: block; }
.eb-vsp__i-sound, .eb-vsp__i-muted { line-height: 0; }

.eb-vsp__vol {
	-webkit-appearance: none;
	appearance: none;
	width: 0;
	height: var(--eb-vsp-bar-h);
	margin: 0;
	padding: 0;
	opacity: 0;
	background: transparent;
	cursor: pointer;
	transition: width .3s ease, opacity .3s ease, margin .3s ease;
}
.eb-vsp__volume:hover .eb-vsp__vol,
.eb-vsp__vol:focus-visible { width: 5.5rem; opacity: 1; margin-left: .25rem; }
.eb-vsp__vol::-webkit-slider-runnable-track { height: 2px; background: rgba(255, 255, 255, .45); border-radius: 2px; }
.eb-vsp__vol::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; }
.eb-vsp__vol::-moz-range-track { height: 2px; background: rgba(255, 255, 255, .45); border-radius: 2px; }
.eb-vsp__vol::-moz-range-progress { height: 2px; background: #fff; }
.eb-vsp__vol::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }

/* ---------- Focus ---------- */

.eb-vsp__btn:focus-visible,
.eb-vsp__hint:focus-visible,
.eb-vsp__vol:focus-visible { outline: 2px solid var(--eb-vsp-accent); outline-offset: 3px; }
.eb-vsp__progress:focus-visible .eb-vsp__track { box-shadow: 0 0 0 3px var(--eb-vsp-accent); }

/* ---------- "Sound on" (inside the bar, left: never under the cookie banner) ---------- */

.eb-vsp__hint {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: .6em;
	height: 2.25rem;
	margin: 0;
	padding: 0 1.2em 0 .95em;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--black, #303030);
	font: inherit;
	font-size: var(--wp--preset--font-size--x-small, .75rem);
	font-weight: 500;
	letter-spacing: .16em;
	line-height: 1;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
	animation: eb-vsp-in .5s ease both;
	transition: background-color .25s ease, color .25s ease, transform .2s ease;
}
.eb-vsp__hint[hidden] { display: none; }
.eb-vsp__hint:hover { background: var(--eb-vsp-accent); color: #fff; }
.eb-vsp__hint:active { transform: scale(.97); }
.eb-vsp__hint svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.eb-vsp__hint .eb-vsp__wave { animation: eb-vsp-wave 1.6s ease-in-out infinite; }
.eb-vsp__hint .eb-vsp__wave--2 { animation-delay: .25s; }
@keyframes eb-vsp-wave { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes eb-vsp-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Idle (playing, no pointer activity) ---------- */

.eb-vsp.is-idle .eb-vsp__bar { opacity: 0; transform: translateY(10px); pointer-events: none; }
.eb-video-sound.eb-vsp-idle > .eb-vsp__shade { opacity: 0; }

.eb-vsp__mini {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: rgba(255, 255, 255, .2);
	opacity: 0;
	transition: opacity .45s ease;
}
.eb-vsp__mini span {
	position: absolute;
	inset: 0;
	background: var(--wp--preset--color--white, #fff);
	transform: scaleX(0);
	transform-origin: 0 50%;
}
.eb-vsp.is-idle .eb-vsp__mini { opacity: 1; }

/* ---------- Full screen ---------- */

.eb-video-sound:fullscreen { width: 100vw; height: 100vh; min-height: 100vh; background: #000; }
.eb-video-sound:-webkit-full-screen { width: 100vw; height: 100vh; min-height: 100vh; background: #000; }
.eb-video-sound:fullscreen video { transform: none !important; filter: none !important; object-fit: contain !important; }
.eb-video-sound:-webkit-full-screen video { transform: none !important; filter: none !important; object-fit: contain !important; }
.eb-video-sound:fullscreen .wp-block-cover__inner-container,
.eb-video-sound:fullscreen .wp-block-cover__background { display: none; }
.eb-video-sound:-webkit-full-screen .wp-block-cover__inner-container,
.eb-video-sound:-webkit-full-screen .wp-block-cover__background { display: none; }
.eb-vsp__i-fsexit,
.eb-vsp.is-fullscreen .eb-vsp__i-fs { display: none; }
.eb-vsp.is-fullscreen .eb-vsp__i-fsexit { display: block; }
.eb-vsp__i-fs, .eb-vsp__i-fsexit { line-height: 0; }

/* ---------- Touch & small screens ---------- */

@media (hover: none) {
	.eb-vsp__vol { display: none; }
	.eb-vsp__thumb { transform: scale(1); }
}

@media (max-width: 600px) {
	.eb-video-sound { --eb-vsp-pad: 1rem; }
	.eb-vsp__bar { gap: .35rem; }
	.eb-vsp__sep, .eb-vsp__dur { display: none; }
	.eb-vsp.has-hint .eb-vsp__time { display: none; }
	.eb-vsp__hint { height: 2rem; padding: 0 1em 0 .8em; letter-spacing: .12em; }
}

@media (prefers-reduced-motion: reduce) {
	.eb-vsp *, .eb-vsp *::after { animation: none !important; transition: none !important; }
}
