/* Gallery. Columns are the desktop count; the container narrows them: 4 -> 2, then the phone count. */
.px-page .px-gallery__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--px-space-m);
	margin: 0;
	padding: 0;
	list-style: none;
}
.px-page .px-gallery--c2 .px-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.px-page .px-gallery--c4 .px-gallery__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.px-page .px-gallery__fig { margin: 0; }
.px-page .px-gallery__link { display: block; border-radius: var(--px-radius); }
.px-page .px-gallery__link:focus-visible { outline: 2px solid var(--px-color-primary); outline-offset: 2px; }
.px-page .px-gallery__img {
	display: block;
	inline-size: 100%;
	block-size: auto;
	border-radius: var(--px-radius);
}
.px-page .px-gallery--r1x1 .px-gallery__img { aspect-ratio: 1 / 1; object-fit: cover; }
.px-page .px-gallery--r4x3 .px-gallery__img { aspect-ratio: 4 / 3; object-fit: cover; }
.px-page .px-gallery--r3x4 .px-gallery__img { aspect-ratio: 3 / 4; object-fit: cover; }
.px-page .px-gallery--lightbox .px-gallery__link { cursor: zoom-in; }
.px-page .px-gallery__caption {
	margin-block-start: var(--px-space-xs);
	color: var(--px-color-muted);
	font-size: var(--px-text-small);
	line-height: var(--px-leading-body);
}

@container (max-width: 48rem) {
	.px-page .px-gallery--c4 .px-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 30rem) {
	.px-page .px-gallery__grid { gap: var(--px-space-s); }
	.px-page .px-gallery--m1 .px-gallery__grid { grid-template-columns: minmax(0, 1fr); }
	.px-page .px-gallery--m2 .px-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Logos: a centred row of grey logos that take their colour back on hover / focus. */
.px-page .px-gallery--logos .px-gallery__grid { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--px-space-m) var(--px-space-l); }
.px-page .px-gallery--logos .px-gallery__fig { display: grid; justify-items: center; text-align: center; }
.px-page .px-gallery--logos .px-gallery__img {
	inline-size: auto;
	block-size: 48px;
	max-inline-size: 100%;
	border-radius: 0;
	aspect-ratio: auto;
	object-fit: contain;
	filter: grayscale(1);
	opacity: .7;
	transition: filter .15s, opacity .15s;
}
.px-page .px-gallery--logos .px-gallery__item:hover .px-gallery__img,
.px-page .px-gallery--logos .px-gallery__item:focus-within .px-gallery__img { filter: none; opacity: 1; }
@container (max-width: 30rem) {
	.px-page .px-gallery--logos .px-gallery__img { block-size: 40px; }
	.px-page .px-gallery--logos .px-gallery__grid { gap: var(--px-space-s) var(--px-space-m); }
}
@media (prefers-reduced-motion: reduce) {
	.px-page .px-gallery--logos .px-gallery__img { transition: none; }
}

/* The dialog the script builds on the first click. */
.px-page .px-gallery-box {
	inline-size: min(96vw, 80rem);
	max-inline-size: none;
	max-block-size: 96vh;
	padding: var(--px-space-m);
	border: 0;
	border-radius: var(--px-radius);
	background: var(--px-color-surface);
	color: var(--px-color-text);
}
.px-page .px-gallery-box::backdrop { background: color-mix(in oklab, var(--px-color-text) 80%, transparent); }
.px-page .px-gallery-box__img {
	display: block;
	max-inline-size: 100%;
	max-block-size: 78vh;
	margin-inline: auto;
	object-fit: contain;
}
.px-page .px-gallery-box__caption { margin-block-start: var(--px-space-s); text-align: center; font-size: var(--px-text-small); }
.px-page .px-gallery-box__btn {
	position: absolute;
	display: grid;
	place-items: center;
	inline-size: 2.75rem;
	block-size: 2.75rem;
	padding: 0;
	border: 1px solid var(--px-color-border);
	border-radius: 50%;
	background: var(--px-color-surface);
	color: var(--px-color-text);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}
.px-page .px-gallery-box__btn:hover { background: var(--px-color-primary-soft); }
.px-page .px-gallery-box__btn:focus-visible { outline: 2px solid var(--px-color-primary); outline-offset: 2px; }
.px-page .px-gallery-box__btn--close { inset-block-start: var(--px-space-s); inset-inline-end: var(--px-space-s); }
.px-page .px-gallery-box__btn--prev { inset-block-start: 40%; inset-inline-start: var(--px-space-s); }
.px-page .px-gallery-box__btn--next { inset-block-start: 40%; inset-inline-end: var(--px-space-s); }
.px-page .px-gallery-box__btn[hidden] { display: none; }
