/**
 * Elementor widget styling.
 *
 * Loaded only when Elementor is active. The point is that a page built in
 * Elementor comes out on-brand without an editor styling every widget by
 * hand — Elementor's defaults are a generic blue button and its own type
 * scale, which would drift away from the rest of the site immediately.
 *
 * Deliberately limited to look, not layout: nothing here dictates widths or
 * positions, so an editor can still arrange a page freely.
 */

/* --- Buttons ---------------------------------------------------------- */
.elementor-button,
.elementor-button-link {
	padding: var(--damf-space-4) var(--damf-space-6);
	background-color: var(--damf-navy);
	border: 1.5px solid transparent;
	border-radius: var(--damf-radius);
	color: var(--damf-white);
	font-family: var(--damf-font-body);
	font-size: var(--damf-text-base);
	font-weight: 700;
	line-height: 1;
	/* The inherited kit sets uppercase; the brand's buttons are sentence case. */
	text-transform: none;
	text-decoration: none;
	transition: background-color var(--damf-transition), color var(--damf-transition),
		border-color var(--damf-transition);
}

.elementor-button:hover,
.elementor-button:focus-visible {
	background-color: var(--damf-navy-deep);
	color: var(--damf-white);
}

/* An outlined variant, applied from the widget's CSS Classes field. */
.damf-button-outline .elementor-button {
	background-color: var(--damf-white);
	border-color: var(--damf-navy);
	color: var(--damf-navy);
}

.damf-button-outline .elementor-button:hover,
.damf-button-outline .elementor-button:focus-visible {
	background-color: var(--damf-navy);
	color: var(--damf-white);
}

.damf-button-accent .elementor-button {
	background-color: var(--damf-red);
}

.damf-button-accent .elementor-button:hover {
	background-color: color-mix(in srgb, var(--damf-red) 82%, black);
}

/* --- Headings and text ------------------------------------------------ *
 * Headings inherit the theme's element styles because Elementor outputs real
 * h1–h6 tags; only the eyebrow needs help, since it is a heading widget
 * carrying the eyebrow class.
 */
.elementor-widget-heading .damf-eyebrow,
.elementor-widget-heading .elementor-heading-title.damf-eyebrow {
	font-family: var(--damf-font-body);
	font-size: var(--damf-text-sm);
	font-weight: 700;
	letter-spacing: var(--damf-tracking-eyebrow);
	line-height: 1.4;
	text-transform: uppercase;
	color: var(--damf-red);
}

.elementor-widget-text-editor {
	color: var(--damf-text-muted);
}

/* --- Sections that use the theme's band classes ----------------------- *
 * `.damf-section` already carries the vertical rhythm, so Elementor's own
 * default section padding is removed to stop the two stacking up.
 */
.elementor-section.damf-section {
	padding-block: var(--damf-space-16);
}

.elementor-section.damf-section > .elementor-container {
	inline-size: min(100%, var(--damf-container));
	margin-inline: auto;
	padding-inline: var(--damf-gutter);
}

/* Shortcode widgets fill their column; a band that needs to reach the page
   edges (the projects teaser) uses Elementor's own full-width section layout
   rather than negative margins, which overflowed the viewport. */
.elementor-widget-shortcode {
	inline-size: 100%;
}

/* --- Hero ------------------------------------------------------------- *
 * `.elementor-widget-wrap` is a flex row-wrap container and its widgets are
 * width:100%, so each one takes a full row. Setting `display:inline-block`
 * here does nothing — flex items are blockified. Sitting the two buttons
 * side by side is done in the page data instead, with Elementor's own
 * Advanced → Width → Auto (`_element_width`), which an editor can change
 * back in the UI. All that is left for CSS is the gap between them.
 */
.damf-hero .elementor-widget-button {
	margin-inline-end: var(--damf-space-4);
	margin-block-start: var(--damf-space-4);
}

/*
 * The measure limit goes on the inner container, not the widget. Applied to
 * the widget it shrinks a flex item in the row-wrap `.elementor-widget-wrap`,
 * which left room beside the standfirst for the first button to ride up onto
 * its row while the second wrapped below.
 */
/*
 * Widgets in `.elementor-widget-wrap` are flex items that shrink, so a
 * width:100% widget will still share its line with an auto-width one — which
 * pulled the first button up alongside the standfirst. Everything that is not
 * a button holds a full line, leaving the buttons to share the next one.
 */
.damf-hero .elementor-widget-wrap > .elementor-element:not(.elementor-widget-button) {
	flex: 0 0 100%;
	/*
	 * The theme caps .damf-hero__title and .damf-hero__lead to a readable
	 * measure. Those classes sit on the Elementor *widget* here, so the cap
	 * would shrink the flex item itself and leave room beside it — which is
	 * how the first button ended up on the standfirst's line. The cap is
	 * re-applied to the inner container below, where it belongs.
	 */
	max-inline-size: none;
}

.damf-hero .elementor-widget-heading > .elementor-widget-container,
.damf-hero .elementor-widget-text-editor > .elementor-widget-container {
	max-inline-size: 46rem;
}

/* The editing canvas gives every widget a minimum height, which makes an
   empty shortcode widget look broken. Only applies inside the editor. */
.elementor-editor-active .elementor-widget-shortcode:empty::before {
	content: "Dynamic section — preview on the live page";
	display: block;
	padding: var(--damf-space-4);
	background: var(--damf-tint);
	border: 1px dashed var(--damf-lavender);
	color: var(--damf-text-faint);
	font-size: var(--damf-text-sm);
}
