/*
 * The site's one carousel (inc/Carousel.php, assets/js/carousel.js; ADR-063): a scroll-snapping track that
 * swipes without script, the pill indicator and 48px icon-circle buttons in a bar beneath. Variants:
 * strip (Moments: several photos at their own ratios, gallery.css), single (one photo at a time, caption
 * beneath) and cards (a row of cards). The bar appears only with JavaScript (bt-js is set before the first
 * paint, so nothing shifts). Reduced motion: every move is instant.
 */
.bt-carousel {
	--bt-car-gap: 16px;
	position: relative;
	min-width: 0;
}

:root .bt-carousel .bt-carousel__track {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--bt-car-gap);
	margin: 0;
	padding: 0;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	list-style: none;
}

.bt-carousel .bt-carousel__track::-webkit-scrollbar {
	display: none;
}

.bt-carousel .bt-carousel__track:focus-visible {
	outline: 3px solid var(--wp--preset--color--contrast);
	outline-offset: 4px;
}

:root .bt-carousel .bt-carousel__slide {
	flex: none;
	scroll-snap-align: start;
}

/* a full-bleed strip starts on the wide grid and snaps each photo to it (the strip's --inline, gallery.css) */
:root .bt-carousel--strip .bt-carousel__track {
	padding-inline: var(--inline, var(--wp--preset--spacing--gutter));
	scroll-padding-inline: var(--inline, var(--wp--preset--spacing--gutter));
}

/* ---------- one photo at a time ---------- */
.bt-carousel--single {
	--bt-ratio: 3 / 2;
}

:root .bt-carousel--single .bt-carousel__track.wp-block-gallery.has-nested-images figure.wp-block-image:not(#bt-car) {
	display: block;
	flex: 0 0 100%;
	width: 100%;
	margin: 0;
	border-radius: 0;
	background: none;
}

:root .bt-carousel--single .bt-carousel__track.wp-block-gallery.has-nested-images figure.wp-block-image:not(#bt-car) img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--bt-ratio);
	border-radius: var(--wp--custom--radius--media);
	background: var(--wp--preset--color--base-3);
	/* each photo whole inside the frame: never cropped through a group (R12 to R15 handovers) */
	object-fit: contain;
}

/* the caption beneath the photo, the site's one caption style */
:root .bt-carousel .bt-carousel__track.wp-block-gallery.has-nested-images figure.wp-block-image:not(#bt-car) figcaption {
	position: static;
	max-height: none;
	margin: 10px 0 0;
	padding: 0;
	overflow: visible;
	background: none;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--caption);
	line-height: 1.45;
	text-align: left;
	text-shadow: none;
	font-variant-numeric: tabular-nums;
}

:root .bt-carousel .bt-carousel__track.wp-block-gallery.has-nested-images figure.wp-block-image:not(#bt-car):has(figcaption)::before {
	content: none;
}

/* ---------- cards in a row ---------- */
.bt-carousel--cards {
	--bt-car-gap: clamp(16px, 2vw, 24px);
}

:root .bt-carousel--cards .bt-carousel__track {
	padding-block: 4px 8px;
	scroll-padding-inline: 4px;
}

:root .bt-carousel--cards .bt-carousel__slide {
	flex-basis: calc((100% - 2 * var(--bt-car-gap)) / 3);
	min-width: 0;
	margin: 0;
}

@media (max-width: 1023px) {
	:root .bt-carousel--cards .bt-carousel__slide {
		flex-basis: calc((100% - var(--bt-car-gap)) / 2);
	}
}

@media (max-width: 600px) {
	:root .bt-carousel--cards .bt-carousel__slide {
		flex-basis: 84%;
	}
}

/* ---------- the bar: pill indicator (or a counter) and the two buttons ---------- */
.bt-carousel__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-top: 20px;
}

html:not(.bt-js) .bt-carousel__bar:not(.bt-carousel__bar--one) {
	display: none;
}

.bt-carousel.is-static .bt-carousel__bar {
	visibility: hidden;
}

/* a full-bleed strip keeps its bar on the wide grid */
.bt-carousel--strip .bt-carousel__bar {
	padding-inline: max(var(--wp--preset--spacing--gutter), calc((100% - var(--wp--style--global--wide-size, 82rem)) / 2));
}

.bt-carousel__nav {
	display: flex;
	flex: none;
	gap: 8px;
	margin-left: auto;
}

