/* Текст страницы из редактора WordPress: абзацы, заголовки, списки, фото, таблицы.
 * Заголовки как у блоков внутренних страниц (Russo One, прописные), маркеры и ссылки медью. */

.entry-content {
	color: var(--color-ink);
	line-height: var(--lh-text);
	overflow-wrap: break-word;
}

:is(.entry-content, :where(.entry-content) > .wp-block-group__inner-container) > * + * {
	margin-top: 1rem;
}

:is(.entry-content, :where(.entry-content) > .wp-block-group__inner-container) > :is(h2, h3, h4) {
	margin-top: 2.5rem;
}

/* Заголовки и внутри групп («Блок страницы», «Тёмная плашка») */
.entry-content :is(h2, h3, h4) {
	font-family: var(--font-display);
	font-weight: 400;
	line-height: var(--lh-heading);
	letter-spacing: var(--ls-display);
	text-transform: uppercase;
}

:is(.entry-content, :where(.entry-content) > .wp-block-group__inner-container) > :first-child {
	margin-top: 0;
}

/* Блоки страницы («Блок страницы» в редакторе) отделены друг от друга шагом 88, как в макете */
:is(.entry-content, :where(.entry-content) > .wp-block-group__inner-container) > .is-style-kr-section + *,
:is(.entry-content, :where(.entry-content) > .wp-block-group__inner-container) > * + .is-style-kr-section {
	margin-top: var(--block-gap);
}

.entry-content h2 {
	font-size: var(--fs-block-title);
	line-height: var(--lh-section-title);
}

.entry-content h3 {
	font-size: var(--fs-card-title);
}

.entry-content h4 {
	color: var(--color-brass-deep);
	font-family: var(--font-text);
	font-size: var(--fs-label);
	font-weight: 600;
	letter-spacing: var(--ls-eyebrow-block);
}

:is(.entry-content, :where(.entry-content) > .wp-block-group__inner-container) > :is(h2, h3, h4) + * {
	margin-top: 1.25rem;
}

.entry-content a {
	color: var(--color-brass-deep);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color var(--dur-fast) var(--ease);
}

.entry-content a:hover {
	color: var(--color-ink);
}

.entry-content a:focus-visible {
	outline-color: var(--color-brass-deep);
	outline-offset: 2px;
}

.entry-content strong {
	font-weight: 600;
}

/* Читаемая колонка: абзацы и списки не шире ~75 знаков в строке, таблицы и фото идут на всю ширину */
.entry-content :is(p, ul, ol):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *, .is-style-kr-person *) {
	max-width: var(--text-measure);
}

.entry-content p {
	line-height: var(--lh-text-long);
}

/* Абзац перед списком («…должно содержать:») стоит к нему вплотную */
.entry-content .wp-block-group.is-style-kr-section > .wp-block-group__inner-container > p:has(+ :is(ul, ol)) {
	margin-bottom: calc(0.875rem - var(--block-head-gap));
}

/* Списки: редакционная типографика без значков и плашек.
 * Пункты — строки между тонкими линиями. Нумерованный список и длинный маркированный (от пяти пунктов,
 * например перечень обязательств политики) получают сквозной номер 01, 02… шрифтом заголовков,
 * чтобы на пункт можно было сослаться. Короткие маркированные списки идут без маркера.
 * Списки в тёмных плашках, строки документов и «простые» оформлены своими стилями (content-blocks.css). */
.entry-content :is(ul, ol):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) {
	display: block;
	margin-block: 0;
	padding: 0;
	list-style: none;
	counter-reset: kr-list;
}

.entry-content :is(ul, ol):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) > li {
	position: relative;
	margin: 0;
	padding: 0.875rem 0;
	border: 0;
	border-top: 1px solid var(--color-rule);
	counter-increment: kr-list;
	font-size: 1.0625rem; /* 17 */
	line-height: var(--lh-text-long);
}

.entry-content :is(ul, ol):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) > li:last-child {
	border-bottom: 1px solid var(--color-rule);
}

.entry-content :is(ul, ol):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) > li::before {
	content: none;
}

/* Нумерованные и длинные списки: номер в узкой колонке слева */
.entry-content :is(ol, ul:has(> li:nth-child(5))):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) > li {
	padding-left: 3.25rem;
}

