/*
 * Всплывающие окна: общий native dialog/controller, отдельные варианты подписки и успешной заявки.
 * Подписка использует светлый компонент Figma в обеих темах страницы; высота зависит от актуального текста и защиты формы.
 * Окно успешной заявки сохраняет прежнее оформление. Анимация включается только без prefers-reduced-motion.
 */
.ps-popup {
	--ps-popup-bg: var(--ps-color-light-gray);
	--ps-popup-action: var(--ps-color-surface);

	width: min(829px, 90vw);
	max-width: none;
	max-height: 90vh;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 32px;
	background: var(--ps-popup-bg);
	color: var(--ps-color-contrast);
	font-family: var(--ps-font);
	overflow: hidden;
}

.ps-popup::backdrop {
	background: rgb(0 0 0 / 80%);
}

html.ps-popup-open,
html.ps-popup-open body {
	overflow: hidden;
}

.ps-popup *,
.ps-popup *::before,
.ps-popup *::after {
	box-sizing: border-box;
}

/* Внутренний блок занимает всё окно: клик мимо него — это клик по подложке (см. popups.js). */
.ps-popup__inner {
	position: relative;
	max-height: 90vh;
	padding: 56px 24px 32px;
	overflow-y: auto;
}

.ps-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ps-color-surface);
	color: var(--ps-color-contrast);
	cursor: pointer;
}

.ps-popup__close svg {
	width: 24px;
	height: 24px;
}

.ps-popup__action {
	min-width: 133px;
	height: 60px;
	padding: 0 32px;
	border: 0;
	border-radius: var(--ps-radius-pill);
	background: var(--ps-popup-action);
	color: var(--ps-color-contrast);
	font-size: var(--ps-fs-s);
	font-weight: 600;
	cursor: pointer;
}

.ps-popup__close:focus-visible,
.ps-popup__action:focus-visible {
	outline: 2px solid var(--ps-color-gold);
	outline-offset: 2px;
}

/* ----- Подписка: светлый вариант компонента выбран в макете для обеих тем страницы. ----- */
.ps-popup--subscribe {
	--ps-popup-bg: #f7f7f7;
	--ps-color-base: #f7f7f7;
	--ps-color-contrast: #0f0f0f;
	--ps-color-muted: #5d5d5d;
	--ps-color-surface: #e9e9e9;
	--ps-color-field-bg: #fff;
	--ps-color-field-border: #333;

	width: min(827px, calc(100% - 48px));
	border-radius: 30px;
	color-scheme: light;
}

.ps-popup--subscribe::backdrop {
	background: rgb(15 15 15 / 25%);
}

.ps-popup--subscribe .ps-popup__inner {
	padding: 48px;
}

.ps-popup--subscribe .ps-popup__close {
	top: 48px;
	right: 48px;
	width: 40px;
	height: 40px;
}

.ps-popup--subscribe .ps-popup__close svg {
	width: 40px;
	height: 40px;
}

.ps-popup--subscribe .ps-block {
	margin: 0;
}

.ps-popup--subscribe .ps-subscribe .ps-head {
	margin-bottom: 36px;
	padding-right: 52px;
}

.ps-popup--subscribe .ps-subscribe .ps-head__title {
	padding: 0;
	font-size: 28px;
	font-weight: 700;
	line-height: 28px;
	overflow-wrap: anywhere;
}

.ps-popup--subscribe .ps-subscribe .ps-head__lead {
	max-width: none;
	margin: 12px 0 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 20px;
}

.ps-popup--subscribe .ps-subscribe__form,
.ps-popup--subscribe .ps-subscribe__row {
	gap: 24px;
}

.ps-popup--subscribe .ps-subscribe__row {
	grid-template-columns: minmax(0, 1fr);
}

.ps-popup--subscribe .ps-subscribe__input {
	border-color: #333;
	background: #fff;
	font-size: 20px;
}

/* Светлое поле окна сохраняет единую границу фокуса и на тёмной странице. */
.ps-popup--subscribe .ps-subscribe__input:focus:not([aria-invalid="true"]) {
	border-color: var(--ps-color-contrast);
	outline: 2px solid var(--ps-color-contrast);
	outline-offset: -2px;
}

.ps-popup--subscribe .ps-subscribe__submit {
	justify-self: center;
	justify-content: center;
	width: min(227px, 100%);
	min-width: 0;
	--ps-button-font-size: var(--ps-button-preset-font-large);
	--ps-button-font-weight: var(--ps-button-preset-weight-regular);
}

.ps-popup--subscribe .ps-subscribe__consent {
	font-size: 12px;
	line-height: 16px;
}

.ps-popup--subscribe .ps-subscribe__agree {
	width: 28px;
	height: 28px;
}

/* Узкий экран без отдельного макета: освобождаем ширину текста, размещая закрытие над заголовком. */
@media (max-width: 375px) {

	.ps-popup--subscribe .ps-popup__inner {
		padding: 24px;
	}

	.ps-popup--subscribe .ps-popup__close {
		top: 12px;
		right: 12px;
	}

	.ps-popup--subscribe .ps-subscribe .ps-head {
		padding-top: 40px;
		padding-right: 0;
	}
}

/* ----- Заявка отправлена ----- */
.ps-popup--sent {
	--ps-popup-bg: var(--ps-color-base);

	width: min(704px, 90vw);
	border-radius: 0;
	text-align: center;
}

:root[data-theme="dark"] .ps-popup--sent {
	--ps-popup-bg: var(--ps-color-graphite);
	--ps-popup-action: var(--ps-color-line);
}

.ps-popup--sent .ps-popup__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 48px 24px 40px;
}

.ps-popup--sent .ps-popup__close {
	top: 24px;
	right: 24px;
	width: 24px;
	height: 24px;
	background: transparent;
	color: var(--ps-color-gold);
}

:root[data-theme="dark"] .ps-popup--sent .ps-popup__close {
	color: #fff;
}

.ps-popup__icon {
	width: 66px;
	height: 66px;
	color: var(--ps-color-gold);
}

.ps-popup__title {
	margin: 24px 0 24px;
	font-size: var(--ps-fs-xl);
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
}

.ps-popup__action:hover {
	background: var(--ps-color-gold);
	color: #000;
}

@media (min-width: 768px) {

	.ps-popup__inner {
		padding: 48px;
	}

	.ps-popup__close {
		top: 48px;
		right: 48px;
		width: 40px;
		height: 40px;
	}

	.ps-popup--subscribe .ps-subscribe .ps-head__title {
		font-size: 40px;
		line-height: 48px;
	}

	.ps-popup--subscribe .ps-subscribe .ps-head__lead {
		font-size: 20px;
		font-weight: 400;
		line-height: 28px;
	}

	.ps-popup--subscribe .ps-subscribe__row {
		grid-template-columns: minmax(0, 1fr) 227px;
	}

	.ps-popup--subscribe .ps-subscribe__consent {
		font-size: 16px;
		line-height: 20px;
	}

	.ps-popup--sent .ps-popup__inner {
		padding: 48px 48px 40px;
	}

	.ps-popup--sent .ps-popup__close {
		top: 24px;
		right: 24px;
		width: 24px;
		height: 24px;
	}

	.ps-popup__title {
		font-size: var(--ps-fs-2xl);
	}
}

@media (prefers-reduced-motion: no-preference) {

	.ps-popup[open] {
		animation: ps-popup-fade 0.3s ease-out;
	}

	.ps-popup[open]::backdrop {
		animation: ps-popup-fade 0.3s ease-out;
	}
}

@keyframes ps-popup-fade {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}
