/* The gallery grid and its lightbox, on the public site. */

.sosar-gallery {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.75rem;
	margin: 0;
	max-width: none;
}

@media (min-width: 40rem) {
	.sosar-gallery {
		grid-template-columns: repeat(var(--sosar-gallery-columns, 3), 1fr);
		gap: 1rem;
	}
}

.sosar-gallery__item {
	margin: 0;
	border-radius: 1.25rem;
	overflow: hidden;
	background: #ead9c2;
	box-shadow: 0 1px 2px rgba(43, 42, 39, 0.05), 0 12px 32px -12px rgba(43, 42, 39, 0.18);
}

.sosar-gallery__link {
	display: block;
}

.sosar-gallery__item img {
	width: 100%;
	height: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	display: block;
	border-radius: 0;
	transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.sosar-gallery__item--portrait img {
	object-position: 50% 25%;
}

.sosar-gallery__link:hover img,
.sosar-gallery__link:focus-visible img {
	transform: scale(1.03);
}

/* One picture on its own: a poster, say. Shown whole, not cropped to 4:3. */
.sosar-gallery--single {
	grid-template-columns: 1fr;
	max-width: 44rem;
}

/* No card round it: the picture alone, sized to itself. */
.sosar-gallery--single .sosar-gallery__item {
	width: fit-content;
	max-width: 100%;
	background: transparent;
	box-shadow: none;
}

.sosar-gallery--single .sosar-gallery__item img {
	width: auto;
	max-width: 100%;
	height: auto;
	aspect-ratio: auto;
	object-fit: contain;
}

/* ---------------------------------------------------------------- lightbox */

.sosar-lightbox {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(20, 18, 16, 0.94);
	color: #fff;
	z-index: 1000;
}

.sosar-lightbox::backdrop {
	background: transparent;
}

.sosar-lightbox__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	width: 100%;
	height: 100%;
	padding: 3.5rem 4rem;
}

.sosar-lightbox__image {
	max-width: 100%;
	max-height: calc(100vh - 8rem);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 0.5rem;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.sosar-lightbox__caption {
	margin: 0;
	font-size: 0.95rem;
	opacity: 0.85;
	text-align: center;
}

.sosar-lightbox__caption:empty {
	display: none;
}

.sosar-lightbox__button {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font: inherit;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.sosar-lightbox__button:hover,
.sosar-lightbox__button:focus-visible {
	background: rgba(255, 255, 255, 0.28);
}

.sosar-lightbox__button--close {
	top: 0.75rem;
	right: 0.75rem;
}

.sosar-lightbox__button--prev {
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
}

.sosar-lightbox__button--next {
	right: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
}

.sosar-lightbox__count {
	position: absolute;
	top: 1.35rem;
	left: 1.25rem;
	font-size: 0.9rem;
	opacity: 0.75;
}

@media (max-width: 40rem) {
	.sosar-lightbox__stage {
		padding: 3.5rem 0.75rem;
	}

	.sosar-lightbox__button--prev,
	.sosar-lightbox__button--next {
		top: auto;
		bottom: 0.75rem;
		transform: none;
	}
}
