/**
 * Comic backdrop, slots and category collage.
 *
 * The comic shapes themselves — tilted panels, halftone, zoom lines — are
 * exported illustrations behind mpg-comic-backdrop, not CSS. Everything here
 * only positions content on top of that artwork.
 */

.mpg-backdrop {
	position: relative;

	/* The artwork spans its column; without this the aspect ratio would have
	   nothing to resolve against and the panel would collapse to its content. */
	width: 100%;
	background-image: var(--mpg-backdrop-image);
	background-position: top center;
	background-repeat: no-repeat;
	background-size: 100% auto;

	/* aspect-ratio acts as a preferred height here: taller content wins, which
	   is what we want for a slot whose text can wrap onto another line. */
	aspect-ratio: var(--mpg-backdrop-ratio, auto);

	max-width: var(--mpg-backdrop-max-width, none);
	margin-inline: auto;
}

/* The artwork of some frames runs to the edge of the panel; a border keeps it
   reading as an inked comic panel next to the text column. */
.mpg-backdrop--outline {
	border: 3px solid #000;
}

.mpg-backdrop__content {
	position: relative;
	height: 100%;
}

/* -------------------------------------------------------------------------
 * Slots.
 * ---------------------------------------------------------------------- */

.mpg-slot--pinned {
	position: absolute;
	inset-block-start: var(--mpg-slot-top, 0);
	inset-inline-start: var(--mpg-slot-left, 0);
	width: var(--mpg-slot-width, 100%);
}

.mpg-slot--flow {
	position: relative;
	width: var(--mpg-slot-width, 100%);
	margin-inline-start: var(--mpg-slot-left, 0);
	padding-block-start: var(--mpg-slot-top, 0);
}

/* -------------------------------------------------------------------------
 * Category collage.
 * ---------------------------------------------------------------------- */

.mpg-collage {
	position: absolute;
	inset: 0;
}

.mpg-collage__item {
	position: absolute;
	inset-block-start: var(--mpg-spot-y, 50%);
	inset-inline-start: var(--mpg-spot-x, 50%);
	width: var(--mpg-spot-width, 25%);
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	color: #fff;
	text-decoration: none;
}

.mpg-collage__item:hover .mpg-collage__mascot,
.mpg-collage__item:focus-visible .mpg-collage__mascot {
	transform: translateY(-4px) scale(1.04);
}

.mpg-collage__item:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 4px;
	border-radius: 4px;
}

/* A category with no place in this artwork still needs to be reachable, so it
   falls back to the flow instead of stacking on the centre. */
.mpg-collage__item--unplaced {
	position: relative;
	inset: auto;
	width: auto;
	transform: none;
}

.mpg-collage__mascot {
	width: 100%;
	height: auto;
	transition: transform 180ms ease-out;
}

.mpg-collage__label {
	font-family: var(--mpg-heading-font, inherit);
	font-size: clamp(0.9rem, 2.6vw, 1.5rem);
	font-weight: 700;
	text-shadow: 5px 5px 5px rgba(0, 0, 0, 0.85);
	white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
	.mpg-collage__mascot {
		transition: none;
	}
}

/* -------------------------------------------------------------------------
 * Comic icons.
 * ---------------------------------------------------------------------- */

.mpg-comic-icon {
	display: block;
	width: var(--mpg-icon-width, 30%);
	height: auto;
	aspect-ratio: var(--mpg-icon-ratio, auto);
	margin-inline: auto;
}
