/*
 * KingComposer -> Elementor compatibility.
 *
 * Migrated content keeps the KingComposer DOM:
 *   kc_row > kc-row-container > kc-wrap-columns > kc_column > kc-col-container > widgets
 * Every container created by the migration has the "dr-kc" class plus one role class:
 *   dr-kc-cols  : holds columns (flex row)
 *   dr-kc-block : plain block, like the original KingComposer <div>/<section>
 *   dr-kc-auto  : automatic width, like the original KingComposer wrapper <div>
 *
 * This file loads after Elementor's CSS and before the theme stylesheets, and the role rules use a
 * single class, so they beat Elementor's ".e-con" defaults while theme rules still win over them.
 */

/* Neutralise Elementor container spacing on migrated containers (variables only). */
.e-con.dr-kc {
	--padding-top: 0px;
	--padding-right: 0px;
	--padding-bottom: 0px;
	--padding-left: 0px;
	--gap: 0px;
	--row-gap: 0px;
	--column-gap: 0px;
	--widgets-spacing: 0px;
	--widgets-spacing-row: 0px;
	--widgets-spacing-column: 0px;
	--min-height: 0;
}

.dr-kc-block {
	display: block;
}

/* If the theme turns a migrated wrapper into a flexbox, use the browser default direction
   (row) like the original KingComposer <div>, not Elementor's column default. */
.e-con.e-flex.dr-kc-block {
	--flex-direction: row;
}

.dr-kc-auto {
	width: auto;
}

/* Column alignment, mirroring kingcomposer.css:
   - below 999px KingComposer rows were floats, so each column kept its own height;
   - from 999px ".kc_row_inner" and ".kc-row-container .kc-wrap-columns" were flex rows (columns
     stretch), but columns inside an extra row wrapper class stayed floats;
   - equal-height sections using the container were flex at every width. */
.e-con.dr-kc-cols {
	--align-items: flex-start;
}

/* Column rows wrap (KingComposer columns drop to the next line instead of shrinking). */
.dr-kc-cols {
	flex-wrap: wrap;
}

@media screen and (min-width: 999px) {
	.e-con.dr-kc-cols.kc_row_inner,
	.kc-row-container .e-con.dr-kc-cols.kc-wrap-columns {
		--align-items: stretch;
	}
}

section[data-kc-equalheight="true"] > .kc-container .e-con.dr-kc-cols.kc-wrap-columns {
	--align-items: stretch;
}

/* Elementor centres image widgets; KingComposer images followed the surrounding text alignment.
   Single-class selector so theme rules (loaded later) still win. */
.kc_single_image {
	text-align: inherit;
}

/* HTML widgets that only wrap frozen KingComposer markup (or loose text) must not add a box:
   in KingComposer the element itself was the block / flex item. Frontend only, so the
   Elementor editor can still select the widget. */
body:not(.elementor-editor-active) .e-con.dr-kc > .elementor-widget-html:not(.kc-elm) {
	display: contents;
}
