/**
 * BWOD WC Product Pages — gallery styles.
 */

.bwod-pp-gallery {
	display: flex;
	gap: 15px;
	max-width: 100%;
	margin: 0 0 20px;
	align-items: flex-start;
}

/* Thumbnail column: up/down arrows wrapping a window that shows max 4 square
   thumbs; more than 4 scrolls via the arrows (desktop). */
.bwod-pp-thumbcol {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 90px;
	flex-shrink: 0;
}

.bwod-pp-thumbs {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 90px;
	max-height: 384px; /* 4 × 90px thumbs + 3 × 8px gaps */
	overflow: hidden;
}

.bwod-pp-thumb-nav {
	width: 90px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 1px solid #e0e0e0;
	background: #f7f7f7;
	border-radius: 6px;
	color: #1f2d3d;
	font-size: 11px;
	line-height: 1;
	cursor: pointer;
	flex: 0 0 auto;
}

.bwod-pp-thumb-nav:hover,
.bwod-pp-thumb-nav:focus {
	background: #eef1f5;
	border-color: #9aa0a6;
	color: #1f2d3d;
	box-shadow: none;
	outline: none;
}

.bwod-pp-thumb-nav:focus-visible {
	box-shadow: 0 0 0 3px rgba(31, 45, 61, 0.25);
}

.bwod-pp-thumb-nav:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.bwod-pp-thumb {
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	background: #f7f7f7;
	cursor: pointer;
	overflow: hidden;
	width: 90px;
	height: 90px;
	aspect-ratio: 1 / 1;
	flex: 0 0 auto;
}

.bwod-pp-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Assert the full 2px border so the theme's 1px hover border can't shrink it (bounce). */
.bwod-pp-thumb.is-active,
.bwod-pp-thumb:hover,
.bwod-pp-thumb:focus {
	border: 2px solid #333;
	background: #f7f7f7;
	box-shadow: none;
	outline: none;
}

.bwod-pp-thumb:focus-visible {
	box-shadow: 0 0 0 3px rgba(31, 45, 61, 0.35);
}

.bwod-pp-main {
	flex: 1;
	min-width: 0;
}

.bwod-pp-main-btn {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 0;
	border: 0;
	background: #f7f7f7;
	border-radius: 8px;
	overflow: hidden;
	cursor: zoom-in;
}

/* Neutralise theme button hover/focus so no border/fill paints over the image. */
.bwod-pp-main-btn:hover,
.bwod-pp-main-btn:focus {
	background: #f7f7f7;
	border: 0;
	box-shadow: none;
	outline: none;
}

.bwod-pp-main-btn:focus-visible {
	box-shadow: 0 0 0 3px rgba(31, 45, 61, 0.4);
}

/* !important beats the theme's global `img { height: auto }`, which otherwise
   makes the image size to its natural ratio (e.g. 331×4815 for a tall pen) and
   get clipped by the square box. Forced to fill the box so object-fit: contain
   can letterbox the whole product inside. */
.bwod-pp-main-img {
	width: 100% !important;
	height: 100% !important;
	display: block;
	object-fit: contain !important;
}

/* The lightbox is GLightbox (bundled in assets/vendor/glightbox). It ships its
   own styles, but for extreme aspect ratios (e.g. a 55×800 pen) GLightbox sizes
   the <img> element so the image stretches/overflows the viewport. Force the
   image to keep its natural ratio and fit within the viewport. !important is
   needed to beat GLightbox's inline, JS-computed width/height. */
.glightbox-container .gslide-image img {
	max-width: 90vw !important;
	max-height: 88vh !important;
	object-fit: contain !important;
}

@media (max-width: 768px) {
	.bwod-pp-gallery {
		flex-direction: column-reverse;
		align-items: stretch;
	}
	/* Mobile keeps the horizontal thumb row — no up/down arrows, no height cap. */
	.bwod-pp-thumb-nav {
		display: none;
	}
	.bwod-pp-thumbcol {
		width: 100%;
	}
	.bwod-pp-thumbs {
		flex-direction: row;
		width: 100%;
		max-height: none;
		overflow-x: auto;
		overflow-y: hidden;
	}
	.bwod-pp-thumb {
		flex: 0 0 70px;
		width: 70px;
		height: 70px;
	}
	/* Smaller colour-picker swatches on mobile (names kept). */
	.bwod-pp-colorpick {
		gap: 8px;
	}
	.bwod-pp-colorpick-swatch {
		width: 52px;
		font-size: 10px;
	}
	.bwod-pp-colorpick .bwod-pp-dot {
		width: 26px;
		height: 26px;
	}
}

/* Standalone colour picker ([bwod_product_colors]) — place under the gallery. */
.bwod-pp-colorpick {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 20px;
	align-items: flex-start;
}

.bwod-pp-colorpick-swatch {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 64px;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	font-size: 12px;
	color: #555;
}

/* Theme-proof hover/focus (same approach as the matrix swatches). */
.bwod-pp-colorpick-swatch:hover,
.bwod-pp-colorpick-swatch:focus {
	color: #1f2d3d;
	border: 0;
	background: transparent;
	box-shadow: none;
	outline: none;
}

.bwod-pp-colorpick-swatch:hover .bwod-pp-dot {
	border-color: #1f2d3d;
}

.bwod-pp-colorpick-swatch:focus-visible {
	outline: 2px solid #1f2d3d;
	outline-offset: 3px;
	border-radius: 6px;
}

.bwod-pp-colorpick .bwod-pp-dot {
	width: 34px;
	height: 34px;
	margin: 0;
}

.bwod-pp-colorpick-swatch.is-selected .bwod-pp-dot {
	outline: 3px solid #1f2d3d;
	outline-offset: 2px;
}

.bwod-pp-colorpick-label {
	display: block;
	width: 100%;
	min-height: 2.6em;
	line-height: 1.3;
	text-align: center;
	overflow-wrap: break-word;
	word-break: break-word;
	hyphens: auto;
}

/* No-labels variant: just the dots, tightly packed. */
.bwod-pp-colorpick--nolabels .bwod-pp-colorpick-swatch {
	width: auto;
}
