/**
 * Wellness Filterable Gallery - Frontend styles.
 *
 * @package Wellness_Filterable_Gallery
 */

/* Gallery container */
.wfg-gallery {
	--wfg-cols: 3;
	--wfg-cols-tablet: 2;
	--wfg-cols-mobile: 1;
	--wfg-gap: 16px;
}

/* Header with View All */
.wfg-header {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 16px;
}

.wfg-view-all {
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.wfg-view-all:hover {
	opacity: 0.85;
}

/* Filter buttons */
.wfg-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 20px;
}

.wfg-filter-btn {
	border: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	transition: all 0.2s ease;
}

.wfg-filter-btn:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.wfg-filter-btn.active {
	cursor: default;
}

/* Grid */
.wfg-grid {
	display: grid;
	grid-template-columns: repeat(var(--wfg-cols-mobile), 1fr);
	gap: var(--wfg-gap);
}

@media (min-width: 768px) {
	.wfg-grid {
		grid-template-columns: repeat(var(--wfg-cols-tablet), 1fr);
	}
}

@media (min-width: 1024px) {
	.wfg-grid {
		grid-template-columns: repeat(var(--wfg-cols), 1fr);
	}
}

/* Gallery item */
.wfg-item {
	opacity: 1;
	transition: opacity 0.3s ease;
}

.wfg-item.wfg-hidden {
	opacity: 0;
	pointer-events: none;
	position: absolute;
	visibility: hidden;
	width: 0;
	height: 0;
	overflow: hidden;
	margin: 0;
	padding: 0;
}

.wfg-item-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.wfg-item-image-wrap {
	overflow: hidden;
	border-radius: inherit;
}

.wfg-item-image {
	position: relative;
	width: 100%;
	background-size: cover;
	background-position: center;
	transition: transform 0.3s ease;
}

/* Aspect ratios */
.wfg-ratio-1-1 .wfg-item-image::before {
	content: "";
	display: block;
	padding-top: 100%;
}

.wfg-ratio-4-3 .wfg-item-image::before {
	content: "";
	display: block;
	padding-top: 75%;
}

.wfg-ratio-16-9 .wfg-item-image::before {
	content: "";
	display: block;
	padding-top: 56.25%;
}

.wfg-ratio-3-2 .wfg-item-image::before {
	content: "";
	display: block;
	padding-top: 66.67%;
}

.wfg-ratio-original .wfg-item-image::before {
	content: "";
	display: block;
	padding-top: 75%; /* fallback */
}

.wfg-ratio-original .wfg-item-image {
	background-size: contain;
}

/* Play icon for videos */
.wfg-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 48px;
	height: 48px;
	background: rgba(0, 0, 0, 0.6);
	border-radius: 50%;
}

.wfg-play-icon::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
}

/* Category tag */
.wfg-item-category {
	position: absolute;
	bottom: 8px;
	left: 8px;
	padding: 4px 10px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.5px;
	border-radius: 4px;
	z-index: 2;
}

/* Multi-photo album badge (cover mode) */
.wfg-album-count {
	position: absolute;
	top: 8px;
	right: 8px;
	padding: 4px 8px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: rgba(0, 0, 0, 0.65);
	border-radius: 4px;
	z-index: 2;
	max-width: calc(100% - 16px);
	text-align: center;
}

/* Item meta (title/caption) */
.wfg-item-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.wfg-item-title,
.wfg-item-caption {
	display: block;
}

/* Lightbox modal */
.wfg-lightbox {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	background: rgba(0, 0, 0, 0.9);
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
}

.wfg-lightbox.wfg-open {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.wfg-lightbox-stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 100%;
	min-height: 0;
	flex: 1 1 auto;
	position: relative;
	z-index: 1;
	padding-top: 48px;
	box-sizing: border-box;
}

.wfg-lightbox-meta {
	text-align: center;
	color: #fff;
	padding: 0 56px 12px;
	max-width: 100%;
	box-sizing: border-box;
	flex-shrink: 0;
}

.wfg-lightbox-album-title {
	font-size: clamp(1rem, 2.5vw, 1.25rem);
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 6px;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.wfg-lightbox-progress {
	font-size: 0.875rem;
	font-weight: 500;
	letter-spacing: 0.04em;
	opacity: 0.9;
	color: rgba(255, 255, 255, 0.95);
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.wfg-lightbox-content {
	position: relative;
	max-width: 100%;
	max-height: calc(90vh - 100px);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	min-height: 0;
}

.wfg-lightbox-content img,
.wfg-lightbox-content iframe {
	max-width: 100%;
	max-height: calc(90vh - 100px);
	object-fit: contain;
}

.wfg-lightbox-content iframe {
	width: 90vw;
	height: 50.625vw;
	max-height: calc(90vh - 100px);
}

.wfg-lightbox-caption {
	position: absolute;
	bottom: -40px;
	left: 0;
	right: 0;
	text-align: center;
	color: #fff;
	font-size: 14px;
	padding: 8px 0;
}

.wfg-lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 40px;
	height: 40px;
	border: none;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
	line-height: 1;
}

.wfg-lightbox-close:hover {
	background: rgba(255, 255, 255, 0.4);
}

.wfg-lightbox-prev,
.wfg-lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	border: none;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	border-radius: 50%;
	transition: background 0.2s;
}

.wfg-lightbox-prev {
	left: 20px;
}

.wfg-lightbox-next {
	right: 20px;
}

.wfg-lightbox-prev:hover,
.wfg-lightbox-next:hover {
	background: rgba(255, 255, 255, 0.4);
}

/* Prevent body scroll when lightbox open */
body.wfg-lightbox-open {
	overflow: hidden;
}

/* Responsive lightbox buttons */
@media (max-width: 768px) {
	.wfg-lightbox-prev,
	.wfg-lightbox-next {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}
	
	.wfg-lightbox-prev {
		left: 10px;
	}
	
	.wfg-lightbox-next {
		right: 10px;
	}
}
