/* ЗАО «Ритуал» — транспортное подразделение.
   Единственная таблица стилей сайта. Bootstrap 3.2 удалён на этапе 2:
   от него оставалось только .container, а сетка переписана на CSS Grid.
   Порядок подключения: fonts.css → site.css */

/* ========================================================================
   1. Токены
   ======================================================================== */

:root {
	/* Палитра. Тёмно-фиолетовый и синий сохранены от прежнего сайта —
	   это узнаваемость, менять их нет причин. */
	--brand:        #241d42;
	--brand-soft:   #332a58;
	--accent:       #2f6fa5;
	--accent-dark:  #24567f;
	--accent-pale:  #eaf1f8;

	--ink:          #1b1a21;
	--ink-muted:    #56545f;
	/* #7a7784 давал 4.03:1 на светло-сером фоне — ниже требуемых 4.5.
	   Здесь 5.01:1 и при этом заметно светлее --ink-muted. */
	--ink-faint:    #6b6875;

	--surface:      #ffffff;
	--surface-alt:  #f6f5f8;
	--rule:         #e3e1e8;

	/* Типографика */
	--font-text:  'PT Sans', 'Segoe UI', Tahoma, Arial, sans-serif;
	--font-head:  'PT Serif', Georgia, 'Times New Roman', serif;

	/* Шкала отступов */
	--gap-xs: 0.25rem;
	--gap-sm: 0.5rem;
	--gap-md: 1rem;
	--gap-lg: 1.75rem;
	--gap-xl: 3rem;

	--radius: 3px;
	--page:   1140px;
}

/* ========================================================================
   2. Сброс
   ======================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--font-text);
	font-size: 17px;
	line-height: 1.65;
	color: var(--ink);
	background: var(--surface);
}

@media (min-width: 768px) {
	body { font-size: 18px; }
}

img {
	max-width: 100%;
	height: auto;
	border: 0;
}

/* ========================================================================
   3. Типографика
   ======================================================================== */

h1, h2, h3, h4 {
	font-family: var(--font-head);
	color: var(--brand);
	line-height: 1.25;
	text-wrap: balance;
}

h1 {
	font-size: 1.85rem;
	margin: 0 0 var(--gap-lg);
}

h2 {
	font-size: 1.4rem;
	margin: var(--gap-xl) 0 var(--gap-md);
}

h3 {
	font-size: 1.15rem;
	margin: var(--gap-lg) 0 var(--gap-sm);
}

@media (min-width: 768px) {
	h1 { font-size: 2.4rem; }
	h2 { font-size: 1.7rem; }
	h3 { font-size: 1.3rem; }
}

p {
	margin: 0 0 var(--gap-md);
}

a {
	color: var(--accent-dark);
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover,
a:focus {
	color: var(--brand);
}

/* Видимый фокус — важен для навигации с клавиатуры. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
	border-radius: 2px;
}

ul, ol {
	margin: 0 0 var(--gap-md);
	padding-left: 1.4em;
}

li { margin-bottom: var(--gap-xs); }

hr {
	border: 0;
	border-top: 1px solid var(--rule);
	margin: var(--gap-lg) 0;
}

small {
	font-size: 0.85em;
	color: var(--ink-muted);
	line-height: 1.5;
}

strong, b { font-weight: 700; }

/* Смысловая обёртка текстовых блоков. Ограничения по ширине здесь нет
   намеренно: её задаёт .container, а колонка в 68ch внутри 1140px висела
   у левого края, оставляя справа почти 600px пустоты. Заодно тарифные
   таблицы получают полную ширину и перестают переносить значения. */
.prose {
	/* ширину задаёт .container */
}

.lead {
	font-size: 1.1em;
	color: var(--ink-muted);
}

.nowrap { white-space: nowrap; }

/* Ссылка «сразу к содержимому» для скринридеров и клавиатуры. */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100;
	padding: var(--gap-sm) var(--gap-md);
	background: var(--brand);
	color: #fff;
}

.skip-link:focus {
	left: 0;
	color: #fff;
}

