/**
 * Мобильный шаблон: правки шапки и отступов (подключается с ?v=filemtime — обход агрессивного кеша).
 */

/* Футер footer-2: серая карта со скруглением и рамкой */
.footer.footer-2 .footer__main-part.first-part {
	background-color: transparent !important;
}
.footer.footer-2 .footer__main-part.first-part > .maxwidth-theme {
	background-color: transparent;
	border: none;
	box-shadow: none;
	border-radius: 0;
	overflow: visible;
	box-sizing: border-box;
}
.footer.footer-2 .footer__main-part.first-part .footer__main-part-inner.p-block.p-block--48 {
	background-color: rgb(244, 244, 244);
	border-radius: var(--theme-outer-border-radius, 12px);
	overflow: hidden;
	box-sizing: border-box;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.footer.footer-2 .footer__main-part.first-part .footer__main-part-inner .footer__part-item {
	border-bottom: none !important;
}

.footer.footer-2 .footer__main-part.first-part .footer__main-part-menu {
	padding-left: clamp(10px, 1.2vw, 20px);
	box-sizing: border-box;
}

/* Единые боковые отступы с p-block--18 */
#main {
	--theme-page-width-padding: 18px;
}

@media screen and (max-width: 991px) {
	.rscable-tizers-intro-wrap .tizers-list__items-wrapper.mobile-offset,
	.banners-with-text-bg-template .grid-list.mobile-offset,
	[class*="with-text-bg-template"] .grid-list.mobile-offset {
		margin-left: 0 !important;
		margin-right: 0 !important;
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	/* Ширина карточек = ширина контента (как hero), было 260px из mobile-scrolled--items-2 */
	.banners-with-text-bg-template .mobile-scrolled--items-2 > *:where(a, div),
	[class*="with-text-bg-template"] .mobile-scrolled--items-2 > *:where(a, div) {
		width: 100%;
	}
}

/* MIDDLE_ADV: .maxwidth-theme внутри баннеров с текстом имеет горизонтальный паддинг,
 * из-за которого карточки уже героя. Убираем — ширина совпадает с .banners-big__inner-wrap */
@media screen and (max-width: 767px) {
	body.index .drag-block.container.MIDDLE_ADV .index-block > [class*="with-text-bg-template"] > .maxwidth-theme,
	body.index .drag-block.container.MIDDLE_ADV .index-block > .banners-with-text-bg-template > .maxwidth-theme {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}
}

/* Подписи у иконок (Войти, Сравнение) */
#mobileheader .header__icon-name {
	display: none !important;
}

#mobileheader .header-cabinet__link {
	font-size: 0 !important;
	line-height: 0 !important;
	color: transparent !important;
	text-indent: -9999px;
	overflow: hidden;
	width: 40px !important;
	min-width: 40px !important;
	height: 40px !important;
	min-height: 40px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-direction: row !important;
	padding: 0 !important;
}

#mobileheader .header-cabinet__link svg,
#mobileheader .header-cabinet__link .header__icon,
#mobileheader .header-cabinet__link i.svg {
	text-indent: 0;
	font-size: initial;
	line-height: normal;
	color: inherit;
}

#mobileheader .header-compare .compare-link.flexbox--direction-column,
#mobileheader .header-favorite a.header-icon.flexbox--direction-column,
#mobileheader .header-cart a.flexbox--direction-column {
	flex-direction: row !important;
	align-items: center !important;
	justify-content: center !important;
	min-height: 40px !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

/* Одна линия, без вылета за экран */
#mobileheader .mobileheader__inner {
	min-width: 0;
	overflow: hidden;
}

#mobileheader .mobileheader__inner > .maxwidth-theme {
	min-width: 0;
	max-width: 100%;
	flex: 1 1 auto;
}

#mobileheader .mobileheader__inner-part.line-block {
	flex-wrap: nowrap !important;
	align-items: center !important;
	align-content: center !important;
	min-width: 0;
	flex: 1 1 auto;
	max-width: 100%;
	min-height: 48px;
	--gap: clamp(2px, 0.8vw, 5px) !important;
	gap: var(--gap) !important;
}

#mobileheader .mobileheader__inner-part > .flex-1:first-of-type,
#mobileheader .mobileheader__inner-part .flex-1 {
	min-width: 0 !important;
	flex: 1 1 28px !important;
}

