/*
 * Unit17 Gallery page (page-templates/gallery.php).
 *
 * Layout only; chips, buttons, headings and colours come from u17-system.css.
 */

.u17-gallery {
	font-family: var(--u17-font);
	font-weight: 300;
	color: var(--u17-text);
	background: var(--u17-white);
	overflow-x: clip;
}

.u17-gallery *,
.u17-gallery *::before,
.u17-gallery *::after {
	box-sizing: border-box;
}

.u17-gallery p {
	margin-top: 0;
}

/* ============================================================ header */
.u17-gallery__hero {
	align-items: flex-end;
	min-height: clamp(340px, 42vw, 560px);
	background: var(--u17-ink);
	--u17-photo-scrim:
		linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.3) 45%, rgba(0, 0, 0, 0.85) 100%),
		linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 60%);
}

.u17-gallery__hero > img {
	object-position: 50% 60%;
}

.u17-gallery__hero-inner {
	width: 100%;
	padding-block: 48px clamp(36px, 5vw, 64px);
}

.u17-gallery__hero .u17-kicker {
	color: var(--u17-teal);
}

.u17-gallery__title {
	margin-bottom: 14px;
	color: var(--u17-white);
}

.u17-gallery__lead {
	max-width: 600px;
	margin: 0;
	font-weight: 300;
	color: rgba(255, 255, 255, 0.88);
}

/* ============================================================ filters */
.u17-gallery__body {
	padding-top: clamp(40px, 5vw, 64px);
}

.u17-gallery__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: clamp(24px, 3vw, 36px);
}

/* ============================================================ grid
   Rows are two-thirds of a column wide, so a landscape tile keeps roughly the
   3:2 shape of the photos; portraits take two rows, features two by two. */
.u17-gallery__grid {
	--cols: 4;
	--gap: 10px;
	--col: calc((min(100vw, var(--u17-wrap) + 2 * var(--u17-gutter)) - 2 * var(--u17-gutter) - (var(--cols) - 1) * var(--gap)) / var(--cols));
	display: grid;
	grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
	grid-auto-rows: calc(var(--col) * 2 / 3);
	grid-auto-flow: dense;
	gap: var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.u17-gallery__item {
	margin: 0;
	min-width: 0;
}

.u17-gallery__item[hidden] {
	display: none;
}

.u17-gallery__item--p {
	grid-row: span 2;
}

.u17-gallery__item--x {
	grid-column: span 2;
	grid-row: span 2;
}

.u17-gallery__link {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: var(--u17-surface-3);
}

.u17-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform var(--u17-slow) var(--u17-ease), filter 0.4s;
}

.u17-gallery__zoom {
	position: absolute;
	right: 12px;
	bottom: 12px;
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	opacity: 0;
	transform: translateY(6px);
	transition: opacity var(--u17-fast), transform var(--u17-fast);
}

.u17-gallery__zoom svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: var(--u17-white);
	stroke-width: 1.8;
	stroke-linecap: round;
}

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

.u17-gallery__link:hover .u17-gallery__zoom,
.u17-gallery__link:focus-visible .u17-gallery__zoom {
	opacity: 1;
	transform: none;
}

.u17-gallery .u17-gallery__link:focus-visible {
	outline: 3px solid var(--u17-teal);
	outline-offset: -3px;
}

/* ============================================================ shop these cars */
.u17-gallery__shop-head {
	max-width: 760px;
	margin-bottom: clamp(32px, 4vw, 48px);
}

.u17-gallery__shop-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--u17-space-4);
}

.u17-gallery__shop-card {
	position: relative;
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	isolation: isolate;
	color: var(--u17-white);
	text-decoration: none;
}

.u17-gallery__shop-img {
	position: absolute;
	inset: 0;
	z-index: -2;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform var(--u17-slow) var(--u17-ease);
}

.u17-gallery__shop-card::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.85) 100%);
}

.u17-gallery__shop-card:hover .u17-gallery__shop-img,
.u17-gallery__shop-card:focus-visible .u17-gallery__shop-img {
	transform: scale(1.04);
}

.u17-gallery__shop-text {
	position: absolute;
	left: 28px;
	right: 28px;
	bottom: 26px;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px 20px;
}

.u17-gallery__shop-name {
	font-size: clamp(22px, 2.4vw, 32px);
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
}

.u17-gallery__shop-card .u17-link-arrow {
	color: var(--u17-teal);
}

