/*
 * Home — homepage-only styles.
 * Loaded on template-homepage.php and template-option-4.php (depends on
 * foundation.css). Includes the hero slider, intro band, services grid,
 * selected-projects grid and the homepage contact/testimonials stack.
 */

/* ──────────────────────────────────────────────────────────────────
 * Hero slider
 * Backdrop is neutral (no brand green): any green cast comes from
 * photography + overlays; solid green behind slides would read as tint
 * during fades.
 * ────────────────────────────────────────────────────────────────── */
@keyframes heroKenBurnsZoom {
	from { transform: scale(1.12); }
	to { transform: scale(1); }
}

.hero-slider {
	position: relative;
	background: #0c0c0c;
	min-height: min(78vh, 720px);
	overflow: hidden;
}

.hero-slider__viewport {
	position: relative;
	min-height: inherit;
}

.hero-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.85s ease, visibility 0.85s ease;
	display: flex;
	align-items: center;
	padding: 5.5rem 0 6rem;
}

.hero-slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 1;
}

.hero-slide__bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	/* Pull colour balance away from yellow–green cast in photos; keep
	 * readable contrast. */
	filter: saturate(0.78) contrast(1.07) hue-rotate(4deg);
	/* Idle = end zoom so deactivating never snaps to 1.12 during crossfade. */
	transform: scale(1);
	animation: none;
}

.hero-slide.is-active .hero-slide__bg {
	/* both: first paint uses keyframe `from` (no one-frame flash at scale(1)). */
	animation: heroKenBurnsZoom 8s linear both;
}

.hero-slide__shade {
	position: absolute;
	inset: 0;
	/* True neutral dark wash (RGB-balanced — no green channel bias). */
	background: linear-gradient(105deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.45) 45%, rgba(0, 0, 0, 0.22) 100%);
}

.hero-slide .container {
	position: relative;
	z-index: 2;
	max-width: var(--container);
	width: 100%;
}

