/**
 * Layout of content migrated from Elementor (blocks with sd-el-* classes).
 * Reproduces Elementor's box model so migrated pages render exactly as before.
 *
 * .sd-el-section — an Elementor column's widget area: 10px inner padding ("default" column gap) and a wrapping
 *   flex row: widgets are full-width unless marked .sd-el-w-auto; flex items never collapse margins, exactly like
 *   Elementor widgets.
 * .sd-el-box     — an Elementor section that has its own background/padding/margin (around .sd-el-section).
 * .sd-el-text    — one text widget: its blocks keep normal margin collapsing between each other, but the first and
 *   last margins stay inside (flow-root), as inside an Elementor widget.
 *
 * In a classic theme the Group block prints an inner wrapper (.wp-block-group__inner-container); the blocks are
 * its children, so that wrapper is the flex container. Without the wrapper (themes with layout support) the group
 * itself is.
 */
.sd-el-section {
	padding: 10px;
}

/*
 * Elementor "boxed" sections (the default; not the widget areas of multi-column rows): content area capped at 1140px and centred (kit setting); "full width"
 * sections are not capped. Only matters where the content is wider than that, i.e. in the full-width template.
 */
.sd-el-section:not(.sd-el-section--full):not(.sd-el-wrap) {
	max-width: 1140px;
	margin-left: auto;
	margin-right: auto;
}

.sd-el-section > .wp-block-group__inner-container,
.sd-el-section:not(:has(> .wp-block-group__inner-container)) {
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
}

/* Every widget is positioned (Elementor: .elementor-widget {position: relative}): absolute parts such as carousel
 * arrows are placed against it. */
:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > * {
	flex: 0 1 100%;
	max-width: 100%;
	position: relative;
}

/* Elementor: figures inside widgets other than text have no margin. */
:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > :not(.sd-el-text) figure {
	margin: 0;
}

:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-w-auto {
	flex: 0 1 auto;
	width: auto;
}

/* Custom width (Elementor "initial"): sized by its own width from the page/element CSS (printed later, as specific),
 * not by the row; full width until a width is set, like every Elementor widget. */
:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-w-initial {
	flex: 0 1 auto;
	width: 100%;
}

/* A widget with a negative vertical margin is not stretched (in Elementor that margin sat on the inner widget
 * container, so the widget itself kept its own height). Before the sd-el-self-* rules, which win when set. */
:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-nostretch {
	align-self: flex-start;
}

:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-self-start {
	align-self: flex-start;
}

:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-self-center {
	align-self: center;
}

:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-self-end {
	align-self: flex-end;
}

.sd-el-text {
	display: flow-root;
}

/*
 * Elementor's generic resets for everything inside an Elementor document (.elementor x), with the same
 * specificity, so migrated content keeps them: e.g. text-widget <hr> without margins, iframes at full width.
 */
.sd-el-section *,
.sd-el-section ::after,
.sd-el-section ::before {
	box-sizing: border-box;
}

.sd-el-section a {
	box-shadow: none;
	text-decoration: none;
}

.sd-el-section hr {
	background-color: transparent;
	margin: 0;
}

.sd-el-section img {
	border: none;
	border-radius: 0;
	box-shadow: none;
	height: auto;
	max-width: 100%;
}

.sd-el-section embed,
.sd-el-section iframe,
.sd-el-section object,
.sd-el-section video {
	border: none;
	line-height: 1;
	margin: 0;
	max-width: 100%;
	width: 100%;
}

/* Elementor section hidden on every device: kept for editors, never shown. */
.sd-el-hidden {
	display: none !important;
}

/* Elementor column gap (the column's inner padding): no / narrow / extended / wide / wider; default is 10px. */
.sd-el-section.sd-el-gap-no {
	padding: 0;
}

.sd-el-section.sd-el-gap-narrow {
	padding: 5px;
}

.sd-el-section.sd-el-gap-extended {
	padding: 15px;
}

.sd-el-section.sd-el-gap-wide {
	padding: 20px;
}

.sd-el-section.sd-el-gap-wider {
	padding: 30px;
}

/*
 * Text alignment classes of core blocks (core's own rules live in wp-block-library, which this site does not load).
 */
