/* PTS Image Gallery — frontend layouts */
.pts-gallery {
	--pts-columns: 4;
	--pts-column-gap: 16px;
	--pts-row-gap: 16px;
	--pts-thumb-gap: 10px;
	--pts-stage-gap: 14px;
	--pts-radius: 14px;
	--pts-aspect-ratio: 4 / 3;
	--pts-featured-height: 560px;
	--pts-thumb-size: 84px;
	--pts-card-width: 360px;
	--pts-bento-row: 180px;
	--pts-nav-size: 44px;
	--pts-nav-color: #0f172a;
	--pts-nav-bg: #fff;
	--pts-nav-radius: 50%;
	--pts-overlay-color: #07111f;
	--pts-overlay-opacity: .28;
	--pts-thumb-border: #d8dee8;
	--pts-thumb-active: #2563eb;
	--pts-thumb-border-width: 2px;
	--pts-transition: 300ms;
	box-sizing: border-box;
	max-width: 100%;
	position: relative;
}

.pts-gallery *,
.pts-gallery *::before,
.pts-gallery *::after {
	box-sizing: border-box;
}

.pts-gallery figure,
.pts-gallery img,
.pts-gallery button {
	margin: 0;
}

.pts-gallery button {
	font: inherit;
}

.pts-gallery__empty {
	padding: 32px;
	border: 1px dashed #cbd5e1;
	border-radius: 12px;
	background: #f8fafc;
	color: #475569;
	text-align: center;
}

.pts-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--pts-columns), minmax(0, 1fr));
	column-gap: var(--pts-column-gap);
	row-gap: var(--pts-row-gap);
}

.pts-gallery__item,
.pts-gallery__featured-stage {
	position: relative;
	min-width: 0;
	border-radius: var(--pts-radius);
	background: #eef2f7;
	isolation: isolate;
}

.pts-gallery__item {
	overflow: hidden;
}

.pts-gallery__grid .pts-gallery__item,
.pts-gallery__horizontal-card {
	aspect-ratio: var(--pts-aspect-ratio);
}

.pts-gallery__media-button,
.pts-gallery__media-link,
.pts-gallery__media-static {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	text-decoration: none;
	overflow: hidden;
	border-radius: inherit;
}

.pts-gallery__media-button,
.pts-gallery__media-link {
	cursor: pointer;
}

.pts-gallery__media-button:focus-visible,
.pts-gallery__media-link:focus-visible,
.pts-gallery__nav:focus-visible,
.pts-gallery__thumb:focus-visible {
	outline: 3px solid #60a5fa;
	outline-offset: 3px;
}

.pts-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: cover;
	transform: scale(1);
	transition: transform var(--pts-transition) ease, opacity var(--pts-transition) ease;
}


/* Image fit and focal position controls for Horizontal Scrolling and Bento only. */
.pts-gallery--horizontal .pts-gallery__image,
.pts-gallery--bento .pts-gallery__image {
	object-fit: var(--pts-image-fit, cover);
	object-position: var(--pts-image-position-x, center) var(--pts-image-position-y, center);
}

.pts-gallery__overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background: var(--pts-overlay-color);
	opacity: 0;
	transition: opacity var(--pts-transition) ease;
}

.pts-gallery--overlay-enabled .pts-gallery__item:hover .pts-gallery__overlay,
.pts-gallery--overlay-enabled .pts-gallery__slide:hover .pts-gallery__overlay,
.pts-gallery--overlay-enabled .pts-gallery__item:focus-within .pts-gallery__overlay,
.pts-gallery--overlay-enabled .pts-gallery__slide:focus-within .pts-gallery__overlay {
	opacity: var(--pts-overlay-opacity);
}

.pts-gallery__caption {
	position: absolute;
	z-index: 3;
	left: 12px;
	right: 12px;
	bottom: 12px;
	display: flex;
	flex-direction: column;
	gap: 3px;
	max-width: calc(100% - 24px);
	padding: 9px 11px;
	border-radius: 10px;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	pointer-events: none;
	transition: transform var(--pts-transition) ease, opacity var(--pts-transition) ease;
}

