.gallery {
	display: grid;
	grid-template-columns: repeat(var(--nb-cols), 1fr);
	grid-auto-flow: row;
	margin-bottom: 1rem;
	gap: var(--gap);
	overflow-y: scroll;
	overflow-x: hidden;
	scroll-snap-stop: always;
	scroll-snap-type: y mandatory;
	scroll-behavior: smooth;
	scrollbar-color: var(--primary) transparent;

	--gap: 0.5rem;
	--nb-cols: 3;
	--col-width: calc(100cqw / var(--nb-cols));
	--remove-gap: (var(--gap) / (var(--nb-cols) - 1));
	--item-aspect-ratio: 1 / 1;

	max-height: calc((var(--col-width) - var(--remove-gap)) * var(--item-aspect-ratio));
}
.gallery::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

.gallery::-webkit-scrollbar-track {
	background: transparent;
	border-radius: 3px;
}

.gallery::-webkit-scrollbar-thumb {
	background: var(--primary);
	border-radius: 3px;
}

.gallery::-webkit-scrollbar-thumb:hover {
	background: var(--secondary);
}
.gallery img {
	width: 100%;
	aspect-ratio: 1/1;
	object-fit: cover;
	background: var(--text-primary);
	padding: 0.5rem;
	cursor: pointer;
	scroll-snap-align: start;
	pointer-events: auto;
	border-radius: 8px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.1);
}
.gallery img:hover {
	transform: translateY(-2px) scale(1.02);
}
.gallery img:active {
	transform: translateY(0) scale(0.98);
}
.fullscreen {
	display: none;
	position: fixed;
	z-index: 99;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	background-color: rgba(0, 0, 0, 0.8);
	backdrop-filter: blur(10px);
	animation: fadeIn 0.3s ease-out;
}
.fullscreen.active {
	display: flex;
	align-items: center;
	justify-content: center;
}
.fullscreen::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(
		135deg,
		rgba(0, 0, 0, 0.4) 0%,
		rgba(0, 0, 0, 0.2) 50%,
		rgba(0, 0, 0, 0.4) 100%
	);
	pointer-events: none;
}
.fullscreen-image {
	max-width: 95%;
	max-height: 85%;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	z-index: 2;
	opacity: 1;
}

.fullscreen-image.animate {
	animation: slideIn 0.3s ease-out;
}
.arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 60px;
	height: 60px;
	background-color: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(10px);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 3;
	border: 1px solid rgba(255, 255, 255, 0.2);
}
.arrow:hover {
	background-color: rgba(255, 255, 255, 0.25);
	transform: translateY(-50%) scale(1.05);
}

.arrow:active {
	transform: translateY(-50%) scale(0.95);
}
.left-arrow {
	left: 20px;
}
.right-arrow {
	right: 20px;
}
.arrow::before {
	content: '';
	width: 20px;
	height: 20px;
	border-top: 3px solid white;
	border-right: 3px solid white;
}
.left-arrow::before {
	transform: rotate(-135deg);
	margin-left: 5px;
}
.right-arrow::before {
	transform: rotate(45deg);
	margin-right: 5px;
}
.close-btn {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 40px;
	height: 40px;
	background-color: rgba(255, 255, 255, 0.15);
	backdrop-filter: blur(10px);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 3;
	border: 1px solid rgba(255, 255, 255, 0.2);
}
.close-btn:hover {
	background-color: rgba(255, 255, 255, 0.25);
	transform: scale(1.05);
}
.close-btn:active {
	transform: scale(0.95);
}
.close-btn::before,
.close-btn::after {
	content: '';
	position: absolute;
	width: 20px;
	height: 2px;
	background-color: white;
}
.close-btn::before {
	transform: rotate(45deg);
}
.close-btn::after {
	transform: rotate(-45deg);
}
.image-counter {
	position: absolute;
	bottom: 20px;
	left: 0;
	right: 0;
	text-align: center;
	color: white;
	font-size: 1.1rem;
	z-index: 3;
	background-color: rgba(0, 0, 0, 0.4);
	padding: 8px 16px;
	border-radius: 20px;
	display: inline-block;
	margin: 0 auto;
	width: fit-content;
}
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
@keyframes slideIn {
	from {
		transform: scale(0.9);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}
.loading {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #fff;
	animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
@media (max-width: 900px) {
	.gallery {
		--nb-cols: 2;
	}
}
@media (max-width: 600px) {
	.arrow {
		width: 50px;
		height: 50px;
	}

	.left-arrow {
		left: 10px;
	}

	.right-arrow {
		right: 10px;
	}
}
