/* ===================================================================
   VIDEO PLAYER (.vp)
   Any <video> inside .article-wrap (or a figure.vp) is upgraded by
   video-player.js. Loaded on its own so standalone pages can use it.
   Portrait clips stay phone-sized; landscape clips use the full width.
   =================================================================== */
.vp {
	--vp-navy: #1b2e3c;
	--vp-cream: #eee9da;
	--vp-accent: #6899b2;
	position: relative;
	max-width: 360px;
	margin: var(--s-5, 28px) auto var(--s-6, 40px);
	border-radius: 18px;
	overflow: hidden;
	background: var(--vp-navy);
	box-shadow:
		0 0 0 1px rgba(27, 46, 60, 0.12),
		0 24px 48px -16px rgba(27, 46, 60, 0.5);
	isolation: isolate;
	outline: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}
.vp.is-landscape {
	max-width: none;
	border-radius: 14px;
}
.vp video {
	display: block;
	width: 100%;
	height: auto;
	background: var(--vp-navy);
	cursor: pointer;
}
.vp svg {
	width: 22px;
	height: 22px;
	display: block;
}

/* Cover: big play button before start and after the end */
.vp-cover {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	background: linear-gradient(
		180deg,
		rgba(27, 46, 60, 0.1) 0%,
		rgba(27, 46, 60, 0.35) 55%,
		rgba(27, 46, 60, 0.75) 100%
	);
	cursor: pointer;
	transition:
		opacity 0.3s ease,
		visibility 0.3s;
}
.vp.is-started:not(.is-ended) .vp-cover {
	opacity: 0;
	visibility: hidden;
}
.vp-big {
	position: relative;
	width: 78px;
	height: 78px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: var(--primary, #46758e);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
	transition:
		transform 0.2s ease,
		background 0.2s ease;
}
.vp-big::before {
	content: "";
	position: absolute;
	inset: -8px;
	border-radius: 50%;
	border: 2px solid rgba(238, 233, 218, 0.45);
	animation: vp-pulse 2.4s ease-out infinite;
}
.vp-big:hover {
	background: var(--primary-dark, #35596c);
	transform: scale(1.06);
}
.vp-big svg {
	width: 34px;
	height: 34px;
}
.vp-big .i-play {
	margin-left: 4px;
}
.vp-big .i-replay,
.vp.is-ended .vp-big .i-play {
	display: none;
}
.vp.is-ended .vp-big .i-replay {
	display: block;
}
.vp-label {
	padding: 7px 14px;
	border-radius: 999px;
	background: rgba(27, 46, 60, 0.7);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--vp-cream);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.01em;
}
@keyframes vp-pulse {
	0% {
		transform: scale(0.92);
		opacity: 1;
	}
	80%,
	100% {
		transform: scale(1.3);
		opacity: 0;
	}
}

/* Control bar */
.vp-bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 36px 12px 10px;
	background: linear-gradient(to top, rgba(16, 28, 37, 0.88), rgba(16, 28, 37, 0));
	transition:
		opacity 0.25s ease,
		transform 0.25s ease;
}
.vp:not(.is-started) .vp-bar,
.vp.is-ended .vp-bar {
	opacity: 0;
	pointer-events: none;
}
.vp.is-idle .vp-bar {
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
}
.vp.is-idle {
	cursor: none;
}
.vp-row {
	display: flex;
	align-items: center;
	gap: 4px;
	margin-top: 4px;
}
.vp-spacer {
	flex: 1;
}
.vp-btn {
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--vp-cream);
	cursor: pointer;
	transition: background 0.15s ease;
}
.vp-btn:hover {
	background: rgba(238, 233, 218, 0.14);
}
.vp-btn:focus-visible,
.vp-big:focus-visible,
.vp-seek:focus-visible {
	outline: 2px solid var(--vp-accent);
	outline-offset: 2px;
}
.vp-toggle .i-pause,
.vp.is-playing .vp-toggle .i-play,
.vp-mute .i-muted,
.vp.is-muted .vp-mute .i-vol,
.vp-fs .i-shrink,
.vp.is-fullscreen .vp-fs .i-expand {
	display: none;
}
.vp.is-playing .vp-toggle .i-pause,
.vp.is-muted .vp-mute .i-muted,
.vp.is-fullscreen .vp-fs .i-shrink {
	display: block;
}
.vp-time {
	margin-left: 4px;
	color: rgba(238, 233, 218, 0.85);
	font-size: 12.5px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
}

