/*!
 * Alcateia Widgets: Hero (alw-hr)
 * Author: Joao Pedro | Alcateia Marketing & Design Agency
 * Author URI: https://alcateiaagency.com/
 *
 * First section of the page, edge to edge, with the content held to the same
 * line as a boxed Container. The photo is a real <img> inside <picture>, so it
 * can be the LCP element with fetchpriority. Zero JavaScript.
 *
 * Rules (same as every element):
 * - Media queries only as "(max-width: 767px)" and friends. The plugin rewrites
 *   these exact strings when the site has custom Elementor breakpoints.
 * - Component rules start with ".alw-hr " to beat Elementor and kit rules.
 * - Style controls write the --alw-hr-* variables below.
 */

.alw-hr {
	/* Width and alignment: mirror a boxed Container */
	--alw-hr-max: 1300px;
	--alw-hr-pad: 20px;
	/* Height: minimum, the section grows if the content needs it */
	--alw-hr-h: 100svh;
	--alw-hr-offset: 0px;
	/* Vertical position of the content */
	--alw-hr-y: center;
	--alw-hr-pt: clamp(3rem, 8vh, 6rem);
	--alw-hr-pb: clamp(3rem, 8vh, 6rem);
	/* Overlay: color and opacity, never below .55 for WCAG contrast */
	--alw-hr-ov: #0c1016;
	--alw-hr-ov-a: .62;
	/* Colors */
	--alw-hr-text: #fff;
	--alw-hr-accent: var(--alw-accent, #c8742f);
	--alw-hr-accent-text: #fff;
	--alw-hr-accent-hover: color-mix(in srgb, var(--alw-hr-accent) 82%, #000);
	--alw-hr-panel: #f2efe9;
	--alw-hr-panel-text: #1d232b;
	--alw-hr-gap: clamp(2rem, 4vw, 4rem);
	--alw-hr-btn-r: 4px;

	position: relative;
	isolation: isolate;
	display: grid;
	box-sizing: border-box;
	overflow: hidden;
	color: var(--alw-hr-text);
	font-family: var(--alw-font-body);
}

.alw-hr *,
.alw-hr *::before,
.alw-hr *::after {
	box-sizing: border-box;
}

/* Photo behind the text. Overlay on ::after, no extra node. */
.alw-hr .alw-hr__media {
	position: absolute;
	inset: 0;
	z-index: -1;
	display: block;
	margin: 0;
}

.alw-hr .alw-hr__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--alw-hr-ov);
	opacity: var(--alw-hr-ov-a);
}

.alw-hr .alw-hr__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: var(--alw-hr-pos, 50% 50%);
}

/* Same math as a boxed Container: min(screen - padding, width) */
.alw-hr .alw-hr__inner {
	width: min(100% - 2 * var(--alw-hr-pad), var(--alw-hr-max));
	margin-inline: auto;
	padding-block: var(--alw-hr-pt) var(--alw-hr-pb);
	align-self: var(--alw-hr-y);
}

.alw-hr .alw-hr__content {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-width: 40rem;
}

.alw-hr .alw-hr__eyebrow {
	margin: 0;
	color: inherit;
	font-size: .8125rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: .12em;
	text-transform: uppercase;
}

.alw-hr .alw-hr__title {
	margin: 0;
	padding: 0;
	color: inherit;
	font-family: var(--alw-font-display);
	font-size: clamp(2.25rem, 5.2vw, 4.25rem);
	font-weight: 700;
	line-height: 1.04;
	letter-spacing: normal;
	text-transform: none;
	text-wrap: balance;
}

.alw-hr .alw-hr__title-alt {
	display: block;
	font-weight: 400;
}

.alw-hr .alw-hr__subtitle {
	margin: 0;
	color: inherit;
	font-size: clamp(1.0625rem, 1.6vw, 1.3125rem);
	line-height: 1.45;
}