/* ========================================================================
   4. Раскладка
   ======================================================================== */

.container {
	width: 100%;
	max-width: var(--page);
	margin: 0 auto;
	padding: 0 18px;
}

@media (min-width: 768px) {
	.container {
		padding: 0 var(--gap-lg);
	}
}

.site-main {
	display: block;
	/* Только вертикальные отступы: сокращение padding обнулило бы
	   горизонтальные поля .container, и текст прилипал бы к краям экрана. */
	padding-top: var(--gap-xl);
	padding-bottom: var(--gap-xl);
	min-height: 40vh;
}

@media (max-width: 640px) {
	.site-main {
		padding-top: var(--gap-lg);
		padding-bottom: var(--gap-lg);
	}
}

/* ========================================================================
   5. Шапка
   ======================================================================== */

.site-header {
	padding: var(--gap-md) 0;
	background: var(--surface);
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--gap-md);
}

.site-header__logo {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	min-height: 44px;
	line-height: 0;
}

.site-header__logo img {
	width: 203px;
	height: 53px;
}

.site-header__contact {
	flex: 0 0 auto;
	text-align: right;
}

.site-header__phone {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
	color: var(--brand);
	text-decoration: none;
	white-space: nowrap;
}

.site-header__phone:hover,
.site-header__phone:focus {
	color: var(--accent-dark);
	text-decoration: underline;
}

.site-header__hours {
	margin: var(--gap-xs) 0 0;
	font-size: 0.8rem;
	color: var(--ink-muted);
	white-space: nowrap;
}

/* Телефон — главный канал связи, на узком экране он занимает всю ширину
   и становится настоящей кнопкой, а не мелким текстом в углу. */
@media (max-width: 640px) {
	.site-header {
		padding: var(--gap-sm) 0;
	}

	.site-header__inner {
		justify-content: center;
		text-align: center;
		gap: var(--gap-sm);
	}

	.site-header__logo img {
		width: 160px;
		height: 42px;
	}

	.site-header__contact {
		flex: 1 0 100%;
		text-align: center;
	}

	.site-header__phone {
		padding: 0.55rem var(--gap-md);
		border: 1px solid var(--accent);
		border-radius: var(--radius);
		background: var(--accent-pale);
		font-size: 1.35rem;
		color: var(--accent-dark);
	}

	.site-header__phone + .site-header__phone {
		margin-top: var(--gap-xs);
	}

	.site-header__hours {
		margin-top: var(--gap-sm);
	}
}

/* ========================================================================
   6. Навигация
   ======================================================================== */

.site-nav {
	background: var(--brand);
}

.site-nav__list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__list li {
	margin: 0;
}

.site-nav__list a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0.7rem var(--gap-sm);
	font-size: 0.95rem;
	color: #f2f1f6;
	text-align: center;
	text-decoration: none;
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
	border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.site-nav__list a:hover,
.site-nav__list a:focus {
	background: var(--brand-soft);
	color: #fff;
}

.site-nav__list a[aria-current="page"] {
	background: var(--accent);
	color: #fff;
	font-weight: 700;
}

/* Нечётный последний пункт растягивается на всю строку —
   сетка не «рвётся» дырой. */
.site-nav__list li:last-child:nth-child(odd) {
	grid-column: 1 / -1;
}

@media (min-width: 768px) {
	.site-nav__list {
		display: flex;
	}

	.site-nav__list li {
		flex: 1 1 0;
	}

	.site-nav__list a {
		min-height: 52px;
		border-bottom: 0;
	}

	.site-nav__list li:first-child a {
		border-left: 1px solid rgba(255, 255, 255, 0.12);
	}
}

/* ========================================================================
   7. Карточки разделов (главная)
   ======================================================================== */

.cards {
	display: grid;
	/* 280px, а не 240: при ширине страницы 1140px это даёт три колонки
	   и ровные ряды 3+3, тогда как 240px давало 4+2 с дырой в конце. */
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: var(--gap-lg);
	margin: 0 0 var(--gap-xl);
	padding: 0;
	list-style: none;
}

