/* Модальные окна услуг: панель в системе сайта — графит, линии сетки, крестики по углам,
	кнопка закрытия — плитка как в шапке, фото в уголках видоискателя. Ниже: описание и кнопки,
	справа — таблица вагонов или частые вопросы по услуге. */
html.is-modal {
	overflow: hidden;
}

.smodal {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: clamp(12px, 3vw, 48px) clamp(12px, 3vw, 48px);
	border: 0;
	background: transparent;
	color: var(--c-white);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.smodal[open] {
	display: grid;
	place-items: center;
}

.smodal::backdrop {
	background: rgba(0, 0, 0, 0.78);
}

.smodal__panel {
	--line: var(--grid-line-dark);
	--cross: var(--grid-cross-dark);
	position: relative;
	width: min(1120px, 100%);
	border: 1px solid var(--line); /* taste-skill-ignore: сетка — фирменный приём */
	background: var(--c-graphite);
	animation: smodal-in 320ms var(--ease-out);
}

.smodal.is-closing .smodal__panel {
	animation: smodal-out 180ms var(--ease-out) forwards;
}

.smodal.is-closing::backdrop {
	opacity: 0;
	transition: opacity 180ms var(--ease-out);
}

@keyframes smodal-in {
	from { opacity: 0; transform: translateY(16px); }
}

@keyframes smodal-out {
	to { opacity: 0; transform: translateY(8px); }
}

/* Крестики по углам панели */
.smodal__panel::before,
.smodal__panel::after,
.smodal__head::before,
.smodal__head::after {
	content: "";
	position: absolute;
	z-index: 2;
	width: 11px;
	height: 11px;
	background:
		linear-gradient(var(--cross), var(--cross)) center / 1px 100% no-repeat, /* taste-skill-ignore: крестик сетки */
		linear-gradient(var(--cross), var(--cross)) center / 100% 1px no-repeat; /* taste-skill-ignore: крестик из двух линий */
	pointer-events: none;
}

.smodal__panel::before { left: -6px; top: -6px; }
.smodal__panel::after { right: -6px; bottom: -6px; }
.smodal__head::before { left: -6px; bottom: -6px; }
.smodal__head::after { right: -6px; top: -6px; }

/* Шапка окна: название и плитка закрытия */
.smodal__head {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 64px;
	border-bottom: 1px solid var(--line); /* taste-skill-ignore: линия строки */
}

.smodal__title {
	align-self: center;
	padding: 18px clamp(20px, 2.4vw, 32px);
	font-size: var(--fs-h3);
	font-weight: var(--fw-regular);
	line-height: 1.1;
	letter-spacing: -0.03em;
}

.smodal__close {
	position: relative;
	min-height: 64px;
	border-left: 1px solid var(--line); /* taste-skill-ignore: граница плитки */
	color: var(--c-white);
	transition: background-color var(--dur-fast) var(--ease-out);
}

.smodal__close i::before,
.smodal__close i::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 20px;
	height: 1.5px;
	background: currentColor;
	translate: -50% -50%;
	rotate: 45deg;
}

.smodal__close i::after { rotate: -45deg; }

.smodal__close:hover {
	background: var(--accent);
}

.smodal__close:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -4px;
}

/* Фото: полосой во всю ширину, в уголках видоискателя */
.smodal__media {
	--vf: 16px;
	position: relative;
	height: clamp(180px, 24vw, 300px);
	margin: 0;
	border-bottom: 1px solid var(--line); /* taste-skill-ignore */
	overflow: hidden;
}

.smodal__media::before {
	z-index: 1;
	inset: 12px;
	opacity: 1;
	scale: 1;
}

.smodal__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Тело: описание и кнопки слева, справа — таблица или вопросы */
.smodal__body {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.smodal__main {
	display: flex;
	flex-direction: column;
	gap: var(--space-l);
	padding: clamp(20px, 2.4vw, 32px);
}

.smodal__text {
	font-size: var(--fs-lead);
	line-height: 1.3;
	letter-spacing: -0.015em;
}

.smodal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: auto;
}