.alw-hr .alw-hr__text {
	max-width: 60ch;
	margin: 0;
	color: inherit;
	font-size: 1rem;
	line-height: 1.6;
	opacity: .9;
}

.alw-hr .alw-hr__actions {
	display: flex;
	flex-wrap: wrap;
	align-self: stretch;
	justify-content: var(--alw-hr-btn-jc, flex-start);
	gap: .75rem;
	margin-top: .75rem;
}

.alw-hr .alw-hr__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .55em;
	min-height: 48px;
	padding: var(--alw-hr-btn-pad, .7em 1.4em);
	border: 2px solid transparent;
	border-radius: var(--alw-hr-btn-r);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color .2s, color .2s, border-color .2s;
}

.alw-hr .alw-hr__btn--primary {
	background: var(--alw-hr-accent);
	color: var(--alw-hr-accent-text);
}

.alw-hr .alw-hr__btn--primary:hover {
	background: var(--alw-hr-accent-hover);
	color: var(--alw-hr-accent-text);
}

.alw-hr .alw-hr__btn--secondary {
	border-color: currentColor;
	color: var(--alw-hr-btn2, inherit);
}

.alw-hr .alw-hr__btn--secondary:hover {
	background: color-mix(in srgb, currentColor 12%, transparent);
	color: var(--alw-hr-btn2, inherit);
}

.alw-hr .alw-hr__btn:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

.alw-hr .alw-hr__btn svg {
	flex: none;
	width: 1.1em;
	height: 1.1em;
}

/* Height (Cover and Inner page). Minimum: the section grows, it never cuts. */
.alw-hr--cover,
.alw-hr--page {
	min-height: calc(var(--alw-hr-h) - var(--alw-hr-offset));
}

/* Cover: photo background, text on the left. Stronger overlay on the text side. */
.alw-hr--left .alw-hr__media::after {
	background: linear-gradient(90deg, var(--alw-hr-ov) 0%, var(--alw-hr-ov) 45%, color-mix(in srgb, var(--alw-hr-ov) 45%, transparent) 100%);
}

/* Cover: photo background, centered text */
.alw-hr--center .alw-hr__content {
	align-items: center;
	max-width: 48rem;
	margin-inline: auto;
	text-align: center;
}

.alw-hr--center .alw-hr__actions {
	justify-content: var(--alw-hr-btn-jc, center);
}

/* Cover split: photo next to the text */
.alw-hr--split {
	background: var(--alw-hr-panel);
	color: var(--alw-hr-panel-text);
}

.alw-hr--split .alw-hr__media {
	position: relative;
	inset: auto;
	z-index: auto;
	min-width: 0;
	order: 2; /* The <picture> comes first in the HTML (found earlier for the LCP), but shows after the text */
}

.alw-hr--split .alw-hr__media::after {
	content: none;
}

/* The photo always fills its whole column. Positioned, so no theme rule, lazy-load placeholder
   or small image file can shrink it to its natural width. !important on purpose: themes and
   optimization plugins ship img { width: auto !important }, and only this beats them. */
.alw-hr.alw-hr--split .alw-hr__media .alw-hr__img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	object-fit: cover;
	object-position: var(--alw-hr-pos, 50% 50%);
}

.alw-hr--split .alw-hr__inner {
	width: auto;
	min-width: 0;
	margin: 0;
	padding-inline: var(--alw-hr-pad);
}

.alw-hr--split .alw-hr__btn--secondary {
	color: var(--alw-hr-btn2, var(--alw-hr-panel-text));
}

/* Inner page */
.alw-hr--page {
	--alw-hr-h: 45svh;
	--alw-hr-y: end;
	--alw-hr-pt: 2rem;
	--alw-hr-pb: clamp(2.5rem, 9vh, 5rem);
}

.alw-hr--page .alw-hr__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .75rem 2rem;
}

.alw-hr--page .alw-hr__title {
	font-size: clamp(2rem, 4.2vw, 3.25rem);
}

