/**
 * Zero Emissions Hub — Ecosystem Popup
 *
 * Palette is taken from the site's Divi global colours:
 *   gcid-primary-color   #22577a
 *   gcid-secondary-color #57cc99
 *   gcid-heading-color   #0e0c19
 *   gcid-body-color      #3c3a47
 *
 * The button radius (100px) and padding mirror the site's existing
 * "Primary Solid" Divi button preset, so the card reads as part of the theme
 * rather than as a bolted-on widget.
 *
 * Typeface is deliberately inherited: whatever Divi is serving, the card uses.
 */

.zeh-ep {
	--zeh-primary: #22577a;
	--zeh-primary-dark: #1a4560;
	--zeh-secondary: #57cc99;
	--zeh-heading: #0e0c19;
	--zeh-body: #3c3a47;
	--zeh-muted: #6b6875;
	--zeh-eyebrow: #3d6f8f;
	--zeh-surface: #ffffff;
	--zeh-border: rgba(14, 12, 25, 0.09);
	--zeh-ep-bottom: 24px;
	--zeh-ep-bottom-m: 12px;
	/* Horizontal inset from the viewport edge. Deliberately independent of the
	   bottom offset, so raising the card to clear a floating contact bar does
	   not also push it sideways. */
	--zeh-ep-side: 24px;

	position: fixed;
	bottom: var(--zeh-ep-bottom);
	z-index: 99990;

	box-sizing: border-box;
	width: 372px;
	max-width: calc(100vw - 32px);

	background: var(--zeh-surface);
	border: 1px solid var(--zeh-border);
	border-radius: 16px;
	box-shadow:
		0 1px 3px rgba(14, 12, 25, 0.05),
		0 18px 44px -14px rgba(34, 87, 122, 0.30);
	overflow: hidden;

	font-family: inherit;
	text-align: left;

	/* Hidden state. Kept off the compositor until it is actually needed. */
	opacity: 0;
	transform: translate3d(0, 14px, 0);
	transition:
		opacity 0.34s ease,
		transform 0.34s cubic-bezier(0.16, 0.84, 0.44, 1);
}

/* Belt and braces: some themes force `aside { display: block }`. */
.zeh-ep[hidden] {
	display: none !important;
}

.zeh-ep.is-open {
	opacity: 1;
	transform: translate3d(0, 0, 0);
}

.zeh-ep--right {
	right: var(--zeh-ep-side);
}

.zeh-ep--left {
	left: var(--zeh-ep-side);
}

.zeh-ep *,
.zeh-ep *::before,
.zeh-ep *::after {
	box-sizing: inherit;
}

/* Divi sets margins and bottom padding on p / h2 globally. Neutralise them
   inside the card only — class specificity beats Divi's element selectors. */
.zeh-ep p,
.zeh-ep h2 {
	margin: 0;
	padding: 0;
	font-family: inherit;
	text-transform: none;
}

/* --- accent rule ------------------------------------------------------- */

.zeh-ep__rule {
	height: 3px;
	background: linear-gradient(90deg, var(--zeh-primary) 0%, var(--zeh-secondary) 100%);
}

/* --- close ------------------------------------------------------------- */

.zeh-ep__close {
	position: absolute;
	top: 8px;
	inset-inline-end: 8px;
	right: 8px;

	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;

	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--zeh-muted);
	cursor: pointer;
	line-height: 0;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.zeh-ep__close:hover,
.zeh-ep__close:focus-visible {
	background: rgba(14, 12, 25, 0.06);
	color: var(--zeh-heading);
}

.zeh-ep__close:focus-visible {
	outline: 2px solid var(--zeh-secondary);
	outline-offset: 1px;
}

/* --- body -------------------------------------------------------------- */

.zeh-ep__inner {
	padding: 16px 18px 15px;
}

/* Icon and eyebrow share one row at every size. Stacking them cost 30px of
   height on desktop and bought nothing — the icon is a brand cue, not content. */
.zeh-ep__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 9px;
	padding-right: 34px;   /* keep clear of the close button */
}

.zeh-ep__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	margin-bottom: 0;

	background: rgba(87, 204, 153, 0.16);
	border-radius: 9px;
	color: var(--zeh-primary);
	line-height: 0;
}

.zeh-ep__icon svg {
	width: 18px;
	height: 18px;
}

/* The short body copy is mobile-only. */
.zeh-ep__body--short {
	display: none;
}

.zeh-ep--greentonne .zeh-ep__icon {
	background: rgba(87, 204, 153, 0.22);
	color: #1f7a52;
}

.zeh-ep__eyebrow {
	margin-bottom: 0 !important;
	font-size: 10px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.09em;
	text-transform: uppercase !important;
	color: var(--zeh-eyebrow);
}

/* Title and body are clamped at every size. Bulgarian and Turkish run longer
   than English, and without a clamp a translation can silently push the card
   past the height it was designed to fit in. */
.zeh-ep__title {
	margin-bottom: 7px !important;
	font-size: 16.5px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--zeh-heading);

	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.zeh-ep__body {
	margin-bottom: 13px !important;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.55;
	color: var(--zeh-body);
}

