/*
 * Плавающие контакты: постоянная нижняя кнопка и растущая вверх капсула без переключения height в auto.
 * По запросу пользователя ручное раскрытие анимируется и при reduce; самостоятельная cookie-политика ниже не меняется.
 */
.ps-contact {
	--ps-contact-size: 80px;
	--ps-contact-icon-size: 48px;
	--ps-contact-panel-padding: 16px;
	--ps-contact-item-gap: 10px;

	position: fixed;
	right: 24px;
	bottom: 22px;
	z-index: 96;
	display: flex;
	flex-direction: column-reverse;
	align-items: center;
	width: var(--ps-contact-size);
	min-height: var(--ps-contact-size);
	border-radius: calc(var(--ps-contact-size) / 2);
	background: var(--ps-color-surface);
	color: var(--ps-color-contrast);
}

.ps-contact__toggle {
	position: relative;
	flex: none;
	width: var(--ps-contact-size);
	height: var(--ps-contact-size);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ps-color-surface);
	color: inherit;
	cursor: pointer;
}

.ps-contact__icon {
	position: absolute;
	inset: 0;
	width: var(--ps-contact-icon-size);
	height: var(--ps-contact-icon-size);
	margin: auto;
	pointer-events: none;
	transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ps-contact__icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

.ps-contact__icon--open {
	opacity: 1;
	transform: scale(1) rotate(0deg);
}

.ps-contact__icon--close {
	opacity: 0;
	transform: scale(0) rotate(-90deg);
}

.ps-contact.is-open .ps-contact__icon--open {
	opacity: 0;
	transform: scale(0) rotate(90deg);
}

.ps-contact.is-open .ps-contact__icon--close {
	opacity: 1;
	transform: scale(1) rotate(0deg);
}

/* Высота выводится из числа элементов: нижняя кнопка всегда занимает своё место в потоке. */
.ps-contact__panel {
	flex: none;
	width: 100%;
	padding-top: 0;
	visibility: hidden;
	pointer-events: none;
	transition: padding-top 0.35s cubic-bezier(0.1, 0.76, 0.55, 0.94), visibility 0s 0.35s;
}

.ps-contact.is-open .ps-contact__panel {
	padding-top: var(--ps-contact-panel-padding);
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}

.ps-contact__list {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	transition: gap 0.35s cubic-bezier(0.1, 0.76, 0.55, 0.94);
}

.ps-contact__list > li {
	display: flex;
	flex: none;
	min-height: 0;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 0;
	margin: 0;
	padding: 0;
	opacity: 0;
	transform: translateY(10px);
	transition: height 0.35s cubic-bezier(0.1, 0.76, 0.55, 0.94), opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
}

.ps-contact.is-open .ps-contact__list {
	gap: var(--ps-contact-item-gap);
}

.ps-contact.is-open .ps-contact__list > li {
	height: var(--ps-contact-icon-size);
	opacity: 1;
	transform: none;
}

.ps-contact__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--ps-contact-icon-size);
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.ps-contact__link svg {
	display: block;
	width: 100%;
	height: 100%;
}

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

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

.ps-contact__link:hover,
.ps-contact.is-open .ps-contact__toggle:hover {
	color: var(--ps-color-gold);
}

.ps-contact.is-open .ps-contact__toggle:hover {
	background: transparent;
}

/* ----- Cookie-баннер (макет Figma «Cookies», светлая #e9e9e9 и тёмная #333 темы) ----- */
.ps-cookie {
	position: fixed;
	right: 24px;
	bottom: 24px;
	left: 24px;
	z-index: 95;
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px 24px;
	border-radius: 35px;
	background: var(--ps-color-surface);
	color: var(--ps-color-contrast);
	font-size: 12px;
	line-height: 16px;
}

/* Кнопка контактов есть — баннер над ней: 22 (отступ кнопки) + 80 (кнопка) + 12 (зазор) по макету. */
body:has(.ps-contact) .ps-cookie {
	bottom: 114px;
}

.ps-cookie[hidden] {
	display: none;
}

.ps-cookie__text {
	margin: 0;
}

.ps-cookie__text a {
	text-decoration: underline;
	text-decoration-color: var(--ps-color-gold);
	text-decoration-skip-ink: none;
	text-underline-position: from-font;
}

.ps-cookie__accept {
	flex: none;
	align-self: stretch;
	padding: 16px 24px;
	border: 0;
	border-radius: 40px;
	background: #5d5d5d;
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	line-height: 20px;
	cursor: pointer;
}

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

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

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

	.ps-cookie:not([hidden]) {
		animation: ps-cookie-in 0.3s ease-out;
	}
}

@keyframes ps-cookie-in {

	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (min-width: 768px) {

	.ps-cookie {
		flex-direction: row;
		align-items: center;
		gap: 40px;
		padding: 16px 20px 16px 28px;
		border-radius: 60px;
		font-size: 16px;
		line-height: 20px;
	}

	.ps-cookie__accept {
		align-self: auto;
		font-size: 20px;
		font-weight: 500;
		line-height: 28px;
	}
}

@media (min-width: 1025px) {

	/* Кнопка — у правого края контейнера 1200 px (в макете 1315 из 1440), 60 px от низа; баннер слева от неё, зазор 20 px. */
	.ps-contact {
		--ps-contact-size: 92px;
		--ps-contact-icon-size: 56px;
		--ps-contact-panel-padding: 18px;
		--ps-contact-item-gap: 12px;

		right: max(24px, calc(50vw - 600px));
		bottom: 60px;
	}

	/* Баннер у правого края контейнера, а при кнопке контактов — левее неё (92 + 20 px). */
	.ps-cookie,
	body:has(.ps-contact) .ps-cookie {
		--ps-cookie-right: max(24px, calc(50vw - 600px));

		right: var(--ps-cookie-right);
		bottom: 60px;
		left: auto;
		width: min(953px, calc(100vw - var(--ps-cookie-right) - 24px));
	}

	body:has(.ps-contact) .ps-cookie {
		right: calc(var(--ps-cookie-right) + 112px);
		width: min(953px, calc(100vw - var(--ps-cookie-right) - 136px));
	}
}
