/* 3DL Product Gallery */
.tdlg {
	--tdlg-thumb: 84px;
	--tdlg-gap: 10px;
	--tdlg-accent: #d6ac55;
	--tdlg-ui: rgba(18, 18, 16, .6);
	--tdlg-ui-hover: rgba(18, 18, 16, .85);
	position: relative;
}

/* Stage and slides. !important undoes WooCommerce's styles for a gallery without FlexSlider
   (later images shrunk to 25% inline blocks) and the theme's float layout. */
.tdlg .tdlg-stage { position: relative; }
.tdlg .tdlg-track {
	display: flex !important;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	aspect-ratio: var(--tdlg-ratio, 1 / 1);
	margin: 0 !important;
	padding: 0 !important;
	transition: none !important;
	outline: none;
}
.tdlg .tdlg-track::-webkit-scrollbar { display: none; }
.tdlg .tdlg-track:focus-visible { outline: 2px solid var(--tdlg-accent); outline-offset: 2px; }
.tdlg .tdlg-track > .tdlg-slide {
	flex: 0 0 100%;
	width: 100% !important;
	height: 100%;
	display: flex !important;
	float: none !important;
	margin: 0 !important;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	container-type: size;
}
.tdlg .tdlg-slide > a { display: block; width: 100%; height: 100%; outline-offset: -2px; }
.tdlg.tdlg--lightbox .tdlg-slide > a { cursor: zoom-in; }
.tdlg .tdlg-slide > a > img,
.tdlg .tdlg-slide > img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: contain;
	margin: 0;
	box-shadow: none;
	transition: opacity .15s;
}

/* Buttons on the stage */
.tdlg .tdlg-arrow,
.tdlg .tdlg-full,
.tdlg-lb .tdlg-arrow,
.tdlg-lb .tdlg-lb-close {
	position: absolute;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--tdlg-ui, rgba(18, 18, 16, .6));
	color: #fff;
	font: inherit;
	line-height: 1;
	text-indent: 0;
	box-shadow: none;
	cursor: pointer;
	opacity: .9;
	transition: opacity .2s, background-color .2s;
}
.tdlg .tdlg-arrow { top: 50%; transform: translateY(-50%); }
.tdlg .tdlg-prev, .tdlg-lb .tdlg-prev { left: 10px; }
.tdlg .tdlg-next, .tdlg-lb .tdlg-next { right: 10px; }
.tdlg .tdlg-full { top: 10px; right: 10px; width: 40px; height: 40px; }
.tdlg .tdlg-arrow:hover, .tdlg .tdlg-full:hover,
.tdlg-lb .tdlg-arrow:hover, .tdlg-lb .tdlg-lb-close:hover { background: var(--tdlg-ui-hover, rgba(18, 18, 16, .85)); opacity: 1; }
.tdlg .tdlg-arrow:focus-visible, .tdlg .tdlg-full:focus-visible, .tdlg .tdlg-play:focus-visible,
.tdlg-lb button:focus-visible { outline: 2px solid var(--tdlg-accent, #d6ac55); outline-offset: 2px; opacity: 1; }
.tdlg .tdlg-arrow[disabled], .tdlg-lb .tdlg-arrow[disabled] { opacity: 0 !important; pointer-events: none; }
.tdlg svg, .tdlg-lb svg { width: 22px; height: 22px; display: block; }
@media (hover: hover) and (pointer: fine) {
	.tdlg .tdlg-stage:not(:hover):not(:focus-within) .tdlg-arrow,
	.tdlg .tdlg-stage:not(:hover):not(:focus-within) .tdlg-full { opacity: 0; }
}
.tdlg .tdlg-count,
.tdlg-lb .tdlg-count {
	position: absolute;
	left: 10px;
	bottom: 10px;
	z-index: 3;
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--tdlg-ui, rgba(18, 18, 16, .6));
	color: #fff;
	font-size: 13px;
	line-height: 1.6;
	pointer-events: none;
}

/* Video */
.tdlg .tdlg-video, .tdlg-lb .tdlg-video { background: #000; }
.tdlg-video .tdlg-video-box {
	position: relative;
	width: 100%;
	width: min(100cqw, calc(100cqh * var(--tdlg-vr, 1.7778)));
	aspect-ratio: var(--tdlg-vr, 1.7778);
}
.tdlg-video .tdlg-play {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #000;
	cursor: pointer;
}
.tdlg-video .tdlg-play img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
	margin: 0;
}
.tdlg-video .tdlg-play-icon {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 72px;
	height: 72px;
	margin: -36px 0 0 -36px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .6);
	box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .9);
	transition: transform .2s, background-color .2s;
}
.tdlg-video .tdlg-play-icon::after {
	content: "";
	position: absolute;
	left: 29px;
	top: 22px;
	border-style: solid;
	border-width: 14px 0 14px 22px;
	border-color: transparent transparent transparent #fff;
}
.tdlg-video .tdlg-play:hover .tdlg-play-icon { transform: scale(1.08); background: var(--tdlg-accent, #d6ac55); }
.tdlg-video .tdlg-player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.tdlg-video.is-playing .tdlg-play { visibility: hidden; }
/* Keep the player's own controls (top right, progress bar) clear */
.tdlg .tdlg-stage:has(.is-playing) .tdlg-full,
.tdlg .tdlg-stage:has(.is-playing) .tdlg-count { display: none; }

/* Thumbnail strip: one row that scrolls. !important undoes WooCommerce's 4-per-row float grid. */
.tdlg .tdlg-thumbs {
	display: flex !important;
	gap: var(--tdlg-gap);
	overflow-x: auto;
	overflow-y: hidden;
	margin: var(--tdlg-gap) 0 0 !important;
	padding: 2px !important;
	list-style: none !important;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
	overscroll-behavior-x: contain;
}
.tdlg .tdlg-thumbs li {
	flex: 0 0 var(--tdlg-thumb);
	width: var(--tdlg-thumb) !important;
	float: none !important;
	clear: none !important;
	margin: 0 !important;
	padding: 0;
	list-style: none !important;
	scroll-snap-align: start;
}
.tdlg .tdlg-thumb {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background: rgba(127, 127, 127, .15);
	overflow: hidden;
	cursor: pointer;
}
.tdlg .tdlg-thumb img,
.tdlg .tdlg-thumb-poster {
	display: block;
	width: 100% !important;
	height: 100% !important;
	margin: 0;
	object-fit: cover;
	background: center / cover no-repeat;
	opacity: .55;
	transition: opacity .2s;
}
.tdlg .tdlg-thumb:hover img, .tdlg .tdlg-thumb.is-active img,
.tdlg .tdlg-thumb:hover .tdlg-thumb-poster, .tdlg .tdlg-thumb.is-active .tdlg-thumb-poster { opacity: 1; }
.tdlg .tdlg-thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 2px solid transparent;
	border-radius: inherit;
	pointer-events: none;
}
.tdlg .tdlg-thumb.is-active::after { border-color: var(--tdlg-accent); }
.tdlg .tdlg-thumb:focus-visible { outline: 2px solid var(--tdlg-accent); outline-offset: 2px; }
.tdlg .tdlg-thumb--video::before {
	content: "";
	position: absolute;
	z-index: 1;
	left: 50%;
	top: 50%;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .65) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 12'%3E%3Cpath d='M0 0l10 6-10 6z' fill='%23fff'/%3E%3C/svg%3E") 57% 50% / 10px 12px no-repeat;
}

