/**
 * AUTOOL Product Media — full styling.
 *
 * The critical display toggles (which gallery/pane shows at which viewport)
 * are inlined in wp_head by GalleryRenderer::print_critical_css(); this file
 * only carries presentation. The custom strip starts at 768px; the overall
 * tablet product header can be stacked or use desktop-like columns.
 *
 * Sizing/appearance knobs arrive as CSS vars set inline on .autool-pm from
 * the settings page: --autool-pm-slide, --autool-pm-slide-gap,
 * --autool-pm-ratio, --autool-pm-thumb,
 * --autool-pm-thumb-gap, --autool-pm-thumb-radius, --autool-pm-arrow,
 * --autool-pm-media-radius, --autool-pm-media-border.
 *
 * A sitewide reset `:where(button,…){border-radius:…!important}` flattens
 * button corners, so every rounded button control here needs !important.
 */

/* ---------------------------------------------------------------- strip */

.autool-pm__media {
	position: relative;
	box-sizing: border-box;
	overflow: hidden;
	border: var(--autool-pm-media-border, 0 solid #e5e5e5);
	border-radius: var(--autool-pm-media-radius, 6px);
	background: #fff;
}

	.autool-pm__viewport {
	display: flex;
	gap: var(--autool-pm-slide-gap, 2px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	outline: none;
	cursor: grab;
}

.autool-pm__viewport::-webkit-scrollbar {
	display: none;
}

/* While mouse-dragging or settling after a flick: no snap, so the strip
   follows the pointer / the JS-chosen target freely. */
.autool-pm__viewport.is-dragging,
.autool-pm__thumbs.is-dragging {
	scroll-snap-type: none;
	scroll-behavior: auto;
	cursor: grabbing;
}

.autool-pm__viewport.is-dragging img {
	pointer-events: none;
}

.autool-pm__slide {
	position: relative;
	flex: 0 0 var(--autool-pm-slide, 88%);
	scroll-snap-align: start;
	aspect-ratio: var(--autool-pm-ratio, 1 / 1);
	background: #fff;
}

.autool-pm--has-system-lightbox .autool-pm__slide.is-active {
	cursor: zoom-in;
}

.autool-pm--natural .autool-pm__slide {
	aspect-ratio: auto;
	align-self: flex-start;
}

.autool-pm__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	-webkit-user-drag: none;
	user-select: none;
}

.autool-pm--natural .autool-pm__slide img {
	height: auto;
}

/* ----------------------------------------------------- video indicators */

/* Blocksy's attachment-video indicator is retained verbatim when an image
   has Blocksy Pro video metadata. AUTOOL-only videos use a real button with
   the same centered 40px visual language. The dark halo keeps either icon
   obvious over white product photography. */
.autool-pm__video-indicator {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	padding: 7px;
	transform: translate(-50%, -50%);
	border: 0;
	border-radius: 50% !important;
	background: rgba(17, 17, 17, 0.62);
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

.autool-pm__video-indicator svg {
	display: block;
	width: 40px;
	height: 40px;
	flex: 0 0 40px;
}

.autool-pm__video-indicator:hover {
	transform: translate(-50%, -50%) scale(1.08);
	background: rgba(17, 17, 17, 0.76);
}

.autool-pm__video-indicator:focus-visible {
	outline: 3px solid var(--theme-palette-color-1, #0161e0);
	outline-offset: 3px;
}

.autool-pm__slide > .ct-video-indicator svg {
	box-sizing: content-box;
	width: 40px;
	height: 40px;
	padding: 7px;
	border-radius: 50%;
	background: rgba(17, 17, 17, 0.62);
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

/* --------------------------------------------------------------- arrows */

/* Circular frosted-glass arrows (Anker-style): translucent white +
   backdrop blur, hairline border, subtle shadow. */
.autool-pm__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--autool-pm-arrow, 48px);
	height: var(--autool-pm-arrow, 48px);
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.55);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: #1a1a1a;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	z-index: 4;
	transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.autool-pm__arrow:hover {
	transform: translateY(-50%) scale(1.06);
	background: rgba(255, 255, 255, 0.75);
}

.autool-pm__arrow--prev {
	left: 14px;
}

.autool-pm__arrow--prev svg {
	transform: rotate(180deg);
}

.autool-pm__arrow--next {
	right: 14px;
}

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

/* --------------------------------------------------------------- badges */

.autool-pm-badge {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 5;
	align-items: center;
	padding: 6px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.01em;
	pointer-events: none;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.autool-pm-badge--dark {
	background: #111;
	color: #fff;
}

.autool-pm-badge--accent {
	background: var(--theme-palette-color-1, #0161e0);
	color: #fff;
}

/* Blocksy's badge slot lives inside this container; anchor our overlay copy
   to it when the default flexy gallery is the visible one. Low-specificity
   :where() so the critical CSS absolute-parking rule always wins. */
:where(.single-product) .ct-product-gallery-container {
	position: relative;
}

.autool-pm__sale {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 5;
}

.autool-pm__sale .onsale {
	position: static;
	display: inline-block;
}

/* --------------------------------------------------------------- thumbs */

/* Single-row thumbnail strip: never wraps; overflow scrolls (mouse drag,
   touch swipe, or clicking a partially visible thumb). Scrollbar hidden. */
.autool-pm__thumbs {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--autool-pm-thumb-gap, 4px);
	margin-top: 12px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
}

.autool-pm__thumbs::-webkit-scrollbar {
	display: none;
}

/* Hidden by default; the critical state rules reveal the desktop video row
   only while Video is active. Higher specificity beats the base flex rule. */
.autool-pm__thumbs.autool-pm__thumbs--videos {
	display: none;
}

.autool-pm__thumb {
	position: relative;
	flex: 0 0 var(--autool-pm-thumb, 56px);
	width: var(--autool-pm-thumb, 56px);
	height: var(--autool-pm-thumb, 56px);
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--autool-pm-thumb-radius, 4px) !important;
	overflow: hidden;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.autool-pm__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-user-drag: none;
	user-select: none;
}

.autool-pm__thumb:hover {
	border-color: rgba(0, 0, 0, 0.35);
}

.autool-pm__thumb.is-active {
	border-color: #111;
}

/* Video thumbnails: poster + small play glyph. */
.autool-pm__thumb--video {
	background: #000;
}

.autool-pm__thumb--video img {
	opacity: 0.85;
}

.autool-pm__thumb-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	pointer-events: none;
}

/* ---------------------------------------------------------- video panes */

/* Desktop overlay layer: covers the media box exactly, so switching to
   Video never moves anything below. */
.autool-pm__video-layer {
	position: absolute;
	inset: 0;
	z-index: 6;
	background: #000;
}

/* Standalone pane (mobile / desktop without the strip layout). */
.autool-pm-switch__pane {
	position: relative;
	box-sizing: border-box;
	margin-top: 12px;
	aspect-ratio: 16 / 9;
	border: var(--autool-pm-media-border, 0 solid #e5e5e5);
	border-radius: var(--autool-pm-media-radius, 8px);
	overflow: hidden;
	background: #000;
}

.autool-pm__video-content {
	position: absolute;
	inset: 0;
}

/* Click-to-play facade shared by both panes. */
.autool-pm-facade {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: #000;
	cursor: pointer;
}

.autool-pm-facade img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0.85;
	transition: opacity 0.15s ease;
}

.autool-pm-facade:hover img {
	opacity: 1;
}

.autool-pm-facade__play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.autool-pm__video-layer iframe,
.autool-pm-switch__pane iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Multi-video navigation stays above the facade/iframe. Both pane copies are
   kept synchronized by JS, so the same controls work on desktop and phone. */
.autool-pm__video-arrow {
	position: absolute;
	top: 50%;
	z-index: 8;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	transform: translateY(-50%);
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.72);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: #171717;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease;
}

