/* VHS Tapes: cassettes */
.vhst-wrap {
	--vhst-w: 50vw;
	--vhst-gap: 28px;
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 1.5em !important;
	padding: 0 !important;
	background: transparent !important;
}

.vhst-wrap *,
.vhst-wrap *::before,
.vhst-wrap *::after {
	box-sizing: border-box;
}

.vhst-tape {
	display: block;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
}

.vhst-tape + .vhst-tape {
	margin-top: var(--vhst-gap) !important;
}

@media (min-width: 782px) {
	.vhst-wrap .vhst-tape {
		width: var(--vhst-w);
		max-width: none;
	}
	.vhst-wrap.vhst-center .vhst-tape { margin-left: calc(50% - var(--vhst-w) / 2) !important; }
	.vhst-wrap.vhst-left .vhst-tape   { margin-left: 0 !important; }
	.vhst-wrap.vhst-right .vhst-tape  { margin-left: calc(100% - var(--vhst-w)) !important; }
}

.vhst-wrap .vhst-body {
	position: relative;
	display: block;
	width: 100%;
	height: auto !important;
	aspect-ratio: 612 / 350;
	margin: 0 !important;
	padding: 0 !important;
	container-type: inline-size;
	filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

.vhst-wrap .vhst-art {
	position: absolute !important;
	top: 0;
	left: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
}

/* Where the video preview sits (the green part of the cassette) */
.vhst-wrap .vhst-win {
	position: absolute;
	left: 28.6%;
	top: 30.86%;
	width: 41.67%;
	height: 44%;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	border-radius: 3px;
	background: #000;
}

.vhst-wrap .vhst-prev {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	min-height: 0 !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	object-fit: cover !important;
	aspect-ratio: auto !important;
	pointer-events: none;
}

.vhst-wrap .vhst-glass {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
	box-shadow: inset 0 0 14px 2px rgba(0, 0, 0, 0.7);
	background: linear-gradient(115deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0) 38%);
}

/* Play button: see-through, but easy to see */
.vhst-wrap .vhst-play {
	position: absolute !important;
	top: 0;
	left: 0;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100% !important;
	height: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.vhst-wrap .vhst-play-ico {
	position: relative;
	display: block;
	width: 56px;
	height: 56px;
	border: 2px solid var(--vhst-pcol, #fff);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.28);
	opacity: var(--vhst-pop, 0.85);
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
	transition: opacity 0.15s, transform 0.15s;
}

@supports (width: 1cqw) {
	.vhst-wrap .vhst-play-ico {
		width: calc(var(--vhst-play, 11) * 1cqw);
		height: calc(var(--vhst-play, 11) * 1cqw);
		border-width: max(1.5px, 0.35cqw);
	}
}

.vhst-wrap .vhst-play-ico::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34%;
	height: 40%;
	background: var(--vhst-pcol, #fff);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
	transform: translate(-35%, -50%);
}

.vhst-wrap .vhst-play:hover .vhst-play-ico,
.vhst-wrap .vhst-play:focus-visible .vhst-play-ico {
	opacity: 1;
	transform: scale(1.08);
}

.vhst-wrap .vhst-play:focus-visible {
	outline: 2px dashed #fff !important;
	outline-offset: -4px;
}

/* The sticker with the title. The outer box places, tilts and shades it;
   the inner one is the paper, with its bottom right corner folded back. */
.vhst-wrap .vhst-stk {
	position: absolute;
	left: 20.5%;
	top: 79.4%;
	width: 59%;
	height: 15%;
	margin: 0 !important;
	padding: 0 !important;
	transform: rotate(calc(var(--vhst-tilt, 1) * -0.8deg));
	filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.65));
	pointer-events: none;
}

.vhst-wrap .vhst-sticker {
	--vhst-c: calc(var(--vhst-wear, 0.6) * 20px);
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 !important;
	padding: 0 3% !important;
	overflow: hidden;
	background: var(--vhst-sticker, #f1eee4);
	border-radius: 2px 3px 2px 3px;
	/* the corner that has come off follows the fold line exactly */
	clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--vhst-c)), calc(100% - var(--vhst-c)) 100%, 0 100%);
}

@supports (width: 1cqw) {
	.vhst-wrap .vhst-sticker {
		--vhst-c: calc(var(--vhst-wear, 0.6) * 3.4cqw);
	}
}