/* ============================================================ your build */
.u17-gallery__cta {
	background: var(--u17-paper);
}

.u17-gallery__cta-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 28px 48px;
}

.u17-gallery__cta-inner > div:first-child {
	max-width: 620px;
}

.u17-gallery__cta .u17-heading {
	margin-bottom: 16px;
}

.u17-gallery__cta .u17-prose p:last-child {
	margin-bottom: 0;
}

/* ============================================================ viewer */
.u17-no-scroll {
	overflow: hidden;
}

.u17-lightbox {
	position: fixed;
	inset: 0;
	width: 100vw;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(8, 8, 8, 0.96);
	color: var(--u17-white);
	font-family: var(--u17-font);
	/* Horizontal swipes go to the script (next / previous), not the browser. */
	touch-action: pan-y pinch-zoom;
}

.u17-lightbox::backdrop {
	background: rgba(0, 0, 0, 0.6);
}

.u17-lightbox[open] {
	display: flex;
	flex-direction: column;
}

.u17-lightbox__stage {
	flex: 1;
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 64px 84px 12px;
}

.u17-lightbox__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.u17-lightbox__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 28px;
	padding: 14px 84px calc(20px + env(safe-area-inset-bottom, 0px));
}

.u17-lightbox__caption {
	flex: 1 1 280px;
	margin: 0;
	font-size: 17px;
	font-weight: 400;
}

.u17-lightbox__shop {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 22px;
	margin: 0;
}

.u17-lightbox__shop .u17-link-arrow {
	color: var(--u17-teal);
	font-size: 14px;
}

.u17-lightbox__shop .u17-link-arrow:hover {
	color: var(--u17-white);
}

.u17-lightbox__counter {
	margin: 0;
	font-size: 14px;
	letter-spacing: 2px;
	color: rgba(255, 255, 255, 0.7);
}

button.u17-lightbox__btn {
	position: absolute;
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.35);
	color: var(--u17-white);
	cursor: pointer;
	transition: background-color var(--u17-fast), border-color var(--u17-fast);
}

/* :focus as well as :focus-visible — Hello's button:focus paints #c36 pink. */
button.u17-lightbox__btn:hover,
button.u17-lightbox__btn:focus {
	border-color: rgba(255, 255, 255, 0.25);
	background: rgba(0, 0, 0, 0.6);
	color: var(--u17-white);
	outline: none;
}

button.u17-lightbox__btn:hover,
button.u17-lightbox__btn:focus-visible {
	border-color: var(--u17-teal);
	box-shadow: 0 0 0 2px var(--u17-teal);
}

.u17-lightbox__btn svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.u17-lightbox__close {
	top: calc(12px + env(safe-area-inset-top, 0px));
	right: 16px;
}

.u17-lightbox__prev,
.u17-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
}

.u17-lightbox__prev {
	left: 16px;
}

.u17-lightbox__next {
	right: 16px;
}

/* ============================================================ responsive */
@media (max-width: 1024px) {
	.u17-gallery__grid {
		--cols: 3;
	}
}

@media (max-width: 767px) {
	.u17-gallery__shop-grid {
		grid-template-columns: 1fr;
	}

	.u17-gallery__cta .u17-actions {
		width: 100%;
	}
}

@media (max-width: 600px) {
	.u17-gallery__grid {
		--cols: 2;
		--gap: 6px;
	}

	.u17-gallery__zoom {
		display: none;
	}

	.u17-lightbox__stage {
		padding: 64px 0 8px;
	}

	.u17-lightbox__bar {
		padding-inline: 20px;
	}

	.u17-lightbox__prev,
	.u17-lightbox__next {
		top: auto;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		transform: none;
	}

	.u17-lightbox__bar {
		padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
	}

	.u17-lightbox__prev {
		left: auto;
		right: 80px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.u17-gallery *,
	.u17-gallery *::before {
		transition: none !important;
	}
}

/* ============================================================ editor preview
   Shown only to the editor previewing unsaved changes (inc/gallery.php). */
.u17-gallery__preview {
	position: sticky;
	top: 0;
	z-index: 20;
	margin: 0;
	padding: 10px var(--u17-gutter);
	background: #f0b849;
	font-family: var(--u17-font);
	font-size: 15px;
	font-weight: 500;
	text-align: center;
	color: var(--u17-black);
}

.u17-gallery__preview a {
	margin-left: 8px;
	color: var(--u17-black);
	text-decoration: underline;
}