.zeh-ep__body--long {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* --- call to action ---------------------------------------------------- */

.zeh-ep__cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;

	padding: 11px 22px;
	background: var(--zeh-primary);
	border-radius: 100px;

	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.2;
	color: #ffffff !important;
	text-decoration: none !important;

	transition: background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.zeh-ep__cta:hover,
.zeh-ep__cta:focus-visible {
	background: var(--zeh-primary-dark);
	color: #ffffff !important;
	transform: translateY(-1px);
	box-shadow: 0 6px 16px -6px rgba(34, 87, 122, 0.55);
}

.zeh-ep__cta:focus-visible {
	outline: 2px solid var(--zeh-secondary);
	outline-offset: 2px;
}

.zeh-ep__cta svg {
	flex: none;
	transition: transform 0.18s ease;
}

.zeh-ep__cta:hover svg {
	transform: translateX(2px);
}

.zeh-ep--greentonne .zeh-ep__cta {
	background: #1f7a52;
}

.zeh-ep--greentonne .zeh-ep__cta:hover,
.zeh-ep--greentonne .zeh-ep__cta:focus-visible {
	background: #186040;
	box-shadow: 0 6px 16px -6px rgba(31, 122, 82, 0.55);
}

.zeh-ep__note {
	margin-top: 9px !important;
	font-size: 11px;
	line-height: 1.4;
	color: var(--zeh-muted);
}

/* -----------------------------------------------------------------------
 * Tablet
 * -------------------------------------------------------------------- */

@media (max-width: 980px) and (min-width: 601px) {
	.zeh-ep {
		width: 340px;
	}

	.zeh-ep__title {
		font-size: 16px;
	}
}

/* -----------------------------------------------------------------------
 * Mobile — a compact floating sheet, inset from the edges so it still reads
 * as a card rather than a system banner. Respects the iOS home-indicator
 * safe area.
 *
 * SIZE BUDGET. The Coalition for Better Ads treats a persistent mobile
 * element occupying more than 30% of viewport height as beneath the standard,
 * and Google's guidance for interstitials points lower still — the app-install
 * banner it uses as the reference example sits around 20%.
 *
 * The 1.0/1.1 layout measured ~303px, which is 45% of a 667px iPhone SE
 * viewport. Everything below exists to bring that under 30% on the smallest
 * phone in common use and to roughly 22% on a current one:
 *
 *   - icon and eyebrow collapse onto one row      saves ~45px
 *   - a shorter body string, not a truncation     saves ~42px
 *   - title and body clamped to 2 lines each      bounds the worst case
 *   - tighter padding and type scale              saves ~25px
 *
 * Clamping is what makes the budget a guarantee rather than an estimate: a
 * longer Bulgarian or Turkish string can no longer push the card taller.
 * -------------------------------------------------------------------- */

@media (max-width: 600px) {
	.zeh-ep,
	.zeh-ep--left,
	.zeh-ep--right {
		left: 10px;
		right: 10px;
		width: auto;
		max-width: none;
		bottom: calc(var(--zeh-ep-bottom-m) + env(safe-area-inset-bottom, 0px));
		border-radius: 14px;
	}

	.zeh-ep__inner {
		padding: 11px 14px 12px;
	}

	/* Icon and eyebrow on one line, with room reserved for the close button. */
	.zeh-ep__head {
		display: flex;
		align-items: center;
		gap: 9px;
		margin-bottom: 6px;
		padding-right: 30px;
	}

	.zeh-ep__icon {
		flex: none;
		width: 24px;
		height: 24px;
		margin-bottom: 0;
		border-radius: 7px;
	}

	.zeh-ep__icon svg {
		width: 15px;
		height: 15px;
	}

	.zeh-ep__eyebrow {
		margin-bottom: 0 !important;
		font-size: 9.5px;
		letter-spacing: 0.07em;
	}

	.zeh-ep__title {
		margin-bottom: 4px !important;
		font-size: 15px;
		line-height: 1.28;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.zeh-ep__body--long {
		display: none;
	}

	.zeh-ep__body--short {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		margin-bottom: 9px !important;
		font-size: 12.5px;
		line-height: 1.5;
	}

	/* Full-width tap target — a pill floating left is an awkward reach on a
	   large phone. 40px tall, comfortably above the 44px-with-padding minimum
	   once the surrounding margin is counted. */
	.zeh-ep__cta {
		display: flex;
		justify-content: center;
		width: 100%;
		padding: 10px 18px;
		font-size: 13.5px;
	}

	.zeh-ep__close {
		top: 5px;
		right: 5px;
		width: 30px;
		height: 30px;
	}

	.zeh-ep__note {
		margin-top: 6px !important;
		font-size: 10.5px;
		text-align: center;
	}
}

/* Very short viewports — landscape phones, split screen, and the small
   desktop windows nobody tests. Drop the icon and cap the body at two lines.
   The note stays: on Turkish pages it is the line telling the reader the
   destination is in English, and losing that costs more than 14px is worth. */
@media (max-height: 500px) {
	.zeh-ep__icon {
		display: none;
	}

	.zeh-ep__head {
		margin-bottom: 5px;
	}

	.zeh-ep__inner {
		padding: 10px 14px 11px;
	}

	.zeh-ep__title {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.zeh-ep__body--long,
	.zeh-ep__body--short {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		margin-bottom: 8px !important;
	}

	.zeh-ep__note {
		margin-top: 5px !important;
		font-size: 10px;
	}
}

/* -----------------------------------------------------------------------
 * Accessibility and print
 * -------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.zeh-ep {
		transform: none;
		transition: opacity 0.01ms linear;
	}

	.zeh-ep.is-open {
		transform: none;
	}

	.zeh-ep__cta,
	.zeh-ep__cta svg,
	.zeh-ep__close {
		transition: none;
	}

	.zeh-ep__cta:hover {
		transform: none;
	}

	.zeh-ep__cta:hover svg {
		transform: none;
	}
}

@media (forced-colors: active) {
	.zeh-ep {
		border: 1px solid CanvasText;
	}

	.zeh-ep__cta {
		border: 1px solid ButtonText;
	}
}

@media print {
	.zeh-ep {
		display: none !important;
	}
}
