/* Catalog category tiles (home «Ми виготовляємо» / «Мы производим»; render.php has the markup).
   Owner 2026-10-10 («так же как на нашем рабочем сайте … интерактив происходит очень плавно»): the live home's
   asymmetric mosaic of 9 photos with the caption under each, and its hover — the photo slowly zooms in and darkens,
   a thin white frame glides in from the edges, the white БлокМодуль mark and «Дивитися об’єкти» appear in its centre.
   Transform / opacity only (compositor); the zoom, veil and mark in layered timings (live: overlay 200 ms ease-in), the
   frame glides in live's timing (300 ms linear — owner 2026-10-11, see the motion block), clipped by the photo (live
   lets it spill over the caption), no layout shift (the photo is
   absolutely positioned in a box whose size never depends on the file). Touch screens get no hover (a tap opens the
   rubric); keyboard focus shows the same overlay; reduced motion: no zoom / glide, the overlay just fades in. */
.bm-b-cats {
	--bm-cats-gap: 20px;
	--bm-cats-cap: 35px; /* caption line under a photo on the desktop mosaic (live: 35 px) */
	--bm-cats-soft: cubic-bezier(.25, .1, .25, 1); /* photo zoom: soft start, long settle (live: 1 s ease) */
	--bm-cats-out: cubic-bezier(.22, .61, .36, 1); /* veil, mark + label: ease-out (the frame: linear, as live) */
	--bm-cats-ease: cubic-bezier(.22, 1, .36, 1); /* the row rise (view.js) */
}
/* 1cqw = 1 % of the content width: the mosaic's photo heights scale with it (rows below) */
.bm-b-cats .bm-wrap { container-type: inline-size; }

.bm-b-cats__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr)); /* any other tile count than 9: a plain grid */
	gap: var(--bm-cats-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}
.bm-b-cats__item { display: flex; min-width: 0; }
.bm-b-cats__tile {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	color: var(--bm-strong);
	text-decoration: none;
}
.bm-b-cats__media {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: var(--bm-cats-ar, 1.6);
	border-radius: var(--bm-r);
	background: var(--bm-g100);
	isolation: isolate;
}
.bm-b-cats__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.bm-b-cats__name {
	display: block;
	padding: 10px 6px 0;
	font: 500 14px/1.3 var(--bm-fd);
	text-align: center;
	text-transform: uppercase;
	text-wrap: balance;
	color: var(--bm-strong);
}

/* ---------- the 9-tile mosaic (live home: .make__gallery) ---------- */
.bm-b-cats__grid--9 > :nth-child(1) { grid-area: c1; }
.bm-b-cats__grid--9 > :nth-child(2) { grid-area: c2; }
.bm-b-cats__grid--9 > :nth-child(3) { grid-area: c3; }
.bm-b-cats__grid--9 > :nth-child(4) { grid-area: c4; }
.bm-b-cats__grid--9 > :nth-child(5) { grid-area: c5; }
.bm-b-cats__grid--9 > :nth-child(6) { grid-area: c6; }
.bm-b-cats__grid--9 > :nth-child(7) { grid-area: c7; }
.bm-b-cats__grid--9 > :nth-child(8) { grid-area: c8; }
.bm-b-cats__grid--9 > :nth-child(9) { grid-area: c9; }

/* desktop: 4 columns of 1fr as on live — a column never gets narrower than its one-line caption (min-width auto
   below), so on the UA page the third one grows to «Санітарні блоки (модульний туалет, душ)» and the other three share
   the rest, on the RU page («Санитарные блоки») all four are equal; rows = photo height (18 / 12.4 / 11.6 / 22.8 % of
   the content width: live 225 / 155 / 145 / 285 px at 1250) + the caption line. Houses + buildings wide on top;
   pavilions, the tall posts (rows 2–3), sanitary blocks, АБК; dachas under the pavilions; the large offices (rows 3–4)
   on the right; dormitories wide at the bottom. */
@media (min-width: 1101px) {
	.bm-b-cats__grid--9 {
		grid-template-columns: repeat(4, 1fr);
		grid-template-rows: 254px 186px 176px 312px; /* no container units: the rows at content width 1216 */
		grid-template-rows: calc(18cqw + 35px) calc(12.4cqw + 35px) calc(11.6cqw + 35px) calc(22.8cqw + 35px);
		grid-template-areas:
			"c1 c1 c2 c2"
			"c3 c4 c5 c6"
			"c7 c4 c8 c8"
			"c9 c9 c8 c8";
	}
	.bm-b-cats__grid--9 > .bm-b-cats__item { min-width: auto; } /* a column never cuts its one-line caption */
	.bm-b-cats__grid--9 .bm-b-cats__media { flex: 1 1 0; min-height: 0; aspect-ratio: auto; }
	.bm-b-cats__grid--9 .bm-b-cats__name {
		flex: none;
		height: var(--bm-cats-cap);
		padding: 0 4px;
		line-height: var(--bm-cats-cap);
		white-space: nowrap;
	}
}

