/**
 * Paginated image gallery — tiles, mild hover scale, image-only lightbox.
 */

.heinz-project-gallery {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	width: 100%;
}

.heinz-project-gallery .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;
}

.heinz-project-gallery__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	width: 100%;
}

@media (min-width: 768px) {
	.heinz-project-gallery__grid--2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px 24px;
	}

	.heinz-project-gallery__grid--3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 12px 24px;
	}

	.heinz-project-gallery__grid--4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 12px 24px;
	}
}

.heinz-project-gallery__tile {
	position: relative;
	display: block;
	margin: 0;
	padding: 0;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 3 / 2;
	border: 0;
	background: var(--heinz-color-dark-surface);
	cursor: pointer;
}

.heinz-project-gallery__tile[hidden] {
	display: none;
}

.heinz-project-gallery__tile:focus-visible {
	outline: 2px solid var(--heinz-color-primary);
	outline-offset: 3px;
}

.heinz-project-gallery__media {
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.heinz-project-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transform: scale(1);
	transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.heinz-project-gallery__tile:hover .heinz-project-gallery__image,
.heinz-project-gallery__tile:focus-visible .heinz-project-gallery__image {
	transform: scale(1.04);
}

.heinz-project-gallery__pager {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.75rem 1rem;
}

.heinz-project-gallery__pages {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.heinz-project-gallery__page {
	margin: 0;
	padding: 0.4rem 0.75rem;
	border: 1px solid #ffffff19;
	background: transparent;
	color: var(--heinz-color-text);
	font-family: var(--heinz-font-body);
	font-size: var(--text-xs);
	font-weight: var(--font-weight-light);
	letter-spacing: var(--tracking-widest);
	line-height: var(--text-xs--line-height);
	text-transform: uppercase;
	cursor: pointer;
}

.heinz-project-gallery__page:hover,
.heinz-project-gallery__page:focus-visible,
.heinz-project-gallery__page.is-active {
	border-color: var(--heinz-color-primary);
	color: var(--heinz-color-title);
	outline: none;
}

.heinz-project-gallery__page:hover,
.heinz-project-gallery__page:focus,
.heinz-project-gallery__page:focus-visible {
	background-color: var(--heinz-color-primary);
}

.heinz-project-gallery__page:disabled {
	opacity: 0.35;
	cursor: default;
}

.heinz-project-gallery__modal {
	position: fixed;
	inset: 0;
	z-index: 400;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.heinz-project-gallery__modal[hidden] {
	display: none;
}

.heinz-project-gallery__backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--heinz-color-bg) 72%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.heinz-project-gallery__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: min(92vw, 80rem);
	max-height: calc(100svh - 3rem);
	padding: 0;
	background: transparent;
	border: 0;
	box-shadow: none;
}

.heinz-project-gallery__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 2;
	width: 2.25rem;
	height: 2.25rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: color-mix(in srgb, var(--heinz-color-bg) 72%, transparent);
	color: var(--heinz-color-title);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.heinz-project-gallery__close:focus,
.heinz-project-gallery__close:focus-visible {
	background: transparent;
	outline: none;
}

.heinz-project-gallery__close:hover {
	background-color: var(--heinz-color-primary);
	color: var(--heinz-color-title);
	outline: none;
}

.heinz-project-gallery__dialog-image {
	display: block;
	max-width: 100%;
	width: auto;
	height: auto;
	max-height: calc(100svh - 3rem);
	object-fit: contain;
}

.heinz-project-gallery__empty {
	margin: 0;
	color: var(--heinz-color-text);
	font-family: var(--heinz-font-body);
}

@media (prefers-reduced-motion: reduce) {
	.heinz-project-gallery__image {
		transition: none;
	}

	.heinz-project-gallery__tile:hover .heinz-project-gallery__image,
	.heinz-project-gallery__tile:focus-visible .heinz-project-gallery__image {
		transform: none;
	}
}

body.heinz-gallery-open {
	overflow: hidden;
}
