/**
 * Speed Train Product Media Gallery
 *
 * Everything themeable is a custom property on .st-pg so the Elementor style
 * controls can set it without a stylesheet-specificity fight with the theme.
 */

.st-pg {
	--st-pg-ratio: 1/1;
	--st-pg-bg: #f6f6f6;
	--st-pg-radius: 0px;

	/* Defaults match the gallery this replaces on cutthat.com: a black chip with
	   a #ffcc00 chevron, 5px corners, 23px on the stage and 18px on the strip.
	   All of it is overridden by the widget's Style tab. */
	--st-pg-arrow-color: #ffcc00;
	--st-pg-arrow-bg: #000000;
	--st-pg-arrow-size: 23px;
	--st-pg-arrow-pad: 6px;
	--st-pg-arrow-radius: 5px;
	--st-pg-thumb-nav-size: 18px;

	--st-pg-thumb-cols: 4;
	--st-pg-thumb-gap: 10px;
	--st-pg-thumb-border-width: 2px;
	--st-pg-thumb-border: transparent;
	--st-pg-thumb-active: #ffcc00;
	--st-pg-play-bg: rgba(20, 20, 20, 0.75);

	/* Ring style, matching the play button the Jet gallery used here. */
	--st-pg-play-color: #ffcc00;
	--st-pg-play-ring-width: 5px;
	--st-pg-play-ring-pad: 20px;
	--st-pg-play-ring-size: 40px;

	display: flex;
	flex-direction: column;
	gap: var(--st-pg-thumb-gap);
	position: relative;
}

.st-pg *,
.st-pg *::before,
.st-pg *::after {
	box-sizing: border-box;
}

/**
 * Every control in here is a <button>, and the Elementor kit styles bare buttons
 * site-wide — on cutthat.com that is `.elementor-kit-73420 button`, which paints
 * them yellow with 7px/17px padding and a 1px radius. That selector is one class
 * plus one element, so a single class of ours loses to it and the gallery comes
 * out wearing the site's button skin: yellow frames around every thumbnail.
 *
 * The kit also has a matching `button:hover, button:focus` rule, at two classes
 * plus an element. So the controls are reset here and every rule for them below
 * repeats .st-pg to reach three classes, which outranks both whatever order the
 * stylesheets load in. The hover and focus states are re-asserted further down.
 */
.st-pg.st-pg .st-pg__nav,
.st-pg.st-pg .st-pg__thumb,
.st-pg.st-pg .st-pg__thumbs-nav,
.st-pg.st-pg .st-pg__facade {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: normal;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	box-shadow: none;
	min-width: 0;
	min-height: 0;
	width: auto;
	height: auto;
	cursor: pointer;
}

/* ---------- stage ---------- */

.st-pg__stage {
	position: relative;
	background: var(--st-pg-bg);
	border-radius: var(--st-pg-radius);
	overflow: hidden;
}

.st-pg__viewport {
	overflow: hidden;
	width: 100%;
}

.st-pg__track {
	display: flex;
	will-change: transform;
	transition: transform 350ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.st-pg.is-dragging .st-pg__track {
	transition: none;
}

.st-pg__slide {
	flex: 0 0 100%;
	width: 100%;
	position: relative;
	aspect-ratio: var(--st-pg-ratio);
	display: flex;
	align-items: center;
	justify-content: center;
}

.st-pg__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* "Follow the image" sets --st-pg-ratio to auto, which aspect-ratio accepts
   as-is — the image then sets the height. */

.st-pg__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 8px 12px;
	font-size: 13px;
	line-height: 1.4;
	color: #fff;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
}

/* ---------- video facade ---------- */

.st-pg.st-pg .st-pg__facade {
	appearance: none;
	border: 0;
	padding: 0;
	margin: 0;
	background: #101010;
	width: 100%;
	height: 100%;
	position: relative;
	cursor: pointer;
	display: block;
	overflow: hidden;
}

.st-pg__poster-fallback {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 120px;
	background: repeating-linear-gradient(-45deg, #1b1b1b, #1b1b1b 12px, #222 12px, #222 24px);
}

.st-pg__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.st-pg__play svg {
	width: 68px;
	height: 48px;
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
	transition: transform 150ms ease;
}

.st-pg__play-bg {
	fill: var(--st-pg-play-bg);
}

.st-pg__play-arrow {
	fill: #fff;
}

/**
 * Ring style: an outlined circle with a bare arrow, which is what the Jet
 * gallery drew here. Borders and padding apply to an <svg> box like any other
 * element, so the same icon serves both looks — the filled plate behind the
 * arrow is simply not painted.
 */
.st-pg--play-ring .st-pg__play-bg {
	fill: none;
}

.st-pg--play-ring .st-pg__play-arrow {
	fill: var(--st-pg-play-color);
}

.st-pg--play-ring .st-pg__play svg {
	width: var(--st-pg-play-ring-size);
	height: var(--st-pg-play-ring-size);
	padding: var(--st-pg-play-ring-pad);
	border: var(--st-pg-play-ring-width) solid var(--st-pg-play-color);
	border-radius: 100px;
	filter: none;
}

.st-pg.st-pg .st-pg__facade:hover .st-pg__play svg,
.st-pg.st-pg .st-pg__facade:focus-visible .st-pg__play svg {
	transform: scale(1.08);
}

.st-pg__video-title {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 10px 14px;
	color: #fff;
	font-size: 13px;
	line-height: 1.35;
	text-align: left;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.st-pg__slide video,
.st-pg__slide iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: 0;
	background: #000;
	object-fit: contain;
}

/* ---------- arrows / counter ---------- */

.st-pg.st-pg .st-pg__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	border: 0;
	border-radius: var(--st-pg-arrow-radius);
	background: var(--st-pg-arrow-bg);
	color: var(--st-pg-arrow-color);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--st-pg-arrow-pad);
	transition: opacity 150ms ease;
}