.pts-gallery__caption-title,
.pts-gallery__caption-text {
	display: block;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pts-gallery__caption-title {
	font-weight: 600;
	line-height: 1.25;
}

.pts-gallery__caption-text {
	font-size: .9em;
	line-height: 1.35;
}

.pts-gallery__nav {
	position: absolute;
	z-index: 7;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--pts-nav-size);
	height: var(--pts-nav-size);
	padding: 0;
	border: 1px solid rgba(15, 23, 42, .08);
	border-radius: var(--pts-nav-radius);
	background: var(--pts-nav-bg);
	color: var(--pts-nav-color);
	box-shadow: 0 8px 22px rgba(15, 23, 42, .14);
	cursor: pointer;
	transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.pts-gallery__nav:hover {
	transform: scale(1.05);
	box-shadow: 0 10px 26px rgba(15, 23, 42, .18);
}

.pts-gallery__nav svg {
	width: 46%;
	height: 46%;
}

.pts-gallery__counter,
.pts-gallery__card-index,
.pts-gallery__bento-index {
	position: absolute;
	z-index: 6;
	padding: 5px 9px;
	border-radius: 999px;
	background: rgba(15, 23, 42, .72);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: .02em;
	backdrop-filter: blur(8px);
}

/* Masonry */
.pts-gallery__masonry {
	column-count: var(--pts-columns);
	column-gap: var(--pts-column-gap);
}

.pts-gallery__masonry-item {
	width: 100%;
	margin: 0 0 var(--pts-row-gap);
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	aspect-ratio: auto;
}

.pts-gallery__masonry-item .pts-gallery__media-button,
.pts-gallery__masonry-item .pts-gallery__media-link,
.pts-gallery__masonry-item .pts-gallery__media-static {
	height: auto;
}

.pts-gallery__masonry-item .pts-gallery__image {
	height: auto;
	object-fit: contain;
}

/* Carousel + featured strip */
.pts-gallery__featured-shell {
	display: flex;
	flex-direction: column;
	gap: var(--pts-stage-gap);
	min-width: 0;
}

.pts-gallery__featured-stage {
	position: relative;
	height: var(--pts-featured-height);
	overflow: hidden;
}

.pts-gallery__slide {
	position: absolute;
	inset: 0;
	z-index: 1;
	opacity: 0;
	visibility: hidden;
	transform: scale(.995);
	transition: opacity 280ms ease, transform 280ms ease, visibility 280ms ease;
	pointer-events: none;
}

.pts-gallery__slide.is-active {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
	pointer-events: auto;
}

.pts-gallery__featured-stage .pts-gallery__nav--prev {
	left: clamp(8px, 2vw, 20px);
	top: 50%;
	transform: translateY(-50%);
}

.pts-gallery__featured-stage .pts-gallery__nav--next {
	right: clamp(8px, 2vw, 20px);
	top: 50%;
	transform: translateY(-50%);
}

.pts-gallery__featured-stage .pts-gallery__nav--prev:hover,
.pts-gallery__featured-stage .pts-gallery__nav--next:hover {
	transform: translateY(-50%) scale(1.05);
}

.pts-gallery__counter {
	top: 14px;
	right: 14px;
}

.pts-gallery__thumbs {
	display: flex;
	gap: var(--pts-thumb-gap);
	max-width: 100%;
	overflow: auto hidden;
	padding: 3px;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
}

.pts-gallery__thumb {
	flex: 0 0 var(--pts-thumb-size);
	width: var(--pts-thumb-size);
	height: calc(var(--pts-thumb-size) * .72);
	padding: 0;
	border: var(--pts-thumb-border-width) solid var(--pts-thumb-border);
	border-radius: max(7px, calc(var(--pts-radius) * .65));
	background: #fff;
	overflow: hidden;
	cursor: pointer;
	scroll-snap-align: start;
	opacity: .78;
	transition: border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.pts-gallery__thumb:hover {
	opacity: 1;
	transform: translateY(-1px);
}

.pts-gallery__thumb.is-active {
	border-color: var(--pts-thumb-active);
	opacity: 1;
}

.pts-gallery__thumb-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pts-gallery--thumbs-left .pts-gallery__featured-shell,
.pts-gallery--thumbs-right .pts-gallery__featured-shell {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: stretch;
}

.pts-gallery--thumbs-right .pts-gallery__featured-shell {
	grid-template-columns: minmax(0, 1fr) auto;
}

.pts-gallery--thumbs-left .pts-gallery__thumbs,
.pts-gallery--thumbs-right .pts-gallery__thumbs {
	flex-direction: column;
	width: calc(var(--pts-thumb-size) + 8px);
	max-height: var(--pts-featured-height);
	overflow: hidden auto;
	scroll-snap-type: y proximity;
}

.pts-gallery--thumbs-left .pts-gallery__thumb,
.pts-gallery--thumbs-right .pts-gallery__thumb {
	flex-basis: calc(var(--pts-thumb-size) * .72);
}

.pts-gallery--thumbs-left .pts-gallery__featured-stage {
	grid-column: 2;
	grid-row: 1;
}

.pts-gallery--thumbs-left .pts-gallery__thumbs {
	grid-column: 1;
	grid-row: 1;
}

.pts-gallery--thumbs-right .pts-gallery__featured-stage {
	grid-column: 1;
	grid-row: 1;
}

.pts-gallery--thumbs-right .pts-gallery__thumbs {
	grid-column: 2;
	grid-row: 1;
}

/* Horizontal scrolling gallery */
.pts-gallery__horizontal-shell {
	position: relative;
	min-width: 0;
}

.pts-gallery__horizontal-track {
	display: flex;
	gap: var(--pts-column-gap);
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	padding: 4px 2px 12px;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
	scrollbar-width: none;
}

.pts-gallery__horizontal-track::-webkit-scrollbar {
	display: none;
}

.pts-gallery--show-scrollbar .pts-gallery__horizontal-track {
	scrollbar-width: thin;
	scrollbar-color: #94a3b8 #e2e8f0;
}

.pts-gallery--show-scrollbar .pts-gallery__horizontal-track::-webkit-scrollbar {
	display: block;
	height: 8px;
}

.pts-gallery--show-scrollbar .pts-gallery__horizontal-track::-webkit-scrollbar-thumb {
	background: #94a3b8;
	border-radius: 99px;
}

.pts-gallery__horizontal-track.is-dragging {
	cursor: grabbing;
	scroll-behavior: auto;
	user-select: none;
}

.pts-gallery__horizontal-card {
	flex: 0 0 min(var(--pts-card-width), 88vw);
	scroll-snap-align: start;
}

.pts-gallery__card-index {
	top: 12px;
	right: 12px;
}

.pts-gallery__nav--scroll-prev,
.pts-gallery__nav--scroll-next {
	top: 50%;
	transform: translateY(-65%);
}

.pts-gallery__nav--scroll-prev {
	left: calc(var(--pts-nav-size) * -.42);
}

.pts-gallery__nav--scroll-next {
	right: calc(var(--pts-nav-size) * -.42);
}

.pts-gallery__nav--scroll-prev:hover,
.pts-gallery__nav--scroll-next:hover {
	transform: translateY(-65%) scale(1.05);
}

.pts-gallery__progress {
	position: relative;
	width: min(180px, 45%);
	height: 4px;
	margin: 10px auto 0;
	border-radius: 99px;
	background: #e2e8f0;
	overflow: hidden;
}

.pts-gallery__progress span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: #2563eb;
	transition: width 120ms linear;
}

/* Bento */
.pts-gallery__bento {
	display: grid;
	grid-template-columns: repeat(var(--pts-columns), minmax(0, 1fr));
	grid-auto-rows: var(--pts-bento-row);
	grid-auto-flow: dense;
	column-gap: var(--pts-column-gap);
	row-gap: var(--pts-row-gap);
}

.pts-gallery__bento-item {
	min-height: 0;
}

.pts-gallery__bento-item--wide {
	grid-column: span 2;
}

.pts-gallery__bento-item--tall {
	grid-row: span 2;
}

.pts-gallery__bento-item--large {
	grid-column: span 2;
	grid-row: span 2;
}

.pts-gallery__bento-index {
	top: 12px;
	right: 12px;
}

@media (max-width: 767px) {
	.pts-gallery__caption {
		left: 8px;
		right: 8px;
		bottom: 8px;
		max-width: calc(100% - 16px);
		padding: 7px 9px;
	}

	.pts-gallery--thumbs-left .pts-gallery__featured-shell,
	.pts-gallery--thumbs-right .pts-gallery__featured-shell {
		display: flex;
		flex-direction: column;
	}

	.pts-gallery--thumbs-left .pts-gallery__thumbs,
	.pts-gallery--thumbs-right .pts-gallery__thumbs {
		flex-direction: row;
		width: 100%;
		max-height: none;
		overflow: auto hidden;
		scroll-snap-type: x proximity;
	}

	.pts-gallery--thumbs-left .pts-gallery__thumb,
	.pts-gallery--thumbs-right .pts-gallery__thumb {
		flex-basis: var(--pts-thumb-size);
	}

	.pts-gallery__nav--scroll-prev {
		left: 8px;
	}

	.pts-gallery__nav--scroll-next {
		right: 8px;
	}

	.pts-gallery__bento-item--wide,
	.pts-gallery__bento-item--large {
		grid-column: span min(2, var(--pts-columns));
	}
}

@media (prefers-reduced-motion: reduce) {
	.pts-gallery *,
	.pts-gallery *::before,
	.pts-gallery *::after {
		scroll-behavior: auto !important;
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
	}
}

/* Natural-height option for the responsive grid. */
.pts-gallery--natural-grid .pts-gallery__grid .pts-gallery__item {
	aspect-ratio: auto;
}

.pts-gallery--natural-grid .pts-gallery__grid .pts-gallery__media-button,
.pts-gallery--natural-grid .pts-gallery__grid .pts-gallery__media-link,
.pts-gallery--natural-grid .pts-gallery__grid .pts-gallery__media-static {
	height: auto;
}

.pts-gallery--natural-grid .pts-gallery__grid .pts-gallery__image {
	height: auto;
	object-fit: contain;
}