.autool-pm__video-arrow:hover {
	transform: translateY(-50%) scale(1.06);
	background: rgba(255, 255, 255, 0.9);
}

.autool-pm__video-arrow:focus-visible {
	outline: 3px solid var(--theme-palette-color-1, #0161e0);
	outline-offset: 2px;
}

.autool-pm__video-arrow--prev {
	left: 14px;
}

.autool-pm__video-arrow--prev svg {
	transform: rotate(180deg);
}

.autool-pm__video-arrow--next {
	right: 14px;
}

.autool-pm__video-counter {
	display: none;
}

/* --------------------------------------------------- images/video switch */

/* Anker reference geometry: contiguous rectangular tabs, 17px SVG, 14/21
   type and 5px/8px button padding. The switch has a consistent 9px vertical
   margin at every responsive size. */
.autool-pm-switch__tabs {
	display: flex;
	justify-content: flex-start;
	gap: 0;
	margin: 9px 0;
}

.autool-pm-switch__tabs button {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 0 !important;
	margin: 0;
	padding: 5px 8px;
	border: 0;
	border-radius: 0 !important;
	background: transparent;
	color: #1d1d1f;
	font-size: 14px;
	font-weight: 600;
	line-height: 21px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.autool-pm-switch__tabs button svg {
	flex: 0 0 17px;
	width: 17px;
	height: 17px;
}

.autool-pm-switch__tabs button:hover {
	background: rgba(0, 0, 0, 0.06);
}

.autool-pm-switch__tabs button.is-active {
	background: #1d1d1f;
	color: #fff;
}

/* Mobile video thumb row inside the switch block. */
.autool-pm-switch__vthumbs {
	margin-top: 10px;
}

/* A single desktop video thumbnail is a deliberate spacer that keeps the
   switch at the same Y position as Images. The redundant mobile copy hides. */
.autool-pm-switch__vthumbs.autool-pm__thumbs--single {
	display: none !important;
}

@media (max-width: 767.98px) {
	body.autool-single-gallery-anker-style.autool-single-gallery-mobile-full-bleed.single-product .woocommerce-product-gallery {
		margin-bottom: 18px !important;
	}

	.autool-pm-switch--mobile .autool-pm-switch__tabs {
		justify-content: center;
		margin-bottom: 0;
	}

	/* Phones use arrows + counter for multi-video navigation. Never expose the
	   separate poster-thumbnail gallery, including during desktop→phone resize. */
	.autool-pm-switch--mobile .autool-pm-switch__vthumbs {
		display: none !important;
	}

	.autool-pm-switch__pane .autool-pm__video-arrow {
		width: 40px;
		height: 40px;
	}

	.autool-pm-switch__pane .autool-pm__video-arrow--prev {
		left: 12px;
	}

	.autool-pm-switch__pane .autool-pm__video-arrow--next {
		right: 12px;
	}

	/* Match the site's existing mobile image counter: bottom/right 12px,
	   dark translucent pill, white 12px text and 1/N format. */
	.autool-pm-switch__pane .autool-pm__video-counter {
		position: absolute;
		right: 12px;
		bottom: 12px;
		z-index: 8;
		display: flex;
		align-items: center;
		justify-content: center;
		min-width: 48px;
		height: 28px;
		padding: 0 10px;
		border-radius: 999px;
		background: rgba(26, 29, 32, 0.82);
		color: #fff;
		font-size: 12px;
		font-weight: 600;
		line-height: 1;
		pointer-events: none;
	}

	/* Replace the mobile image gallery with an equal-height video slot and
	   keep the Anker-style tabs below it at the same document position. */
	.autool-pm-video-on .autool-pm-switch--mobile {
		display: flex;
		flex-direction: column;
	}

	.autool-pm-video-on .autool-pm-switch--mobile .autool-pm-switch__pane {
		order: 1;
		height: var(--autool-pm-mobile-slot-height, 100vw);
		margin-top: 0;
		aspect-ratio: auto;
	}

	.autool-pm-video-on .autool-pm-switch--mobile .autool-pm-switch__tabs {
		order: 2;
	}

}