/* Hero copy — staggered cascade in; reverse cascade out before slide swap. */
.hero-slide .container > * {
	opacity: 0;
	transform: translateY(1rem);
	transition:
		opacity 0.48s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-slide.hero-slide--static-first.is-active:not(.hero-slide--exiting) .container > * {
	opacity: 1;
	transform: none;
	transition: none;
}

.hero-slide.is-active:not(.hero-slide--exiting) .container > *:nth-child(1) { transition-delay: 0.08s; }
.hero-slide.is-active:not(.hero-slide--exiting) .container > *:nth-child(2) { transition-delay: 0.18s; }
.hero-slide.is-active:not(.hero-slide--exiting) .container > *:nth-child(3) { transition-delay: 0.3s; }
.hero-slide.is-active:not(.hero-slide--exiting) .container > *:nth-child(4) { transition-delay: 0.42s; }

.hero-slide.is-active:not(.hero-slide--exiting) .container > * {
	opacity: 1;
	transform: translateY(0);
}

.hero-slide.is-active.hero-slide--exiting .container > * {
	opacity: 0;
	transform: translateY(-0.75rem);
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-slide.is-active.hero-slide--exiting .container > *:nth-child(1) { transition-delay: 0.24s; }
.hero-slide.is-active.hero-slide--exiting .container > *:nth-child(2) { transition-delay: 0.12s; }
.hero-slide.is-active.hero-slide--exiting .container > *:nth-child(3) { transition-delay: 0.06s; }
.hero-slide.is-active.hero-slide--exiting .container > *:nth-child(4) { transition-delay: 0s; }

.hero-slide__eyebrow {
	display: inline-block;
	font-family: var(--font-heading);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.55);
	margin-bottom: 1rem;
}

.hero-slide h1,
.hero-slide__title {
	font-size: clamp(1.85rem, 3.6vw, 2.85rem);
	font-weight: 600;
	line-height: 1.12;
	color: var(--colour-white);
	margin-bottom: 1.25rem;
}

.hero-slide p {
	font-size: 1.05rem;
	line-height: 1.75;
	color: rgba(255, 255, 255, 0.78);
	margin-bottom: 2rem;
	max-width: min(36rem, 100%);
}

.hero-slide .btn-secondary {
	margin-left: 0;
	border-color: rgba(255, 255, 255, 0.45);
	color: var(--colour-white);
}

.hero-slide .btn-secondary:hover {
	background: var(--colour-white);
	color: #1a1a1a;
	border-color: var(--colour-white);
}

.hero-slider__controls {
	position: absolute;
	bottom: 2rem;
	right: max(1.5rem, calc((100vw - var(--container)) / 2 + 2rem));
	left: auto;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.hero-slider__dots {
	display: flex;
	gap: 0.85rem;
	align-items: center;
}

/* Pagination: stacked emblems — opacity crossfade (avoids jumpy filter
 * interpolation). */
.hero-slider__dot {
	width: 24px;
	height: 24px;
	padding: 0;
	border: none;
	border-radius: 0;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-slider__dot-stack {
	position: relative;
	width: 24px;
	height: 24px;
	display: block;
}

.hero-slider__dot-img {
	position: absolute;
	left: 0;
	top: 0;
	width: 24px;
	height: 24px;
	object-fit: contain;
	display: block;
	pointer-events: none;
}

/* Keep pagination white-only so brand green never appears in the hero. */
.hero-slider__dot-img--colour {
	display: none;
}

.hero-slider__dot-img--mono {
	filter: brightness(0) invert(1);
	opacity: 0.5;
	transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-slider__dot:hover .hero-slider__dot-img--mono,
.hero-slider__dot.is-active .hero-slider__dot-img--mono,
.hero-slider__dot:focus-visible .hero-slider__dot-img--mono {
	opacity: 0.95;
}

.hero-slider__dot.is-active {
	transform: scale(1.12);
}

.hero-slider__dot:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.55);
	outline-offset: 4px;
}

/* ──────────────────────────────────────────────────────────────────
 * Intro band
 * ────────────────────────────────────────────────────────────────── */
.intro {
	position: relative;
	overflow: hidden;
	padding: 5rem 0;
	text-align: center;
}

/* Emblem: intro only — very transparent black silhouette. */
.intro-watermark {
	position: absolute;
	right: -5%;
	top: 50%;
	width: min(72vw, 640px);
	transform: translateY(-50%) rotate(-12deg);
	pointer-events: none;
	z-index: 0;
}

.intro-watermark__parallax {
	will-change: transform;
}

.intro .container {
	position: relative;
	z-index: 1;
}

.intro-watermark__img {
	width: 100%;
	height: auto;
	display: block;
	filter: brightness(0);
	opacity: 0.055;
}

.intro h1,
.intro h2 {
	font-family: var(--font-heading);
	font-size: 2rem;
	color: var(--heritage-green);
	margin-bottom: 1rem;
}

.intro p {
	max-width: 600px;
	margin: 0 auto;
	color: var(--colour-text-light);
	line-height: 1.9;
}

/* ──────────────────────────────────────────────────────────────────
 * Services grid
 * ────────────────────────────────────────────────────────────────── */
.services {
	padding: 5rem 0;
	background: var(--colour-white);
}

/* .section-heading rules live in foundation.css. */

/* Shared services card grid — used by the homepage "Our services" section and
   the sfs_service archive (both render partials/service-card.php, so they stay
   identical). Flexbox with centred wrapping means an incomplete final row
   (e.g. the last 3 of 7) is centred rather than left-aligned. Any change here
   updates both pages automatically. */
.services-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1.75rem;
}

/* 4 per row: each card is a quarter minus its share of the 3 row gaps
   (3 × 1.75rem ÷ 4 = 1.3125rem). */
.services-grid > .service-card {
	flex: 0 1 calc(25% - 1.3125rem);
	max-width: calc(25% - 1.3125rem);
}

/* Tablet: 2 per row (1 gap ÷ 2 = 0.875rem). */
@media (max-width: 1024px) {
	.services-grid > .service-card {
		flex-basis: calc(50% - 0.875rem);
		max-width: calc(50% - 0.875rem);
	}
}

/* Mobile: single column. */
@media (max-width: 600px) {
	.services-grid > .service-card {
		flex-basis: 100%;
		max-width: 100%;
	}
}

/* Legacy 3+2 split (Option 4 template). The homepage now uses one 4-up grid. */
.services-grid--bottom {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 2rem;
	margin-top: 2rem;
	max-width: 732px;
	margin-left: auto;
	margin-right: auto;
}

/* Whole card is a link so the image and title are both clickable. Flex column
 * so the text block can grow and centre vertically below the image. */
a.service-card {
	display: flex;
	flex-direction: column;
	color: inherit;
	text-decoration: none;
}

.service-card {
	padding: 1.75rem 1.75rem;
	border: 1px solid var(--colour-border);
	border-radius: 8px;
	text-align: center;
	border-top: 10px solid var(--colour-border);
	transition: border-color 0.3s, box-shadow 0.3s;
	overflow: hidden;
}

.service-card:hover {
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
}

/* Title (+ optional excerpt) fills the space beneath the image and is centred
 * vertically, so one- and two-line titles line up across a row. */
.service-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* Service card image strip. */
.service-card-image {
	margin: -1.75rem -1.75rem 1.5rem;
	height: 165px;
	overflow: hidden;
	border-radius: 0;
}

.service-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.55s ease;
	filter: saturate(0.92) contrast(1.02);
}

.service-card:hover .service-card-image img {
	transform: scale(1.06);
}

.service-card--cleaning  { border-top-color: var(--cleaning); }
.service-card--survey    { border-top-color: var(--survey); }
.service-card--restoration { border-top-color: var(--restoration); }
.service-card--decorating { border-top-color: var(--decorating); }
.service-card--additional { border-top-color: var(--additional); }

.service-card:hover { border-color: var(--colour-border); }
.service-card--cleaning:hover  { border-top-color: var(--cleaning); }
.service-card--survey:hover    { border-top-color: var(--survey); }
.service-card--restoration:hover { border-top-color: var(--restoration); }
.service-card--decorating:hover { border-top-color: var(--decorating); }
.service-card--additional:hover { border-top-color: var(--additional); }

