/**
 * Fotogallery Styles
 *
 * Grid gallery + lightbox for Flickr albums.
 */

/* ─── Variables ─── */
.oas-fotogallery,
.oas-fotogallery-archive {
	--fg-gap: 6px;
	--fg-radius: 8px;
	--fg-columns: 2;
	--fg-transition: 0.2s ease;
}

/* ─── Single Gallery Grid ─── */
.oas-fotogallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--fg-columns), 1fr);
	gap: var(--fg-gap);
}

.oas-fotogallery[data-columns="1"] { --fg-columns: 1; }
.oas-fotogallery[data-columns="2"] { --fg-columns: 2; }
.oas-fotogallery[data-columns="3"] { --fg-columns: 3; }
.oas-fotogallery[data-columns="4"] { --fg-columns: 4; }

.oas-fotogallery__item {
	display: block;
	padding: 0;
	margin: 0;
	border: none;
	background: #111;
	cursor: pointer;
	overflow: hidden;
	border-radius: var(--fg-radius);
	position: relative;
	aspect-ratio: 1 / 1;
	transition: transform var(--fg-transition), box-shadow var(--fg-transition);
}

.oas-fotogallery__item:hover,
.oas-fotogallery__item:focus-visible {
	transform: scale(1.02);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
	z-index: 1;
}

.oas-fotogallery__item:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
}

.oas-fotogallery__thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity var(--fg-transition);
}

.oas-fotogallery__item:hover .oas-fotogallery__thumb {
	opacity: 0.9;
}

.oas-fotogallery__empty {
	text-align: center;
	color: #666;
	padding: 2rem;
}

/* ─── Archive Grid ─── */
.oas-fotogallery-archive__grid {
	display: grid;
	grid-template-columns: repeat(var(--fg-columns), 1fr);
	gap: 1.5rem;
}

.oas-fotogallery-archive[data-columns="1"] { --fg-columns: 1; }
.oas-fotogallery-archive[data-columns="2"] { --fg-columns: 2; }
.oas-fotogallery-archive[data-columns="3"] { --fg-columns: 3; }
.oas-fotogallery-archive[data-columns="4"] { --fg-columns: 4; }

.oas-fotogallery-archive__card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--fg-radius);
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: transform var(--fg-transition), box-shadow var(--fg-transition);
}

.oas-fotogallery-archive__card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.oas-fotogallery-archive__cover {
	position: relative;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: #1a1a1a;
}

.oas-fotogallery-archive__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.oas-fotogallery-archive__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #666;
}

.oas-fotogallery-archive__count {
	position: absolute;
	bottom: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	gap: 4px;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	padding: 4px 8px;
	border-radius: 4px;
	backdrop-filter: blur(4px);
}

.oas-fotogallery-archive__info {
	padding: 1rem 1.25rem;
}

.oas-fotogallery-archive__title {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.3;
}

.oas-fotogallery-archive__date {
	font-size: 0.8rem;
	color: #888;
}

/* ─── Archive Pagination ─── */
.oas-fotogallery-archive__pagination {
	margin-top: 2rem;
	text-align: center;
}

.oas-fotogallery-archive__pagination .page-numbers {
	display: inline-flex;
	list-style: none;
	gap: 0.5rem;
	padding: 0;
	margin: 0;
}

.oas-fotogallery-archive__pagination .page-numbers li a,
.oas-fotogallery-archive__pagination .page-numbers li span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	border-radius: 4px;
	font-size: 14px;
	text-decoration: none;
	transition: background var(--fg-transition), color var(--fg-transition);
}

.oas-fotogallery-archive__pagination .page-numbers li a {
	background: #f0f0f1;
	color: #1d2327;
}

.oas-fotogallery-archive__pagination .page-numbers li a:hover {
	background: #2271b1;
	color: #fff;
}

.oas-fotogallery-archive__pagination .page-numbers li .current {
	background: #1d2327;
	color: #fff;
}

/* ─── Lightbox ─── */
.oas-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.oas-lightbox[aria-hidden="false"] {
	opacity: 1;
	visibility: visible;
}

.oas-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.92);
}

.oas-lightbox__container {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 1;
}

.oas-lightbox__close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 8px;
	border-radius: 50%;
	transition: background var(--fg-transition);
	z-index: 10;
}

.oas-lightbox__close:hover,
.oas-lightbox__close:focus-visible {
	background: rgba(255, 255, 255, 0.15);
}

.oas-lightbox__content {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 90vw;
	max-height: 75vh;
	padding: 2rem;
}

.oas-lightbox__image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 4px;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.oas-lightbox__image.is-loaded {
	opacity: 1;
}

/* Navigation arrows */
.oas-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: #fff;
	cursor: pointer;
	padding: 16px;
	border-radius: 50%;
	transition: background var(--fg-transition);
	z-index: 10;
}

.oas-lightbox__nav:hover,
.oas-lightbox__nav:focus-visible {
	background: rgba(255, 255, 255, 0.1);
}

.oas-lightbox__nav--prev {
	left: 16px;
}

.oas-lightbox__nav--next {
	right: 16px;
}

/* Footer: caption + counter */
.oas-lightbox__footer {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	padding: 1.5rem 2rem;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
	color: #fff;
}

.oas-lightbox__caption {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-width: 70%;
}

.oas-lightbox__title {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

.oas-lightbox__description {
	font-size: 0.85rem;
	opacity: 0.8;
	line-height: 1.4;
}

.oas-lightbox__counter {
	font-size: 0.9rem;
	font-weight: 500;
	white-space: nowrap;
	opacity: 0.9;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
	.oas-fotogallery-archive__grid {
		--fg-columns: 2;
	}
}

@media (max-width: 768px) {
	.oas-fotogallery__grid {
		--fg-columns: 2 !important;
	}

	.oas-fotogallery-archive__grid {
		--fg-columns: 2;
	}

	.oas-lightbox__nav {
		padding: 10px;
	}

	.oas-lightbox__nav--prev {
		left: 8px;
	}

	.oas-lightbox__nav--next {
		right: 8px;
	}

	.oas-lightbox__footer {
		padding: 1rem;
	}

	.oas-lightbox__content {
		padding: 1rem;
		max-height: 70vh;
	}
}

@media (max-width: 480px) {
	.oas-fotogallery-archive__grid {
		--fg-columns: 1;
	}

	.oas-lightbox__caption {
		max-width: 60%;
	}
}