.entry-content :is(ol, ul:has(> li:nth-child(5))):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) > li::before {
	content: counter(kr-list, decimal-leading-zero);
	position: absolute;
	top: 1.1875rem; /* первая строка: 14 поля + поправка на меньший кегль номера */
	left: 0;
	color: var(--color-brass-deep);
	font-family: var(--font-display);
	font-size: 0.875rem;
	line-height: 1.2;
	letter-spacing: var(--ls-display);
}

/* Вложенный список — просто отступ, без номеров и линий */
.entry-content li :is(ul, ol) {
	max-width: none;
	margin-top: 0.5rem;
}

.entry-content li :is(ul, ol) > li {
	padding: 0.375rem 0;
	border: 0;
	font-size: inherit;
}

.entry-content li :is(ul, ol) > li::before {
	content: none;
}

@media (max-width: 47.9375rem) {
	.entry-content :is(ol, ul:has(> li:nth-child(5))):not([class*="is-style-"], .is-style-kr-plate *, .is-style-kr-bar *) > li {
		padding-left: 2.5rem;
	}
}

/* Фото и галереи */
.entry-content img {
	height: auto;
}

.entry-content figure {
	margin-inline: 0;
}

.entry-content figcaption {
	margin-top: 0.5rem;
	color: var(--color-ink-soft);
	font-size: var(--fs-caption);
}

/* Отступ галереи задаём через переменную WordPress: по ней считается ширина фото в колонках.
 * Если поменять только gap, три фото 296 + 24 не влезают в ряд и галерея ломается на две колонки. */
.entry-content .wp-block-gallery.has-nested-images {
	--wp--style--unstable-gallery-gap: 1.5rem; /* 24, как в макете */
	gap: var(--wp--style--unstable-gallery-gap);
}

/* Видео (блок «Встраивание», YouTube и др.): на всю ширину колонки в пропорции 16:9 */
.entry-content .wp-block-embed {
	margin: 0;
}

.entry-content .wp-block-embed__wrapper {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--color-night);
}

.entry-content .wp-block-embed__wrapper::before {
	content: none; /* у WordPress своя распорка для пропорций, здесь её заменяет aspect-ratio */
}

.entry-content .wp-block-embed__wrapper iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Цитата: медная черта слева */
.entry-content blockquote {
	margin-inline: 0;
	padding-left: 1.5rem;
	border-left: 2px solid var(--color-brass-deep);
	font-size: var(--fs-lead);
	line-height: var(--lh-lead);
}

/* Таблицы: прокрутка по горизонтали внутри блока, страница не уезжает */
.entry-content .wp-block-table {
	overflow-x: auto;
}

/* Светлая подложка и сетка: линия у каждой ячейки, поэтому сетка не ломается,
   сколько бы строк и столбцов ни добавили или объединили в редакторе */
.entry-content table {
	width: 100%;
	margin: 0;
	border: 1px solid var(--color-table-border);
	border-collapse: collapse;
	background: var(--color-table-bg);
	color: var(--color-ink);
	font-size: var(--fs-table);
	line-height: var(--lh-text);
}

.entry-content thead,
.entry-content tfoot {
	border: 0;
}

.entry-content th,
.entry-content td {
	padding: var(--table-cell-pad);
	border: 1px solid var(--color-table-line);
	text-align: left;
	vertical-align: top;
}

/* Названия столбцов: тонированная полоса, медью, прописными */
.entry-content thead th,
.entry-content thead td {
	border-bottom: 1px solid var(--color-table-head-line);
	background: var(--color-table-head-bg);
	color: var(--color-brass-deep);
	font-size: var(--fs-table-head-lg);
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: var(--ls-table-head);
	text-transform: uppercase;
	vertical-align: bottom;
}

/* Названия строк: первый столбец и ячейки-заголовки внутри таблицы */
.entry-content tbody th,
.entry-content tbody tr > td:first-child {
	font-weight: 500;
}

/* Подписи строк заданы явно (th в теле таблицы, например «Календарь охотника» с объединёнными
 * ячейками): первая обычная ячейка строки — уже значение, не подпись */
.entry-content table:has(tbody th) tbody tr > td:first-child {
	font-weight: 400;
}

/* В ячейке часть текста выделена жирным (должность в «Графике приёма»): остальное (ФИО) обычным */
.entry-content tbody tr > td:first-child:has(strong) {
	font-weight: 400;
}

.entry-content tbody th {
	background: var(--color-table-label-bg);
}

