/**
 * Variant CSS: gallery--categorized-sections
 *
 * Gallery split into separate, titled sub-sections — each with its own h3
 * heading (e.g. Wnętrza / Realizacje), a short note and its own 3-image grid.
 * Unlike a single flat grid, mosaic or carousel: it organises a portfolio
 * thematically so visitors instantly read "what is what". A hairline divider
 * sits under each category head; the note aligns to the right on desktop and
 * stacks under the title on mobile. Image src are swapped by the photo system.
 * Part of the `gallery` role.
 */

body.aibt-universal .universal-gallery--categorized-sections {
	padding-block: calc(clamp(3rem, 7vw, 5rem) * var(--density, 1));
}

/* Center every aligned-center text block in this variant. */
body.aibt-universal .universal-gallery--categorized-sections .has-text-align-center {
	margin-inline: auto !important;
}

/* Intro. */
body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__intro {
	margin-bottom: clamp(2rem, 4.5vw, 3.2rem);
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__kicker {
	font-family: var(--font-body) !important;
	font-size: var(--text-xs) !important;
	font-weight: 600 !important;
	letter-spacing: var(--tracking-widest, 0.18em) !important;
	text-transform: uppercase !important;
	color: var(--accent) !important;
	margin: 0 auto var(--space-sm, 0.6rem) auto !important;
}

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

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

/* Category block — stacked, generous rhythm between groups. */
body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat {
	margin-top: clamp(2.2rem, 5vw, 3.4rem);
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat:first-of-type {
	margin-top: 0;
}

/* Category head — title left, note right, hairline rule under. */
body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat-head {
	align-items: baseline;
	gap: clamp(0.4rem, 1.6vw, 1rem);
	padding-bottom: calc(clamp(0.7rem, 1.6vw, 1rem) * var(--density, 1));
	margin-bottom: clamp(1rem, 2.4vw, 1.5rem);
	border-bottom: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat-title {
	font-family: var(--font-display) !important;
	font-size: clamp(1.3rem, 2.6vw, 1.85rem) !important;
	line-height: 1.1 !important;
	letter-spacing: -0.015em !important;
	color: var(--ink) !important;
	margin: 0 !important;
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat-note {
	font-family: var(--font-body) !important;
	font-size: var(--text-sm) !important;
	font-weight: 500 !important;
	letter-spacing: var(--tracking-wide, 0.04em) !important;
	color: color-mix(in srgb, var(--ink) 62%, transparent) !important;
	margin: 0 !important;
	text-align: right;
}

/* Per-category grid. */
body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid {
	gap: clamp(0.8rem, 2vw, 1.3rem);
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid .wp-block-image,
body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid figure {
	margin: 0;
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid img {
	width: 100%;
	height: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--decor-radius, 14px);
	filter: var(--photo-filter, none);
	transition: transform var(--duration-slow, 500ms) var(--ease-expressive, ease);
}

body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid img:hover {
	transform: scale(1.03);
}

/* Tablet: 2 columns per category. */
@media (max-width: 860px) {
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Mobile: drop wide uppercase tracking; stack note under title, left-aligned. */
@media (max-width: 640px) {
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__kicker {
		letter-spacing: 0 !important;
	}
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat-head {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.3rem;
	}
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__cat-note {
		text-align: left;
	}
}

@media (max-width: 520px) {
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid {
		grid-template-columns: 1fr;
		gap: clamp(0.9rem, 4vw, 1.3rem);
	}
}

/* Respect reduced-motion: kill the hover zoom transition + transform. */
@media (prefers-reduced-motion: reduce) {
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid img {
		transition: none;
	}
	body.aibt-universal .universal-gallery--categorized-sections .universal-gallery__grid img:hover {
		transform: none;
	}
}

/* A8/A9 left-shift fix (2026-06-08): centered intro element(s) were max-width-capped by
   WP constrained layout but pinned left by horizontal margin:0. Force margin-inline:auto.
   Section class doubled -> specificity (0,4,1) beats h2.__headline-style rules; harmless on
   already-centered elements (auto margins compute to 0). Only left/right are overridden. */
body.aibt-universal .universal-gallery--categorized-sections.universal-gallery--categorized-sections .universal-gallery__headline { margin-inline: auto !important; }