/* tablet: 2 columns, a wide tile between pairs (live 768–1024: the same order and pattern) */
@media (min-width: 768px) and (max-width: 1100px) {
	.bm-b-cats__grid--9 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-areas: "c1 c1" "c2 c3" "c4 c5" "c6 c6" "c7 c8" "c9 c9";
	}
	.bm-b-cats__grid--9 > :nth-child(1) { --bm-cats-ar: 2.6; }
	.bm-b-cats__grid--9 > :nth-child(-n+5):nth-child(n+2) { --bm-cats-ar: 2; }
	.bm-b-cats__grid--9 > :nth-child(6) { --bm-cats-ar: 1.9; }
	.bm-b-cats__grid--9 > :nth-child(7),
	.bm-b-cats__grid--9 > :nth-child(8) { --bm-cats-ar: 1.5; }
	.bm-b-cats__grid--9 > :nth-child(9) { --bm-cats-ar: 2.3; }
}
@media (max-width: 1100px) {
	.bm-b-cats__grid:not(.bm-b-cats__grid--9) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* phones: 2 columns of 3:2 photos, the dormitories full width (live 481–767), then one column (live ≤ 480) */
@media (max-width: 767px) {
	.bm-b-cats { --bm-cats-gap: 16px; }
	.bm-b-cats__grid--9 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-areas: "c1 c2" "c3 c4" "c5 c6" "c7 c8" "c9 c9";
		--bm-cats-ar: 1.5;
	}
	.bm-b-cats__grid--9 > :nth-child(9) { --bm-cats-ar: 2.2; }
	.bm-b-cats__grid:not(.bm-b-cats__grid--9) { grid-template-columns: 1fr; }
	.bm-b-cats__name { padding-top: 8px; font-size: 13px; }
}
@media (max-width: 480px) {
	.bm-b-cats__grid--9 {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas: "c1" "c2" "c3" "c4" "c5" "c6" "c7" "c8" "c9";
	}
	.bm-b-cats__grid--9 > :nth-child(9) { --bm-cats-ar: 1.5; }
	.bm-b-cats__name { padding-inline: 0; font-size: 14px; } /* the full width: «Санітарні блоки (…)» on one line at 390 as live */
}

/* ---------- hover / focus overlay ---------- */
/* ::before = the veil that darkens the photo, ::after = the white frame (live: 1 px, 10 px in from the edges),
   .bm-b-cats__more = the mark (::before) + the label (::after, from data-label; aria-hidden, not link text) */
