/* Product page — gallery and COLOR from design/pages/Product.dc.html. */

.woocommerce div.product > .r-gal {
	grid-column: 1;
}

.r-gal {
	display: flex;
	gap: 16px;
	min-width: 0;
}

/* Thumbnails: column on desktop */
.r-gal__thumbs {
	flex: 0 0 clamp(56px, 7vw, 92px);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.r-gal--single .r-gal__thumbs,
.r-gal--single .r-gal__prev,
.r-gal--single .r-gal__next {
	display: none;
}

.r-gal__thumb {
	box-sizing: border-box; /* a <button> */
	width: 100%;
	aspect-ratio: 9 / 10;
	padding: 0;
	overflow: hidden;
	cursor: pointer;
	background: var(--c-surface-2);
	border: 1px solid transparent;
	opacity: .75;
	transition: opacity .2s;
}

.r-gal__thumb:hover {
	opacity: 1;
}

.r-gal__thumb[aria-pressed="true"] {
	border-color: var(--c-ink);
	opacity: 1;
}

.r-gal__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Main image: scroll-snap strip */
.r-gal__main {
	position: relative;
	flex: 1;
	min-width: 0;
}

.r-gal__track {
	display: flex;
	aspect-ratio: 4 / 5;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	background: var(--c-surface-2);
	contain: paint; /* keeps off-screen slides from widening the phone layout */
}

.r-gal__track::-webkit-scrollbar {
	display: none;
}

.r-gal__track:focus-visible {
	outline: var(--focus);
	outline-offset: 2px;
}

.r-gal__slide {
	flex: 0 0 100%;
	margin: 0;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.r-gal__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Round buttons on the photo */
.r-gal__btn {
	position: absolute;
	width: var(--tap);
	height: var(--tap);
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgb(255 255 255 / .92);
	color: var(--c-ink);
	cursor: pointer;
	display: grid;
	place-items: center;
}

.r-gal__btn[hidden] {
	display: none;
}

.r-gal__btn:hover {
	background: var(--c-white);
}

.r-gal__prev,
.r-gal__next {
	top: 50%;
	transform: translateY(-50%);
}

.r-gal__prev {
	left: 16px;
}

.r-gal__next {
	right: 16px;
}

.r-gal__zoom {
	right: 16px;
	bottom: 16px;
}

/* Zoom dialog */
.r-zoom {
	width: 100vw;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgb(20 15 11 / .94);
}

.r-zoom[open] {
	display: grid;
	place-items: center;
}

.r-zoom::backdrop {
	background: rgb(20 15 11 / .94);
}

.r-zoom__img {
	max-width: min(100vw - 32px, 1100px);
	max-height: calc(100dvh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
}

.r-zoom__prev,
.r-zoom__next {
	top: 50%;
	transform: translateY(-50%);
}

.r-zoom__prev {
	left: 16px;
}

.r-zoom__next {
	right: 16px;
}

.r-zoom__close {
	top: 16px;
	right: 16px;
}

/* COLOR (inc/product-color.php): the product's one color, read-only — design's selected swatch. */
.r-colors {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 10px 0 16px;
}

.r-colors__label {
	margin: 0;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.r-colors__list {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.r-colors__opt {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 1px solid var(--c-ink);
	border-radius: 50%;
}

.r-colors__name {
	margin: 0;
	font-size: 13px;
	color: var(--c-muted);
}

/* "Buy it now" (inc/buy-now.php): own row under quantity + Add to cart, full width and 56px tall
   like the design's Add to Bag; outline so Add to cart stays the main action. */
.r-buy-now {
	flex: 1 0 100%;
	box-sizing: border-box;
	min-height: 56px;
	padding: 0 24px;
	background: transparent;
	color: var(--c-ink);
	border: 1px solid var(--c-ink);
	border-radius: 0;
	font-family: var(--f-body);
	font-size: 14px;
	letter-spacing: .24em;
	text-transform: uppercase;
	cursor: pointer;
}

.r-buy-now:hover {
	background: rgb(43 36 30 / .06);
}

.r-buy-now:focus-visible {
	outline: var(--focus);
	outline-offset: 2px;
}

.r-buy-now:disabled {
	opacity: .5;
	cursor: not-allowed;
}

/* Phones: thumbnails become a row under the photo (design .r-gal / .r-thumbs rules). */
@media (max-width: 860px) {
	.woocommerce div.product > .r-gal {
		grid-column: 1 / -1;
	}

	.r-gal {
		flex-direction: column-reverse;
		gap: 10px;
	}

	.r-gal__thumbs {
		flex: none;
		flex-direction: row;
		gap: 8px;
		overflow-x: auto;
		scrollbar-width: none;
		contain: paint;
		padding-bottom: 2px;
	}

	.r-gal__thumbs::-webkit-scrollbar {
		display: none;
	}

	.r-gal__thumb {
		flex: none;
		width: 64px;
	}

	.r-gal__prev {
		left: 10px;
	}

	.r-gal__next,
	.r-gal__zoom {
		right: 10px;
	}

	.r-gal__zoom {
		bottom: 10px;
	}
}
