/**
 * Variant CSS: gallery--quad-contact-sheet
 *
 * Four photos laid out like a darkroom contact sheet: thin frames on a faint card
 * surface, each cell annotated below with an auto 01–04 frame index (CSS counter)
 * and a short bound label — a subtle, archival, editorial feel. Unlike the bare 2×2,
 * the filmstrip or the mosaic: the draw here is the contact-sheet aesthetic, with
 * numbered frames and an annotation row, like a real proof sheet. The index is a CSS
 * counter (structural, never a binding); the label uses the optional gallery-cap-N
 * binding. Index = --accent; label = --text-secondary on the section/card surface
 * (never a background token as foreground; ≥4.5 contrast). Tiles use --decor-radius
 * and images carry --photo-filter. Image src are swapped by the photo system.
 * Dedicated to exactly four photos. Part of the `gallery` role.
 */

body.aibt-universal .universal-gallery--quad-contact-sheet {
	padding-block: calc(clamp(3rem, 7vw, 5.5rem) * var(--density, 1));
	background: var(--background);
	color: var(--text-primary);
}

/* Intro. */
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__intro {
	margin-bottom: clamp(2rem, 4vw, 3rem);
}

body.aibt-universal .universal-gallery--quad-contact-sheet .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 0 var(--space-sm) 0 !important;
}

body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__headline {
	font-family: var(--font-display) !important;
	color: var(--ink) !important;
	margin: 0 !important;
}

body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__headline em {
	color: var(--accent) !important;
	font-style: italic;
}

/* The sheet: a faint card-surface proof sheet holding a 4-up row of cells.
   Hairline frame + inner padding evoke the printed contact sheet border. */
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__sheet {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	/* Top-align cells so every frame's top edge lines up; cells size to content
	   instead of stretching to the row height. */
	align-items: start;
	gap: clamp(0.7rem, 1.6vw, 1.2rem);
	padding: clamp(0.85rem, 2vw, 1.4rem);
	background: var(--background-card, transparent);
	border: 1px solid var(--divider-primary, rgba(128, 128, 128, 0.22));
	border-radius: var(--decor-radius, 14px);
	counter-reset: sheet-frame;
}

/* Each cell: image + annotation row. Counter increments per cell. */
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__cell {
	display: flex;
	flex-direction: column;
	gap: 0;
	counter-increment: sheet-frame;
}

body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__item {
	margin: 0 !important;
	overflow: hidden;
	border-radius: calc(var(--decor-radius, 14px) - 6px);
	/* Thin print frame around each photo. */
	border: 1px solid var(--divider-primary, rgba(128, 128, 128, 0.22));
}

body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__item img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	filter: var(--photo-filter, none);
	transition: transform var(--duration-slow, 480ms) var(--ease-default, ease);
}

body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__cell:hover img,
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__cell:focus-within img {
	transform: scale(1.04);
}

/* Annotation row: index number (from counter) + a short bound label beside it.
   Sits on the card surface, so text uses --accent / --text-secondary (legible,
   never a background token as foreground). */
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__label {
	display: flex;
	align-items: baseline;
	gap: 0.5ch;
	margin: var(--space-xs, 0.5rem) 0 0 0 !important;
	padding-top: 0.4rem;
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 500 !important;
	letter-spacing: var(--tracking-wide) !important;
	color: var(--text-secondary) !important;
	line-height: var(--leading-snug, 1.3) !important;
}

/* Frame index prefix (01, 02, …) rendered from the counter, in the accent. */
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__label::before {
	content: counter(sheet-frame, decimal-leading-zero);
	font-family: var(--font-display);
	font-weight: 700;
	letter-spacing: var(--tracking-wide);
	color: var(--accent);
}

/* Keyboard focus parity with hover (image becomes focusable when a client links it). */
body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__item a:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
	border-radius: calc(var(--decor-radius, 14px) - 6px);
}

/* Tablet: four cells get tight — drop to a 2×2 sheet, index/label intact. */
@media (min-width: 641px) and (max-width: 959px) {
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__sheet {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: clamp(0.7rem, 2.2vw, 1.1rem);
	}
}

/* Mobile: a 2×2 contact sheet still reads; shrink the gap and the sheet padding. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__sheet {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.55rem;
		padding: 0.6rem;
	}
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__label {
		font-size: var(--text-xs) !important;
		letter-spacing: var(--tracking-normal, 0) !important;
	}
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__kicker {
		letter-spacing: var(--tracking-wide) !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__item img {
		transition: none;
	}
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__cell:hover img,
	body.aibt-universal .universal-gallery--quad-contact-sheet .universal-gallery__cell:focus-within img {
		transform: none;
	}
}
