/*
 * S-MAY Foundation - Elementor compatibility layer
 * Author: Netmark Systems & Technologies
 *
 * The page design is the original Tailwind stylesheet (tailwind.css). Elementor wraps every element in its own
 * containers/widgets that bring default padding, gaps, widths and typography. The rules below neutralise those
 * defaults so the original utility classes decide the look - while staying LOWER in specificity than the
 * per-element styles Elementor writes when someone customises a widget in the editor, so editor changes still win.
 */

/* ---------- 1. Containers ------------------------------------------------ */
body.smay-theme .e-con {
	--padding-top: 0px;
	--padding-right: 0px;
	--padding-bottom: 0px;
	--padding-left: 0px;
	--padding-block-start: 0px;
	--padding-block-end: 0px;
	--padding-inline-start: 0px;
	--padding-inline-end: 0px;
	--margin-block-start: 0px;
	--margin-block-end: 0px;
	--margin-inline-start: 0px;
	--margin-inline-end: 0px;
	--gap: 0px;
	--row-gap: 0px;
	--column-gap: 0px;
	--width: auto;
	--flex-wrap-mobile: nowrap;
	--container-widget-width: auto;
	--container-widget-flex-grow: 0;
}
body.smay-theme .e-con.e-parent { --width: 100%; }
body.smay-theme .e-con:not(.smay-hset) { height: auto; min-height: 0; }
/* Tailwind "flex" = row; Elementor containers default to a column. */
body.smay-theme .e-con.smay-row { --flex-direction: row; flex-direction: row; }
/* Originally inline elements (links, pills, badges) hug their content. */
body.smay-theme .e-con.smay-fit { width: fit-content; max-width: 100%; }

/* ---------- 2. Widgets (shared) ----------------------------------------- */
body.smay-theme .e-con.smay-row > .elementor-widget:not(.smay-wset),
body.smay-theme .e-con.grid > .elementor-widget:not(.smay-wset) { width: auto; }
body.smay-theme .elementor-widget:not(:last-child):not(.smay-mb) { margin-block-end: 0; margin-bottom: 0; }

/* SVG icons: the HTML widget disappears from the box tree so the <svg> behaves exactly as before. */
body.smay-theme .elementor-widget-html.smay-svg,
body.smay-theme .elementor-widget-html.smay-svg > .elementor-widget-container { display: contents; }

/* ---------- 3. Headings -------------------------------------------------- */
/* Typography/colour come from the Tailwind classes on the widget wrapper (inherited). */
body.smay-theme .elementor-widget-heading .elementor-heading-title {
	font: inherit;
	color: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	text-shadow: none;
	margin: 0;
	padding: 0;
}

/* ---------- 4. Text editor ---------------------------------------------- */
:where(body.smay-theme) .elementor-widget-text-editor:not(.smay-font) { font-family: inherit; }
:where(body.smay-theme) .elementor-widget-text-editor:not(.smay-weight) { font-weight: inherit; }
:where(body.smay-theme) .elementor-widget-text-editor:not(.smay-color) { color: inherit; }
body.smay-theme .elementor-widget-text-editor > .elementor-widget-container,
body.smay-theme .elementor-widget-text-editor .elementor-text-editor {
	font: inherit;
	color: inherit;
	line-height: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	text-align: inherit;
}
body.smay-theme .elementor-widget-text-editor p { margin: 0; }
body.smay-theme .elementor-widget-text-editor p + p { margin-top: 1em; }

/* ---------- 5. Images ---------------------------------------------------- */
body.smay-theme .elementor-widget-image.smay-img > .elementor-widget-container { width: 100%; height: 100%; }
body.smay-theme .elementor-widget-image.smay-img img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	border-radius: inherit;
	box-shadow: none;
	object-fit: contain;
}
body.smay-theme .elementor-widget-image.smay-img.smay-cover img { object-fit: cover; }

/* ---------- 6. Links inside Elementor ----------------------------------- */
body.smay-theme .e-con[href] { text-decoration: none; }

/* ---------- 7. Contact form (HTML widget) ------------------------------- */
body.smay-theme .elementor-widget-html form .hidden { display: none; }

/* ---------- 8. Header --------------------------------------------------- */
/* Sticky is applied to #masthead (the wrapper in header.php) so it stays stuck for the whole page. */
#masthead { position: sticky; top: 0; z-index: 50; }
body.admin-bar #masthead { top: 32px; }
@media (max-width: 782px) { body.admin-bar #masthead { top: 46px; } }

/* Mobile menu panel (toggled by assets/js/header.js) */
@media (max-width: 1023.98px) {
	body.smay-theme .smay-header.smay-menu-open .smay-mobile-nav { display: flex; }
}
body.smay-theme .smay-header .smay-menu-toggle .smay-icon-close { display: none; }
body.smay-theme .smay-header.smay-menu-open .smay-menu-toggle .smay-icon-close { display: block; }
body.smay-theme .smay-header.smay-menu-open .smay-menu-toggle .smay-icon-open { display: none; }

/* Current page highlight (same look as the original active link) */
body.smay-theme .smay-header a.smay-nav-link.smay-current {
	background-color: var(--color-leaf);
	color: var(--color-primary-foreground);
}
body.smay-theme .smay-header a { text-decoration: none; }
