/* Heritage Chill palette: navy #16263B, cream #FDF9F0, amber #C8892E */
/* v1.0.4 - Higher specificity + !important overrides to defeat theme button styles */

.jih-gallery {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0 0 24px 0;
	max-width: 640px;
	--jih-gallery-navy: #16263B;
	--jih-gallery-cream: #FDF9F0;
	--jih-gallery-amber: #C8892E;
}

/* ---------- Main image ---------- */

.jih-gallery .jih-gallery__main {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--jih-gallery-cream);
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid rgba(22, 38, 59, 0.08);
	padding: 0;
	margin: 0;
}

@supports not (aspect-ratio: 1 / 1) {
	.jih-gallery .jih-gallery__main::before {
		content: '';
		display: block;
		padding-top: 100%;
	}
	.jih-gallery .jih-gallery__main-img {
		position: absolute;
		top: 0;
		left: 0;
	}
}

.jih-gallery .jih-gallery__main-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: opacity 0.2s ease-in-out;
	padding: 0;
	margin: 0;
	max-width: none;
}

.jih-gallery .jih-gallery__main-img.is-loading {
	opacity: 0.4;
}

/* ---------- Thumbnail row wrapper ---------- */

.jih-gallery .jih-gallery__thumbs-wrap {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 8px;
	padding: 0;
	margin: 0;
}

/* ---------- Prev/next arrow buttons ---------- */

.jih-gallery .jih-gallery__nav {
	flex: 0 0 auto;
	width: 36px !important;
	min-width: 36px !important;
	background: var(--jih-gallery-cream) !important;
	border: 2px solid rgba(22, 38, 59, 0.15) !important;
	border-radius: 4px !important;
	color: var(--jih-gallery-navy) !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
	box-shadow: none !important;
	text-shadow: none !important;
	font-weight: normal;
	line-height: 1;
	height: auto;
}

.jih-gallery .jih-gallery__nav:hover:not(:disabled),
.jih-gallery .jih-gallery__nav:focus:not(:disabled) {
	border-color: var(--jih-gallery-amber) !important;
	color: var(--jih-gallery-amber) !important;
	background: var(--jih-gallery-cream) !important;
}

.jih-gallery .jih-gallery__nav:focus {
	outline: none;
}

.jih-gallery .jih-gallery__nav:focus-visible {
	outline: 2px solid var(--jih-gallery-amber);
	outline-offset: 2px;
}

.jih-gallery .jih-gallery__nav:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.jih-gallery .jih-gallery__nav svg {
	width: 18px;
	height: 18px;
	display: block;
	pointer-events: none;
	stroke: currentColor;
	fill: none;
}

.jih-gallery .jih-gallery__nav--hidden {
	display: none !important;
}

/* ---------- Scrollable thumbnail strip ---------- */

.jih-gallery .jih-gallery__thumbs {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	padding: 0;
	margin: 0;
	list-style: none;
}

.jih-gallery .jih-gallery__thumbs::-webkit-scrollbar {
	display: none;
}

/* ---------- Individual thumbnail ---------- */

.jih-gallery .jih-gallery__thumb {
	flex: 0 0 auto !important;
	width: 100px !important;
	height: 100px !important;
	min-width: 100px !important;
	min-height: 100px !important;
	max-width: 100px !important;
	max-height: 100px !important;
	aspect-ratio: 1 / 1;
	padding: 0 !important;
	margin: 0 !important;
	background: #ffffff !important;
	border: 2px solid rgba(22, 38, 59, 0.15) !important;
	border-radius: 4px !important;
	overflow: hidden !important;
	cursor: pointer !important;
	transition: border-color 0.15s ease, transform 0.1s ease;
	appearance: none;
	-webkit-appearance: none;
	scroll-snap-align: start;
	display: block;
	position: relative;
	box-shadow: none !important;
	text-shadow: none !important;
	color: inherit !important;
	line-height: 0;
	font-size: 0;
}

.jih-gallery .jih-gallery__thumb:hover {
	border-color: rgba(200, 137, 46, 0.6) !important;
	background: #ffffff !important;
}

.jih-gallery .jih-gallery__thumb.is-active {
	border-color: var(--jih-gallery-amber) !important;
	background: #ffffff !important;
	color: inherit !important;
}

.jih-gallery .jih-gallery__thumb:focus {
	outline: none;
	border-color: var(--jih-gallery-amber) !important;
}

.jih-gallery .jih-gallery__thumb:focus-visible {
	outline: 2px solid var(--jih-gallery-amber);
	outline-offset: 2px;
}

.jih-gallery .jih-gallery__thumb:active {
	transform: scale(0.96);
}

.jih-gallery .jih-gallery__thumb img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	transform: scale(1.15);
	transition: transform 0.2s ease;
}

.jih-gallery .jih-gallery__thumb:hover img,
.jih-gallery .jih-gallery__thumb.is-active img {
	transform: scale(1.2);
}

/* ---------- Mobile ---------- */

@media (max-width: 480px) {
	.jih-gallery .jih-gallery__thumb {
		width: 80px !important;
		height: 80px !important;
		min-width: 80px !important;
		min-height: 80px !important;
		max-width: 80px !important;
		max-height: 80px !important;
	}
	.jih-gallery .jih-gallery__nav {
		width: 32px !important;
		min-width: 32px !important;
	}
	.jih-gallery .jih-gallery__thumbs,
	.jih-gallery .jih-gallery__thumbs-wrap {
		gap: 6px;
	}
}