#mobileheader .mobileheader__inner-part > .line-block__item {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0;
	width: 40px;
	min-width: 40px;
	height: 44px;
	min-height: 44px;
	max-height: 44px;
}

#mobileheader .mobileheader__inner-part > .line-block__item.no-shrinked {
	transform: none;
}

#mobileheader .mobileheader__inner-part > .line-block__item > *,
#mobileheader .mobileheader__inner-part .header-icon-link,
#mobileheader .mobileheader__inner-part button[class*="header-search"],
#mobileheader .mobileheader__inner-part .icon-block--with_icon,
#mobileheader .mobileheader__inner-part .icon-block--only_icon {
	width: 40px !important;
	min-width: 40px !important;
	height: 44px !important;
	min-height: 44px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 !important;
}

#mobileheader .mobileheader__inner-part > .line-block__item:not(.logo) svg {
	width: 24px !important;
	height: 24px !important;
	max-width: 24px !important;
	max-height: 24px !important;
}

#mobileheader .rscable-email-trigger svg {
	width: 34px !important;
	height: 34px !important;
	max-width: 34px !important;
	max-height: 34px !important;
}

#mobileheader .phones .phones__inner,
#mobileheader .phones .phones__phones-wrapper {
	display: flex !important;
	align-items: center !important;
}

#mobileheader .phones .icon-block__only-icon,
#mobileheader .phones .icon-block__only-icon svg,
#mobileheader .phones .icon-block__only-icon img {
	max-width: 24px !important;
	max-height: 24px !important;
	width: 24px !important;
	height: 24px !important;
	object-fit: contain;
	vertical-align: middle;
}

#mobileheader .logo {
	width: clamp(116px, 31vw, 136px) !important;
	max-width: clamp(116px, 31vw, 136px) !important;
	min-width: 0;
	flex-shrink: 1;
}

#mobileheader .logo > a {
	justify-content: flex-start !important;
}

#mobileheader .logo svg {
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
	max-height: 32px !important;
}

#mobileheader .logo img {
	max-height: 32px;
	width: auto;
	max-width: 100%;
}

@media screen and (max-width: 360px) {
	#mobileheader .mobileheader__inner-part.line-block {
		--gap: 1px !important;
	}

	#mobileheader .logo {
		width: 104px !important;
		max-width: 104px !important;
	}
}

/*
 * Bitrix24 site_button (include/header/body_above_counter.php) — скрыть на мобильном шаблоне целиком.
 * Правки только здесь, не в rscable-site-tweaks (см. .cursor_docs/styles-architecture-map.md).
 *
 * Базовые (специфичность 0-1-0) — закрывают все b24-классы в исходном состоянии:
 */
[class*="b24-widget-button"],
[data-b24-crm-button-icon],
[data-b24-crm-hello-cont] {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}
/*
 * Усиленные (специфичность 0-2-0 / 0-2-1) — перебивают внутренний CSS виджета
 * (.b24-widget-button-wrapper.b24-widget-button-visible { display:flex !important } = 0-2-0).
 */
