/* APS Product Images Gallery - unified grid + lightbox styles
   Shared between the product page preview grid and the full images page. */

html.aps-gal-lock, body.aps-gal-lock { overflow: hidden; }

/* grid (used both for the 4-image preview and the full grid) */
.aps-gal-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: calc(10px * var(--aps-nova-scale, 1));
	max-width: 1000px;
	margin: 0 auto 20px;
	box-sizing: border-box;
}
.aps-gal-grid.aps-gal-grid-full {
	max-width: 1200px;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: calc(14px * var(--aps-nova-scale, 1));
}
.aps-gal-grid * { box-sizing: border-box; }

.aps-gal-item {
	appearance: none;
	-webkit-appearance: none;
	background: #fff;
	border: 1px solid color-mix(in srgb, var(--aps-nova-border-color, #f0f1f3) var(--aps-nova-border-opacity, 100%), #fff);
	margin: 0;
	padding: 0;
	display: block;
	cursor: zoom-in;
	line-height: 0;
	border-radius: var(--aps-nova-radius, 10px);
	overflow: hidden;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: box-shadow .15s ease, transform .15s ease;
}
.aps-gal-item:hover {
	box-shadow: 0 8px 18px rgba(0,0,0,.08);
	transform: translateY(-2px);
}
.aps-gal-item img {
	width: 100%;
	aspect-ratio: 1/1;
	height: auto;
	display: block;
	object-fit: cover;
	object-position: center;
}

.aps-gal-grid:not(.aps-gal-grid-full) { gap: calc(10px * var(--aps-nova-scale, 1)); }

@media (max-width: 900px) { .aps-gal-grid:not(.aps-gal-grid-full) { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) {
	.aps-gal-grid:not(.aps-gal-grid-full) { grid-template-columns: repeat(2, 1fr); }
	.aps-gal-grid.aps-gal-grid-full { grid-template-columns: repeat(3, 1fr); }
}

/* view more button (product page preview grid) */
.aps-gal-viewmore-wrap { max-width: 1000px; margin: 0 auto 30px; }
.aps-gal-viewmore-btn {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: calc(10px * var(--aps-nova-scale, 1));
	width: 100%;
	padding: calc(16px * var(--aps-nova-scale, 1)) calc(44px * var(--aps-nova-scale, 1));
	border-radius: var(--aps-nova-radius, 10px);
	background: color-mix(in srgb, var(--aps-skin-color-1, #00509d) 6%, #fff);
	border: 1px solid color-mix(in srgb, var(--aps-nova-border-color, #f0f1f3) var(--aps-nova-border-opacity, 100%), #fff);
	color: var(--aps-skin-color-1, #00509d) !important;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none !important;
	box-sizing: border-box;
	touch-action: manipulation;
	transition: background .15s ease;
}
.aps-gal-viewmore-btn:hover { background: color-mix(in srgb, var(--aps-skin-color-1, #00509d) 11%, #fff); }
.aps-gal-viewmore-icon { --aps-icon-size: 18px; flex: 0 0 auto; }
.aps-gal-viewmore-text { flex: 0 0 auto; }
.aps-gal-viewmore-arrow {
	position: absolute;
	left: 20px;
	top: 50%;
	transform: translateY(-50%) scaleX(-1);
	width: 24px;
	height: 24px;
	display: block;
}

/* ad slots on the full images page */
.aps-gal-ad-slot { max-width: 1200px; margin: 0 auto 20px; text-align: center; overflow: hidden; }

/* lightbox (unified, self-hosted, no external dependency) - light theme, skin-tinted */
.aps-gal-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	opacity: 0;
	transition: opacity .2s ease;
	--aps-lb-accent: var(--aps-skin-color-1, #2f6fed);
}
.aps-gal-lb[hidden] { display: none; }
.aps-gal-lb.is-visible { opacity: 1; }
.aps-gal-lb-backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--aps-lb-accent) 7%, #fff);
}

/* top bar - white card, left aligned */
.aps-gal-lb-topbar {
	position: relative;
	z-index: 3;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: calc(16px * var(--aps-nova-scale, 1));
	margin: calc(12px * var(--aps-nova-scale, 1)) calc(14px * var(--aps-nova-scale, 1)) calc(6px * var(--aps-nova-scale, 1));
	padding: calc(14px * var(--aps-nova-scale, 1)) calc(16px * var(--aps-nova-scale, 1));
	background: #fff;
	border: 1px solid color-mix(in srgb, var(--aps-nova-border-color, #f0f1f3) var(--aps-nova-border-opacity, 100%), #fff);
	border-radius: var(--aps-nova-radius, 10px);
	box-shadow: 0 2px 10px rgba(16,24,40,.05);
}
.aps-gal-lb-counter {
	flex: 0 0 auto;
	font-size: 17px;
	font-weight: 800;
	color: var(--aps-lb-accent);
	font-variant-numeric: tabular-nums;
	letter-spacing: .01em;
}
.aps-gal-lb-sep {
	flex: 0 0 auto;
	width: 1px;
	height: 24px;
	background: color-mix(in srgb, var(--aps-nova-border-color, #f0f1f3) var(--aps-nova-border-opacity, 100%), #fff);
}
.aps-gal-lb-title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: clamp(13px, 2.4vw, 17px);
	font-weight: 800;
	color: #101828;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.aps-gal-lb-close {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--aps-nova-radius, 10px);
	background: color-mix(in srgb, var(--aps-lb-accent) 7%, #f2f4f7);
	color: #101828;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}
.aps-gal-lb-close > span {
	display: block;
	font-size: 24px;
	font-weight: 700;
	line-height: 1;
	transform: translateY(-1px);
}
.aps-gal-lb-close:hover { background: color-mix(in srgb, var(--aps-lb-accent) 14%, #e4e7ec); transform: scale(1.05); }
.aps-gal-lb-close:active { transform: scale(.95); }

/* stage - image sits in a clean card */
.aps-gal-lb-stage {
	position: relative;
	z-index: 2;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: calc(4px * var(--aps-nova-scale, 1)) calc(18px * var(--aps-nova-scale, 1)) calc(10px * var(--aps-nova-scale, 1));
	touch-action: none;
	box-sizing: border-box;
}
.aps-gal-lb-canvas {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	max-width: 1100px;
	background: #fff;
	border: 1px solid color-mix(in srgb, var(--aps-nova-border-color, #f0f1f3) var(--aps-nova-border-opacity, 100%), #fff);
	border-radius: var(--aps-nova-radius, 10px);
	box-shadow: 0 6px 28px rgba(16,24,40,.07);
	padding: calc(14px * var(--aps-nova-scale, 1));
	box-sizing: border-box;
	overflow: hidden;
}
.aps-gal-lb-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	opacity: 0;
	transition: opacity .2s ease;
	transform-origin: center center;
	cursor: zoom-in;
	will-change: transform;
}
.aps-gal-lb-img.is-loaded { opacity: 1; }
.aps-gal-lb-img.is-zoomed { cursor: grab; }
.aps-gal-lb-img.is-grabbing { cursor: grabbing; }
.aps-gal-lb.is-animating .aps-gal-lb-img { transition: opacity .2s ease, transform .25s cubic-bezier(.22,.61,.36,1); }

.aps-gal-lb-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border: 3px solid color-mix(in srgb, var(--aps-lb-accent) 18%, #fff);
	border-top-color: var(--aps-lb-accent);
	border-radius: 50%;
	animation: aps-gal-spin .7s linear infinite;
	opacity: 0;
	transition: opacity .15s ease;
	pointer-events: none;
}
.aps-gal-lb.is-loading .aps-gal-lb-spinner { opacity: 1; }
@keyframes aps-gal-spin { to { transform: rotate(360deg); } }

/* side navigation - overlaps the card edges */
.aps-gal-lb-nav {
	position: absolute;
	top: 50%;
	z-index: 4;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 6px 20px rgba(16,24,40,.14), 0 0 0 1px color-mix(in srgb, var(--aps-lb-accent) 12%, #fff);
	color: var(--aps-lb-accent);
	cursor: pointer;
	touch-action: manipulation;
	transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.aps-gal-lb-nav > svg {
	width: 24px;
	height: 24px;
	display: block;
}
.aps-gal-lb-nav:hover {
	background: var(--aps-lb-accent);
	color: #fff;
	box-shadow: 0 10px 26px color-mix(in srgb, var(--aps-lb-accent) 32%, transparent);
	transform: translateY(-50%) scale(1.08);
}
.aps-gal-lb-nav:active { transform: translateY(-50%) scale(.95); }
.aps-gal-lb-prev { left: 4px; }
.aps-gal-lb-next { right: 4px; }

/* bottom: dots + thumbnails + hint */
.aps-gal-lb-bottom {
	position: relative;
	z-index: 3;
	flex: 0 0 auto;
	padding: calc(4px * var(--aps-nova-scale, 1)) calc(16px * var(--aps-nova-scale, 1)) calc(14px * var(--aps-nova-scale, 1));
	text-align: center;
}
.aps-gal-lb-dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: calc(7px * var(--aps-nova-scale, 1));
	margin-bottom: calc(12px * var(--aps-nova-scale, 1));
}
.aps-gal-lb-dot {
	width: 7px;
	height: 7px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: color-mix(in srgb, var(--aps-lb-accent) 22%, #d0d5dd);
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}
.aps-gal-lb-dot.is-active { background: var(--aps-lb-accent); transform: scale(1.35); }

.aps-gal-lb-thumbs {
	display: flex;
	gap: calc(8px * var(--aps-nova-scale, 1));
	justify-content: flex-start;
	overflow-x: auto;
	padding: calc(4px * var(--aps-nova-scale, 1)) 6px;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--aps-lb-accent) 30%, #d0d5dd) transparent;
}
/* keeps the strip centred when it fits, without clipping the last item when it scrolls */
.aps-gal-lb-thumbs > :first-child { margin-inline-start: auto; }
.aps-gal-lb-thumbs > :last-child { margin-inline-end: auto; }
.aps-gal-lb-thumbs::-webkit-scrollbar { height: 5px; }
.aps-gal-lb-thumbs::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--aps-lb-accent) 30%, #d0d5dd); border-radius: 3px; }
.aps-gal-lb-thumb {
	flex: 0 0 auto;
	width: calc(56px * var(--aps-nova-scale, 1));
	height: calc(56px * var(--aps-nova-scale, 1));
	padding: calc(3px * var(--aps-nova-scale, 1));
	border: 2px solid transparent;
	border-radius: var(--aps-nova-radius, 10px);
	background: #fff;
	cursor: pointer;
	opacity: .65;
	touch-action: manipulation;
	box-sizing: border-box;
	transition: opacity .15s ease, border-color .15s ease, transform .15s ease;
}
.aps-gal-lb-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.aps-gal-lb-thumb:hover { opacity: .95; transform: translateY(-2px); }
.aps-gal-lb-thumb.is-active {
	opacity: 1;
	border-color: var(--aps-lb-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--aps-lb-accent) 14%, #fff);
}

@media (max-width: 600px) {
	/* smaller base values for phones, but still driven by the Nova Style settings */
	.aps-gal-lb-topbar {
		margin: calc(10px * var(--aps-nova-scale, 1)) calc(10px * var(--aps-nova-scale, 1)) calc(4px * var(--aps-nova-scale, 1));
		padding: calc(11px * var(--aps-nova-scale, 1)) calc(12px * var(--aps-nova-scale, 1));
		gap: calc(11px * var(--aps-nova-scale, 1));
	}
	.aps-gal-lb-counter { font-size: 14px; }
	.aps-gal-lb-close { width: 38px; height: 38px; }
	.aps-gal-lb-close > span { font-size: 21px; }
	.aps-gal-lb-stage {
		padding: calc(2px * var(--aps-nova-scale, 1)) calc(12px * var(--aps-nova-scale, 1)) calc(8px * var(--aps-nova-scale, 1));
	}
	.aps-gal-lb-canvas { padding: calc(10px * var(--aps-nova-scale, 1)); }
	.aps-gal-lb-nav { width: 38px; height: 38px; }
	.aps-gal-lb-nav > svg { width: 21px; height: 21px; }
	.aps-gal-lb-prev { left: 2px; }
	.aps-gal-lb-next { right: 2px; }
	.aps-gal-lb-thumb { width: calc(48px * var(--aps-nova-scale, 1)); height: calc(48px * var(--aps-nova-scale, 1)); }
}

/* full images page - in-content header + tabs (site header/footer still apply) */
.aps-gal-full-page { max-width: 1200px; margin: 0 auto; padding: 10px 0 30px; }
.aps-gal-full-head { text-align: center; margin-bottom: 16px; }
.aps-gal-full-back {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--aps-skin-color-1, #00509d);
	text-decoration: none;
	font-weight: 700;
	font-size: 19px;
	line-height: 1.2;
	margin-bottom: 12px;
}
.aps-gal-full-back > svg {
	width: 22px;
	height: 22px;
	display: block;
	flex: 0 0 auto;
	transform: scaleX(-1);
}
.aps-gal-full-title { margin: 0 0 4px; font-size: 24px; font-weight: 800; color: #222; }
.aps-gal-full-count { margin: 0; font-size: 13px; color: #888; }

.aps-gal-full-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.aps-gal-full-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid color-mix(in srgb, var(--aps-nova-border-color, #f0f1f3) var(--aps-nova-border-opacity, 100%), #fff);
	background: #fff;
	border-radius: 999px;
	padding: calc(8px * var(--aps-nova-scale, 1)) calc(18px * var(--aps-nova-scale, 1));
	font-size: 13px;
	font-weight: 600;
	color: #555;
	cursor: pointer;
}
.aps-gal-full-tab.is-active { background: var(--aps-skin-color-1, #00509d); border-color: transparent; color: #fff; }
.aps-gal-full-tab.is-disabled { opacity: .55; cursor: not-allowed; }
.aps-gal-full-tab-badge {
	font-size: 10px;
	background: #eee;
	color: #888;
	padding: 2px 7px;
	border-radius: 999px;
	text-transform: uppercase;
	letter-spacing: .03em;
}
.aps-gal-full-empty { text-align: center; padding: 70px 20px; color: #999; font-size: 15px; }