.entry-content tfoot td,
.entry-content tfoot th {
	background: var(--color-table-label-bg);
	font-weight: 500;
}

/* Телефон в ячейке не рвётся на дефисе («515-» / «65-46»): номер читается одной строкой */
.entry-content :is(td, th) a[href^="tel:"] {
	white-space: nowrap;
}

/* Стиль WordPress «Полосы»: чередование строк в цветах темы */
.entry-content .wp-block-table.is-style-stripes {
	border-bottom: 0;
}

.entry-content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
	background: var(--color-table-label-bg);
}

/* Широкие таблицы (от 4 столбцов) на узком экране не сжимаются, а прокручиваются внутри блока */
.entry-content table:has(tr > :nth-child(4)) {
	min-width: 44rem;
}

.entry-content table:has(tr > :nth-child(5)) {
	min-width: 52rem;
}

.entry-content th strong {
	font-weight: inherit;
}

/* Стиль таблицы «Прейскурант» (охота, рыбалка): закрытая рамкой таблица с линиями у каждой ячейки,
 * крупный текст и крупные названия столбцов, цены шрифтом заголовков, итоговая цена (последний
 * столбец) медью. Первый столбец — номер. Числа выравниваются по правому краю кнопкой
 * «Выравнивание столбца» в редакторе. На телефоне строка становится карточкой: подписи столбцов
 * ставит assets/js/price-list.js. */
.entry-content .wp-block-table.is-style-kr-price table {
	min-width: 0;
	border: 1px solid var(--color-table-border);
	border-top: 2px solid var(--color-brass-deep);
	background: var(--color-table-bg);
	font-size: clamp(1.0625rem, 1.25vw, 1.125rem); /* 18 на 1440 */
	font-variant-numeric: tabular-nums;
}

.entry-content .wp-block-table.is-style-kr-price :is(th, td) {
	padding: 1.125rem 1.125rem;
	border: 1px solid var(--color-table-line);
	vertical-align: baseline;
}

/* Названия столбцов: крупно, медью, без прописных — читаются как заголовки, а не подписи */
.entry-content .wp-block-table.is-style-kr-price thead :is(th, td) {
	padding-block: 1rem;
	border-bottom: 1px solid var(--color-table-head-line);
	background: var(--color-table-head-bg);
	color: var(--color-brass-deep);
	font-size: clamp(1.0625rem, 1.25vw, 1.125rem); /* 18 на 1440, как текст таблицы */
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	vertical-align: bottom;
}

/* Номер: медью, шрифтом заголовков, как в нумерованных списках */
.entry-content .wp-block-table.is-style-kr-price tbody td:first-child {
	width: 2.5rem;
	color: var(--color-brass-deep);
	font-family: var(--font-display);
	font-size: 0.9375rem;
	font-weight: 400;
	letter-spacing: var(--ls-display);
}

/* Цены и суммы: шрифтом заголовков, не переносятся */
.entry-content .wp-block-table.is-style-kr-price tbody .has-text-align-right {
	font-family: var(--font-display);
	font-size: 1.1875rem; /* 19 */
	letter-spacing: var(--ls-display);
	white-space: nowrap;
}

/* Итоговая цена — крупнее и медью */
.entry-content .wp-block-table.is-style-kr-price tbody td.has-text-align-right:last-child {
	color: var(--color-brass-deep);
	font-size: clamp(1.25rem, 1.667vw, 1.5rem); /* 24 на 1440 */
}

/* Единица измерения и другие короткие столбцы — приглушённо */
.entry-content .wp-block-table.is-style-kr-price tbody td:not(:first-child, :nth-child(2), .has-text-align-right) {
	color: var(--color-ink-soft);
	font-size: var(--fs-nav-item);
	white-space: nowrap;
}

.entry-content .wp-block-table.is-style-kr-price tbody tr:hover > * {
	background: var(--color-row-hover);
}

/* Телефон: каждая строка — карточка. Сверху название услуги и мелко единица измерения,
 * ниже цены отдельной тонированной панелью: строки «подпись — сумма» через линию, последняя
 * (итог) отделена медной линией и крупнее. Номер и пустые ячейки скрыты.
 * Подписи и классы ячеек ставит assets/js/price-list.js по шапке таблицы. */