div.b24-widget-button-wrapper,
div.b24-widget-button-inner-container,
.b24-widget-button-wrapper.b24-widget-button-visible,
.b24-widget-button-popup.b24-widget-button-popup-show,
.b24-widget-button-shadow.b24-widget-button-shadow-show {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

/* Главная: зазор между блоком героя и MIDDLE_ADV */
@media screen and (max-width: 767px) {
	body.index .main.banner-auto > .container > .drag-block.container.MIDDLE_ADV {
		margin-top: 16px;
	}
}

/* Главная / MIDDLE_ADV: мобильные тайзеры — статичный список с иконкой рядом с текстом */
@media screen and (max-width: 767px) {
	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-cards {
		display: grid !important;
		grid-template-columns: 1fr !important;
		gap: 10px !important;
		overflow: visible !important;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card {
		display: flex !important;
		align-items: center;
		min-height: 72px;
		padding: 12px 14px;
		background: #f6f7f8;
		border: 1px solid rgba(0, 0, 0, 0.06);
		border-radius: var(--theme-outer-border-radius, 12px);
		box-sizing: border-box;
		overflow: hidden;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__image {
		position: relative !important;
		flex: 0 0 48px;
		width: 48px !important;
		height: 48px !important;
		min-height: 48px !important;
		margin-right: 12px;
		border-radius: 12px;
		background: #fff;
		overflow: hidden;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__img {
		position: static !important;
		width: 100% !important;
		height: 100% !important;
		max-width: 100% !important;
		max-height: 100% !important;
		object-fit: contain !important;
		object-position: center center !important;
		transform: none !important;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info {
		position: static !important;
		inset: auto !important;
		display: flex !important;
		flex: 1 1 auto;
		min-width: 0;
		padding: 0 !important;
		align-items: flex-start !important;
		justify-content: center !important;
		text-align: left !important;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info .color_light,
	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info a.color_light {
		color: #222 !important;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info .font_20,
	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info .font_24,
	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info .font_28 {
		font-size: 15px !important;
		line-height: 1.25 !important;
		font-weight: 600 !important;
		margin: 0 !important;
	}

	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info > .font_13,
	body.index .drag-block.container.MIDDLE_ADV .banners-with-text-bg-template .ui-card__info .chip {
		display: none !important;
	}
}

/*
 * Hero-form banner: высота Swiper-контейнера и слайда.
 *
 * Архитектура:
 *  - .banners-big__inner-wrap — внешний контейнер с фоном, overflow:hidden = граница обрезки.
 *  - .banners-big__text — внутренняя flex-колонка (заголовок + форма), overflow:hidden из компонента.
 *
 * Проблема Swiper: Aspro задаёт .banners-big__depend-height { height: 100% } на adaptive-3 mobile.
 * Родитель auto-height → 100% = 0 → Swiper читает el.clientHeight = 0 → клипает форму.
 * height:auto на .main-slider устраняет это: Swiper читает реальный размер содержимого.
 *
 * Проблема Chrome flex: min-height на контейнере не является «definite height» для flex-детей.
 * Явный height на .banners-big__item решает это для Chrome.
 *
 * overflow:visible на item и slide позволяет форме выходить визуально за
 * их вычисленные границы (в Chrome через flex visual overflow).
 *
 * Файл грузится с ?v=filemtime → браузер всегда берёт актуальную версию.
 */
@media screen and (max-width: 767px) {
	/*
	 * Hero-banner height chain: Swiper-контейнер → слайд → item → inner-wrap.
	 *
	 * Высота: clamp(480px, 78svh, 680px).
	 * Соотношение 78svh/50svh (banner/card-max): всегда остаётся 28svh (~196px на 700px svh)
	 * для заголовка + подзаголовка + отступов (~130px). Запас ~66px.
	 *
	 * Слой 1 — Swiper-контейнер (.main-slider):
	 *   height:auto → не мешает Swiper, контейнер не фиксирует высоту.
	 *   min-height → контейнер расширяется до 480px+, перебивает overflow:hidden clip.
	 */
	.banners-big--adaptive-3 .rscable-banners-big__wrapper--hero-form .main-slider {
		height: auto !important;
		min-height: clamp(480px, 78svh, 680px) !important;
	}

	/* Слой 2 — Swiper-слайд: Swiper ставит inline height≈360px — min-height перебивает. */
	.banners-big--adaptive-3 .rscable-banners-big__wrapper--hero-form .main-slider__item {
		min-height: clamp(480px, 78svh, 680px) !important;
		overflow: visible !important;
	}

	/* Слой 3 — item: явный height = «definite» для Chrome (иначе flex:1 1 0% детей = 0). */
	.banners-big--adaptive-3 .rscable-banners-big__wrapper--hero-form .banners-big__item {
		padding-top: 0 !important;
		height: clamp(480px, 78svh, 680px) !important;
		max-height: none !important;
		overflow: visible !important;
	}

	/* Слой 4 — inner-wrap: финальная граница overflow:hidden. */
	.banners-big--adaptive-3 .rscable-banners-big__wrapper--hero-form .banners-big__inner-wrap {
		overflow: hidden !important;
		min-height: clamp(480px, 78svh, 680px) !important;
	}

	/* .banners-big__text: overflow:hidden клипает форму в Firefox при меньшем svh.
	   inner-wrap остаётся единственной границей. */
	.banners-big--adaptive-3 .rscable-banners-big__wrapper--hero-form .banners-big__text {
		overflow: visible !important;
	}
}
