/* 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-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-scale, 1));
}
.aps-gal-grid * { box-sizing: border-box; }

.aps-gal-item,
.aps-gal-link {
	appearance: none;
	-webkit-appearance: none;
	background: #fff;
	border: 1px solid var(--aps-hair, #e3e8ef);
	margin: 0;
	padding: 0;
	display: block;
	cursor: zoom-in;
	line-height: 0;
	border-radius: var(--aps-radius, 10px);
	overflow: hidden;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: border-color .15s ease;
}
/* 4.39.11 the "+N" tile of the photos section is a link to the photos page */
.aps-gal-link { position: relative; cursor: pointer; text-decoration: none !important; box-shadow: none !important; }
.aps-gal-item:hover,
.aps-gal-link:hover {
	border-color: var(--aps-skin-color-1);
}
.aps-gal-item img,
.aps-gal-link 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-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); }
}


/* 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);
}
.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-scale, 1));
	/* the same width as the image card below (stage side padding, card max width) */
	width: calc(100% - 28px * var(--aps-scale, 1));
	max-width: 1100px;
	box-sizing: border-box;
	margin: calc(12px * var(--aps-scale, 1)) auto 0;
	padding: calc(14px * var(--aps-scale, 1)) calc(16px * var(--aps-scale, 1));
	background: #fff;
	border: 1px solid var(--aps-hair, #e3e8ef);
	border-bottom-color: #eef0f3;
	/* one card with the image below it: square bottom corners, no gap */
	border-radius: var(--aps-radius, 10px) var(--aps-radius, 10px) 0 0;
}
.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: var(--aps-hair, #e3e8ef);
}
.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-radius, 10px);
	background: color-mix(in srgb, var(--aps-lb-accent) 7%, #f2f4f7);
	color: #101828;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}
/* 4.42.0 the whole square closes the viewer (the "x" itself takes no tap), and a few pixels around it too */
.aps-gal-lb-close { position: relative; touch-action: manipulation; }
.aps-gal-lb-close::before { content: ""; position: absolute; inset: -6px; border-radius: inherit; }
.aps-gal-lb-close > span {
	pointer-events: none;
	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: 0 calc(14px * var(--aps-scale, 1)) calc(10px * var(--aps-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 var(--aps-hair, #e3e8ef);
	border-top: 0;
	border-radius: 0 0 var(--aps-radius, 10px) var(--aps-radius, 10px);
	box-shadow: 0 6px 28px rgba(16,24,40,.07);
	padding: calc(14px * var(--aps-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-panel.is-loading .aps-gal-lb-spinner { opacity: 1; }

/* 4.42.0 the track: three panels (previous, current, next) side by side, moved with the finger;
   each panel has the card's padding, its photo and its own loading circle */
.aps-gal-lb-track {
	position: absolute;
	inset: 0;
	padding: inherit;
	will-change: transform;
	backface-visibility: hidden;
}
.aps-gal-lb-panel {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: inherit;
	box-sizing: border-box;
	overflow: hidden;
	backface-visibility: hidden;
}
@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; }
/* 4.41.1 Arabic (RTL) pages: "next" on the left and "previous" on the right, arrows mirrored */
.aps-gal-lb.is-rtl .aps-gal-lb-prev { left: auto; right: 4px; }
.aps-gal-lb.is-rtl .aps-gal-lb-next { right: auto; left: 4px; }
.aps-gal-lb.is-rtl .aps-gal-lb-nav > svg { transform: scaleX(-1); }

/* bottom: dots + thumbnails + hint */
.aps-gal-lb-bottom {
	position: relative;
	z-index: 3;
	flex: 0 0 auto;
	padding: calc(4px * var(--aps-scale, 1)) calc(16px * var(--aps-scale, 1)) calc(14px * var(--aps-scale, 1));
	text-align: center;
}
.aps-gal-lb-dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: calc(7px * var(--aps-scale, 1));
	margin-bottom: calc(12px * var(--aps-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-scale, 1));
	justify-content: flex-start;
	overflow-x: auto;
	padding: calc(4px * var(--aps-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-scale, 1));
	height: calc(56px * var(--aps-scale, 1));
	padding: calc(3px * var(--aps-scale, 1));
	border: 2px solid transparent;
	border-radius: var(--aps-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);
}

/* 4.41.0 the "more" card: the last stop of a viewer opened from the main image slider (after 4
   photos) or the photos section (after 3) - the next photo blurred, "+N", the label and a button
   to the photos page (the same words as on the page) */
.aps-gal-lb-more[hidden] { display: none !important; }
.aps-gal-lb-more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: inherit;
}
.aps-gal-lb-more-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	filter: blur(10px);
	transform: scale(1.08);
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}
.aps-gal-lb-more-t {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: calc(8px * var(--aps-scale, 1));
	padding: 16px;
	color: #fff;
	line-height: 1.2;
	text-align: center;
	background: color-mix(in srgb, var(--aps-scrim, var(--aps-skin-color-2)) 58%, transparent);
	box-sizing: border-box;
}
.aps-gal-lb-more-t .aps-more-n { font-size: calc(52px * var(--aps-scale, 1)); font-weight: 800; line-height: 1.05; }
.aps-gal-lb-more-t .aps-more-l { font-size: calc(20px * var(--aps-scale, 1)); font-weight: 700; }
.aps-gal-lb-more-t .aps-more-btn {
	margin-top: calc(8px * var(--aps-scale, 1));
	padding: calc(10px * var(--aps-scale, 1)) calc(24px * var(--aps-scale, 1));
	font-size: calc(15px * var(--aps-scale, 1));
	font-weight: 700;
	color: var(--aps-scrim, var(--aps-skin-color-2)) !important;
	background: #fff;
	border-radius: 999px;
	text-decoration: none !important;
	white-space: nowrap;
	touch-action: manipulation;
	box-shadow: 0 6px 20px rgba(16,24,40,.18);
	transition: transform .15s ease, box-shadow .15s ease;
}
.aps-gal-lb-more-t .aps-more-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16,24,40,.24); }
.aps-gal-lb-panel.is-more .aps-gal-lb-img { display: none; }
.aps-gal-lb.is-more .aps-gal-lb-stage { cursor: default; }
/* its thumbnail: the photo darkened with "+N" */
.aps-gal-lb-thumb.is-more { position: relative; overflow: hidden; }
.aps-gal-lb-thumb-more {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 15px;
	font-weight: 800;
	color: #fff;
	background: color-mix(in srgb, var(--aps-scrim, var(--aps-skin-color-2)) 62%, transparent);
	border-radius: inherit;
}

@media (max-width: 600px) {
	/* smaller base values for phones, but still driven by the Nova Style settings */
	.aps-gal-lb-topbar {
		width: calc(100% - 20px * var(--aps-scale, 1));
		margin: calc(10px * var(--aps-scale, 1)) auto 0;
		padding: calc(11px * var(--aps-scale, 1)) calc(12px * var(--aps-scale, 1));
		gap: calc(11px * var(--aps-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: 0 calc(10px * var(--aps-scale, 1)) calc(8px * var(--aps-scale, 1));
	}
	.aps-gal-lb-canvas { padding: calc(10px * var(--aps-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.is-rtl .aps-gal-lb-prev { left: auto; right: 2px; }
	.aps-gal-lb.is-rtl .aps-gal-lb-next { right: auto; left: 2px; }
	.aps-gal-lb-thumb { width: calc(48px * var(--aps-scale, 1)); height: calc(48px * var(--aps-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);
	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: var(--aps-ink); }
.aps-gal-full-count { margin: 0; font-size: 13px; color: var(--aps-mute); }

.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: 0;
	background: var(--aps-tile);
	border-radius: 999px;
	padding: calc(8px * var(--aps-scale, 1)) calc(18px * var(--aps-scale, 1));
	font-size: 13px;
	font-weight: 700;
	color: var(--aps-skin-color-1);
	cursor: pointer;
}
.aps-gal-full-tab.is-active { background: var(--aps-solid, var(--aps-skin-color-2)); color: var(--aps-on-solid, #fff); }
.aps-gal-full-tab.is-disabled { opacity: .55; cursor: not-allowed; }
.aps-gal-full-tab-badge {
	font-size: 10px;
	background: #fff;
	color: var(--aps-mute);
	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; }