.cards li {
	margin: 0;
}

/* Ссылка — вся карточка целиком: одна цель нажатия вместо трёх,
   и в списке ссылок скринридера один осмысленный пункт вместо трёх
   одинаковых. */
.card {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: var(--gap-lg);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--ink);
	text-decoration: none;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.card:hover,
.card:focus-visible {
	border-color: var(--accent);
	background: var(--accent-pale);
	color: var(--ink);
}

.card__icon {
	display: block;
	width: 100%;
	height: 96px;
	margin-bottom: var(--gap-md);
	object-fit: contain;
	object-position: center;
}

.card__title {
	margin: 0 0 var(--gap-sm);
	font-size: 1.25rem;
	color: var(--brand);
}

.card:hover .card__title,
.card:focus-visible .card__title {
	text-decoration: underline;
}

.card__text {
	margin: 0;
	font-size: 0.95rem;
	color: var(--ink-muted);
}

/* Телефоны как основное действие страницы контактов. */
.phone-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-sm);
}

.phone-list a {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 0.5rem var(--gap-md);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	background: var(--accent-pale);
	font-size: 1.25rem;
	font-weight: 700;
	text-decoration: none;
}

.phone-list a:hover,
.phone-list a:focus-visible {
	background: var(--accent);
	color: #fff;
}

/* ========================================================================
   8. Таблицы
   ======================================================================== */

.table {
	width: 100%;
	margin-bottom: var(--gap-lg);
	border-collapse: collapse;
}

.table th,
.table td {
	padding: 0.75rem var(--gap-md);
	border-top: 1px solid var(--rule);
	vertical-align: top;
	text-align: left;
}

.table tr:first-child td,
.table thead th {
	border-top: 0;
}

.table thead th {
	border-bottom: 2px solid var(--rule);
	font-family: var(--font-head);
	color: var(--brand);
}

.table p:last-child {
	margin-bottom: 0;
}

/* Тарифные таблицы «показатель / значение»: на телефоне строка
   разворачивается в блок, горизонтальная прокрутка не нужна. */
@media (max-width: 640px) {
	.table-stack,
	.table-stack tbody,
	.table-stack tr,
	.table-stack td {
		display: block;
		width: auto;
	}

	.table-stack tr {
		padding: var(--gap-md) 0;
		border-top: 1px solid var(--rule);
	}

	.table-stack tr:first-child {
		border-top: 0;
	}

	.table-stack td {
		padding: 0;
		border: 0;
	}

	.table-stack td:first-child {
		font-size: 0.85rem;
		color: var(--ink-muted);
		margin-bottom: var(--gap-xs);
	}

	.table-stack td:last-child {
		font-weight: 700;
		color: var(--brand);
	}
}

/* ========================================================================
   9. Фотогалерея
   ======================================================================== */

.gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: var(--gap-sm);
	margin: var(--gap-lg) 0 0;
	padding: 0;
	list-style: none;
}

.gallery li {
	margin: 0;
}

.gallery a {
	display: block;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	padding: 4px;
	background: var(--surface);
	line-height: 0;
	transition: border-color 0.15s ease;
}

.gallery a:hover,
.gallery a:focus-visible {
	border-color: var(--accent);
}

/* Превью 400×299 — соотношение сохраняется, кадрирование не применяется. */
.gallery img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 1px;
}

/* ========================================================================
   9. Калькулятор стоимости
   ======================================================================== */

.calc {
	margin: 0 0 var(--gap-lg);
	padding: var(--gap-lg);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--surface-alt);
}

.calc__fields {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: var(--gap-md);
}

.calc__field {
	position: relative;
	flex: 1 1 260px;
	min-width: 0;
}

.calc__field--km {
	flex: 0 1 170px;
}

.calc label {
	display: block;
	margin-bottom: var(--gap-xs);
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--ink-muted);
}

.calc input {
	width: 100%;
	min-height: 48px;
	padding: 0.6rem var(--gap-md);
	border: 1px solid #b9b6c4;
	border-radius: var(--radius);
	background: var(--surface);
	font-family: inherit;
	font-size: 1.05rem;
	color: var(--ink);
}

