/**
 * A-Key Hero Background
 * Homepage: sunset skyline on the first full-width Spectra hero.
 * Inner service/town pages: night skyline on the first dark (#111) hero box.
 * Does not use background-attachment: fixed (broken on iOS).
 */

/* -------------------------------------------------------------------------
 * Homepage hero
 * body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type
 * is the first (and only) Spectra container on the front page — the block that
 * already holds the H1, call button, and the akey-cd "Open 24/7 · Hablamos español"
 * line. Scoped to the front page so inner pages are untouched by these rules.
 * ------------------------------------------------------------------------- */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type {
	position: relative;
	isolation: isolate;
	box-sizing: border-box;
	min-height: 480px;
	padding: 56px 24px 48px;
	background-color: #1a1510;
	background-image: url(sunset-900.jpg);
	background-image: image-set(
		url(sunset-900.webp) type("image/webp"),
		url(sunset-900.jpg) type("image/jpeg")
	);
	background-size: cover;
	background-position: center 40%;
	background-repeat: no-repeat;
}

@media (min-width: 768px) {
	body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type {
		padding: 72px 32px 64px;
		background-image: url(sunset.jpg);
		background-image: image-set(
			url(sunset.webp) type("image/webp"),
			url(sunset.jpg) type("image/jpeg")
		);
	}
}

/* Replace Spectra's solid #111 ::before with a dark gradient overlay. */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type.spectra-background-color::before,
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	opacity: 1;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0.55) 0%,
		rgba(0, 0, 0, 0.45) 50%,
		rgba(0, 0, 0, 0.35) 100%
	) !important;
}

/* Keep hero copy above the overlay. */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type > * {
	position: relative;
	z-index: 1;
}

/* Let the skyline show through the inner dark box (inline background-color:#111). */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type > div[style*="background-color:#111"] {
	background-color: transparent !important;
	background-image: none !important;
}

/* Readable type over the photo. */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type,
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type p,
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type h1,
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type span {
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 0 12px rgba(0, 0, 0, 0.35);
}

/* Last tagline inside the hero has no inline color — keep it white. */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type > p:last-child {
	color: #ffffff;
}

/* Inline #cccccc body copy is too dim over the photo. */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type p[style*="color:#cccccc"],
body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] p[style*="color:#cccccc"] {
	color: #f3f3f3 !important;
}

/* Call button stays high-contrast (red on white type) and lifts off the photo. */
body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type a[href^="tel:"] {
	text-shadow: none;
	color: #ffffff !important;
	background-color: #d9534f !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

@media (max-width: 767px) {
	body.home .entry-content > .wp-block-spectra-container.alignfull:first-of-type {
		min-height: 0;
		padding: 36px 16px 32px;
	}
}

/* -------------------------------------------------------------------------
 * Inner service / town pages
 * These pages start with the same dark hero box (inline background-color:#111)
 * but are not wrapped in a Spectra container. Photos, legal pages, and any
 * page without that first-child box are not matched.
 * ------------------------------------------------------------------------- */
body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	box-sizing: border-box;
	background-color: #111 !important;
	background-image: url(night-900.jpg);
	background-image: image-set(
		url(night-900.webp) type("image/webp"),
		url(night-900.jpg) type("image/jpeg")
	);
	background-size: cover;
	background-position: center 45%;
	background-repeat: no-repeat;
}

@media (min-width: 768px) {
	body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] {
		padding-top: 48px !important;
		padding-bottom: 48px !important;
		background-image: url(night.jpg);
		background-image: image-set(
			url(night.webp) type("image/webp"),
			url(night.jpg) type("image/jpeg")
		);
	}
}

body:not(.home) .entry-content > div:first-child[style*="background-color:#111"]::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0.45) 0%,
		rgba(0, 0, 0, 0.52) 50%,
		rgba(0, 0, 0, 0.48) 100%
	);
}

body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] > * {
	position: relative;
	z-index: 1;
}

body:not(.home) .entry-content > div:first-child[style*="background-color:#111"],
body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] p,
body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] h1,
body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] span {
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 0 12px rgba(0, 0, 0, 0.35);
}

body:not(.home) .entry-content > div:first-child[style*="background-color:#111"] a[href^="tel:"] {
	text-shadow: none;
	color: #ffffff !important;
	background-color: #d9534f !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