.bt-carousel__count {
	margin: 0;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	font-variant-numeric: tabular-nums;
}

.bt-carousel__now {
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
}

/* "Report or remove this photo" (ADR-054), first in an album's bar */
.bt-carousel__report {
	flex: none;
	order: 3;
	width: 100%;
	color: var(--wp--preset--color--contrast-2);
	font-size: var(--wp--preset--font-size--small);
	text-align: right;
	text-underline-offset: 3px;
}

.bt-carousel__bar:has(.bt-carousel__report) {
	flex-wrap: wrap;
}

.bt-carousel__report:hover {
	color: var(--wp--preset--color--contrast);
}

/* ---------- the brand pill indicator: the current slide is a short pill, the others small dots ---------- */
.bt-dots {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	min-width: 0;
}

.bt-dot {
	--bt-dot: #857e72;
	--bt-dot-on: var(--wp--preset--color--primary);
	display: grid;
	place-items: center;
	width: 24px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.bt-dot[aria-current="true"] {
	width: 40px;
}

.bt-dot::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: var(--bt-dot);
	transition: width 0.32s var(--wp--custom--motion--ease, ease), background-color 0.32s;
}

.bt-dot[aria-current="true"]::before {
	width: 28px;
	background: var(--bt-dot-on);
}

.bt-dot:focus-visible {
	outline: 3px solid var(--wp--preset--color--contrast);
	outline-offset: -4px;
	border-radius: 999px;
}

:where(.has-surface-dark-background-color, .is-style-card-ink) .bt-dot {
	--bt-dot: rgb(255 255 255 / 0.55);
	--bt-dot-on: var(--wp--preset--color--white);
}

:where(.has-surface-dark-background-color, .is-style-card-ink) .bt-dot:focus-visible {
	outline-color: var(--wp--preset--color--white);
}

/* ---------- icon-only circle buttons (48px): carousels, the lightbox ---------- */
.bt-icon-btn {
	--bt-ring: var(--wp--preset--color--contrast);
	--bt-hfill: var(--wp--preset--color--contrast);
	--bt-hfg: var(--wp--preset--color--white);
	position: relative;
	isolation: isolate;
	overflow: visible;
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--bt-ring);
	box-shadow: inset 0 0 0 1.5px var(--bt-ring);
	cursor: pointer;
	transition: color var(--wp--custom--motion--fill) var(--wp--custom--motion--ease), transform var(--wp--custom--motion--press) var(--wp--custom--motion--ease);
}

.bt-icon-btn::before {
	content: "";
	position: absolute;
	inset: -1px; /* 1px past the ring so no edge line shows on hover: see assets/css/blocks/button.css */
	z-index: -1;
	border-radius: 50%;
	background: var(--bt-hfill);
	clip-path: circle(0 at 50% 50%);
	transition: clip-path var(--wp--custom--motion--fill) var(--wp--custom--motion--ease);
}

.bt-icon-btn:hover,
.bt-icon-btn:focus-visible {
	color: var(--bt-hfg);
}

.bt-icon-btn:hover::before,
.bt-icon-btn:focus-visible::before {
	clip-path: circle(75% at 50% 50%);
}

.bt-icon-btn:focus-visible {
	outline: 3px solid var(--wp--preset--color--contrast);
	outline-offset: 3px;
}

.bt-icon-btn:active {
	transform: scale(0.96);
}

.bt-icon-btn svg {
	display: block;
	width: 20px;
	height: 20px;
	overflow: hidden;
}

.bt-icon-btn[aria-disabled="true"] {
	--bt-ring: #b9b1a5;
	cursor: default;
}

.bt-icon-btn[aria-disabled="true"]::before {
	display: none;
}

.bt-icon-btn[aria-disabled="true"]:hover {
	color: var(--bt-ring);
}

:where(.has-surface-dark-background-color, .is-style-card-ink) .bt-icon-btn {
	--bt-ring: var(--wp--preset--color--white);
	--bt-hfill: var(--wp--preset--color--white);
	--bt-hfg: var(--wp--preset--color--contrast);
}

:where(.has-surface-dark-background-color, .is-style-card-ink) .bt-icon-btn:focus-visible {
	outline-color: var(--wp--preset--color--white);
}

@media (prefers-reduced-motion: no-preference) {
	:root .bt-carousel .bt-carousel__track {
		scroll-behavior: smooth;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bt-dot::before,
	.bt-icon-btn,
	.bt-icon-btn::before {
		transition: none;
	}
}
