/**
 * Cardel ROAL gallery + accessible lightbox styles.
 */

/* -- Gallery grid -------------------------------------------------------- */

.roal-gallery {
	margin: 2rem auto;
	padding: 0 1rem;
	max-width: 1400px;
}

.roal-gallery__empty {
	text-align: center;
	font-style: italic;
	color: #666;
}

.roal-gallery__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 8px;
	grid-template-columns: repeat( 5, 1fr );
}

@media ( max-width: 1024px ) {
	.roal-gallery__grid { grid-template-columns: repeat( 4, 1fr ); }
}
@media ( max-width: 768px ) {
	.roal-gallery__grid { grid-template-columns: repeat( 3, 1fr ); }
}
@media ( max-width: 520px ) {
	.roal-gallery__grid { grid-template-columns: repeat( 2, 1fr ); }
}

.roal-gallery__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.roal-gallery__trigger {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: #f3f3f3;
	cursor: zoom-in;
	overflow: hidden;
	position: relative;
	aspect-ratio: 3 / 2;
	border-radius: 0;
}

.roal-gallery__trigger:focus {
	outline: none;
}

.roal-gallery__trigger:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: 2px;
	z-index: 2;
}

.roal-gallery__trigger picture,
.roal-gallery__trigger img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 220ms ease;
}

.roal-gallery__trigger:hover img,
.roal-gallery__trigger:focus-visible img {
	transform: scale( 1.04 );
}

@media ( prefers-reduced-motion: reduce ) {
	.roal-gallery__trigger img {
		transition: none;
	}
	.roal-gallery__trigger:hover img,
	.roal-gallery__trigger:focus-visible img {
		transform: none;
	}
}

/* -- Lightbox ------------------------------------------------------------ */

html.roal-lightbox-active,
html.roal-lightbox-active body {
	overflow: hidden;
}

.roal-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 180ms ease-out;
	pointer-events: none;
}

.roal-lightbox.is-open {
	opacity: 1;
	pointer-events: auto;
}

.roal-lightbox[hidden] {
	display: none;
}

@media ( prefers-reduced-motion: reduce ) {
	.roal-lightbox {
		transition: none;
	}
}

.roal-lightbox__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 10, 10, 10, 0.92 );
	cursor: zoom-out;
}

.roal-lightbox__panel {
	position: relative;
	width: 100%;
	height: 100%;
	max-width: 100vw;
	display: grid;
	grid-template-columns: auto 1fr auto;
	grid-template-rows: auto 1fr;
	align-items: center;
	color: #fff;
}

.roal-lightbox__header {
	grid-column: 1 / -1;
	grid-row: 1;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem 1.25rem;
	z-index: 2;
}

.roal-lightbox__counter {
	margin: 0;
	font-size: 0.95rem;
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
	opacity: 0.9;
}

.roal-lightbox__close,
.roal-lightbox__nav {
	background: rgba( 255, 255, 255, 0.08 );
	color: #fff;
	border: 1px solid rgba( 255, 255, 255, 0.15 );
	border-radius: 50%;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 160ms ease, transform 160ms ease;
	padding: 0;
}

@media ( prefers-reduced-motion: reduce ) {
	.roal-lightbox__close,
	.roal-lightbox__nav {
		transition: none;
	}
}

.roal-lightbox__close:hover,
.roal-lightbox__nav:hover {
	background: rgba( 255, 255, 255, 0.18 );
}

.roal-lightbox__close:focus,
.roal-lightbox__nav:focus {
	outline: none;
}

.roal-lightbox__close:focus-visible,
.roal-lightbox__nav:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

.roal-lightbox__nav {
	width: 56px;
	height: 56px;
	z-index: 2;
}

.roal-lightbox__nav--prev {
	grid-column: 1;
	grid-row: 2;
	margin-left: 1rem;
}

.roal-lightbox__nav--next {
	grid-column: 3;
	grid-row: 2;
	margin-right: 1rem;
}

.roal-lightbox__figure {
	grid-column: 2;
	grid-row: 2;
	margin: 0;
	padding: 0 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	min-width: 0;
}

.roal-lightbox__picture {
	max-width: 100%;
	max-height: 100%;
	display: block;
	line-height: 0;
}

.roal-lightbox__image {
	max-width: 100%;
	max-height: calc( 100vh - 6rem );
	height: auto;
	width: auto;
	display: block;
	object-fit: contain;
	background: #000;
	box-shadow: 0 12px 32px rgba( 0, 0, 0, 0.6 );
}

@media ( max-width: 640px ) {
	.roal-lightbox__nav {
		width: 44px;
		height: 44px;
	}
	.roal-lightbox__nav--prev {
		margin-left: 0.25rem;
	}
	.roal-lightbox__nav--next {
		margin-right: 0.25rem;
	}
	.roal-lightbox__image {
		max-height: calc( 100vh - 5rem );
	}
}

/* Visually-hide caption while keeping it for assistive tech */
.roal-lightbox__caption.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}
