/**
 * Variant CSS: gallery--polaroid-scatter
 * Layer 2 (Path B gallery role, 2026-06-06).
 * Photos styled as polaroids: white frame with a deep caption shelf at the bottom,
 * soft drop shadow, and a slight per-item rotation (via :nth-child) so the wall feels
 * hand-pinned rather than gridded. Captions are bound + visible. On hover the card
 * straightens and lifts. Mobile drops all rotation and stacks to one column.
 */

body.aibt-universal .universal-gallery--polaroid-scatter {
	background: var(--background);
	color: var(--ink);
	text-align: center;
}

/* A8 left-pin: centered text that also carries margins must auto both sides. */
body.aibt-universal .universal-gallery.universal-gallery--polaroid-scatter .has-text-align-center {
	margin-inline: auto !important;
}

body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__intro {
	margin: 0 auto var(--space-xl) auto;
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__kicker {
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 600 !important;
	letter-spacing: var(--tracking-widest) !important;
	text-transform: uppercase !important;
	color: var(--accent) !important;
	margin: 0 auto var(--space-sm) auto !important;
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__headline {
	font-family: var(--font-display) !important;
	color: var(--ink) !important;
	margin: 0 auto !important;
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__headline em {
	font-style: italic;
	color: var(--accent);
}

/* Scatter wall: responsive grid; generous row gap leaves room for tilt overhang. */
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__scatter {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(1.5rem, 4vw, 3rem) var(--space-lg);
	align-items: start;
	max-width: 980px;
	margin-inline: auto;
	padding-block: var(--space-sm);
}

/* Polaroid frame: white card, thick bottom shelf for the caption, soft shadow. */
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid {
	background: #ffffff;
	padding: 0.75rem 0.75rem 0 0.75rem;
	border-radius: 3px;
	box-shadow:
		0 1px 2px color-mix(in srgb, var(--ink) 18%, transparent),
		0 12px 28px color-mix(in srgb, var(--ink) 16%, transparent);
	transition:
		transform var(--duration-medium, var(--duration-fast)) var(--ease-default),
		box-shadow var(--duration-medium, var(--duration-fast)) var(--ease-default);
	transform-origin: center center;
}

body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__img,
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__img figure {
	margin: 0;
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__img {
	overflow: hidden;
	background: color-mix(in srgb, var(--ink) 8%, transparent);
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__img img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	filter: var(--photo-filter, none);
}

/* Caption shelf: the white space below the photo, handwritten-feel label.
   The polaroid frame is a fixed white surface, so the caption uses a fixed dark
   ink (NOT polarity-aware --ink, which flips to near-white in dark themes and
   would vanish on the white shelf — KI-020). #2A2A2A on #fff ≈ 13:1 AA in every
   theme, matching the hardcoded white frame. */
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__caption {
	font-family: var(--font-body) !important;
	font-size: var(--text-sm) !important;
	color: color-mix(in srgb, #2A2A2A 88%, transparent) !important;
	text-align: center;
	margin: 0 auto !important;
	padding: 0.85rem 0.5rem 1.1rem 0.5rem;
	line-height: var(--leading-relaxed, 1.5);
}

/* Hand-pinned tilt: alternating angles per position, neutralized on hover. */
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:nth-child(3n+1) {
	transform: rotate(-3deg);
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:nth-child(3n+2) {
	transform: rotate(2deg) translateY(0.75rem);
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:nth-child(3n+3) {
	transform: rotate(2.5deg);
}
body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:hover {
	transform: rotate(0deg) translateY(-6px) scale(1.02);
	box-shadow:
		0 2px 4px color-mix(in srgb, var(--ink) 20%, transparent),
		0 20px 40px color-mix(in srgb, var(--ink) 22%, transparent);
	z-index: 2;
	position: relative;
}

/* Tablet: two per row, gentler tilt overhang handled by the row gap. */
@media (max-width: 781px) {
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__scatter {
		grid-template-columns: repeat(2, 1fr);
		max-width: 560px;
	}
}

/* Mobile: single column, zero rotation/offset so nothing clips at 375px. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__scatter {
		grid-template-columns: 1fr;
		max-width: 340px;
		gap: var(--space-lg);
	}
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid,
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:nth-child(3n+1),
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:nth-child(3n+2),
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__polaroid:nth-child(3n+3) {
		transform: none;
		box-sizing: border-box;
	}
	body.aibt-universal .universal-gallery--polaroid-scatter .universal-gallery__kicker {
		letter-spacing: 0 !important;
	}
}
