:root {
	--container-max: 1440px;
	--gutter-desktop: 40px;
	--gutter-tablet: 20px;
	--gutter-mobile: 15px;

	--section-padding: 50px;
}

@media (max-width: 767px) {
	:root {
		--section-padding: 60px;
	}
}

/* === Оболочка секции === */
body.v2 .site-section {
	position: relative;
	z-index: 0;
	margin: 0; /* обнуляем на всякий случай */
	padding: 0;
	max-width: 100%;
}

body.v2 .site-section:not(.has-sticky-bg) {
	overflow: hidden;
}

/* === Высота секции === */
body.v2 .site-section.has-min-height {
	min-height: var(--min-height, auto);
}

@media (max-width: 1024px) {
	body.v2 .site-section.has-min-height {
		min-height: var(--min-height-tablet, var(--min-height, auto));
	}
}
@media (max-width: 767px) {
	body.v2 .site-section.has-min-height {
		min-height: var(--min-height-mobile, var(--min-height-tablet, var(--min-height, auto)));
	}
}

/* Полная ширина */
body.v2 .site-section.is-full-width {
	width: 100%;
}

/* === Внутренний контейнер === */
body.v2 .site-section .container {
	width: 100%;
	max-width: var(--container-max);
	margin-left: auto;
	margin-right: auto;

	padding-left: var(--gutter-desktop);
	padding-right: var(--gutter-desktop);

	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: flex-start;

	position: relative;
	box-sizing: border-box;

	height: 100%;
	min-height: inherit;
	/* overflow: hidden; */

	/* Убираем дефолтные отступы */
	padding-top: 0;
	padding-bottom: 0;
}

/* === Адаптивные отступы по бокам === */
@media (max-width: 1024px) {
	body.v2 .site-section .container {
		padding-left: var(--gutter-tablet);
		padding-right: var(--gutter-tablet);
	}
}
@media (max-width: 767px) {
	body.v2 .site-section .container {
		padding-left: var(--gutter-mobile);
		padding-right: var(--gutter-mobile);
	}
}

/* === Отключить боковые отступы (left/right) === */
body.v2 .container.disable_horizontal_padding {
		padding-left: 0;
		padding-right: 0;
}

/* === Отступы внутри container === */
body.v2 .container.pt {
	padding-top: var(--section-padding);
}
body.v2 .container.pb {
	padding-bottom: var(--section-padding);
}

/* === Отступы внутри секции === */
body.v2 .site-section.pt-section {
	padding-top: var(--section-padding);
}
body.v2 .site-section.pb-section {
	padding-bottom: var(--section-padding);
}

/* === Отступы вне секции === */
body.v2 .site-section.pt-outside {
	margin-top: var(--section-padding);
}
body.v2 .site-section.pb-outside {
	margin-bottom: var(--section-padding);
}

/* === Контейнер во всю ширину === */
body.v2 .site-section .container.is-full-width {
	max-width: none;
	width: 100%;
}

/* === Позиционирование контента === */
body.v2 .container.align-top    { justify-content: flex-start; }
body.v2 .container.align-center { justify-content: center; }
body.v2 .container.align-bottom { justify-content: flex-end; }

body.v2 .container.justify-left   { align-items: flex-start; }
body.v2 .container.justify-center { align-items: center; }
body.v2 .container.justify-right  { align-items: flex-end; }

/* === Убираем внешний margin у первого/последнего блока === */
body.v2 .container > *:first-child {
	margin-top: 0;
}
body.v2 .container > *:last-child {
	margin-bottom: 0;
}

/* === Фон: background_mode = full === */
body.v2 .site-section.has-bg-full:not(.has-sticky-bg)::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--bg-color, transparent);
	background-image: var(--bg-image-desktop);
	background-size: var(--bg-size, cover);
	background-repeat: no-repeat;
	background-position: var(--bg-position, center);
	transition: background 0.3s ease;
}

/* === Фон: background_mode = content === */
body.v2 .site-section.has-bg-content:not(.has-sticky-bg) .container::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--bg-color, transparent);
	background-image: var(--bg-image-desktop);
	background-size: var(--bg-size, cover);
	background-repeat: no-repeat;
	background-position: var(--bg-position, center);
	transition: background 0.3s ease;
	border-radius: inherit;
}

/* === Адаптивная смена фонов === */
@media (max-width: 1024px) {
	body.v2 .site-section.has-bg-full:not(.has-sticky-bg)::before,
	body.v2 .site-section.has-bg-content:not(.has-sticky-bg) .container::before {
		background-image: var(--bg-image-tablet, var(--bg-image-desktop));
	}
}
@media (max-width: 767px) {
	body.v2 .site-section.has-bg-full:not(.has-sticky-bg)::before,
	body.v2 .site-section.has-bg-content:not(.has-sticky-bg) .container::before {
		background-image: var(--bg-image-mobile, var(--bg-image-tablet, var(--bg-image-desktop)));
	}
}

/* Родительская секция */
body.v2 .site-section.has-sticky-bg {
	position: relative;
}

/* Обёртка фона */
body.v2 .site-section.has-sticky-bg .background {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
}

/* Sticky-фон */
body.v2 .site-section.has-sticky-bg .background-inner {
	position: sticky;
	top: 30px;
	width: 100%;
	height: 100vh;
	background: var(--bg-color, transparent);
	background-image: var(--bg-image-desktop);
	background-size: var(--bg-size, cover);
	background-position: var(--bg-position, center);
	background-repeat: no-repeat;
	z-index: 0;
}

/* Контент поверх */
body.v2 .site-section.has-sticky-bg .container {
	position: relative;
	z-index: 1;
}

/* Адаптивные фоны */
@media (max-width: 1024px) {
	body.v2 .site-section.has-sticky-bg .background-inner {
		background-image: var(--bg-image-tablet, var(--bg-image-desktop));
	}
}
@media (max-width: 767px) {
	body.v2 .site-section.has-sticky-bg .background-inner {
		background-image: var(--bg-image-mobile, var(--bg-image-tablet, var(--bg-image-desktop)));
	}
}


/* Активируем flex и базовые параметры */
/* === Активация растяжения на контейнере === */
body.v2 .container.stretch-content {
	display: flex;
	flex-direction: column;
	justify-content: stretch;
	align-items: stretch;
}

body.v2 .container > .block-editor-inner-blocks {
	max-width: 100%;
	width: 100%;
}

/* === Gutenberg: уровень InnerBlocks */
body.v2 .container.stretch-content > .block-editor-inner-blocks {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

/* Gutenberg: уровень layout */
body.v2 .container.stretch-content .block-editor-block-list__layout {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

/* Gutenberg: сам ACF-блок — универсально */
body.v2 .container.stretch-content .block-editor-block-list__block[data-type^="acf/"] {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

/* Вложенные ACF-обёртки */
body.v2 .container.stretch-content .acf-block-component,
body.v2 .container.stretch-content .acf-block-body,
body.v2 .container.stretch-content .acf-block-body > div:first-child,
body.v2 .container.stretch-content .acf-block-preview,
body.v2 .container.stretch-content .acf-block-preview > *:first-child {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

/* === Фронт: первый дочерний элемент (любой) */
body.v2 .container.stretch-content > *:first-child {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}
