/*
 * «Коллекции» (page-collections.php, данные — inc/collections.php): алфавитный указатель на одной плашке, без фото и JS.
 * Строка заголовка: h1 (.catalog__title — как на остальных внутренних страницах) и справа на той же базовой линии строка букв;
 * не помещается — буквы уходят под заголовок. На плашке блоки букв в две колонки страницы (CSS columns), блок не рвётся;
 * в блоке — буква (как годы на «О компании») и названия в колонках сверху вниз: число строк приходит из PHP в --r2 / --r3.
 * ≤1199 — блоки в одну колонку, названия в три; ≤699 — названия в две, буква 40px.
 */
.coll-index {
	--ci-pad: clamp(22px, 3.2vw, 48px);                /* внутренний отступ плашки */
	--ci-gap: clamp(26px, 2.6vw, 40px);                /* между блоками букв */
	--ci-head: calc(64px + var(--wp-admin--admin-bar--height, 0px)); /* липкая шапка (.site-header__inner: 64, с 1024 — 72) + админ-панель */
	color: var(--c-green);
}

@media (min-width: 1024px) {
	.coll-index {
		--ci-head: calc(72px + var(--wp-admin--admin-bar--height, 0px));
	}
}

/* Переход по букве — обычные якоря; плавно только без prefers-reduced-motion (файл подключается только на этой странице) */
@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/* Строка заголовка */
.coll-index__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px 32px;
	margin-bottom: var(--sp-4);
}

.coll-index__head .catalog__title {
	margin: 0;
}

/* Строка букв: поле нажатия 6 × 7 вокруг буквы; −7 по краям — чтобы буквы стояли по краю контейнера */
.coll-index__az {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 4px;
	margin-inline: -7px;
}

.coll-index__az a {
	padding: 6px 7px;
	border-radius: 6px;
	color: var(--c-gold-text);
	font-family: var(--font-display);
	font-size: 22px;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	transition: color .25s;
}

.coll-index__az a:hover {
	color: var(--c-green);
}

.coll-index__az a:focus-visible,
.coll-index__names a:focus-visible {
	outline: 2px solid var(--c-gold-text);
	outline-offset: 2px;
}

/* Плашка; блоки букв — в две колонки страницы, отрицательный низ гасит отступ под последним блоком */
.coll-index__plaque {
	padding: var(--ci-pad);
	border-radius: var(--r-card);
	background: var(--c-plaque);
}

.coll-index__groups {
	columns: 2;
	column-gap: clamp(32px, 4.5vw, 80px);
	margin-bottom: calc(-1 * var(--ci-gap));
}

.coll-index__group {
	display: grid;
	grid-template-columns: clamp(52px, 5.6vw, 84px) minmax(0, 1fr);
	column-gap: 16px;
	padding-bottom: var(--ci-gap);
	break-inside: avoid;
	scroll-margin-top: calc(var(--ci-head) + 24px);
}

.coll-index__letter {
	margin: 0;
	color: inherit;
	font-family: var(--font-display);
	font-size: clamp(44px, 4vw, 60px);
	font-weight: 500;
	line-height: .8;
	white-space: nowrap;
}

/* «0–9» шире буквы — мельче, чтобы не залезать на названия (сейчас таких коллекций нет) */
.coll-index__group--digits .coll-index__letter {
	font-size: clamp(26px, 2.4vw, 36px);
	line-height: 1.05;
}

/* Названия: колонки заполняются сверху вниз, потом вправо */
.coll-index__names {
	display: grid;
	grid-auto-flow: column;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-template-rows: repeat(var(--r2), auto);
	gap: 9px 24px;
	margin: 0;
	padding: 3px 0 0;
	list-style: none;
}

.coll-index__names li {
	min-width: 0;
}

.coll-index__names a {
	color: var(--c-green);
	font-family: var(--font-display);
	font-size: clamp(20px, 1.6vw, 24px);
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	overflow-wrap: break-word;
	transition: color .25s;
}

.coll-index__names a:hover {
	color: var(--c-gold-text);
}

/* До 1199: блоки в одну колонку страницы, названия в три */
@media (max-width: 1199.98px) {
	.coll-index__groups {
		columns: 1;
	}

	.coll-index__names {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		grid-template-rows: repeat(var(--r3), auto);
	}
}

/* До 699: названия в две колонки, буква 40px */
@media (max-width: 699.98px) {
	.coll-index__group {
		grid-template-columns: 40px minmax(0, 1fr);
		column-gap: 10px;
	}

	.coll-index__letter {
		font-size: 40px;
	}

	.coll-index__group--digits .coll-index__letter {
		font-size: 22px;
	}

	.coll-index__names {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-template-rows: repeat(var(--r2), auto);
		gap: 8px 14px;
		padding-top: 1px;
	}

	.coll-index__names a {
		font-size: 19px;
	}

	.coll-index__az a {
		font-size: 21px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.coll-index__az a,
	.coll-index__names a {
		transition: none;
	}
}
