/* Tot ce e configurabil trece prin variabile, ca să poți suprascrie din Bricks. */
.wygv {
    --wygv-thumb-track: calc((100% - (var(--wygv-thumb-columns, 5) - 1) * var(--wygv-gap, 10px)) / var(--wygv-thumb-columns, 5));

	position: relative;

	display: block;
	width: 100%;
}

/* Plasa de siguranta: daca ratio-ul e invalid sau gol, imaginea isi pastreaza
   proportiile naturale in loc sa se prabuseasca la inaltime 0. */
.wygv__viewport {
	min-height: 1px;
}

.wygv__inner {
	display: flex;
	flex-direction: column;
	gap: var(--wygv-gap, 10px);
}

/* Miniaturile in stanga: coloana e scoasa din flux si ancorata de stage.
   Asa capata o inaltime de referinta reala (inaltimea imaginii mari), fata de
   care max-height se poate calcula si scroll-ul chiar functioneaza. */
.wygv--thumbs-left .wygv__inner {
	display: block;
	position: relative;
	padding-left: calc(var(--wygv-thumb-w, 92px) + var(--wygv-gap, 10px));
}

.wygv--thumbs-none .wygv__thumbs {
	display: none;
}

/* ---------- Zona mare ---------- */

.wygv__stage {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
}

.wygv__viewport {
	overflow: hidden;
	position: relative;
	aspect-ratio: var(--wygv-ratio, 1 / 1);
}

.wygv__viewport:focus-visible {
	outline: 2px solid var(--wygv-accent, currentColor);
	outline-offset: 3px;
}

.wygv__track {
	display: flex;
	height: 100%;
	transition: transform var(--wygv-ease, 420ms cubic-bezier(.22, .61, .36, 1));
	will-change: transform;
}

.wygv__slide {
	flex: 0 0 100%;
	position: relative;
	height: 100%;
}

.wygv__slide.is-zoomable {
	cursor: zoom-in;
}

.wygv__media {
	position: relative;
	width: 100%;
	height: 100%;
}

.wygv__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: var(--wygv-fit, contain);
	object-position: top center;
}

/* ---------- Player ---------- */

.wygv__player,
.wygv__player iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.wygv__player {
	opacity: 0;
	pointer-events: none;
	transition: opacity 260ms ease;
}

.wygv__slide--video.is-loaded .wygv__player {
	opacity: 1;
	pointer-events: auto;
}

/* Posterul rămâne dedesubt până când player-ul e gata. */
.wygv__slide--video.is-loaded .wygv__image {
	opacity: 0;
	transition: opacity 260ms ease;
}

/* ---------- Butonul central play/pause ---------- */