.service-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-bottom: 1.25rem;
}

.service-card--cleaning .service-dot  { background: var(--cleaning); }
.service-card--survey .service-dot    { background: var(--survey); }
.service-card--restoration .service-dot { background: var(--restoration); }
.service-card--decorating .service-dot { background: var(--decorating); }
.service-card--additional .service-dot { background: var(--additional); }

.service-card h3 {
	font-family: var(--font-heading);
	font-size: 1.05rem;
	font-weight: 600;
	color: var(--heritage-green);
	margin-bottom: 0.75rem;
	line-height: 1.35;
}

.service-card p {
	font-size: 0.9rem;
	color: var(--colour-text-light);
	line-height: 1.8;
}

/* Described service cards — the homepage service-descriptions A/B variant.
 * Left-aligned and top-anchored so the short description reads naturally under
 * the title (the standard card centres a title-only body). */
.service-card--described .service-card__body {
	justify-content: flex-start;
	text-align: left;
}

.service-card--described h3 {
	margin-bottom: 0.5rem;
}

.service-card--described p {
	line-height: 1.65;
	margin: 0;
}

/* The project card grid (.projects-section, .projects-grid, .project-card,
 * .project-overlay, .projects-heading, .projects-cta) lives in components.css
 * because it's shared by the homepage, the project archive, the project
 * single "Other projects" block and the service single "Related projects"
 * block — all rendered via partials/project-cards-grid.php. */

/* ──────────────────────────────────────────────────────────────────
 * Contact + testimonials stack (shared emblem between bands)
 * Used on the homepage. The project single uses .contact-section--standalone
 * which is defined in components.css.
 * ────────────────────────────────────────────────────────────────── */
.contact-testimonials-stack {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: auto auto;
	/* Clip the watermark emblem's horizontal bleed. Use `clip` (not `hidden`):
	 * `hidden` would force overflow-y to compute to `auto`, turning this into a
	 * scroll container — which showed a nested vertical scrollbar (the "double
	 * scroll") once the testimonial slide grew taller. `clip` contains the
	 * bleed without establishing a scroll container. */
	overflow-x: clip;
}

.contact-testimonials-stack__bg {
	grid-column: 1;
	z-index: 0;
	pointer-events: none;
}

.contact-testimonials-stack__bg--contact {
	grid-row: 1;
	background: var(--colour-white);
	min-height: 100%;
	align-self: stretch;
}

.contact-testimonials-stack__bg--testimonials {
	grid-row: 2;
	background: #e8e4dc;
	border-top: 1px solid var(--colour-border);
	border-bottom: 1px solid rgba(10, 75, 44, 0.08);
	min-height: 100%;
	align-self: stretch;
}

/* One emblem spanning both rows — between panel fills (0) and content (2).
 * Rotation on outer wrapper so inner parallax translate does not wipe rotate
 * (inline transform). */
.contact-testimonials-stack .contact-watermark {
	grid-row: 1 / -1;
	grid-column: 1;
	z-index: 1;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding-top: clamp(1rem, 6vh, 4rem);
	pointer-events: none;
	overflow: visible;
	width: 100%;
	min-height: 0;
	transform: rotate(11deg);
	transform-origin: center center;
}

.contact-testimonials-stack .contact-watermark__parallax {
	width: min(72vw, 850px);
	margin-left: -23%;
	will-change: transform;
}

.contact-testimonials-stack .contact-section {
	grid-row: 1;
	grid-column: 1;
	position: relative;
	z-index: 2;
	background: transparent;
	overflow: visible;
	padding: 6rem 0;
}

.contact-testimonials-stack .testimonials-section {
	grid-row: 2;
	grid-column: 1;
	position: relative;
	z-index: 2;
	background: transparent;
	padding: 4.5rem 1.5rem 5rem;
	overflow: visible;
	border: none;
}

/* ──────────────────────────────────────────────────────────────────
 * Responsive
 * ────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
	.hero-slider { min-height: 70vh; }
	.hero-slide { padding: 4.5rem 0 5.5rem; }
	.hero-slider__controls {
		bottom: 1.25rem;
		right: 1.5rem;
	}

	.services-grid { grid-template-columns: 1fr; }
	.services-grid--bottom { grid-template-columns: 1fr; max-width: 100%; }

	.intro-watermark {
		right: -12%;
		width: min(95vw, 520px);
		transform: translateY(-48%) rotate(-10deg);
	}

	.intro-watermark__img {
		opacity: 0.045;
	}

	.contact-testimonials-stack .contact-watermark {
		transform: rotate(8deg);
	}

	.contact-testimonials-stack .contact-watermark__parallax {
		margin-left: -28%;
		width: min(95vw, 520px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hero-slide .container > * {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
	.hero-slide {
		transition: none !important;
	}
	.hero-slide__bg {
		transition: none !important;
		animation: none !important;
		transform: scale(1) !important;
	}
	.intro-watermark__parallax {
		transform: none !important;
		will-change: auto;
	}
	.hero-slider__dot-img--colour,
	.hero-slider__dot-img--mono {
		transition-duration: 0.01ms;
	}
}
