/**
 * Estepp's — Elementor bridge.
 *
 * Loaded with a dependency on `elementor-frontend` so it is ordered AFTER
 * Elementor's own stylesheet. Without that, these rules and Elementor's
 * defaults have equal specificity and Elementor wins simply by loading later.
 */

.estepps-elementor-content {
	display: block;
}

/* Elementor's own container width is set from the theme's token. */
.elementor-section.elementor-section-boxed > .elementor-container,
.e-con {
	--container-max-width: var(--estepps-width);
}

/* Give theme buttons dropped into Elementor the same look as native ones. */
.elementor-widget-container .estepps-button {
	text-decoration: none;
}

/* Elementor headings and text inherit the theme's families rather than
   falling back to the browser default. */
.elementor-widget-heading .elementor-heading-title {
	font-family: var(--estepps-font-heading);
	color: var(--estepps-navy);
}

.elementor-widget-text-editor {
	font-family: var(--estepps-font-body);
}

/* Elementor's global text colour is applied per widget, which would otherwise
   win over the colour inherited from a dark section and leave charcoal text on
   navy. These put the light colours back on any Elementor widget inside one. */
.estepps-dark .elementor-widget-text-editor,
.estepps-dark .elementor-widget-container,
.estepps-dark .elementor-widget-icon-list .elementor-icon-list-text,
.estepps-dark p,
.estepps-dark li {
	color: rgba(255, 255, 255, 0.88);
}

.estepps-dark .elementor-widget-heading .elementor-heading-title {
	color: var(--estepps-white);
}

.estepps-dark .elementor-widget-heading .elementor-heading-title.estepps-eyebrow,
.estepps-dark .estepps-eyebrow {
	color: var(--estepps-gold);
}

.estepps-dark .elementor-widget-icon-list .elementor-icon-list-icon svg,
.estepps-dark .elementor-widget-icon-list .elementor-icon-list-icon i {
	fill: var(--estepps-gold);
	color: var(--estepps-gold);
}

/* Button colours inside dark sections are handled with the button variants
   further down, so nothing extra is needed here. */

/*
 * Buttons.
 *
 * Elementor's global kit styles buttons as `.elementor-widget-button
 * .elementor-button` and paints them with the kit's accent colour. Matching
 * that specificity is not enough on its own, so every rule here also carries
 * the `estepps-btn` hook the page builder puts on the widget wrapper.
 *
 * Note the hook sits on the SAME element as `.elementor-widget-button`, hence
 * the chained selector rather than a descendant one.
 */
.estepps-btn.elementor-widget-button .elementor-button {
	/* Elementor renders the button as inline-block, where a min-height drops all
	   its slack below the text and align-items has no effect — the label ended up
	   sitting ~9px high. Flex centring fixes it for every label length. */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-height: 52px;
	padding: 0.75rem 1.75rem;
	border: 2px solid transparent;
	border-radius: var(--estepps-radius-button);
	background-color: var(--estepps-blue);
	color: var(--estepps-white);
	font-family: var(--estepps-font-body);
	font-size: var(--estepps-text-sm);
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	transition: background-color var(--estepps-transition), border-color var(--estepps-transition),
		color var(--estepps-transition);
}

/* Elementor wraps the label in its own spans; neither should reintroduce a
   baseline offset inside the flex box. */
.estepps-btn.elementor-widget-button .elementor-button .elementor-button-content-wrapper,
.estepps-btn.elementor-widget-button .elementor-button .elementor-button-text {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1.2;
}

.estepps-btn.elementor-widget-button .elementor-button:hover,
.estepps-btn.elementor-widget-button .elementor-button:focus {
	background-color: var(--estepps-blue-dark);
	color: var(--estepps-white);
}

.estepps-btn--secondary.elementor-widget-button .elementor-button {
	background-color: transparent;
	border-color: var(--estepps-blue);
	color: var(--estepps-blue);
}

.estepps-btn--secondary.elementor-widget-button .elementor-button:hover,
.estepps-btn--secondary.elementor-widget-button .elementor-button:focus {
	background-color: var(--estepps-blue);
	color: var(--estepps-white);
}

.estepps-btn--accent.elementor-widget-button .elementor-button {
	background-color: var(--estepps-gold);
	color: var(--estepps-navy);
}

.estepps-btn--accent.elementor-widget-button .elementor-button:hover,
.estepps-btn--accent.elementor-widget-button .elementor-button:focus {
	background-color: var(--estepps-gold-dark);
	color: var(--estepps-navy);
}

.estepps-btn--small.elementor-widget-button .elementor-button {
	min-height: 42px;
	padding: 0.5rem 1.1rem;
	font-size: var(--estepps-text-xs);
}

.estepps-btn--large.elementor-widget-button .elementor-button {
	min-height: 58px;
	padding: 0.9rem 2.25rem;
	font-size: var(--estepps-text-base);
}

/* On navy sections the secondary outline switches to white. */
.estepps-dark .estepps-btn--secondary.elementor-widget-button .elementor-button {
	border-color: rgba(255, 255, 255, 0.55);
	color: var(--estepps-white);
}

.estepps-dark .estepps-btn--secondary.elementor-widget-button .elementor-button:hover,
.estepps-dark .estepps-btn--secondary.elementor-widget-button .elementor-button:focus {
	background-color: var(--estepps-white);
	border-color: var(--estepps-white);
	color: var(--estepps-navy);
}

/* Keep the editor's inline-editing outlines clear of the sticky header. */
body.elementor-editor-active .estepps-site-header {
	position: relative;
}

/* Placeholders inside the editor should still be obvious but not clickable-looking. */
.elementor-widget-shortcode .estepps-image-placeholder {
	pointer-events: none;
}