/* Seek bar: --p is played, --b is buffered */
.vp-seek {
	--p: 0%;
	--b: 0%;
	-webkit-appearance: none;
	appearance: none;
	display: block;
	width: 100%;
	height: 18px;
	margin: 0;
	background: transparent;
	cursor: pointer;
}
.vp-seek::-webkit-slider-runnable-track {
	height: 4px;
	border-radius: 4px;
	background: linear-gradient(
		to right,
		var(--vp-accent) var(--p),
		rgba(238, 233, 218, 0.45) var(--p) var(--b),
		rgba(238, 233, 218, 0.2) var(--b)
	);
}
.vp-seek::-moz-range-track {
	height: 4px;
	border-radius: 4px;
	background: linear-gradient(
		to right,
		var(--vp-accent) var(--p),
		rgba(238, 233, 218, 0.45) var(--p) var(--b),
		rgba(238, 233, 218, 0.2) var(--b)
	);
}
.vp-seek::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	margin-top: -5px;
	border: 0;
	border-radius: 50%;
	background: var(--vp-cream);
	box-shadow: 0 0 0 4px rgba(104, 153, 178, 0.4);
	transform: scale(0);
	transition: transform 0.15s ease;
}
.vp-seek::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border: 0;
	border-radius: 50%;
	background: var(--vp-cream);
	box-shadow: 0 0 0 4px rgba(104, 153, 178, 0.4);
	transform: scale(0);
	transition: transform 0.15s ease;
}
.vp-seek:hover::-webkit-slider-thumb,
.vp-seek:focus-visible::-webkit-slider-thumb,
.vp-seek:active::-webkit-slider-thumb {
	transform: scale(1);
}
.vp-seek:hover::-moz-range-thumb,
.vp-seek:focus-visible::-moz-range-thumb,
.vp-seek:active::-moz-range-thumb {
	transform: scale(1);
}
@media (hover: none) {
	.vp-seek::-webkit-slider-thumb {
		transform: scale(1);
	}
	.vp-seek::-moz-range-thumb {
		transform: scale(1);
	}
}

/* Buffering spinner */
.vp-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 -22px;
	border: 3px solid rgba(238, 233, 218, 0.25);
	border-top-color: var(--vp-cream);
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	animation: vp-spin 0.8s linear infinite;
	transition: opacity 0.2s ease;
}
.vp.is-waiting.is-started:not(.is-ended) .vp-spinner {
	opacity: 1;
}
@keyframes vp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Play / pause flash in the centre on click */
.vp-flash {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgba(27, 46, 60, 0.6);
	color: var(--vp-cream);
	opacity: 0;
	pointer-events: none;
}
.vp-flash svg {
	width: 28px;
	height: 28px;
}
.vp-flash.is-on {
	animation: vp-flash 0.6s ease-out;
}
@keyframes vp-flash {
	0% {
		opacity: 1;
		transform: scale(0.85);
	}
	100% {
		opacity: 0;
		transform: scale(1.25);
	}
}

/* Full screen */
.vp:fullscreen {
	max-width: none;
	margin: 0;
	border-radius: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
}
.vp:fullscreen video {
	width: auto;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	background: #000;
}

@media (prefers-reduced-motion: reduce) {
	.vp-big::before,
	.vp-flash.is-on {
		animation: none;
	}
}