.wygv__playpause {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 3;
	display: grid;
	place-items: center;
	width: var(--wygv-play-size, 68px);
	height: var(--wygv-play-size, 68px);
	padding: 0;
	border: 0;
	border-radius: var(--wygv-btn-radius, 50%);
	background: var(--wygv-btn-bg, rgba(255, 255, 255, .92));
	color: var(--wygv-btn-color, #111);
	cursor: pointer;
	box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
	transition: transform 180ms ease, opacity 220ms ease;
}

.wygv__playpause:hover {
	transform: translate(-50%, -50%) scale(1.06);
}

.wygv__playpause .wygv__icon {
	width: 42%;
	height: 42%;
	fill: currentColor;
}

.wygv__playpause .wygv__icon--play {
	margin-left: 8%; /* centrare optică a triunghiului */
}

.wygv__playpause .wygv__icon--pause,
.wygv__slide.is-playing .wygv__playpause .wygv__icon--play {
	display: none;
}

.wygv__slide.is-playing .wygv__playpause .wygv__icon--pause {
	display: block;
	margin-left: 0;
}

/* Când rulează, butonul se retrage și apare la hover. */
.wygv__slide.is-playing .wygv__playpause {
	opacity: 0;
}

.wygv__slide.is-playing:hover .wygv__playpause,
.wygv__slide.is-playing .wygv__playpause:focus-visible {
	opacity: 1;
}

/* ---------- Buton sunet ---------- */

.wygv__sound {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: var(--wygv-btn-radius, 50%);
	background: var(--wygv-btn-bg, rgba(255, 255, 255, .92));
	color: var(--wygv-btn-color, #111);
	cursor: pointer;
}

.wygv__sound .wygv__icon {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.wygv__sound .wygv__icon--muted,
.wygv__sound.is-muted .wygv__icon--unmuted {
	display: none;
}

.wygv__sound.is-muted .wygv__icon--muted {
	display: block;
}

/* ---------- Săgeți laterale ---------- */

.wygv__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: grid;
	place-items: center;
	width: var(--wygv-nav-size, 42px);
	height: var(--wygv-nav-size, 42px);
	padding: 0;
	border: 0;
	border-radius: var(--wygv-btn-radius, 50%);
	background: var(--wygv-btn-bg, rgba(255, 255, 255, .92));
	color: var(--wygv-btn-color, #111);
	cursor: pointer;
	opacity: 0;
	transition: opacity 200ms ease;
}

.wygv__stage:hover .wygv__nav,
.wygv__nav:focus-visible {
	opacity: 1;
}

@media (hover: none) {
	.wygv__nav {
		opacity: 1;
	}
}

.wygv__nav[disabled] {
	opacity: .25 !important;
	cursor: default;
}

.wygv__nav svg {
	width: 45%;
	height: 45%;
}

.wygv__nav--prev {
	left: 12px;
}

.wygv__nav--next {
	right: 12px;
}

.wygv__zoom {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: var(--wygv-btn-radius, 50%);
	background: var(--wygv-btn-bg, rgba(255, 255, 255, .92));
	color: var(--wygv-btn-color, #111);
	cursor: pointer;
	opacity: 0;
	transition: opacity 200ms ease;
}

.wygv__stage:hover .wygv__zoom,
.wygv__zoom:focus-visible {
	opacity: 1;
}

.wygv__zoom svg {
	width: 17px;
	height: 17px;
}

/* ---------- Miniaturi ---------- */

.wygv__thumbs-wrap {
	position: relative;
	min-width: 0;
}

.wygv__thumbs {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: var(--wygv-thumb-track);
	gap: var(--wygv-gap, 10px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;

	/* Bara nativa e inlocuita cu sageti la hover. */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.wygv__thumbs::-webkit-scrollbar {
	width: 0;
	height: 0;
}

.wygv--thumbs-left .wygv__thumbs-wrap {
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	width: var(--wygv-thumb-w, 92px);
	height: fit-content;

	/* Cat e mai mic: inaltimea imaginii mari, sau numarul de miniaturi cerut.
	   Restul raman ascunse si se ajunge la ele cu sagetile sau prin swipe. */
	max-height: min(
		100%,
		calc(
			var(--wygv-thumb-columns, 5) * var(--wygv-thumb-w, 92px) +
			(var(--wygv-thumb-columns, 5) - 1) * var(--wygv-gap, 10px)
		)
	);
}

.wygv--thumbs-left .wygv__thumbs {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	grid-auto-flow: row;
	grid-auto-columns: auto;
	grid-auto-rows: min-content;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	scroll-snap-type: y proximity;
}

.wygv__thumb {
	position: relative;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	scroll-snap-align: start;
	aspect-ratio: 1 / 1;
	opacity: .55;
	transition: opacity 200ms ease;
}

.wygv__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 2px solid transparent;
	transition: border-color 200ms ease;
	pointer-events: none;
}

.wygv__thumb:hover,
.wygv__thumb.is-active {
	opacity: 1;
}

.wygv__thumb.is-active::after {
	border-color: var(--wygv-accent, currentColor);
}

.wygv__thumb:focus-visible {
	outline: 2px solid var(--wygv-accent, currentColor);
	outline-offset: 2px;
}

.wygv__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wygv__thumb-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--wygv-btn-bg, rgba(255, 255, 255, .92));
	color: var(--wygv-btn-color, #111);
}

.wygv__thumb-play svg {
	width: 12px;
	height: 12px;
	fill: currentColor;
	margin-left: 1px;
}

/* ---------- Ecrane mici ----------
   Comutarea miniaturilor (stanga -> jos) se genereaza in template, ca media
   query scopat pe instanta, cu breakpoint-ul ales din Bricks. */

@media (max-width: 480px) {
	.wygv {
		--wygv-thumb-columns: 4;
	}
}

/* Estompare la capete cat timp mai e continut de derulat. */
.wygv__thumbs.is-scroll-y.is-scrollable {
	mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.wygv__thumbs.is-scroll-y.is-scrollable.at-start {
	mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 22px), transparent 100%);
}

.wygv__thumbs.is-scroll-y.is-scrollable.at-end {
	mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 100%);
}

.wygv__thumbs.is-scroll-x.is-scrollable {
	mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.wygv__thumbs.is-scroll-x.is-scrollable.at-start {
	mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 22px), transparent 100%);
}

.wygv__thumbs.is-scroll-x.is-scrollable.at-end {
	mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 100%);
}