.smodal__actions .btn {
	min-height: 52px;
	font-size: 12px;
}

.smodal__side {
	display: flex;
	flex-direction: column;
	border-left: 1px solid var(--line); /* taste-skill-ignore: граница колонки */
}

/* Таблица вагонов / контактов */
.smodal__table {
	margin: 0;
}

.smodal__table div {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 16px;
	min-height: 56px;
	padding: 16px clamp(20px, 2.4vw, 32px);
	border-bottom: 1px solid var(--line); /* taste-skill-ignore: линии таблицы */
}

.smodal__table dt {
	font-size: 17px;
}

.smodal__table dd {
	display: flex;
	align-items: baseline;
	gap: 16px;
	margin: 0;
	color: var(--text-muted-dark);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.smodal__table dd .label {
	color: var(--accent);
}

.smodal__table--contacts dt {
	color: var(--text-muted-dark);
	font-family: var(--font-mono); /* taste-skill-ignore: подписи как в таблицах сайта */
	font-size: 11px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.smodal__table--contacts dd {
	color: var(--c-white);
	font-size: 17px;
}

.smodal__table--contacts a:hover {
	color: var(--accent);
}

/* Вопросы по услуге — строки с плюсом, как в блоке вопросов */
.smodal__faq {
	border-bottom: 1px solid var(--line); /* taste-skill-ignore: линии списка */
}

.smodal__faq summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 56px;
	padding: 14px clamp(20px, 2.4vw, 32px);
	font-size: 17px;
	line-height: 1.35;
	cursor: pointer;
	list-style: none;
	transition: background-color var(--dur-fast) var(--ease-out);
}

.smodal__faq summary::-webkit-details-marker {
	display: none;
}

.smodal__faq summary:hover {
	background: var(--c-white-08);
}

.smodal__plus {
	position: relative;
	flex: none;
	width: 14px;
	height: 14px;
}

.smodal__plus::before,
.smodal__plus::after {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 100%;
	height: 1.5px;
	background: var(--accent);
	translate: 0 -50%;
	transition: rotate var(--dur-base) var(--ease-out);
}

.smodal__plus::after { rotate: 90deg; }
.smodal__faq[open] .smodal__plus::after { rotate: 0deg; }

.smodal__faq p {
	padding: 0 clamp(20px, 2.4vw, 32px) 18px;
	font-size: 16px;
	line-height: 1.5;
	color: var(--text-muted-dark);
}

@media (max-width: 760px) {
	.smodal { place-items: start center; }
	.smodal__body { grid-template-columns: 1fr; }
	.smodal__side { border-left: 0; border-top: 1px solid var(--line); /* taste-skill-ignore */ }
	.smodal__table div { grid-template-columns: 1fr; gap: 4px; }
	.smodal__actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.smodal__panel,
	.smodal.is-closing .smodal__panel { animation: none; }
}

/* Окно всегда целиком в экране: шапка и фото на месте, описание, таблица и вопросы прокручиваются внутри */
.smodal__panel {
	display: flex;
	flex-direction: column;
	max-height: calc(100svh - 2 * clamp(12px, 3vw, 48px));
}

.smodal__head,
.smodal__media {
	flex: none;
}

.smodal__body {
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--c-white-16) transparent;
}

/* Телефон: окно — лист на весь экран, фото ниже, кнопка заявки прижата к низу */
@media (max-width: 760px) {
	.smodal { padding: 0; place-items: stretch; }
	.smodal__panel { width: 100%; height: 100svh; max-height: none; border: 0; }
	.smodal__panel::before,
	.smodal__panel::after { display: none; }
	.smodal__head { grid-template-columns: minmax(0, 1fr) 56px; }
	.smodal__title { padding: 14px 20px; font-size: 22px; }
	.smodal__close { min-height: 56px; }
	.smodal__media { height: 150px; }
	.smodal__main { gap: var(--space-m); padding: 20px; }
	.smodal__text { font-size: 18px; }
	.smodal__table div,
	.smodal__faq summary { padding-inline: 20px; }
	.smodal__faq p { padding-inline: 20px; }
}