/* Thumbnails in a column left of the photo (setting), from tablet width up */
@media (min-width: 768px) {
	.tdlg.tdlg--thumbs-left {
		display: grid;
		grid-template-columns: var(--tdlg-thumb) minmax(0, 1fr);
		gap: var(--tdlg-gap);
	}
	.tdlg.tdlg--thumbs-left .tdlg-stage { grid-column: 2; grid-row: 1; }
	.tdlg.tdlg--thumbs-left .tdlg-thumbs {
		grid-column: 1;
		grid-row: 1;
		flex-direction: column;
		height: 0;
		min-height: 100%;
		margin: 0 !important;
		overflow-x: hidden;
		overflow-y: auto;
		scroll-snap-type: y proximity;
		overscroll-behavior-y: contain;
	}
	.tdlg.tdlg--thumbs-left .tdlg-thumbs li { flex: 0 0 auto; }
}

/* Lightbox */
html.tdlg-lock { overflow: hidden; }
.tdlg-lb {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(12, 12, 11, .97);
	color: #fff;
	overflow: hidden;
}
.tdlg-lb::backdrop { background: rgba(0, 0, 0, .6); }
.tdlg-lb .tdlg-lbg { position: relative; width: 100%; height: 100%; }
.tdlg-lb .tdlg-track {
	display: flex;
	width: 100%;
	height: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior: contain;
	outline: none;
}
.tdlg-lb .tdlg-track::-webkit-scrollbar { display: none; }
.tdlg-lb .tdlg-slide {
	flex: 0 0 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
	scroll-snap-align: start;
	scroll-snap-stop: always;
	container-type: size;
}
.tdlg-lb figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
}
.tdlg-lb .tdlg-lb-img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100vw;
	max-height: 100vh;
	max-height: 100dvh;
	object-fit: contain;
	cursor: zoom-in;
}
.tdlg-lb figure:has(figcaption) .tdlg-lb-img { max-height: calc(100dvh - 48px); }
.tdlg-lb figcaption { padding: 10px 16px; font-size: 14px; line-height: 1.4; text-align: center; color: rgba(255, 255, 255, .8); }
.tdlg-lb .tdlg-slide.is-zoomed { display: block; overflow: auto; overscroll-behavior: contain; }
.tdlg-lb .is-zoomed figure { display: block; width: max-content; max-width: none; max-height: none; margin: auto; }
.tdlg-lb .is-zoomed .tdlg-lb-img { max-width: none; max-height: none; cursor: zoom-out; }
.tdlg-lb .tdlg-arrow { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.tdlg-lb .tdlg-prev { left: 16px; }
.tdlg-lb .tdlg-next { right: 16px; }
.tdlg-lb .tdlg-lb-close { top: 14px; right: 14px; }
.tdlg-lb .tdlg-count { left: 16px; bottom: auto; top: 20px; }
/* Room above and below the video for the close button and the counter */
.tdlg-lb .tdlg-video .tdlg-video-box { width: min(calc(100cqw - 32px), calc((100cqh - 136px) * var(--tdlg-vr, 1.7778))); }
@media (max-width: 767px) {
	.tdlg-lb .tdlg-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.tdlg *, .tdlg-lb * { transition: none !important; }
}