.wygv__thumbs.is-scrollable.at-start.at-end {
	mask-image: none;
}

/* ---------- Sageti pentru banda de miniaturi ---------- */

.wygv__tnav {
	position: absolute;
	z-index: 2;
	display: none;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: var(--wygv-btn-radius, 50%);
	background: var(--wygv-btn-bg, rgba(255, 255, 255, .92));
	color: var(--wygv-btn-color, #111);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
	cursor: pointer;
	opacity: 0;
	transition: opacity 180ms ease, transform 180ms ease;
}

/* Apar doar cand chiar mai e continut de derulat. */
.wygv__thumbs.is-scrollable ~ .wygv__tnav {
	display: grid;
}

.wygv__thumbs-wrap:hover .wygv__tnav,
.wygv__tnav:focus-visible {
	opacity: 1;
}

.wygv__tnav[disabled] {
	opacity: 0;
	pointer-events: none;
}

.wygv__tnav svg {
	width: 15px;
	height: 15px;
}

/* Banda orizontala: sageti stanga / dreapta. */
.wygv__thumbs.is-scroll-x ~ .wygv__tnav--prev {
	top: 50%;
	left: 6px;
	transform: translateY(-50%);
}

.wygv__thumbs.is-scroll-x ~ .wygv__tnav--next {
	top: 50%;
	right: 6px;
	transform: translateY(-50%);
}

/* Banda verticala: aceleasi sageti, rotite, sus / jos. */
.wygv__thumbs.is-scroll-y ~ .wygv__tnav--prev {
	top: 6px;
	left: 50%;
	transform: translateX(-50%) rotate(90deg);
}

.wygv__thumbs.is-scroll-y ~ .wygv__tnav--next {
	bottom: 6px;
	left: 50%;
	transform: translateX(-50%) rotate(90deg);
}

/* Pe touch se face swipe; sagetile ar sta degeaba peste imagini. */
@media (hover: none) {
	.wygv__tnav {
		display: none !important;
	}
}

/* ---------- Lightbox ---------- */

html.wygv-lb-open {
	overflow: hidden;
}

.wygv-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 5vw, 64px);
	background: rgba(12, 12, 12, .84);
	animation: wygv-fade 200ms ease;
}

@keyframes wygv-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.wygv-lb__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	overflow: hidden;
	touch-action: none;
}

/* Cursorul anunta exact ce face clickul: pe imagine zoom, pe fundal inchidere. */
.wygv-lb__img {
	cursor: zoom-in;
}

.wygv-lb.is-zoomed .wygv-lb__img {
	cursor: zoom-out;
}

.wygv-lb.is-zoomed .wygv-lb__img:active {
	cursor: grabbing;
}

.wygv-lb__img {
	display: block;
	max-width: none;
	max-height: none;
	transform-origin: center center;
	will-change: transform;
	user-select: none;
	-webkit-user-drag: none;
}

.wygv-lb__bar {
	position: absolute;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 5px 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .1);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: 13px;
}

.wygv-lb__zoom {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.wygv-lb__zoom:hover {
	background: rgba(255, 255, 255, .18);
}

.wygv-lb__zoom svg {
	width: 15px;
	height: 15px;
}

.wygv-lb__pct {
	min-width: 48px;
	text-align: center;
	font-variant-numeric: tabular-nums;
	letter-spacing: .02em;
}

.wygv-lb__close,
.wygv-lb__nav {
	position: absolute;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	cursor: pointer;
	transition: background 180ms ease;
}

.wygv-lb__close:hover,
.wygv-lb__nav:hover {
	background: rgba(255, 255, 255, .24);
}

.wygv-lb__close {
	top: 18px;
	right: 18px;
}

.wygv-lb__nav--prev {
	left: 18px;
}

.wygv-lb__nav--next {
	right: 18px;
}

.wygv-lb__close svg,
.wygv-lb__nav svg {
	width: 20px;
	height: 20px;
}

.wygv-lb__counter {
	padding-left: 8px;
	margin-left: 4px;
	border-left: 1px solid rgba(255, 255, 255, .22);
	color: rgba(255, 255, 255, .7);
	font-variant-numeric: tabular-nums;
	letter-spacing: .04em;
}

/* ---------- Accesibilitate ---------- */

@media (prefers-reduced-motion: reduce) {
	.wygv__track,
	.wygv__nav,
	.wygv__zoom,
	.wygv__playpause,
	.wygv__thumb,
	.wygv-lb__img,
	.wygv-lb {
		transition: none;
		animation: none;
	}
}
