/* PXL Scroll Gallery - frontend styles */

.pxlsg-wrapper {
	--pxlsg-gap: 16px;
	--pxlsg-duration: 30s;
	--pxlsg-ratio: 3/4;
	--pxlsg-overlay: rgba(10,10,10,0.94);
	--pxlsg-arrow-color: #1a1a1a;
	--pxlsg-close-color: #1a1a1a;
	--pxlsg-close-bg: #ffffff;
	--pxlsg-arrow-size: 28px;
	position: relative;
	width: 100%;
}

/* ---------- Vertical layout ---------- */
.pxlsg-wrapper.pxlsg-layout-vertical .pxlsg-viewport {
	height: 500px;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 8%, #000 92%, transparent 100%);
	mask-image: linear-gradient(to bottom, transparent 0, #000 8%, #000 92%, transparent 100%);
}

.pxlsg-wrapper.pxlsg-layout-vertical .pxlsg-track-list {
	display: flex;
	gap: var(--pxlsg-gap);
	height: 100%;
}

.pxlsg-wrapper.pxlsg-layout-vertical .pxlsg-track {
	overflow: hidden;
	height: 100%;
}

.pxlsg-wrapper.pxlsg-layout-vertical .pxlsg-track-inner {
	display: flex;
	flex-direction: column;
	gap: var(--pxlsg-gap);
	animation: pxlsg-scroll-up var(--pxlsg-duration) linear infinite;
	will-change: transform;
}

.pxlsg-wrapper.pxlsg-layout-vertical .pxlsg-track[data-reverse="1"] .pxlsg-track-inner {
	animation-name: pxlsg-scroll-down;
}

@keyframes pxlsg-scroll-up {
	from { transform: translateY(0); }
	to   { transform: translateY(-50%); }
}

@keyframes pxlsg-scroll-down {
	from { transform: translateY(-50%); }
	to   { transform: translateY(0); }
}

/* ---------- Horizontal layout ---------- */
.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-viewport {
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%);
	mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%);
}

.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-track-list {
	display: flex;
	flex-direction: column;
	gap: var(--pxlsg-gap);
}

.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-track {
	overflow: hidden;
	width: 100%;
}

.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-track-inner {
	display: flex;
	flex-direction: row;
	gap: var(--pxlsg-gap);
	animation: pxlsg-scroll-left var(--pxlsg-duration) linear infinite;
	will-change: transform;
	width: max-content;
}

.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-track[data-reverse="1"] .pxlsg-track-inner {
	animation-name: pxlsg-scroll-right;
}

@keyframes pxlsg-scroll-left {
	from { transform: translateX(0); }
	to   { transform: translateX(-50%); }
}

@keyframes pxlsg-scroll-right {
	from { transform: translateX(-50%); }
	to   { transform: translateX(0); }
}

.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-item {
	width: 260px;
	flex: 0 0 auto;
}

/* ---------- Shared item styles ---------- */
.pxlsg-item {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
}

.pxlsg-wrapper.pxlsg-layout-vertical .pxlsg-item {
	width: 100%;
}

.pxlsg-item img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: var(--pxlsg-ratio);
	object-fit: cover;
	cursor: pointer;
	transition: transform 0.45s ease, filter 0.45s ease;
}

.pxlsg-wrapper.pxlsg-layout-horizontal .pxlsg-item img {
	aspect-ratio: var(--pxlsg-ratio);
}

.pxlsg-pause-hover .pxlsg-track:hover .pxlsg-track-inner {
	animation-play-state: paused;
}

/* Hover effects */
.pxlsg-hover-zoom .pxlsg-item img:hover {
	transform: scale(1.06);
}

.pxlsg-hover-grayscale .pxlsg-item img {
	filter: grayscale(1);
}
.pxlsg-hover-grayscale .pxlsg-item img:hover {
	filter: grayscale(0);
}

.pxlsg-hover-brightness .pxlsg-item img:hover {
	filter: brightness(1.15);
}

.pxlsg-editor-notice {
	padding: 20px;
	text-align: center;
	background: #f5f5f5;
	border: 1px dashed #ccc;
	color: #666;
}

/* ---------- Popup ---------- */
.pxlsg-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
}

.pxlsg-popup.pxlsg-popup-open {
	display: flex;
}

/* Moved to <body> by JS on open so it can never be trapped inside a
   transformed/filtered ancestor (which would otherwise turn this
   position:fixed element into a positioned-relative-to-that-ancestor box -
   the cause of the close button appearing off in the corner of the page
   instead of the corner of the screen). */
body > .pxlsg-popup {
	position: fixed;
}