.has-text-align-left {
	text-align: left;
}

.has-text-align-center {
	text-align: center;
}

.has-text-align-right {
	text-align: right;
}

.has-text-align-justify {
	text-align: justify;
}

/* Elementor Heading widget box (.elementor-heading-title): no own margin/padding, line-height 1. */
.sd-el-heading {
	margin: 0;
	padding: 0;
	line-height: 1;
}

/*
 * The theme boxes every group with a background (.wp-block-group.has-background: padding 15px 15px 1px, margin
 * 30px below); an Elementor section had neither. The section's own spacing comes from its inline style / page CSS.
 */
.wp-block-group.sd-el-box.has-background {
	margin-bottom: 0;
	padding: 0;
}

/*
 * Multi-column sections and inner sections: .sd-el-row (Elementor's .elementor-container: flex row, boxed = capped
 * at 1140px) > .sd-el-col (.elementor-column: flex, its width comes from page CSS) > .sd-el-section.sd-el-wrap (the
 * column's widget area, full column height). Wrapping/stacking per breakpoint is in each page's CSS block.
 */
.sd-el-row,
.sd-el-row *,
.sd-el-row ::after,
.sd-el-row ::before {
	box-sizing: border-box;
}

.sd-el-row {
	position: relative;
}

.sd-el-row:not(.sd-el-row--full) {
	max-width: 1140px;
	margin-left: auto;
	margin-right: auto;
}

/*
 * An inner section among a column's widgets: in Elementor the section box is full width and only its container is
 * capped. A capped row is a narrower flex item, so on screens wider than two caps it shared a line with the next
 * widget or row. Here the row fills its line (flex-basis 100%, as every widget above, once uncapped) and the side
 * padding (percentages = the widget area's width) narrows
 * its content to the cap instead. The cap is the kit's 1140px unless the inner section has its own content width:
 * the converter sets --sd-el-row-cap on that row (page CSS, per device too).
 */
:is(.sd-el-section > .wp-block-group__inner-container, .sd-el-section:not(:has(> .wp-block-group__inner-container))) > .sd-el-row:not(.sd-el-row--full) {
	max-width: 100%;
	padding-left: max(0px, (100% - var(--sd-el-row-cap, 1140px)) / 2);
	padding-right: max(0px, (100% - var(--sd-el-row-cap, 1140px)) / 2);
}

.sd-el-row > .wp-block-group__inner-container,
.sd-el-row:not(:has(> .wp-block-group__inner-container)) {
	display: flex;
	position: relative;
	margin-left: auto;
	margin-right: auto;
}

.sd-el-col {
	display: flex;
	min-height: 1px;
	position: relative;
}

.sd-el-col > .wp-block-group__inner-container {
	display: flex;
	width: 100%;
}

.sd-el-wrap {
	position: relative;
	width: 100%;
}

/* Vertical position of the widgets in a column ("content position"); the widget area fills the column. */
.sd-el-va-top > .wp-block-group__inner-container,
.sd-el-va-middle > .wp-block-group__inner-container,
.sd-el-va-bottom > .wp-block-group__inner-container {
	height: 100%;
}

.sd-el-va-top > .wp-block-group__inner-container {
	align-content: flex-start;
	align-items: flex-start;
}

.sd-el-va-middle > .wp-block-group__inner-container {
	align-content: center;
	align-items: center;
}

.sd-el-va-bottom > .wp-block-group__inner-container {
	align-content: flex-end;
	align-items: flex-end;
}

/*
 * Elementor sections are positioned (.elementor-section {position: relative}): a later section's background paints
 * over earlier content that is moved into it (transforms, negative margins), as before.
 */
.sd-el-box,
section.sd-el-section {
	position: relative;
}

/*
 * Widgets of sites built with Elementor's "optimized markup" (sellerdata.kz): every widget but the last one of its
 * column had no bottom margin — the Makro theme's .elementor-widget:not(:last-child) {margin-bottom: 0 !important}
 * cancelled it, as the margin sat on the widget itself. Set by the converter; !important as in that rule (it also has
 * to beat the block's own inline margin).
 */
.sd-el-mb0 {
	margin-bottom: 0 !important;
}
