/* Technique Video Carousel v1.0.0 */

.twvc {
	--twvc-bg: #f5f5f3;
	--twvc-ink: #1d1d1b;
	--twvc-gap: 6px;
	--twvc-edge: 18px;
	--twvc-pv: var(--twvc-pv-m, 1.4);
	background: var(--twvc-bg);
	color: var(--twvc-ink);
	padding: clamp(40px, 6vw, 88px) 0;
}

@media (min-width: 640px)  { .twvc { --twvc-pv: var(--twvc-pv-t, 2.5); } }
@media (min-width: 1024px) { .twvc { --twvc-pv: var(--twvc-pv-d, 4); } }

.twvc .twvc__title {
	margin: 0 var(--twvc-edge) clamp(24px, 3vw, 44px);
	font-family: var(--twvc-heading-font, inherit);
	font-size: clamp(28px, 3.4vw, 50px);
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.005em;
	text-align: center;
	color: inherit;
}

.twvc__viewport {
	position: relative;
	padding: 0 var(--twvc-edge);
}

/* Track */
.twvc .twvc__track {
	display: flex;
	gap: var(--twvc-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.twvc .twvc__track::-webkit-scrollbar { display: none; }

.twvc .twvc__slide {
	flex: 0 0 calc((100% - (var(--twvc-pv) - 1) * var(--twvc-gap)) / var(--twvc-pv));
	margin: 0;
	padding: 0;
	scroll-snap-align: start;
}
.twvc .twvc__slide::before,
.twvc .twvc__slide::marker { content: none; }

/* Tile (fixed 3:4 — preview crop maths below depends on it) */
.twvc__tile {
	position: relative;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	background: #e6e4df;
	isolation: isolate;
}

.twvc .twvc__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	transition: transform .9s cubic-bezier(.2, .7, .2, 1);
}

/* Muted autoplay preview, cover-cropped */
.twvc__preview {
	position: absolute;
	inset: 0;
	overflow: hidden;
	opacity: 0;
	transition: opacity .7s ease;
	pointer-events: none;
}
.twvc__tile.is-playing .twvc__preview { opacity: 1; }

.twvc .twvc__preview iframe {
	position: absolute;
	top: 50%;
	left: 50%;
	max-width: none;
	border: 0;
	pointer-events: none;
	transform: translate(-50%, -50%) scale(1.06);
}
/* 16:9 in a 3:4 tile → width = (16/9) / (3/4) = 237.04% */
.twvc__tile--video .twvc__preview iframe { width: 237.04%; height: 100%; }
/* 9:16 in a 3:4 tile → height = (3/4) / (9/16) = 133.34% */
.twvc__tile--short .twvc__preview iframe { width: 100%; height: 133.34%; }

/* Shade */
.twvc__shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0) 38%);
	pointer-events: none;
	transition: background-color .35s ease;
}

/* Large centre play (hover / focus) */
.twvc__play-lg {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 72px;
	height: 72px;
	margin: -36px 0 0 -36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .96);
	color: var(--twvc-ink);
	display: grid;
	place-items: center;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
	opacity: 0;
	transform: scale(.82);
	transition: opacity .3s ease, transform .35s cubic-bezier(.2, .7, .2, 1);
	pointer-events: none;
}
.twvc__play-lg svg { width: 28px; height: 28px; margin-left: 4px; fill: currentColor; }

/* Small bottom-left play */
.twvc__meta {
	position: absolute;
	left: 14px;
	right: 14px;
	bottom: 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	color: #fff;
	pointer-events: none;
	transition: opacity .3s ease;
}
.twvc__play-sm {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: var(--twvc-ink);
	display: grid;
	place-items: center;
}
.twvc__play-sm svg { width: 13px; height: 13px; margin-left: 2px; fill: currentColor; }
.twvc__caption {
	font-size: 14px;
	line-height: 1.3;
	text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* Click target */
.twvc .twvc__hit {
	position: absolute;
	inset: 0;
	z-index: 3;
	cursor: pointer;
	text-decoration: none;
	border: 0;
}
.twvc .twvc__hit:focus { outline: none; }
.twvc .twvc__hit:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -6px;
}

/* Hover / focus states */
@media (hover: hover) {
	.twvc__tile:hover .twvc__poster { transform: scale(1.035); }
	.twvc__tile:hover .twvc__shade { background-color: rgba(0, 0, 0, .16); }
	.twvc__tile:hover .twvc__play-lg { opacity: 1; transform: scale(1); }
	.twvc__tile:hover .twvc__play-sm { opacity: 0; }
}
.twvc__tile:focus-within .twvc__play-lg { opacity: 1; transform: scale(1); }
.twvc__tile:focus-within .twvc__play-sm { opacity: 0; }
.twvc__play-sm { transition: opacity .3s ease; }

/* Arrows */
.twvc .twvc__nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	width: 48px;
	height: 48px;
	margin: -24px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .94);
	color: var(--twvc-ink);
	display: grid;
	place-items: center;
	line-height: 0;
	cursor: pointer;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
	-webkit-appearance: none;
	appearance: none;
	transition: opacity .25s ease, transform .25s ease;
}
.twvc .twvc__nav svg { width: 20px; height: 20px; }
.twvc .twvc__nav:hover { transform: scale(1.06); }
.twvc .twvc__nav:focus-visible { outline: 2px solid var(--twvc-ink); outline-offset: 3px; }
.twvc .twvc__nav:disabled { opacity: 0; pointer-events: none; }
.twvc .twvc__nav[hidden] { display: none; }
.twvc .twvc__nav--prev { left: calc(var(--twvc-edge) + 16px); }
.twvc .twvc__nav--next { right: calc(var(--twvc-edge) + 16px); }

@media (max-width: 639px) {
	.twvc .twvc__nav { display: none; }
}

/* Lightbox */
.twvc-lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: grid;
	place-items: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility .3s ease;
}
.twvc-lb.is-open { opacity: 1; visibility: visible; }

.twvc-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(14, 14, 12, .9);
	cursor: zoom-out;
}

.twvc-lb__frame {
	position: relative;
	background: #000;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
	transform: scale(.96);
	transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
.twvc-lb.is-open .twvc-lb__frame { transform: none; }
.twvc-lb__frame--video { width: min(92vw, calc(84vh * 16 / 9)); aspect-ratio: 16 / 9; }
.twvc-lb__frame--short { width: min(92vw, calc(88vh * 9 / 16)); aspect-ratio: 9 / 16; }
.twvc-lb__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.twvc-lb__close {
	position: absolute;
	top: max(16px, env(safe-area-inset-top));
	right: 16px;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	display: grid;
	place-items: center;
	line-height: 0;
	cursor: pointer;
	transition: background-color .2s ease;
}
.twvc-lb__close:hover { background: rgba(255, 255, 255, .26); }
.twvc-lb__close:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.twvc-lb__close svg { width: 20px; height: 20px; }

html.twvc-lock,
html.twvc-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.twvc .twvc__track { scroll-behavior: auto; }
	.twvc *, .twvc-lb, .twvc-lb * { transition-duration: .01ms !important; }
}