.bm-b-cats__media::before,
.bm-b-cats__media::after,
.bm-b-cats__more {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	transition: opacity 150ms linear; /* reduced motion: the overlay just fades in (the motion timings are below) */
}
.bm-b-cats__media::before {
	content: "";
	inset: 0;
	z-index: 1;
	background: rgba(17, 19, 30, .5);
}
.bm-b-cats__media::after {
	content: "";
	inset: 10px;
	z-index: 2;
	border: 1px solid #fff;
}
.bm-b-cats__more {
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 0 16px;
	color: #fff;
	text-align: center;
}
.bm-b-cats__more::before { /* the live hover mark (icon-logo-m), all six bars white: live draws the middle-left one navy,
	which on the darkened photo read as a black gap (owner 2026-10-11 «портит одна чёрная полоска … сделать белой») */
	content: "";
	width: 26px;
	height: 20px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 19 15'%3E%3Cpath fill='%23fff' d='M19 7.184L9.5 3.513V.238L19 4.624v2.56zM9.5 5.378L19 8.685v2.236L9.5 9.576V5.378zM9.5 11.018L19 12.5v1.956H9.5v-3.438zM0 12.506l7.726-1.345v3.295H0v-1.95zM7.726 3.65L0 7.496V5.631L7.726.602V3.65zM7.726 9.582L0 10.882V9.056l7.726-3.58v4.106z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.bm-b-cats__more::after { /* live .card__hover--text: 600 9 px, line 2.8em right under the 20 px mark */
	content: attr(data-label);
	font: 600 9px/2.8 var(--bm-fd);
	letter-spacing: .1em;
}

/* shown: mouse hover (only where the device really hovers — no sticky hover after a tap) or keyboard focus */
@media (hover: hover) and (pointer: fine) {
	.bm-b-cats__tile:hover .bm-b-cats__media::before,
	.bm-b-cats__tile:hover .bm-b-cats__media::after,
	.bm-b-cats__tile:hover .bm-b-cats__more { opacity: 1; }
}
.bm-b-cats__tile:focus-visible .bm-b-cats__media::before,
.bm-b-cats__tile:focus-visible .bm-b-cats__media::after,
.bm-b-cats__tile:focus-visible .bm-b-cats__more { opacity: 1; }

/* motion: at rest = the way out (a little quicker than the way in, no delays); hover / focus = the way in:
   photo zoom 1 s (live 1 s), veil 700 ms, then the mark + label rise 8 px into place (150 ms later).
   The white frame glides in from just outside the photo in live's timing, the same both ways: transform 300 ms linear,
   opacity 200 ms ease-in (owner 2026-10-11 «рамка … немножечко рябит при движении. На рабочем сайте она движется
   плавно»). Measured at 60 fps: a 1 px line moved by a compositor transform lands between pixel rows, so each frame it is
   either crisp or smeared over two rows at half brightness; while it moves slower than about 1 px per frame the eye
   sees it flicker in place. The former 900 ms ease-out glide crawled through its visible last 10 px at 0.2–0.7 px per
   frame: crisp / smeared for ≈ 0.45 s (DPR 1); 300 ms linear crosses them at 1.3–3 px per frame and ends crisp. It
   starts at 1.2 × 1.3, not live's uniform 1.2: the top / bottom lines then travel 0.15 × the height instead of 0.1 ×,
   so on the low tiles (≈ 140–150 px) they too pass faster than 1 px per frame (at 1.2 they flickered ≈ 0.2 s there, as
   on live; measured 1.3: ≈ 0.02–0.03 s).
   No will-change: Blink runs these transform / opacity transitions on the compositor anyway, and a hint keeps a layer
   rastered at its resting scale — the hovered photo stretched 1.1× (soft; the verifier measured 21 % less edge contrast
   on a hovered tile), the frame drawn from its 1.2× raster (a soft line while hovered, measured 2026-10-11) — without
   it both are redrawn sharp once in place. */
@media (prefers-reduced-motion: no-preference) {
	/* identity transforms at rest / hover, never `none`: switching a transform on or off makes Blink lay the page out
	   again (containing block); a value → value change does not (measured: hover 1 layout → 0) */
	.bm-b-cats__img { transform: scale(1); transition: transform 800ms var(--bm-cats-soft); }
	.bm-b-cats__media::before { transition: opacity 500ms var(--bm-cats-out); }
	.bm-b-cats__media::after {
		transform: scale(1.2, 1.3);
		transition: opacity 200ms ease-in, transform 300ms linear; /* = live, both ways (not re-timed below) */
	}
	.bm-b-cats__more {
		transform: translateY(8px);
		transition: opacity 300ms var(--bm-cats-out), transform 400ms var(--bm-cats-out);
	}

	.bm-b-cats__tile:focus-visible .bm-b-cats__img { transform: scale(1.1); transition-duration: 1000ms; }
	.bm-b-cats__tile:focus-visible .bm-b-cats__media::before { transition-duration: 700ms; }
	.bm-b-cats__tile:focus-visible .bm-b-cats__media::after { transform: scale(1); }
	.bm-b-cats__tile:focus-visible .bm-b-cats__more { transform: translateY(0); transition-duration: 600ms, 800ms; transition-delay: 150ms; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
	.bm-b-cats__tile:hover .bm-b-cats__img { transform: scale(1.1); transition-duration: 1000ms; }
	.bm-b-cats__tile:hover .bm-b-cats__media::before { transition-duration: 700ms; }
	.bm-b-cats__tile:hover .bm-b-cats__media::after { transform: scale(1); }
	.bm-b-cats__tile:hover .bm-b-cats__more { transform: translateY(0); transition-duration: 600ms, 800ms; transition-delay: 150ms; }
}

/* ---------- rows rise into place on scroll (view.js) ----------
   .is-low = a tile below the fold at load, waiting for its row (set by the script, so without JS nothing is hidden);
   .is-will = layer hint for the entrance only; .is-rising = the entrance itself (left → right stagger as an inline
   transition-delay). All three are dropped when the tile has arrived. A row = the tiles that start on the same grid
   line (desktop mosaic: 2 / 4 / 2 / 1). */
@media screen and (prefers-reduced-motion: no-preference) {
	.bm-b-cats__grid > .is-low { opacity: 0; transform: translateY(40px) scale(.985); }
	.bm-b-cats__grid > .is-will { will-change: opacity, transform; }
	.bm-b-cats__grid > .is-rising { transition: opacity 800ms var(--bm-cats-ease), transform 900ms var(--bm-cats-ease); }
}