/* Inner page centered: title and breadcrumbs stacked */
.alw-hr--page-center .alw-hr__inner {
	flex-direction: column;
	justify-content: center;
	text-align: center;
}

/* Breadcrumbs */
.alw-hr .alw-hr__crumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem .75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: .9375rem;
}

.alw-hr .alw-hr__crumbs li {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin: 0;
}

/* Chevron (default), drawn with a border: nothing for the screen reader to read */
.alw-hr .alw-hr__crumbs li + li::before {
	content: "";
	width: .4em;
	height: .4em;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	color: var(--alw-hr-sep, inherit);
	transform: rotate(45deg);
}

.alw-hr--sep-arrow .alw-hr__crumbs li + li::before,
.alw-hr--sep-raquo .alw-hr__crumbs li + li::before,
.alw-hr--sep-slash .alw-hr__crumbs li + li::before {
	width: auto;
	height: auto;
	border: 0;
	line-height: 1;
	transform: none;
}

/* Text separators with empty alternative text, so screen readers skip them */
.alw-hr--sep-arrow .alw-hr__crumbs li + li::before {
	content: "\2192";
	content: "\2192" / "";
}

.alw-hr--sep-raquo .alw-hr__crumbs li + li::before {
	content: "\00BB";
	content: "\00BB" / "";
}

.alw-hr--sep-slash .alw-hr__crumbs li + li::before {
	content: "/";
	content: "/" / "";
}

.alw-hr .alw-hr__crumbs a {
	color: inherit;
	text-decoration: none;
}

.alw-hr .alw-hr__crumbs a:hover {
	text-decoration: underline;
	text-underline-offset: .2em;
}

.alw-hr .alw-hr__crumbs a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.alw-hr .alw-hr__crumbs [aria-current] {
	opacity: .85;
}

/* Desktop and tablet */
@media (min-width: 768px) {
	/* minmax(0, ...): a long word or a wide image never pushes the other column. */
	.alw-hr--split {
		container-type: inline-size;
		grid-template-columns: minmax(0, 1fr) minmax(0, var(--alw-hr-photo, 50%));
	}

	.alw-hr--split.alw-hr--flip {
		grid-template-columns: minmax(0, var(--alw-hr-photo, 50%)) minmax(0, 1fr);
	}

	/* The photo reaches the screen edge. The text starts on the content line,
	   measured on the whole Hero width (cqw), so it holds with any photo width. */
	.alw-hr--split .alw-hr__inner {
		padding-inline-start: max(var(--alw-hr-pad), calc((100cqw - var(--alw-hr-max)) / 2));
		padding-inline-end: var(--alw-hr-gap);
	}

	.alw-hr--split.alw-hr--flip .alw-hr__media {
		order: 0;
	}

	.alw-hr--split.alw-hr--flip .alw-hr__inner {
		padding-inline-start: var(--alw-hr-gap);
		padding-inline-end: max(var(--alw-hr-pad), calc((100cqw - var(--alw-hr-max)) / 2));
	}
}

/* Mobile */
@media (max-width: 767px) {
	.alw-hr--left .alw-hr__media::after {
		background: var(--alw-hr-ov);
	}

	.alw-hr--split {
		min-height: 0;
	}

	.alw-hr--split .alw-hr__media {
		aspect-ratio: 4 / 3;
	}

	/* Photo below the text by default (H1 and button first), above by choice. Doubled class:
	   wins over theme or page CSS that reorders the Hero. */
	.alw-hr.alw-hr--split .alw-hr__media {
		order: 2;
	}

	.alw-hr.alw-hr--split.alw-hr--m-photo-top .alw-hr__media {
		order: 0;
	}

	.alw-hr--page .alw-hr__inner {
		flex-direction: column;
		align-items: flex-start;
	}

	.alw-hr--page-center .alw-hr__inner {
		align-items: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.alw-hr .alw-hr__btn {
		transition: none;
	}
}