/*
 * Column rows.
 *
 * Elementor honours a container's `width` but ignores `flex_grow` and `gap`
 * from imported page data, which left columns under-filling their row. Laying
 * the row out as a grid makes the result deterministic and puts the responsive
 * rules in one place. The width override is `!important` because Elementor
 * writes a per-element width rule that would otherwise size the grid items.
 */
.estepps-row.e-con {
	display: grid;
	gap: var(--estepps-card-gap);
	align-items: stretch;
	/* Equal rows, so a grid that wraps (six cards over two rows) keeps every
	   card the same height instead of each row sizing to its own tallest. */
	grid-auto-rows: 1fr;
}

.estepps-row.e-con > .e-con {
	width: auto !important;
	max-width: none;
}

.estepps-row--2.e-con {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.estepps-row--3.e-con {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.estepps-row--4.e-con {
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1024px) {
	.estepps-row--3.e-con,
	.estepps-row--4.e-con {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.estepps-row.e-con {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ------------------------------------------------------------------ *
 * Card tiles
 *
 * One card treatment for the whole site. Elementor gives every container a
 * 10px default padding and lets each widget size itself, which left card
 * titles rendering at section-heading size and call-to-action buttons landing
 * at whatever height the copy above them happened to end.
 *
 * These rules fix all of that in one place:
 *   - identical padding, border and radius on every tile
 *   - one title size regardless of the heading level the outline needs
 *   - a two-line title floor so titles align even when one wraps
 *   - body copy grows, so the button always sits on the bottom edge
 * ------------------------------------------------------------------ */

.estepps-row > .estepps-tile.e-con {
	--estepps-tile-pad: var(--estepps-space-lg);

	display: flex;
	flex-direction: column;
	gap: 0;
	height: 100%;
	padding: var(--estepps-tile-pad);
	background: var(--estepps-white);
	border: 1px solid var(--estepps-border);
	border-radius: var(--estepps-radius-card);
	overflow: hidden;
	transition: border-color var(--estepps-transition), transform var(--estepps-transition),
		box-shadow var(--estepps-transition);
}

.estepps-row > .estepps-tile.e-con:hover {
	border-color: var(--estepps-blue);
	transform: translateY(-3px);
	box-shadow: var(--estepps-shadow);
}

/* On an alt-background section the tiles stay white so they read as cards. */
.estepps-section--alt .estepps-row > .estepps-tile.e-con,
.estepps-dark .estepps-row > .estepps-tile.e-con {
	background: var(--estepps-white);
}

/* A leading image bleeds to the tile's edges rather than floating inside it. */
/*
 * A leading image bleeds to the tile's edges.
 *
 * Two things fight this. Negative margins alone only shift the widget — without
 * an explicit width it keeps the padded content width and leaves a gap down the
 * right-hand side. And Elementor caps every widget with
 * `.elementor.elementor .e-con>.elementor-widget{max-width:100%}`, which is four
 * classes; the `.elementor` ancestor below is what gets this past it.
 */
.elementor .estepps-tile.e-con > .elementor-widget-shortcode:first-child {
	width: calc(100% + var(--estepps-tile-pad) * 2);
	max-width: none;
	margin: calc(var(--estepps-tile-pad) * -1) calc(var(--estepps-tile-pad) * -1) var(--estepps-space-md);
}

.elementor .estepps-tile.e-con > .elementor-widget-shortcode:first-child .estepps-image-placeholder {
	border-width: 0 0 1px;
	border-radius: 0;
}

/*
 * Internal spacing.
 *
 * Elementor zeroes widget margins inside a container and spaces children with
 * `gap` instead — and its reset is a four-class selector, so a plain
 * `.estepps-tile .elementor-widget-x` rule computes to 0. The tile needs
 * different gaps at each step (tight under the title, generous above the
 * button), which a single `gap` value cannot express, so these rules carry the
 * `.elementor` ancestor to outrank the reset.
 */
.elementor .estepps-tile.e-con > .elementor-widget.elementor-widget-heading {
	margin-bottom: var(--estepps-space-2xs);
}

/* The heading element's own margin is folded into the widget margin above. */
.estepps-tile .elementor-heading-title {
	margin-bottom: 0;
}

.estepps-tile .elementor-heading-title {
	font-family: var(--estepps-font-heading);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.15;
	color: var(--estepps-navy);
	/* Two-line floor keeps titles aligned across a row when one of them wraps. */
	min-height: calc(2 * 1.15em);
}

/*
 * Body copy takes up the slack so the button lands on the bottom edge. The gap
 * below it has to stand on its own: in the tallest card of a row there is no
 * leftover space to spread, so this is the minimum breathing room above the
 * button anywhere in the grid.
 */
.elementor .estepps-tile.e-con > .elementor-widget.elementor-widget-text-editor {
	flex: 1 1 auto;
	margin-bottom: var(--estepps-space-lg);
}

.estepps-tile .elementor-widget-text-editor {
	color: var(--estepps-text-muted);
	font-size: var(--estepps-text-sm);
	line-height: var(--estepps-leading-body);
}

.estepps-tile .elementor-widget-button {
	margin-top: auto;
	align-self: flex-start;
}

/* A tile with no call to action must not keep the gap reserved for one. This
   needs the same specificity as the rule above, or the 32px stays behind. */
.elementor .estepps-tile.e-con > .elementor-widget.elementor-widget-text-editor:last-child {
	margin-bottom: 0;
}

@media (max-width: 767px) {
	.estepps-row > .estepps-tile.e-con {
		--estepps-tile-pad: var(--estepps-space-md);
	}

	.estepps-tile .elementor-heading-title {
		/* Full-width tiles stack, so the alignment floor is unnecessary. */
		min-height: 0;
	}
}
