/*
 * Site Engine components: the lightbox and the gallery.
 *
 * Loaded on every Engine page on its own handle, so a site that turns the
 * base design sheet off (one that brought its own design) still draws the
 * parts the Engine builds: a gallery three across with cropped tiles, and
 * the lightbox its pictures open in. Inherits the site's type and colours;
 * sets only what the component needs.
 */

/* ---- Lightbox (an <a class="se-lightbox" href="full.jpg"> around a thumb) ---- */
.se-lightbox {
	display: inline-block;
	cursor: zoom-in;
}

.se-lightbox__overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	background: rgba( 0, 0, 0, 0.85 );
	cursor: zoom-out;
}

.se-lightbox__overlay img {
	max-width: 100%;
	max-height: 84vh;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.5 );
}

.se-lightbox__overlay figure {
	margin: 0;
	max-width: min( 1400px, 100% );
	text-align: center;
	cursor: default;
}

.se-lightbox__caption {
	margin: 0.75rem 0 0;
	color: rgba( 255, 255, 255, 0.85 );
	font-size: 0.95rem;
}

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

.se-lightbox__button {
	position: absolute;
	top: 50%;
	width: 48px;
	height: 48px;
	margin-top: -24px;
	border: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.14 );
	color: #fff;
	font: 400 28px/48px system-ui, sans-serif;
	cursor: pointer;
	transition: background 0.15s ease;
}

.se-lightbox__button:hover,
.se-lightbox__button:focus-visible {
	background: rgba( 255, 255, 255, 0.3 );
	outline: none;
}

.se-lightbox__button--prev { left: 1rem; }
.se-lightbox__button--next { right: 1rem; }

.se-lightbox__button--close {
	top: 1rem;
	right: 1rem;
	margin-top: 0;
	font-size: 22px;
}

.se-lightbox__button[hidden] { display: none; }

@media ( max-width: 640px ) {
	.se-lightbox__overlay { padding: 3.5rem 0.75rem 1rem; }
	.se-lightbox__button--prev { left: 0.4rem; }
	.se-lightbox__button--next { right: 0.4rem; }
}

/* ---- Gallery: three across, one to three rows, every tile the same shape.
   A tile crops its picture to the shape (cover), so mixed photographs sit
   in an even grid; the full picture opens in the lightbox. ---- */
.se-gallery {
	--se-gallery-ratio: 4 / 3;
	padding: clamp( 2.5rem, 6vw, 5rem ) 0;
}

.se-gallery--square { --se-gallery-ratio: 1 / 1; }
.se-gallery--portrait { --se-gallery-ratio: 3 / 4; }

.se-gallery__inner {
	width: min( 100% - 3rem, var( --se-content-max, 1200px ) );
	margin: 0 auto;
}

.se-gallery__head {
	max-width: 62ch;
	margin: 0 0 clamp( 1.25rem, 3vw, 2rem );
}

.se-gallery__eyebrow {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	opacity: 0.7;
}

.se-gallery__title {
	margin: 0 0 0.5rem;
	font-size: clamp( 1.6rem, 3.2vw, 2.4rem );
	line-height: 1.15;
}

.se-gallery__intro {
	margin: 0;
	font-size: 1.05rem;
	opacity: 0.85;
}

.se-gallery__grid {
	display: grid;
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	gap: clamp( 0.6rem, 1.5vw, 1rem );
	margin: 0;
	padding: 0;
	list-style: none;
}

.se-gallery__item {
	margin: 0;
	aspect-ratio: var( --se-gallery-ratio );
	overflow: hidden;
	border-radius: var( --se-radius, 8px );
	background: rgba( 0, 0, 0, 0.06 );
}

.se-gallery__link {
	display: block;
	width: 100%;
	height: 100%;
}

.se-gallery__item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

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

@media ( max-width: 900px ) {
	.se-gallery__grid { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); }
}

@media ( max-width: 520px ) {
	.se-gallery__grid { grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); gap: 0.5rem; }
}

