@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap');

body.gallery-page #primary {
	max-width: none;
	padding: 0;
	margin: 0;
}

body.gallery-page button:focus {
	outline: 2px auto #E40728;
}

.gallery-section {
	margin: 0 auto;
	padding: 84px 64px 120px;
	font-family: 'Montserrat', sans-serif;
}

.gallery-title {
	font-size: 32px;
	font-weight: 600;
	line-height: 40px;
	margin: 0 0 32px;
	color: #1a1a1a;
}

.gallery-tabs-wrap {
	position: relative;
}

.gallery-tabs-placeholder {
	display: none;
}

.gallery-tabs {
	display: flex;
	gap: 0;
	margin-bottom: 32px;
	background: #fff;
	padding: 12px 0;
	z-index: 100;
	transition: box-shadow 0.2s ease;
}

.gallery-tabs.is-fixed {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	padding: 15px 64px;
	z-index: 50000;
}

.gallery-tabs-placeholder.is-active {
	display: block;
}

.gallery-tab {
	padding: 11px 16px;
	font-size: 14px;
	font-weight: 400;
	color: #1a1a1a;
	background: none;
	border: 2px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	transition: border-color 0.2s ease;
	font-family: inherit;
	line-height: 1.4;
}

.gallery-tab:hover {
	border-color: #ccc;
}

.gallery-tab.active {
	border-color: #c8102e;
}

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	row-gap: 24px;
	column-gap: 24px;
}

.gallery-item {
	width: 100%;
	aspect-ratio: 408 / 270;
	overflow: hidden;
	border-radius: 8px;
	position: relative;
	cursor: pointer;
	background: #f0f0f0;
}

.gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease, opacity 0.4s ease;
	opacity: 0;
}

.gallery-item img.loaded {
	opacity: 1;
}

.gallery-item:hover img.loaded {
	transform: scale(1.03);
}

.gallery-item::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: gallery-shimmer 1.5s infinite;
	z-index: 1;
	transition: opacity 0.3s ease;
}

.gallery-item.img-loaded::before {
	opacity: 0;
	pointer-events: none;
}

@keyframes gallery-shimmer {
	to {
		background-position: -200% 0;
	}
}

.gallery-grid.fade-in .gallery-item {
	opacity: 0;
	transform: translateY(12px);
	animation: gallery-grid-fade-in 0.35s ease forwards;
}

@keyframes gallery-grid-fade-in {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.gallery-show-more {
	display: none;
	width: 100%;
	margin-top: 40px;
	padding: 14px 32px;
	font-size: 14px;
	font-weight: 500;
	color: #1a1a1a;
	background: none;
	border: 2px solid #d0d0d0;
	border-radius: 4px;
	cursor: pointer;
	font-family: inherit;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.gallery-show-more:hover {
	border-color: #999;
	background: #f5f5f5;
}

.gallery-show-more.visible {
	display: block;
}

.gallery-empty {
	text-align: center;
	color: #555;
	padding: 40px 0;
}

.gallery-lightbox {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: 99999;
	background: #fff;
	flex-direction: column;
}

.gallery-lightbox.open {
	display: flex;
}

.lightbox-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 28px;
	flex-shrink: 0;
}

.lightbox-title {
	font-size: 16px;
	font-weight: 400;
	color: #1a1a1a;
}

.lightbox-close {
	width: 40px;
	height: 40px;
	border: none;
	background: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background 0.2s ease;
}

.lightbox-close:hover {
	background: #f0f0f0;
}

.lightbox-body {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
	min-height: 0;
	padding: 0 24px 24px;
	touch-action: pan-y;
	user-select: none;
}

.lightbox-image {
	max-width: calc(100% - 140px);
	max-height: 100%;
	object-fit: contain;
	display: block;
	border-radius: 4px;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.lightbox-image.loading-lb {
	opacity: 0.3;
}

.lightbox-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: 1.5px solid #d0d0d0;
	background: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.2s ease, background 0.2s ease;
	z-index: 2;
}

.lightbox-arrow:hover {
	border-color: #999;
	background: #f5f5f5;
}

.lightbox-arrow.prev {
	left: 28px;
}

.lightbox-arrow.next {
	right: 28px;
}

@media (min-width: 1600px) {
	.lightbox-image {
		max-width: calc(100% - 160px);
	}
}

@media (min-width: 1920px) {
	.lightbox-image {
		max-width: calc(100% - 180px);
	}
}

@media (max-width: 768px) {
	.gallery-grid {
		grid-template-columns: repeat(2, 1fr);
		row-gap: 16px;
		column-gap: 16px;
	}

	.gallery-section {
		padding: 17px 40px 80px;
	}

	.gallery-tabs.is-fixed {
		padding: 12px 40px;
	}

	.gallery-title {
		font-size: 28px;
	}

	.lightbox-arrow {
		display: none;
	}

	.lightbox-body {
		padding: 0 16px 16px;
	}

	.lightbox-image {
		max-width: 100%;
	}

	.lightbox-header {
		padding: 16px 20px;
	}
}

@media (max-width: 480px) {
	.gallery-grid {
		grid-template-columns: 1fr;
	}
}