/* -----------------------------------------------------------
   Elementor compatibility (free edition)

   Enqueued only when Elementor is active AND the page is built with
   Elementor (see inc/elementor/loader.php).

   Elementor's base stylesheets (frontend.min.css, widget-*, base-*) are
   wrapped in @layer elementor-base there, so the theme's own unlayered
   CSS wins generic resets (".elementor img", box-sizing, ...) regardless
   of specificity. Elementor's per-post and kit CSS stay unlayered so
   editor settings keep winning.

   What is left here: each AnimaLife widget prints a full-bleed theme
   section, so the section containers must carry no padding, gap or width
   limit. Container geometry is driven by CSS variables, which per-post CSS
   may set, hence the higher-specificity selector.

   Scope: ONLY AnimaLife sections. A section container is one that carries
   the .animalife-section class (added by tools/elementor/lib.php) or, as a
   fallback for data built before that class existed, one that directly
   holds an AnimaLife widget. Containers and stock widgets the client adds
   keep their own padding, gap, width and spacing settings.
----------------------------------------------------------- */
body.animalife-elementor .site-main .elementor .e-con.animalife-section {
	--padding-top: 0px;
	--padding-right: 0px;
	--padding-bottom: 0px;
	--padding-left: 0px;
	--margin-top: 0px;
	--margin-right: 0px;
	--margin-bottom: 0px;
	--margin-left: 0px;
	--gap: 0px;
	--row-gap: 0px;
	--column-gap: 0px;
	--container-max-width: none;
	--content-width: 100%;
	--width: 100%;
	--min-height: 0;
}

/* Fallback for data built before the class existed. A separate rule: a browser
   without :has() drops only this one, not the class rule above. */
body.animalife-elementor .site-main .elementor .e-con:has(> .elementor-widget[class*="elementor-widget-animalife-"]) {
	--padding-top: 0px;
	--padding-right: 0px;
	--padding-bottom: 0px;
	--padding-left: 0px;
	--margin-top: 0px;
	--margin-right: 0px;
	--margin-bottom: 0px;
	--margin-left: 0px;
	--gap: 0px;
	--row-gap: 0px;
	--column-gap: 0px;
	--container-max-width: none;
	--content-width: 100%;
	--width: 100%;
	--min-height: 0;
}

/* "Boxed" containers: the inner wrapper must not constrain the section. */
body.animalife-elementor .site-main .elementor .e-con.animalife-section > .e-con-inner {
	max-width: none;
	padding: 0;
}

body.animalife-elementor .site-main .elementor .e-con:has(> .e-con-inner > .elementor-widget[class*="elementor-widget-animalife-"]) > .e-con-inner {
	max-width: none;
	padding: 0;
}

/* No spacing between AnimaLife widgets (Elementor derives it from this variable). */
body.animalife-elementor .site-main .elementor .elementor-widget[class*="elementor-widget-animalife-"] {
	--kit-widget-spacing: 0px;
}

/* Gallery: the template has ONE .gallery-content wrapper (padding 32px 0 80px)
   around the Featured and All Media sections. Each widget now prints its own
   wrapper, so only the first keeps the top padding and only the last keeps
   the bottom padding; the 32px gap between the sections is the Featured
   section's own margin-bottom (kept inside its widget). Keyed on Elementor's
   per-widget class instead of :first-child/:last-child, which the container
   wrappers would break. */
body.animalife-elementor .elementor-widget-animalife-gallery-featured .gallery-content {
	padding-bottom: 0;
}

body.animalife-elementor .elementor-widget-animalife-gallery-all-media .gallery-content {
	padding-top: 0;
}

/* Home mobile: section.about gets its height only from aspect-ratio (its
   content block is absolutely positioned). The widget wrapper is a flex item
   of a column .e-con, and while flex-basis is resolved its width is still
   indefinite, so the aspect-ratio cannot resolve and the item collapses to
   height 0 (the next sections then slide up over it). An explicit full width
   plus no shrinking lets the ratio resolve. Scoped to AnimaLife widgets so
   client-built containers keep their normal flex behaviour. */
body.animalife-elementor .site-main .e-con > .elementor-widget[class*="elementor-widget-animalife-"] {
	width: 100%;
	flex-shrink: 0;
}


/* Stock Elementor widgets (client-built content) get Elementor's own base
   styles back for exactly the properties main.css's bare resets set.
   revert-layer rolls the property back to the previous cascade layer,
   i.e. @layer elementor-base. :where() keeps this at the same specificity
   as the bare reset (0,0,1; this file loads later, so it wins the tie) while
   Elementor's kit and per-element CSS (0,1,1 and up) still win over it.
   AnimaLife widgets are excluded. Browsers without revert-layer ignore these
   declarations and keep the theme reset (only for stock widgets). */
:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) img {
	max-width: revert-layer;
	display: revert-layer;
}

:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) a {
	color: revert-layer;
	text-decoration: revert-layer;
	cursor: revert-layer;
}

:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) ul {
	list-style: revert-layer;
	margin: revert-layer;
	padding: revert-layer;
}

:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) button,
:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) input,
:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) textarea,
:where(.elementor-widget:not([class*="elementor-widget-animalife-"])) select {
	font-family: revert-layer;
	cursor: revert-layer;
}

/* AnimaLife widgets nested inside a stock widget (n-tabs, n-accordion...) match the
   revert-layer rules above too: re-assert the theme reset for them. Same
   specificity (0,0,1) and later, so these win; values are exactly main.css's. */
:where([class*="elementor-widget-animalife-"]) img {
	max-width: 100%;
	display: block;
}

:where([class*="elementor-widget-animalife-"]) a {
	color: inherit;
	text-decoration: none;
	cursor: inherit;
}

:where([class*="elementor-widget-animalife-"]) ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

:where([class*="elementor-widget-animalife-"]) button,
:where([class*="elementor-widget-animalife-"]) input,
:where([class*="elementor-widget-animalife-"]) textarea,
:where([class*="elementor-widget-animalife-"]) select {
	font-family: inherit;
	cursor: inherit;
}