/* Worn paper: grain, stains, scuffs and a lifting corner. The amount comes from the settings. */
.vhst-wrap .vhst-sticker::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	opacity: var(--vhst-wear, 0.6);
	mix-blend-mode: multiply;
	background:
		radial-gradient(ellipse at 10% 25%, rgba(120, 95, 40, 0.30), transparent 38%),
		radial-gradient(ellipse at 92% 78%, rgba(100, 80, 40, 0.34), transparent 40%),
		radial-gradient(ellipse at 55% 110%, rgba(80, 60, 30, 0.28), transparent 45%),
		linear-gradient(100deg, transparent 30%, rgba(90, 70, 30, 0.12) 31%, transparent 32.5%),
		linear-gradient(80deg, transparent 62%, rgba(90, 70, 30, 0.14) 62.6%, transparent 64%),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .38 0 0 0 0 .30 0 0 0 0 .16 0 0 0 1.6 -.5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	box-shadow: inset 0 0 0.9cqw 0.1cqw rgba(110, 85, 40, 0.55);
}

/* The folded back corner: the triangle between the fold line and the paper it was folded onto */
.vhst-wrap .vhst-sticker::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	width: var(--vhst-c);
	height: var(--vhst-c);
	background:
		linear-gradient(135deg, rgba(70, 55, 25, 0.38) 0%, rgba(70, 55, 25, 0.10) 28%, rgba(255, 255, 255, 0.55) 100%),
		var(--vhst-sticker, #f1eee4);
	clip-path: polygon(100% 0, 0 100%, 0 0);
}

.vhst-wrap .vhst-title {
	position: relative;
	display: block;
	max-width: 100%;
	overflow: hidden;
	margin: 0 !important;
	padding: 0 !important;
	font-family: var(--vhst-font, 'Courier New', monospace);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--vhst-ink, #1d1d1d);
	opacity: 0.88;
	text-shadow: 0 0 0.6px currentColor;
}

@supports (font-size: 1cqw) {
	.vhst-wrap .vhst-title {
		font-size: calc(var(--vhst-ts, 5.2) * 1cqw);
	}
}

/* Your own title sticker picture */
.vhst-wrap .vhst-stk.vhst-stk-img {
	transform: none;
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.6));
}

.vhst-wrap .vhst-stkimg {
	position: absolute !important;
	top: 0;
	left: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	aspect-ratio: auto !important;
	object-fit: contain !important;
}

/* The extra stickers, placed by their centre */
.vhst-wrap .vhst-sx {
	position: absolute !important;
	display: block;
	height: auto !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	aspect-ratio: auto !important;
	filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
	pointer-events: none;
}

.vhst-wrap .vhst-sx[hidden] {
	display: none !important;
}

.vhst-wrap .vhst-ph {
	background: linear-gradient(135deg, #0f2d12, #2f8a35);
}

/* Settings page */
.vhst-adminprev {
	max-width: 900px;
	padding: 20px;
	background: #e9e6df;
}

.vhst-adminprev .vhst-wrap {
	--vhst-w: 100%;
}

.vhst-adminprev .vhst-tape {
	width: 100% !important;
	margin-left: 0 !important;
}

.vhst-thumb {
	display: inline-block;
	width: 48px;
	height: 48px;
	object-fit: cover;
	vertical-align: middle;
}

.vhst-thumb[hidden] {
	display: none;
}

/* ---------- Full screen player (VHS machine) ---------- */
html.vhst-lock {
	overflow: hidden !important;
}

.vhst-ov[hidden] {
	display: none !important;
}

.vhst-ov {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2147483000;
	overflow: hidden;
	background: #000;
	color: var(--vhst-osd, #fff);
	font-family: "Lucida Console", "Courier New", Courier, monospace;
	font-size: clamp(13px, 2.7vmin, 26px);
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.2;
	text-transform: uppercase;
	text-shadow: 2px 2px 0 #000;
	-webkit-user-select: none;
	user-select: none;
}

.vhst-ov *,
.vhst-ov *::before,
.vhst-ov *::after {
	box-sizing: border-box;
}

.vhst-ov.fx-chroma {
	text-shadow: -1.5px 0 rgba(255, 40, 40, 0.75), 1.5px 0 rgba(40, 220, 255, 0.75), 2px 2px 0 #000;
}

.vhst-ov .vhst-v {
	position: absolute;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	background: #000;
	object-fit: contain !important;
}

.vhst-ov .vhst-scan,
.vhst-ov .vhst-band,
.vhst-ov .vhst-noise {
	position: absolute;
	left: 0;
	right: 0;
	pointer-events: none;
	display: none;
}

.vhst-ov .vhst-scan,
.vhst-ov .vhst-noise {
	top: 0;
	bottom: 0;
}

.vhst-ov.fx-scan .vhst-scan {
	display: block;
	background:
		repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0, rgba(0, 0, 0, 0.22) 1px, transparent 1px, transparent 3px),
		radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}

.vhst-ov.fx-track .vhst-band {
	display: block;
	top: -20%;
	height: 16%;
	background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.07) 50%, transparent);
	animation: vhst-roll 7s linear infinite;
}

