/**
 * General site tweaks for fuseservice.com (child theme).
 * Small, scoped overrides — not full feature stylesheets.
 */

/* -------------------------------------------------------------------------
 * Hero block (acf/hero-block) — WPForms layout (visual only)
 *
 * Scope: .fs-hero-block .fs-hero-block__form only.
 * Name|Phone on row 1, Email|Address on row 2.
 * Message, checkboxes, submit stay full width.
 *
 * Tracking hidden fields (GC Lead, Facebook Lead, UTMs, etc.) are unchanged:
 * they stay in the DOM, keep their names/values, and still submit. This CSS
 * only hides their labels and keeps them out of the two-column grid.
 * ------------------------------------------------------------------------- */
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	justify-content: stretch;
	align-items: start;
	column-gap: 10px;
	row-gap: 10px;
}

.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field {
	box-sizing: border-box;
	grid-column: 1 / -1;
	min-width: 0;
	flex: none;
	float: none;
}

.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-name,
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-phone,
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-email,
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-text {
	grid-column: auto;
	width: auto;
	max-width: none;
}

.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-name input,
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-phone input,
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-email input,
.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container > .wpforms-field-text input {
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

/* Same visual hide WPForms already applies — labels should not flash or occupy a grid cell.
   Inputs inside these wrappers are not disabled, renamed, or removed. */
.fs-hero-block .fs-hero-block__form .wpforms-field-hidden,
.fs-hero-block .fs-hero-block__form .wpforms-field-hp {
	display: none;
}

@media (max-width: 680px) {
	.fs-hero-block .fs-hero-block__form .wpforms-container .wpforms-field-container {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Opt-in text link that mirrors the Learn More Button block (accent colour, 2px underline
   that replays on hover, arrow that nudges right). Font size is inherited from the content.
   Use in WYSIWYG content (Text tab): <p><a class="link-arrow" href="...">Get a Quote Now</a></p> */
a.link-arrow {
	display: table;
	position: relative;
	color: var(--color-accent);
	font-weight: 500;
	text-decoration: none;
	transition: var(--transition);
}

/* Parent link styles that would stack a second underline or change the colour:
   headline.css (.fs-headline__desc a: grey border-bottom, hover colour) and
   entry-content.css (.entry-content p a: background-image underline + linkLine animation).
   Keep the accent colour and only our ::before underline. */
a.link-arrow:hover,
a.link-arrow:focus-visible,
.fs-headline__desc a.link-arrow,
.fs-headline__desc a.link-arrow:hover,
.fs-headline__desc a.link-arrow:focus-visible,
.entry-content p a.link-arrow,
.entry-content p a.link-arrow:hover,
.entry-content p a.link-arrow:focus-visible {
	color: var(--color-accent);
	border-bottom: 0;
	text-decoration: none;
	background-image: none;
	animation: none;
}

a.link-arrow::before {
	content: "";
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 100%;
	height: 2px;
	background-color: currentColor;
}

a.link-arrow:hover::before {
	animation: fuseLinkArrowFill 0.5s forwards;
}

a.link-arrow::after {
	content: "\2192";
	position: absolute;
	top: 50%;
	left: calc(100% + 4px);
	transform: translateY(-50%);
	color: inherit;
	transition: var(--transition);
}

a.link-arrow:hover::after {
	left: calc(100% + 5px);
}

@keyframes fuseLinkArrowFill {
	0% {
		width: 0;
	}

	100% {
		width: 100%;
	}
}

/* Theme Options → Header → "Enlarge Single Header Button" vs this site's WPCode snippet
   "TEMP - Header menu item font-size": between 1281px and 1465px it forces
   .fs-header__content .fs-header__actions .button { min-width: auto !important; padding: 14px !important },
   which cancelled the enlarged single button in that range only. Restore the parent's width there;
   the snippet's menu/button font sizing is left as is. */
@media (min-width: 1281px) and (max-width: 1465px) {
	.fs-header--enlarge-single-btn .fs-header__content .fs-header__actions > a.button:only-of-type {
		min-width: clamp(12rem, 16vw, 16rem) !important;
	}
}

/* -------------------------------------------------------------------------
 * Homepage, phones only (≤767px): photo hero under a floating header card.
 *
 * Turns on only when the homepage hero has "Enable background image (Mobile)"
 * set (class fs-hero-block--has-bg-mobile), so nothing changes until the image
 * is added. Desktop (≥993px) is untouched; 768–992px keeps today's plain hero.
 *
 * - Header: a white rounded card inset like the bottom bar (.fs-mbar: 10px from
 *   the edges, 14px radius, same shadow), floating over the photo. It stays
 *   sticky. With the mobile menu open it goes back to the normal full-width bar.
 * - Hero: the mobile photo sits at the top at its own proportions (portrait,
 *   fading to white); the text starts a little above halfway down it. The
 *   reviews strip above the hero and the hero tags are hidden on phones.
 * - Fit (Fuse Theme → Phone Quick Actions → Homepage Hero Fit, inc/mobile-actions.php):
 *   • Screen-height aware (default): photo and text move up together so the last
 *     text line ends just above the bottom bar and "Get a Quote Now" sits behind
 *     it on the first screen. Kept between 38% of the photo (clear of the faces)
 *     and 47% (the original spot).
 *   • Simple fixed shift (body.fs-home-hero-fit-fixed): photo and text move up by
 *     --fs-home-hero-shift (Homepage Hero Shift %, printed inline; default 5%) of
 *     the photo height, on every phone.
 *   • Original (body.fs-home-hero-fit-original): photo at the top, text 47% down.
 * ------------------------------------------------------------------------- */
@media (max-width: 767px) {
	body.home:has(.fs-hero-block--has-bg-mobile) {
		--fs-home-header-gap: 10px;
		--fs-home-header-height: 61px;
		/* Height/width of the mobile hero photo (360×780 export). */
		--fs-home-hero-ratio: 2.1667;
		--fs-home-hero-photo-h: calc(100vw * var(--fs-home-hero-ratio));
		/* Original text spot: 47% down the photo. */
		--fs-home-hero-text-base: calc(var(--fs-home-hero-photo-h) * .47);
		/* Hero text from the top of the "Book Today" pill to the Get a Quote link:
		   pill, heading (3 lines) and gaps, plus 5 lines of description text. */
		--fs-home-hero-text-h: calc(209px + 7 * clamp(14px, 3.9vw, 16px));
		/* Screen-height aware (default): the link lands at the top edge of the bar. */
		--fs-home-hero-text-top: clamp(
			calc(var(--fs-home-hero-photo-h) * .38),
			calc(100vh - var(--fs-mbar-space, 0px) - var(--fs-home-hero-text-h)),
			var(--fs-home-hero-text-base)
		);
		/* The photo moves up by as much as the text did. */
		--fs-home-hero-photo-top: calc(var(--fs-home-hero-text-top) - var(--fs-home-hero-text-base));
	}
	@supports (height: 100svh) {
		body.home:has(.fs-hero-block--has-bg-mobile) {
			/* svh: the screen with the browser toolbars showing. */
			--fs-home-hero-text-top: clamp(
				calc(var(--fs-home-hero-photo-h) * .38),
				calc(100svh - var(--fs-mbar-space, 0px) - var(--fs-home-hero-text-h)),
				var(--fs-home-hero-text-base)
			);
		}
	}
	/* Simple fixed shift: the chosen share of the photo height higher, on every phone. */
	body.home.fs-home-hero-fit-fixed:has(.fs-hero-block--has-bg-mobile) {
		--fs-home-hero-text-top: calc(var(--fs-home-hero-photo-h) * (.47 - var(--fs-home-hero-shift, .05))) !important;
	}
	/* Original: no shift. */
	body.home.fs-home-hero-fit-original:has(.fs-hero-block--has-bg-mobile) {
		--fs-home-hero-text-top: var(--fs-home-hero-text-base) !important;
	}

	/* Floating header card. */
	body.home:has(.fs-hero-block--has-bg-mobile):not(:has(.fs-header__content_show)) .fs-header {
		padding: var(--fs-home-header-gap) 10px 0;
		background: transparent;
		pointer-events: none;
	}
	body.home:has(.fs-hero-block--has-bg-mobile):not(:has(.fs-header__content_show)) .fs-header__main {
		overflow: hidden;
		border-bottom: 0;
		border-radius: 14px;
		box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 8px 24px rgba(0, 0, 0, .16);
		pointer-events: auto;
	}
	body.home:has(.fs-hero-block--has-bg-mobile):not(:has(.fs-header__content_show)) .fs-header__main .fs-container {
		padding-right: 16px;
		padding-left: 16px;
	}
	/* Pull the page up under the header so the photo starts at the top. */
	body.home:has(.fs-hero-block--has-bg-mobile):not(:has(.fs-header__content_show)) .fs-content {
		margin-top: calc(-1 * (var(--fs-home-header-gap) + var(--fs-home-header-height)));
	}

	/* The photo hero goes first. */
	body.home .entry-content > .fs-reviews-banner:has(+ .fs-hero-block--has-bg-mobile) {
		display: none;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__main {
		padding-top: var(--fs-home-hero-text-top);
		background-color: #fff;
		background-position: center var(--fs-home-hero-photo-top) !important;
		background-size: 100% auto !important;
	}
	/* Full-bleed photo at its own proportions, top of the section. */
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__background {
		top: var(--fs-home-hero-photo-top);
		right: auto;
		bottom: auto;
		left: 50%;
		width: 100vw;
		height: var(--fs-home-hero-photo-h);
		transform: translateX(-50%);
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__background-image {
		object-fit: cover;
		object-position: center top;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__main::before {
		display: none;
	}

	/* Text. */
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__inner {
		gap: 40px;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__subheading {
		margin-bottom: 18px !important;
		background: rgba(30, 30, 30, .78);
		color: #fff !important;
		-webkit-backdrop-filter: blur(6px);
		backdrop-filter: blur(6px);
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__title {
		margin-bottom: 20px !important;
		font-size: 34px !important;
		line-height: 1.1 !important;
	}
	/* Order on phones: intro, warranty line, then the Get a Quote link.
	   Font scales so "… same-day service" stays on one line from 360px up. */
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__desc {
		display: flex;
		flex-direction: column;
		gap: 10px;
		font-size: clamp(14px, 3.9vw, 16px) !important;
		line-height: 1.4 !important;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__desc p {
		margin: 0 !important;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__desc p:has(> a.link-arrow) {
		order: 1;
		margin-top: 12px !important;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__desc b,
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__desc strong {
		font-weight: inherit;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__tags {
		display: none;
	}
}

/* Tablet keeps today's plain hero: no mobile photo between 768px and 992px. */
@media (min-width: 768px) and (max-width: 992px) {
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__background {
		display: none;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__main {
		background-image: none !important;
	}
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__main::before,
	body.home .fs-hero-block--has-bg-mobile .fs-hero-block__main::after {
		display: none !important;
	}
}