@media (max-width: 47.9375rem) {
	.entry-content .wp-block-table.is-style-kr-price {
		overflow: visible;
	}

	.entry-content .wp-block-table.is-style-kr-price :is(table, tbody, tr, td) {
		display: block;
	}

	.entry-content .wp-block-table.is-style-kr-price thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}

	.entry-content .wp-block-table.is-style-kr-price tbody tr {
		display: flex;
		flex-direction: column;
		padding: 1.25rem 1rem;
		border-bottom: 1px solid var(--color-table-border);
	}

	.entry-content .wp-block-table.is-style-kr-price tbody tr:last-child {
		border-bottom: 0;
	}

	/* Строка цены: подпись слева, сумма справа, на тонированной панели */
	.entry-content .wp-block-table.is-style-kr-price tbody td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 1rem;
		width: auto;
		padding: 0.625rem 0.875rem;
		border: 0;
		border-top: 1px solid var(--color-table-line);
		background: var(--color-table-head-bg);
		text-align: right;
		white-space: normal;
	}

	.entry-content .wp-block-table.is-style-kr-price tbody td::before {
		content: attr(data-label);
		color: var(--color-ink-soft);
		font-family: var(--font-text);
		font-size: 0.875rem; /* 14 */
		font-weight: 500;
		letter-spacing: normal;
		line-height: 1.3;
		text-align: left;
		text-transform: none;
	}

	/* Первая строка панели — без линии сверху, с отступом от названия */
	.entry-content .wp-block-table.is-style-kr-price tbody td:is(.is-name, .is-unit) + td:not(.is-unit) {
		margin-top: 0.875rem;
		border-top: 0;
	}

	/* Итог — последняя строка: медная линия, подпись и сумма медью */
	.entry-content .wp-block-table.is-style-kr-price tbody td.has-text-align-right:last-child {
		border-top: 1px solid var(--color-brass-deep-line);
	}

	.entry-content .wp-block-table.is-style-kr-price tbody td:last-child::before {
		color: var(--color-brass-deep);
		font-weight: 600;
	}

	/* Название услуги: на всю ширину, без подписи и панели */
	.entry-content .wp-block-table.is-style-kr-price tbody td.is-name {
		display: block;
		padding: 0;
		border: 0;
		background: none;
		color: var(--color-ink);
		font-size: var(--fs-nav-item);
		font-weight: 500;
		line-height: var(--lh-text);
		text-align: left;
	}

	/* Единица измерения — мелкой подписью под названием */
	.entry-content .wp-block-table.is-style-kr-price tbody td.is-unit {
		display: block;
		margin-top: 0.25rem;
		padding: 0;
		border: 0;
		background: none;
		color: var(--color-ink-soft);
		font-size: 0.875rem;
		text-align: left;
	}

	.entry-content .wp-block-table.is-style-kr-price tbody td.is-unit::before {
		content: attr(data-label) ": ";
		font-size: inherit;
	}

	.entry-content .wp-block-table.is-style-kr-price tbody td:is(.is-name, .is-num, .is-empty)::before {
		content: none;
	}

	.entry-content .wp-block-table.is-style-kr-price tbody td:is(.is-num, .is-empty) {
		display: none;
	}

	.entry-content .wp-block-table.is-style-kr-price tbody tr:hover > * {
		background: none;
	}

	.entry-content .wp-block-table.is-style-kr-price tbody tr:hover > td:not(.is-name, .is-unit) {
		background: var(--color-table-head-bg);
	}
}

.entry-content .wp-block-table figcaption {
	margin-top: 0.5rem;
	color: var(--color-ink-soft);
	font-size: var(--fs-caption);
}

@media (max-width: 47.9375rem) {
	.entry-content table {
		font-size: var(--fs-table-mobile);
	}

	.entry-content th,
	.entry-content td {
		padding: var(--table-cell-pad-mobile);
	}
}

/* Строка таблицы под курсором подсвечивается целиком (шапку не трогаем) */
.entry-content tbody tr > * {
	transition: background-color var(--dur-fast) var(--ease);
}

.entry-content tbody tr:hover > * {
	background: var(--color-row-hover);
}

.entry-content :is(.is-style-kr-plate, .is-style-kr-bar) tbody tr:hover > * {
	background: var(--color-row-hover-dark);
}

.entry-content hr {
	height: 0;
	border: 0;
	border-top: 1px solid var(--color-rule);
}

.entry-content__pages {
	display: flex;
	gap: 1rem;
	margin-top: 2rem;
}
