/**
 * Museum Gallery — Automuseums Brand
 *
 * Modern featured-mosaic gallery grid + lightbox for standard (non-FIVA)
 * museum pages. Mirrors the FIVA gallery layout, recolored to the
 * Automuseums brand system (blue) instead of FIVA green/gold.
 *
 * The gallery markup (template-parts/museum/gallery-section.php) uses the
 * shared .fiva-gallery-* class names. This stylesheet and the FIVA one are
 * never enqueued on the same page (FIVA vs non-FIVA templates are mutually
 * exclusive), so there is no selector conflict.
 *
 * @package Astra-Child
 * @author  Synergy Marketing <info@synergymarketing.mk>
 */

/* ============================================
   SECTION WRAPPER
   ============================================ */

.museum-gallery-section {
	margin-top: 2.5rem;
	padding: 2rem;
	background: var(--am-white, #FFFFFF);
	border: 1px solid var(--am-border, #E5E7EB);
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

/* ============================================
   HEADER
   ============================================ */

.museum-gallery-section .fiva-gallery-header {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.museum-gallery-section .fiva-section-divider {
	width: 100px;
	height: 3px;
	border-radius: 2px;
	background: linear-gradient(
		to right,
		var(--am-brand-blue, #2563EB),
		rgba(37, 99, 235, 0.15)
	);
}

.museum-gallery-section .fiva-gallery-header-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
}

.museum-gallery-section .fiva-gallery-title {
	font-family: var(--am-font-heading, 'Inter', system-ui, -apple-system, sans-serif);
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--am-brand-blue, #2563EB);
	margin: 0;
}

.museum-gallery-section .fiva-gallery-count {
	font-family: var(--am-font-heading, 'Inter', system-ui, -apple-system, sans-serif);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--am-brand-blue, #2563EB);
	background: rgba(37, 99, 235, 0.08);
	border: 1px solid var(--am-brand-blue, #2563EB);
	border-radius: 20px;
	padding: 0.3rem 0.75rem;
	white-space: nowrap;
}

/* ============================================
   GRID — featured mosaic (first image is hero)
   ============================================ */

.museum-gallery-section .fiva-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
}

.museum-gallery-section .fiva-gallery-item:first-child {
	grid-column: span 2;
	grid-row: span 2;
}

/* ============================================
   GALLERY ITEM
   ============================================ */

.museum-gallery-section .fiva-gallery-item {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	cursor: pointer;
	aspect-ratio: 4 / 3;
	background-color: var(--am-light, #F3F4F6);
	transition: transform 300ms ease, box-shadow 300ms ease;
}

.museum-gallery-section .fiva-gallery-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.museum-gallery-section .fiva-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 300ms ease;
}

.museum-gallery-section .fiva-gallery-item:hover img {
	transform: scale(1.05);
}

/* Overlay */

.museum-gallery-section .fiva-gallery-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		135deg,
		rgba(37, 99, 235, 0.72),
		rgba(29, 78, 216, 0.55)
	);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 300ms ease;
}

.museum-gallery-section .fiva-gallery-item:hover .fiva-gallery-overlay {
	opacity: 1;
}

/* Expand icon (plus) */

.museum-gallery-section .fiva-gallery-expand {
	width: 36px;
	height: 36px;
	position: relative;
	transform: scale(0.8);
	transition: transform 300ms ease;
}

.museum-gallery-section .fiva-gallery-expand::before,
.museum-gallery-section .fiva-gallery-expand::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	background: #FFFFFF;
	border-radius: 2px;
}

.museum-gallery-section .fiva-gallery-expand::before {
	width: 24px;
	height: 3px;
	transform: translate(-50%, -50%);
}

.museum-gallery-section .fiva-gallery-expand::after {
	width: 3px;
	height: 24px;
	transform: translate(-50%, -50%);
}

.museum-gallery-section .fiva-gallery-item:hover .fiva-gallery-expand {
	transform: scale(1);
}

/* ============================================
   LIGHTBOX
   ============================================ */

.fiva-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fiva-lightbox-overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(15, 23, 42, 0.95);
	cursor: pointer;
}

.fiva-lightbox-content {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
	z-index: 1000000;
}

.fiva-lightbox-image-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.fiva-lightbox-image {
	max-width: 90vw;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 8px;
}

.fiva-lightbox-caption {
	margin-top: 1rem;
	padding: 0.5rem 1rem;
	background-color: rgba(0, 0, 0, 0.7);
	color: #ffffff;
	border-radius: 8px;
	font-family: var(--am-font-body, 'Inter', system-ui, -apple-system, sans-serif);
	font-size: 0.875rem;
	max-width: 90vw;
	text-align: center;
}

.fiva-lightbox-caption:empty {
	display: none;
}

/* Lightbox buttons */

.fiva-lightbox-close,
.fiva-lightbox-prev,
.fiva-lightbox-next {
	position: absolute;
	background-color: rgba(37, 99, 235, 0.9);
	color: #ffffff;
	border: 2px solid #ffffff;
	border-radius: 50%;
	width: 50px;
	height: 50px;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
	transition: all 150ms ease;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000001;
}

.fiva-lightbox-close:hover,
.fiva-lightbox-prev:hover,
.fiva-lightbox-next:hover {
	background-color: var(--am-brand-blue-dark, #1D4ED8);
	border-color: #ffffff;
	transform: scale(1.1);
}

.fiva-lightbox-close {
	top: 20px;
	right: 20px;
}

.fiva-lightbox-prev {
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
}

.fiva-lightbox-prev:hover {
	transform: translateY(-50%) scale(1.1);
}

.fiva-lightbox-next {
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
}

.fiva-lightbox-next:hover {
	transform: translateY(-50%) scale(1.1);
}

.fiva-lightbox-counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background-color: rgba(37, 99, 235, 0.9);
	color: #ffffff;
	padding: 0.25rem 1rem;
	border-radius: 50px;
	font-family: var(--am-font-body, 'Inter', system-ui, -apple-system, sans-serif);
	font-size: 0.875rem;
	font-weight: 600;
	border: 1px solid #ffffff;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1023px) {
	.museum-gallery-section .fiva-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.museum-gallery-section .fiva-gallery-item:first-child {
		grid-column: span 2;
		grid-row: span 1;
	}
}

/* Mobile */
@media (max-width: 767px) {
	.museum-gallery-section {
		padding: 1.25rem;
	}

	.museum-gallery-section .fiva-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.5rem;
	}

	.museum-gallery-section .fiva-gallery-item:first-child {
		grid-column: span 2;
		grid-row: span 1;
	}

	.museum-gallery-section .fiva-gallery-title {
		font-size: 1.25rem;
	}

	.fiva-lightbox-close,
	.fiva-lightbox-prev,
	.fiva-lightbox-next {
		width: 40px;
		height: 40px;
		font-size: 1.5rem;
	}

	.fiva-lightbox-close {
		top: 10px;
		right: 10px;
	}

	.fiva-lightbox-prev {
		left: 10px;
	}

	.fiva-lightbox-next {
		right: 10px;
	}

	.fiva-lightbox-counter {
		bottom: 10px;
		font-size: 0.75rem;
		padding: 0.15rem 0.5rem;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.museum-gallery-section .fiva-gallery-item,
	.museum-gallery-section .fiva-gallery-item img,
	.museum-gallery-section .fiva-gallery-overlay,
	.museum-gallery-section .fiva-gallery-expand {
		transition: none;
	}
}
