/* WP Gallery Suite — Public Front-End Styles */

.wpgs-gallery {
	margin: 1.5em 0;
	box-sizing: border-box;
	background: #000;
	padding: 20px;
	border-radius: 8px;
}

.wpgs-gallery * {
	box-sizing: border-box;
}

.wpgs-empty {
	color: #aaa;
	font-style: italic;
}

/* ---------- Shared item styles ---------- */

.wpgs-item {
	margin: 0;
	position: relative;
}

.wpgs-item-media {
	position: relative;
	aspect-ratio: var(--wpgs-aspect, 1 / 1);
	overflow: hidden;
	border-radius: 6px;
	background: #1a1a1a;
}

.wpgs-item-media img,
.wpgs-item-link img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
}

.wpgs-item-link {
	display: block;
	width: 100%;
	height: 100%;
}

.wpgs-caption {
	margin-top: 6px;
	font-size: 0.875em;
	color: #ddd;
	text-align: center;
}

.wpgs-zoom-btn {
	position: absolute;
	bottom: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.15s ease;
	z-index: 2;
}

.wpgs-zoom-btn:hover {
	background: rgba(0, 0, 0, 0.8);
	transform: scale(1.08);
}

/* ---------- Grid ----------
   Thumbnail size now drives actual column width (auto-fill + minmax),
   so Small/Medium/Large is visibly different on the front end.
   The "columns" setting becomes a soft cap on max columns at wide widths. */

.wpgs-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--wpgs-thumb-size, 240px), 1fr));
	gap: 14px;
}

/* ---------- Masonry ---------- */

.wpgs-masonry {
	display: block;
	column-width: var(--wpgs-thumb-size, 240px);
	column-count: var(--wpgs-columns, 3);
	column-gap: 14px;
}

.wpgs-masonry-item {
	display: inline-block;
	width: 100%;
	margin-bottom: 14px;
	break-inside: avoid;
}

.wpgs-masonry .wpgs-item-media {
	aspect-ratio: var(--wpgs-aspect, 1 / 1);
}

/* ---------- Carousel ----------
   Transform-based (not overflow-scroll) so it works regardless of whether
   the theme's parent containers have overflow:hidden set. The outer wrap
   clips the track; JS translates the track left/right by item-width steps. */

.wpgs-carousel-wrap {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

.wpgs-carousel-viewport {
	overflow: hidden;
	flex: 1 1 auto;
	min-width: 0;
}

.wpgs-carousel-track {
	display: flex;
	gap: 16px;
	transition: transform 0.35s ease;
	cursor: grab;
	will-change: transform;
}

.wpgs-carousel-track.is-dragging {
	transition: none;
	cursor: grabbing;
}

.wpgs-carousel-item {
	flex: 0 0 auto;
	width: var(--wpgs-thumb-size, 240px);
}

.wpgs-carousel-nav {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid #444;
	background: #1a1a1a;
	color: #fff;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	z-index: 2;
}

.wpgs-carousel-nav:hover {
	background: #2a2a2a;
}

/* ---------- Slideshow ----------
   Width and height are set by the gallery's Slideshow Width/Height settings
   (stored as --wpgs-slide-width and --wpgs-slide-height CSS variables).
   Defaults: 100% wide (full container), height auto (follows aspect ratio).
   The max-height on .wpgs-item-media below prevents the image itself from
   becoming absurdly tall on ultra-tall ratios regardless of height override. */

.wpgs-slideshow {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	width: var(--wpgs-slide-width, 100%);
	height: var(--wpgs-slide-height, auto);
	margin: 0 auto;
}

.wpgs-slideshow-track {
	position: relative;
}

.wpgs-slide {
	display: none;
}

.wpgs-slide.is-active {
	display: block;
	animation: wpgs-fade 0.4s ease;
}

.wpgs-slide .wpgs-item-media {
	aspect-ratio: var(--wpgs-aspect, 1 / 1);
	max-height: 80vh;
	width: 100%;
	height: 100%;
}

@keyframes wpgs-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.wpgs-slide-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	z-index: 3;
}

.wpgs-slide-prev { left: 12px; }
.wpgs-slide-next { right: 12px; }

.wpgs-slide-nav:hover {
	background: rgba(0, 0, 0, 0.7);
}

/* ---------- Slideshow thumbnail strip ----------
   Horizontally scrollable filmstrip (not a wrapping grid) so any number
   of thumbnails stay reachable via scroll/swipe/drag, same pattern as
   the Carousel track. Fills the same full width as the slideshow above
   it — individual thumbnails stay a small fixed size regardless of
   container width, since they're a navigation strip, not a display size. */

.wpgs-thumb-strip {
	display: flex;
	flex-wrap: nowrap;
	gap: 8px;
	margin: 14px 0 0;
	width: 100%;
	overflow-x: auto;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	padding-bottom: 4px;
	-webkit-overflow-scrolling: touch;
	cursor: grab;
}

.wpgs-thumb-strip.is-dragging {
	cursor: grabbing;
	scroll-behavior: auto;
}

.wpgs-thumb-strip-item {
	flex: 0 0 auto;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 4px;
	overflow: hidden;
	background: #1a1a1a;
	cursor: pointer;
	opacity: 0.65;
	transition: opacity 0.15s ease, border-color 0.15s ease;
}

.wpgs-thumb-strip-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

.wpgs-thumb-strip-item:hover {
	opacity: 0.9;
}

.wpgs-thumb-strip-item.is-active {
	opacity: 1;
	border-color: #fff;
}

/* ---------- Lightbox ---------- */

.wpgs-lightbox-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease;
	z-index: 100000;
	padding: 40px;
}

.wpgs-lightbox-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.wpgs-lightbox-img {
	max-width: 90vw;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 4px;
}

.wpgs-lightbox-caption {
	color: #eee;
	margin-top: 14px;
	font-size: 0.95em;
	text-align: center;
	max-width: 80vw;
}

.wpgs-lightbox-close {
	position: absolute;
	top: 18px;
	right: 24px;
	background: none;
	border: none;
	color: #fff;
	font-size: 34px;
	line-height: 1;
	cursor: pointer;
}

body.wpgs-lightbox-active {
	overflow: hidden;
}

/* ---------- Responsive ----------
   Grid auto-fills based on --wpgs-thumb-size already, so it naturally
   reflows on narrower screens. We only need to relax masonry's column
   count on small screens so columns don't get too narrow. */

@media (max-width: 600px) {
	.wpgs-masonry {
		column-count: 2 !important;
	}
}

@media (max-width: 400px) {
	.wpgs-masonry {
		column-count: 1 !important;
	}
}
