/**
 * Legacy Shortcodes: [th-slider] tabs and [slide-anything] carousel.
 * See inc/legacy-shortcodes.php.
 * Sizes are px: the theme shrinks the root font size, so rem comes out too small.
 */

/* [th-slider] */
.th-slider__tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-bottom: 24px;
}

.th-slider__tab {
	padding: 8px 20px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	opacity: 0.6;
}

.th-slider__tab[aria-selected="true"] {
	opacity: 1;
	font-weight: 700;
}

.th-slider__tab:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* [slide-anything] */
.sa-slider {
	position: relative;
	--sa-per-view: 1;
	--sa-ratio: 50%;
}

.sa-slider__track {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.sa-slider__track::-webkit-scrollbar {
	display: none;
}

.sa-slider__slide {
	position: relative;
	flex: 0 0 calc(100% / var(--sa-per-view));
	padding-top: calc(var(--sa-ratio) / var(--sa-per-view));
	scroll-snap-align: start;
}

.sa-slider__slide > img,
.sa-slider__slide > a > img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

@media (max-width: 767px) {
	.sa-slider__slide {
		flex-basis: 100%;
		padding-top: var(--sa-ratio);
	}
}

.sa-slider__arrow {
	position: absolute;
	top: 50%;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	cursor: pointer;
}

.sa-slider__arrow::before {
	content: "";
	display: block;
	width: 10px;
	height: 10px;
	margin: auto;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.sa-slider__arrow--prev {
	left: 8px;
}

.sa-slider__arrow--prev::before {
	transform: translateX(2px) rotate(-135deg);
}

.sa-slider__arrow--next {
	right: 8px;
}

.sa-slider__arrow--next::before {
	transform: translateX(-2px) rotate(45deg);
}

.sa-slider__dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 12px;
}

.sa-slider__dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border: 1px solid currentColor;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
}

.sa-slider__dot[aria-current="true"] {
	background: currentColor;
}

.sa-slider__arrow:focus-visible,
.sa-slider__dot:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.sa-slider__thumbs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
	margin-top: 8px;
}

.sa-slider__thumb {
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	opacity: 0.5;
}

.sa-slider__thumb[aria-current="true"],
.sa-slider__thumb:hover {
	opacity: 1;
}

.sa-slider__thumb img {
	display: block;
	width: var(--sa-thumb-w);
	height: var(--sa-thumb-h);
	object-fit: cover;
}

@media (max-width: 767px) {
	.sa-slider__thumb img {
		width: calc(var(--sa-thumb-w) * 0.5);
		height: calc(var(--sa-thumb-h) * 0.5);
	}
}