.calc input:hover {
	border-color: var(--accent);
}

.calc__or {
	flex: 0 0 auto;
	margin: 0 0 0.85rem;
	color: var(--ink-faint);
	font-size: 0.9rem;
}

/* ---- выпадающий список подсказок ---- */

.calc__suggest {
	position: absolute;
	z-index: 20;
	left: 0;
	right: 0;
	top: 100%;
	margin: 2px 0 0;
	padding: 0;
	max-height: 310px;
	overflow-y: auto;
	list-style: none;
	background: var(--surface);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	box-shadow: 0 8px 20px rgba(27, 26, 33, 0.14);
}

.calc__suggest-item {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--gap-sm);
	margin: 0;
	padding: 0.65rem var(--gap-md);
	min-height: 44px;
	cursor: pointer;
	border-bottom: 1px solid var(--rule);
}

.calc__suggest-item:last-child {
	border-bottom: 0;
}

.calc__suggest-item.is-active,
.calc__suggest-item:hover {
	background: var(--accent-pale);
}

.calc__suggest-name {
	font-weight: 700;
	color: var(--brand);
}

.calc__suggest-meta {
	flex: 0 0 auto;
	font-size: 0.8rem;
	color: var(--ink-muted);
}

/* ---- результат ---- */

.calc__result {
	margin: 0 0 var(--gap-xl);
	padding: var(--gap-lg);
	border: 1px solid var(--rule);
	border-left: 4px solid var(--rule);
	border-radius: var(--radius);
}

.calc__result--ok {
	border-color: var(--rule);
	border-left-color: var(--accent);
	background: var(--surface);
}

.calc__result--fixed {
	border-color: var(--rule);
	border-left-color: var(--brand);
	background: var(--surface-alt);
}

.calc__title {
	margin: 0 0 var(--gap-md);
	font-family: var(--font-head);
	font-size: 1.3rem;
	color: var(--brand);
}

.calc__hint {
	margin: 0;
	color: var(--ink-muted);
}

.calc__breakdown {
	margin-bottom: var(--gap-md);
}

.calc__row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--gap-sm);
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--rule);
}

.calc__row-label {
	color: var(--ink-muted);
	font-size: 0.92rem;
}

.calc__row-value {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.calc__row--total {
	border-bottom: 0;
	margin-top: var(--gap-xs);
	padding-top: var(--gap-md);
	border-top: 2px solid var(--rule);
}

.calc__row--total .calc__row-label {
	font-weight: 700;
	color: var(--ink);
	font-size: 1rem;
}

.calc__row--total .calc__row-value {
	font-family: var(--font-head);
	font-size: 1.45rem;
	font-weight: 700;
	color: var(--brand);
}

.calc__note {
	margin: 0 0 var(--gap-md);
	font-size: 0.85rem;
	color: var(--ink-muted);
	line-height: 1.5;
}

.calc__phones {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-sm);
	margin: 0;
}

.calc__phones a {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 0.5rem var(--gap-md);
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	background: var(--accent-pale);
	font-size: 1.15rem;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.calc__phones a:hover,
.calc__phones a:focus-visible {
	background: var(--accent);
	color: #fff;
}

/* ---- таблица направлений ---- */

.dir {
	margin: 0 0 var(--gap-xl);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
}

.dir > summary {
	padding: var(--gap-md) var(--gap-lg);
	min-height: 48px;
	cursor: pointer;
	font-weight: 700;
	color: var(--accent-dark);
}

.dir > summary:hover {
	background: var(--surface-alt);
}

.dir__scroll {
	overflow-x: auto;
	border-top: 1px solid var(--rule);
}

.dir__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}

.dir__table caption {
	padding: var(--gap-md) var(--gap-lg) var(--gap-sm);
	text-align: left;
	font-size: 0.85rem;
	color: var(--ink-muted);
}

.dir__table th,
.dir__table td {
	padding: 0.55rem var(--gap-lg);
	text-align: left;
	border-bottom: 1px solid var(--rule);
	vertical-align: top;
}

