/* Image: ratio is on the <img>, size on the root. Without an image the frontend prints nothing. */
.px-page .px-image { max-width: 100%; }
.px-page .px-image__link { display: block; border-radius: var(--px-radius); }
.px-page .px-image__link:focus-visible { outline: 2px solid var(--px-color-primary); outline-offset: 2px; }
.px-page .px-image__img { display: block; width: 100%; height: auto; border-radius: var(--px-radius); }
.px-page .px-image__img--1x1 { aspect-ratio: 1 / 1; object-fit: cover; }
.px-page .px-image__img--4x3 { aspect-ratio: 4 / 3; object-fit: cover; }
.px-page .px-image__img--16x9 { aspect-ratio: 16 / 9; object-fit: cover; }
.px-page .px-image__img--3x4 { aspect-ratio: 3 / 4; object-fit: cover; }

/* panorama (advanced): 21:9 wins over the ratio option. */
.px-page .px-image--panorama .px-image__img,
.px-page .px-image--panorama .px-image__empty { aspect-ratio: 21 / 9; object-fit: cover; }
/* tone mono (advanced): greyscale, hover leaves it alone. */
.px-page .px-image--mono .px-image__img { filter: grayscale(1); }

.px-page .px-image--m { width: 66%; }
.px-page .px-image--s { width: 33%; }
.px-page .px-image--s .px-image__img--auto { max-height: 8em; width: auto; max-width: 100%; object-fit: contain; }
.px-page .px-image--avatar { width: 4em; }
.px-page .px-image--avatar .px-image__img { aspect-ratio: 1 / 1; object-fit: cover; border-radius: 50%; }
.px-page .px-image--avatar .px-image__link { border-radius: 50%; }
.px-page .px-section--al-center .px-image--m,
.px-page .px-section--al-center .px-image--s,
.px-page .px-section--al-center .px-image--avatar { margin-inline: auto; }

/* Shape (advanced): the radius goes on the picture, its link and the editor frame. */
.px-page .px-image--shape-square .px-image__img,
.px-page .px-image--shape-square .px-image__link,
.px-page .px-image--shape-square .px-image__empty { border-radius: 0; }
.px-page .px-image--shape-round .px-image__img,
.px-page .px-image--shape-round .px-image__link,
.px-page .px-image--shape-round .px-image__empty { border-radius: var(--px-radius-panel, 2rem); }
.px-page .px-image--shape-pill .px-image__img,
.px-page .px-image--shape-pill .px-image__link,
.px-page .px-image--shape-pill .px-image__empty { border-radius: 999px; }
.px-page .px-image--shape-circle .px-image__img,
.px-page .px-image--shape-circle .px-image__link,
.px-page .px-image--shape-circle .px-image__empty { border-radius: 50%; }
.px-page .px-image--shape-circle .px-image__img,
.px-page .px-image--shape-circle .px-image__empty { aspect-ratio: 1 / 1; object-fit: cover; }

/* Effect (advanced). */
.px-page .px-image--effect-shadow .px-image__img { box-shadow: var(--px-shadow); }
.px-page .px-image--effect-float .px-image__img {
	border: 1px solid color-mix(in oklab, var(--px-color-surface) 50%, transparent);
	box-shadow: 0 2px 4px color-mix(in oklab, var(--px-color-text) 8%, transparent), 0 12px 32px color-mix(in oklab, var(--px-color-text) 18%, transparent);
	transform: translateY(-4px);
}

/* Empty frame, only printed in the editor. */
.px-page .px-image__empty { display: block; aspect-ratio: 4 / 3; border: 2px dashed var(--px-color-border); border-radius: var(--px-radius); background: var(--px-color-soft); }

@container (min-width: 30rem) {
	.px-page .px-image--avatar { width: 6em; }
}
/* Narrow columns: the reduced sizes would be too small to read, so they grow. */
@container (max-width: 16rem) {
	.px-page .px-image--m { width: 100%; }
	.px-page .px-image--s { width: 50%; }
}

/* fill: the picture fills the height of its column; a column holding only this image grows with the row. */
.px-page .px-col:has(> .px-image--fill:only-child) { display: flex; flex-direction: column; }
.px-page .px-image--fill { flex: 1 1 auto; width: 100%; height: 100%; min-height: 12rem; }
.px-page .px-image--fill .px-image__link { height: 100%; }
.px-page .px-image--fill :is(.px-image__img, .px-image__empty) { height: 100%; aspect-ratio: auto; object-fit: cover; }

/* overlay (advanced): a second picture floats over a corner of the frame (about 42% wide, 6% outside), hidden on phones.
   The root has no overflow clip, so the floating card is not cut; the radius sits on the <img>s. */
.px-page .px-image--has-overlay { position: relative; }
.px-page .px-image__overlay {
	position: absolute;
	inline-size: 42%;
	pointer-events: none;
	z-index: 1;
}
.px-page .px-image__overlay--top-start { inset-block-start: 12%; inset-inline-start: -6%; }
.px-page .px-image__overlay--top-end { inset-block-start: 12%; inset-inline-end: -6%; }
.px-page .px-image__overlay--middle-end { inset-block-start: 50%; inset-inline-end: -6%; transform: translateY(-50%); }
.px-page .px-image__overlay--bottom-start { inset-block-end: -6%; inset-inline-start: -6%; }
.px-page .px-image__overlay--bottom-end { inset-block-end: -6%; inset-inline-end: -6%; }
/* plain (default): the picture keeps its own ratio and carries no background, radius, shadow or padding. card: radius, shadow and a 4:3 crop. */
/* overlaySize: s 32% · m 42% · l 55% of the frame. Top corners sit 12% down (cards float beside the picture, not above it). */
.px-page .px-image__overlay.px-image__overlay--s { inline-size: 32%; }
.px-page .px-image__overlay.px-image__overlay--l { inline-size: 55%; }
/* overlayInset (advanced): the cards sit inside the frame: top 24px / side 20px, bottom 56px, middle-end 20px from the right. */
.px-page .px-image--ov-inset .px-image__overlay--top-start { inset-block-start: 24px; inset-inline-start: 20px; }
.px-page .px-image--ov-inset .px-image__overlay--top-end { inset-block-start: 24px; inset-inline-end: 20px; }
.px-page .px-image--ov-inset .px-image__overlay--middle-end { inset-inline-end: 20px; }
.px-page .px-image--ov-inset .px-image__overlay--bottom-start { inset-block-end: 56px; inset-inline-start: 20px; }
.px-page .px-image--ov-inset .px-image__overlay--bottom-end { inset-block-end: 56px; inset-inline-end: 20px; }
.px-page .px-image__overlay-img { display: block; inline-size: 100%; block-size: auto; }
.px-page .px-image--ov-card .px-image__overlay-img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--px-radius-panel, 2rem);
	box-shadow: 0 2px 6px color-mix(in oklab, var(--px-color-text) 8%, transparent), 0 12px 28px color-mix(in oklab, var(--px-color-text) 16%, transparent);
}
@media (max-width: 35.999rem) {
	.px-page .px-image__overlay { display: none; }
}

/* 1.10: text for screen readers when the link opens in a new tab. */
.px-page .px-image__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