.st-pg.st-pg .st-pg__nav svg {
	width: var(--st-pg-arrow-size);
	height: var(--st-pg-arrow-size);
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.st-pg.st-pg .st-pg__nav--prev { left: 10px; }
.st-pg.st-pg .st-pg__nav--next { right: 10px; }

.st-pg.st-pg .st-pg__nav[disabled] {
	opacity: 0.35;
	cursor: default;
}

.st-pg__counter {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 3;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 12px;
	line-height: 1.6;
	color: #fff;
	background: rgba(20, 20, 20, 0.6);
}

.st-pg.st-pg--single .st-pg__nav,
.st-pg.st-pg--single .st-pg__counter {
	display: none;
}

/* ---------- thumbnails ---------- */

.st-pg__thumbs {
	position: relative;
	display: flex;
	align-items: center;
	gap: 4px;
}

.st-pg__thumbs-viewport {
	overflow: hidden;
	flex: 1 1 auto;
	min-width: 0;
}

.st-pg__thumbs-track {
	display: flex;
	/* offsetLeft/offsetTop of a thumb must be measured against the strip. */
	position: relative;
	gap: var(--st-pg-thumb-gap);
	overflow-x: auto;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.st-pg__thumbs-track::-webkit-scrollbar {
	display: none;
}

.st-pg.st-pg .st-pg__thumb {
	flex: 0 0 calc((100% - (var(--st-pg-thumb-cols) - 1) * var(--st-pg-thumb-gap)) / var(--st-pg-thumb-cols));
	position: relative;
	padding: 0;
	border: var(--st-pg-thumb-border-width) solid var(--st-pg-thumb-border);
	border-radius: var(--st-pg-radius);
	background: var(--st-pg-bg);
	cursor: pointer;
	overflow: hidden;
	aspect-ratio: 1/1;
	transition: border-color 150ms ease, opacity 150ms ease;
	opacity: 0.7;
}

.st-pg.st-pg .st-pg__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.st-pg.st-pg .st-pg__thumb:hover,
.st-pg.st-pg .st-pg__thumb:focus-visible {
	opacity: 1;
}

.st-pg.st-pg .st-pg__thumb.is-active {
	border-color: var(--st-pg-thumb-active);
	opacity: 1;
}

.st-pg__thumb-play {
	position: absolute;
	right: 4px;
	bottom: 4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--st-pg-play-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.st-pg__thumb-play svg {
	width: 14px;
	height: 14px;
	fill: #fff;
}

.st-pg.st-pg .st-pg__thumbs-nav {
	flex: 0 0 auto;
	border: 0;
	padding: var(--st-pg-arrow-pad);
	border-radius: var(--st-pg-arrow-radius);
	background: var(--st-pg-arrow-bg);
	color: var(--st-pg-arrow-color);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.st-pg.st-pg .st-pg__thumbs-nav svg {
	width: var(--st-pg-thumb-nav-size);
	height: var(--st-pg-thumb-nav-size);
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.st-pg.st-pg .st-pg__thumbs-nav[hidden] {
	display: none;
}

/**
 * The kit does not stop at the resting state — it has a
 * `button:hover, button:focus` rule too, at two classes plus an element. These
 * put our own values back in those states at a specificity it cannot reach.
 */
.st-pg.st-pg .st-pg__nav:is(:hover, :focus, :focus-visible, :active),
.st-pg.st-pg .st-pg__thumbs-nav:is(:hover, :focus, :focus-visible, :active) {
	background: var(--st-pg-arrow-bg);
	color: var(--st-pg-arrow-color);
	padding: var(--st-pg-arrow-pad);
	border-radius: var(--st-pg-arrow-radius);
	border: 0;
}

.st-pg.st-pg .st-pg__thumb:is(:hover, :focus, :focus-visible, :active) {
	background: var(--st-pg-bg);
	padding: 0;
	border-radius: var(--st-pg-radius);
	border-width: var(--st-pg-thumb-border-width);
	border-style: solid;
}

.st-pg.st-pg .st-pg__facade:is(:hover, :focus, :focus-visible, :active) {
	background: #101010;
	padding: 0;
	border-radius: 0;
	border: 0;
}

/* ---------- thumbs on the left ---------- */

@media (min-width: 768px) {
	.st-pg--thumbs-left {
		flex-direction: row;
		align-items: flex-start;
	}

	.st-pg.st-pg--thumbs-left .st-pg__stage {
		flex: 1 1 auto;
		min-width: 0;
		order: 2;
	}

	.st-pg.st-pg--thumbs-left .st-pg__thumbs {
		order: 1;
		flex: 0 0 88px;
		width: 88px;
		flex-direction: column;
		align-items: stretch;
	}

	.st-pg.st-pg--thumbs-left .st-pg__thumbs-track {
		flex-direction: column;
		overflow-x: hidden;
		overflow-y: auto;
		max-height: 520px;
	}

	.st-pg.st-pg--thumbs-left .st-pg__thumb {
		flex: 0 0 auto;
	}

	/* The strip pages up and down here, so the chevrons should too. */
	.st-pg.st-pg--thumbs-left .st-pg__thumbs-nav {
		align-self: center;
	}

	.st-pg.st-pg--thumbs-left .st-pg__thumbs-nav svg {
		transform: rotate(90deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.st-pg__track,
	.st-pg__thumbs-track,
	.st-pg__play svg {
		transition: none;
		scroll-behavior: auto;
	}
}