.vhst-ov .vhst-noise {
	opacity: 0;
	transition: opacity 0.35s;
	background-size: 260px 260px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vhst-ov.fx-noise.is-static .vhst-noise {
	display: block;
	opacity: 1;
	transition: none;
	animation: vhst-jitter 0.14s steps(3) infinite;
}

.vhst-ov.fx-noise .vhst-noise.is-fading {
	display: block;
}

@keyframes vhst-roll {
	from { transform: translateY(0); }
	to   { transform: translateY(760%); }
}

@keyframes vhst-jitter {
	0%   { background-position: 0 0; }
	33%  { background-position: -70px 40px; }
	66%  { background-position: 50px -90px; }
	100% { background-position: -30px 20px; }
}

.vhst-ov .vhst-top {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 4vmin 5vmin 0;
	pointer-events: none;
}

.vhst-ov .vhst-mode {
	font-size: 1.5em;
}

.vhst-ov .vhst-ttl {
	margin-top: 0.4em;
	max-width: 60vw;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	opacity: 0.9;
}

.vhst-ov .vhst-bot {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 1em;
	padding: 0 5vmin 4vmin;
}

.vhst-ov .vhst-time {
	display: flex;
	align-items: center;
	gap: 1em;
}

.vhst-ov .vhst-bar {
	position: relative;
	flex: 1 1 auto;
	height: 14px;
	min-width: 0;
	border: 2px solid currentColor;
	background: rgba(0, 0, 0, 0.45);
	cursor: pointer;
	touch-action: none;
}

.vhst-ov .vhst-fill {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 0;
	background: currentColor;
}

.vhst-ov .vhst-cur,
.vhst-ov .vhst-rem {
	flex: 0 0 auto;
	min-width: 6.5em;
}

.vhst-ov .vhst-rem {
	text-align: right;
}

.vhst-ov .vhst-btns {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.8em 1.2em;
}

.vhst-ov .vhst-grp {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
}

.vhst-ov .vhst-b {
	display: inline-block;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0.4em 0.9em !important;
	border: 2px solid currentColor !important;
	border-radius: 0 !important;
	background: rgba(0, 0, 0, 0.5) !important;
	box-shadow: none !important;
	color: inherit !important;
	font: inherit !important;
	letter-spacing: inherit !important;
	line-height: 1.2 !important;
	text-shadow: inherit;
	text-transform: uppercase !important;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.vhst-ov .vhst-b:hover {
	background: rgba(255, 255, 255, 0.22) !important;
}

.vhst-ov .vhst-b:focus-visible,
.vhst-ov .vhst-bar:focus-visible {
	outline: 2px dashed currentColor;
	outline-offset: 3px;
}

.vhst-ov .vhst-b[aria-pressed="true"] {
	background: var(--vhst-osd, #fff) !important;
	color: #000 !important;
	text-shadow: none;
}

.vhst-ov .vhst-top .vhst-b {
	pointer-events: auto;
}

.vhst-ov .vhst-top,
.vhst-ov .vhst-bot {
	transition: opacity 0.3s;
}

.vhst-ov.is-idle {
	cursor: none;
}

.vhst-ov.is-idle .vhst-eject,
.vhst-ov.is-idle .vhst-bot {
	opacity: 0;
	pointer-events: none;
}

@media (max-width: 600px) {
	.vhst-ov .vhst-cur,
	.vhst-ov .vhst-rem {
		min-width: 0;
		font-size: 0.85em;
	}
	.vhst-ov .vhst-b {
		padding: 0.5em 0.7em !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vhst-ov .vhst-band,
	.vhst-ov .vhst-noise {
		display: none !important;
		animation: none !important;
	}
	.vhst-wrap .vhst-play-ico {
		transition: none;
	}
}

/* Settings page: tabs, the placing area and the sticker table */
.vhst-panel[hidden] {
	display: none;
}

.vhst-place {
	max-width: 620px;
	margin: 8px 0 14px !important;
	padding: 14px !important;
	background: #e9e6df !important;
}

.vhst-place .vhst-tape {
	width: 100% !important;
	margin-left: 0 !important;
}

.vhst-place .vhst-sx {
	pointer-events: auto;
	cursor: move;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-user-drag: none;
}

.vhst-place .vhst-sx.is-drag {
	outline: 1px dashed #2271b1;
}

.vhst-slots {
	max-width: 900px;
}

.vhst-thumb-wide {
	width: 150px;
	height: auto;
	max-height: 44px;
	object-fit: contain;
	background: #ddd;
}