.pxlsg-popup-overlay {
	position: absolute;
	inset: 0;
	background: var(--pxlsg-overlay);
}

.pxlsg-popup-body {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}

/* Card: white matting + rounded corners + soft shadow around the photo,
   like a framed print - matches the reference design. Sized with an
   aspect-ratio (instead of a flat vh height) so it hugs a typical
   landscape photo tightly rather than leaving big blank white bars
   above/below when the image is shorter than the box. */
.pxlsg-popup-frame {
	position: relative;
	width: min(90vw, 1100px);
	aspect-ratio: 3 / 2;
	max-height: 82vh;
	background: #fff;
	border-radius: 18px;
	padding: 10px;
	box-sizing: border-box;
	box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
}

.pxlsg-popup-stage {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 12px;
}

.pxlsg-popup-track {
	display: flex;
	height: 100%;
	transition: transform 0.4s ease;
}

.pxlsg-popup-slide {
	flex: 0 0 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pxlsg-popup-slide img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 8px;
}

/* Round white chips with dark icons for close/prev/next, overlapping the
   card's edges - matches the reference screenshots.
   Width/height/box-sizing are !important because some themes' global
   button resets (min-width, padding, etc.) were overriding these and
   stretching the circle into a pill/oval shape. */
.pxlsg-popup-close,
.pxlsg-popup-prev,
.pxlsg-popup-next {
	position: absolute;
	z-index: 5;
	box-sizing: border-box !important;
	width: 44px !important;
	height: 44px !important;
	min-width: 44px !important;
	max-width: 44px !important;
	min-height: 44px !important;
	max-height: 44px !important;
	margin: 0 !important;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--pxlsg-close-bg);
	border: none;
	border-radius: 50% !important;
	cursor: pointer;
	color: var(--pxlsg-arrow-color);
	font-size: 18px;
	line-height: 1;
	padding: 0 !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	transition: background 0.2s ease, transform 0.2s ease;
}

.pxlsg-popup-close:hover,
.pxlsg-popup-prev:hover,
.pxlsg-popup-next:hover {
	transform: scale(1.07);
}

/* Close sits on the frame's top-right corner, overlapping it slightly -
   positioned relative to the frame itself (like prev/next) rather than
   calculated from the viewport, so it can never drift off-position. */
.pxlsg-popup-close {
	top: -18px;
	right: -18px;
	color: var(--pxlsg-close-color);
	font-size: 20px;
}

.pxlsg-popup-prev,
.pxlsg-popup-next {
	top: 50%;
	transform: translateY(-50%);
	color: var(--pxlsg-arrow-color);
}

.pxlsg-popup-prev:hover,
.pxlsg-popup-next:hover {
	transform: translateY(-50%) scale(1.07);
}

.pxlsg-popup-prev {
	left: -20px;
}

.pxlsg-popup-next {
	right: -20px;
}

/* Dot pagination + "n / total" text, sitting below the card. */
.pxlsg-popup-counter {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
}

.pxlsg-popup-dots {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pxlsg-popup-dots span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
	transition: background 0.2s ease, transform 0.2s ease;
}

.pxlsg-popup-dots span.pxlsg-dot-active {
	background: #fff;
	transform: scale(1.2);
}

.pxlsg-popup-counter-text {
	color: #fff;
	font-family: sans-serif;
	font-size: 14px;
	opacity: 0.85;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.pxlsg-popup-body {
		width: 100%;
		gap: 14px;
	}

	.pxlsg-popup-frame {
		width: 92vw;
		aspect-ratio: 3 / 2;
		max-height: 70vh;
		max-width: none;
		padding: 8px;
		border-radius: 16px;
	}

	.pxlsg-popup-stage {
		border-radius: 10px;
	}

	/* On mobile the card no longer spans near the full screen, so the
	   close button is pinned to the screen's top-right corner instead of
	   the card corner - matches the reference mobile layout. */
	.pxlsg-popup-close {
		position: fixed;
		top: max(14px, env(safe-area-inset-top));
		right: max(14px, env(safe-area-inset-right));
		width: 40px !important;
		height: 40px !important;
		min-width: 40px !important;
		max-width: 40px !important;
		min-height: 40px !important;
		max-height: 40px !important;
		font-size: 18px;
	}

	.pxlsg-popup-prev,
	.pxlsg-popup-next {
		width: 38px !important;
		height: 38px !important;
		min-width: 38px !important;
		max-width: 38px !important;
		min-height: 38px !important;
		max-height: 38px !important;
		font-size: 16px;
	}

	.pxlsg-popup-prev {
		left: -14px;
	}

	.pxlsg-popup-next {
		right: -14px;
	}
}