.dir__table thead th {
	position: sticky;
	top: 0;
	background: var(--surface);
	border-bottom: 2px solid var(--rule);
	font-family: var(--font-head);
	color: var(--brand);
}

.dir__table tbody th {
	font-weight: 400;
}

.dir__table td {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* «Зависит от морга, по телефону» — не цифра, и в одну строку помещаться
   не обязана: иначе на узком экране таблица уезжает вбок. */
.dir__byphone {
	white-space: normal;
	color: var(--ink-muted);
}

.dir__group th {
	padding-top: var(--gap-md);
	background: var(--surface-alt);
	font-family: var(--font-head);
	font-size: 0.95rem;
	color: var(--brand);
}

@media (max-width: 640px) {
	.calc {
		padding: var(--gap-md);
	}

	.calc__or {
		flex: 1 0 100%;
		margin: 0;
	}

	.calc__field--km {
		flex: 1 1 100%;
	}

	.calc__result {
		padding: var(--gap-md);
	}

	.dir > summary,
	.dir__table caption {
		padding-left: var(--gap-md);
		padding-right: var(--gap-md);
	}

	/* На узком экране таблица направлений должна помещаться целиком:
	   иначе третья колонка — та самая, ради которой её и открывают, —
	   оказывается за краем экрана. Ужимаем поля и разрешаем переносы. */
	.dir__table th,
	.dir__table td {
		padding: 0.5rem 8px;
		font-size: 0.82rem;
	}

	.dir__table thead th {
		font-size: 0.78rem;
	}

	.dir__table tbody th,
	.dir__table td {
		white-space: normal;
	}
}

/* ========================================================================
   Оглавление на странице вопросов
   ======================================================================== */

.faq__toc {
	margin: 0 0 var(--gap-xl);
	padding: var(--gap-md) var(--gap-lg);
	border-left: 4px solid var(--accent);
	background: var(--surface-alt);
	border-radius: var(--radius);
}

.faq__toc ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-xs) var(--gap-lg);
	margin: 0;
	padding: 0;
	list-style: none;
}

.faq__toc li {
	margin: 0;
}

.faq__toc a {
	display: inline-block;
	padding: 0.35rem 0;
	font-weight: 700;
}

/* Заголовок вопроса — цель якорной ссылки: даём ей воздух сверху,
   чтобы после перехода строка не упиралась в край экрана. */
.prose h2[id] {
	scroll-margin-top: var(--gap-md);
}

.prose h3 {
	color: var(--ink);
}

/* ========================================================================
   10. Подвал
   ======================================================================== */

.site-footer {
	margin-top: var(--gap-lg);
	padding: var(--gap-lg) 0;
	border-top: 1px solid var(--rule);
	background: var(--surface-alt);
	font-size: 0.9rem;
	color: var(--ink-muted);
}

.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap-lg);
	justify-content: space-between;
}

.site-footer p {
	margin: 0 0 var(--gap-xs);
}

.site-footer__org {
	font-family: var(--font-head);
	font-size: 1.05rem;
	color: var(--brand);
}

.site-footer__legal {
	text-align: right;
}

@media (max-width: 640px) {
	.site-footer {
		text-align: center;
	}

	/* Телефон и почта в подвале — отдельные строки с запасом по высоте,
	   а не мелкие ссылки через запятую. */
	.site-footer a[href^="tel:"],
	.site-footer a[href^="mailto:"],
	.site-footer__legal a {
		display: inline-block;
		padding: 0.6rem var(--gap-sm);
		min-height: 44px;
	}

	.site-footer__inner {
		gap: var(--gap-md);
	}

	.site-footer__col {
		flex: 1 0 100%;
	}

	.site-footer__legal {
		text-align: center;
	}
}

/* ========================================================================
   11. Печать
   ======================================================================== */

@media print {
	.site-nav,
	.cookie-notification,
	.skip-link {
		display: none !important;
	}

	body {
		font-size: 12pt;
		color: #000;
	}

	a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 0.85em;
	}
}
