/**
 * Global footer — testimonials-style band; size/radius aligned with home sections.
 */

.tw-site-footer {
	/* Mirror :root from home-hero.css so inner/outer radii match everywhere */
	--tw-hero-vw: 100vw;
	--tw-frame-inset: clamp(14px, 2.2vw, 28px);
	--tw-hero-radius: clamp(28px, 4.5vw, 42px);
	--tw-hero-inner-radius: max(0px, calc(var(--tw-hero-radius) - var(--tw-frame-inset)));
	--tw-hero-pad: clamp(1.35rem, 5vw, 3.25rem);
	--tw-hero-pad-x: max(var(--tw-hero-pad), env(safe-area-inset-left, 0px));
	--tw-hero-pad-x-end: max(var(--tw-hero-pad), env(safe-area-inset-right, 0px));
	--tw-home-section-gap: calc(var(--tw-hero-pad) * 0.5);
	--tw-bento-radius: clamp(18px, 2.8vw, 24px);
	--tw-max-width: 72rem;
	--tw-space-4: 1.5rem;
	--tw-space-5: 2.5rem;
	--tw-hero-btn-muted-border: rgba(255, 255, 255, 0.22);
	--tw-hero-icon-bg: rgba(255, 255, 255, 0.12);

	margin-top: clamp(0.35rem, 1.1vw, 0.85rem);
	font-family: "Manrope", var(--tw-font-sans, system-ui, sans-serif);
	box-sizing: border-box;
	max-width: none;
}

/* Inner pages: full-bleed band (align with top bar), content padded inside */
body:not(.tw-carpentry-home) .tw-site-footer {
	width: 100%;
	margin-left: 0;
	margin-right: 0;
	padding: 0 var(--tw-frame-inset) var(--tw-space-5) var(--tw-frame-inset);
}

@supports (width: 100svw) {
	.tw-site-footer {
		--tw-hero-vw: 100svw;
	}
}

/*
 * Homepage: footer sits outside .tw-page-frame — match .site-main--front / .tw-hero-home width math
 * (100vw/svw + horizontal frame inset) so the grey band lines up with content inside the white frame.
 * Inner padding on .tw-site-footer__surface-inner matches .tw-home-section__inner.
 */
body.tw-carpentry-home .tw-site-footer {
	width: var(--tw-hero-vw, 100vw);
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	padding: 0 var(--tw-frame-inset) var(--tw-home-section-gap) var(--tw-frame-inset);
}

.tw-site-footer *,
.tw-site-footer *::before,
.tw-site-footer *::after {
	box-sizing: border-box;
}

/* Same radii as .tw-home-section--testimonials .tw-clients-hero (+ stats-strip border) */
.tw-site-footer__surface {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 100%;
	min-height: 0;
	border-radius: var(--tw-hero-inner-radius);
	border: 1px solid rgba(255, 255, 255, 0.1);
	overflow: hidden;
	isolation: isolate;
	color: #fff;
	box-shadow: 0 12px 36px rgba(26, 26, 26, 0.14);
}

.tw-site-footer__surface-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	border-radius: inherit;
	background: linear-gradient(
		125deg,
		rgba(26, 26, 26, 0.98) 0%,
		rgba(77, 77, 77, 0.94) 48%,
		rgba(40, 40, 40, 0.96) 100%
	);
}

.tw-site-footer__surface-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
	background: linear-gradient(
		120deg,
		rgba(26, 26, 26, 0.66) 0%,
		rgba(77, 77, 77, 0.48) 45%,
		rgba(40, 40, 40, 0.44) 100%
	);
}

/* Same vertical rhythm as .tw-home-section__inner; horizontal pad matches section inners on home */
.tw-site-footer__surface-inner {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: none;
	margin: 0 auto;
	padding: var(--tw-hero-pad) var(--tw-hero-pad-x-end) var(--tw-hero-pad) var(--tw-hero-pad-x);
}

.tw-site-footer a {
	color: inherit;
	text-decoration: none;
	text-underline-offset: 2px;
}

.tw-site-footer .tw-home-kicker {
	color: rgba(255, 255, 255, 0.78);
}

.tw-site-footer .tw-home-kicker__line {
	background: rgba(255, 255, 255, 0.35);
}

.tw-site-footer__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: clamp(1.75rem, 4vw, 2.5rem);
	align-items: start;
}

/* Desktop: menu + social (left) → map (centre) → brand / logos / webcube (end). */
@media (min-width: 960px) {
	.tw-site-footer__grid {
		grid-template-columns:
			minmax(0, max-content)
			minmax(0, 1fr)
			minmax(0, max-content);
		gap: clamp(1.5rem, 3.5vw, 2.75rem);
		align-items: stretch;
	}

	.tw-site-footer__grid--no-contact {
		grid-template-columns: minmax(0, max-content) minmax(260px, 1fr);
	}

	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--contact {
		grid-column: 1;
		grid-row: 1;
		height: 100%;
		justify-self: start;
		align-items: flex-start;
		text-align: left;
	}

	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--map {
		grid-column: 2;
		grid-row: 1;
	}

	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--brand {
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
		height: 100%;
		align-items: flex-end;
	}

	.tw-site-footer__col--map {
		justify-self: center;
		width: 100%;
		max-width: 440px;
		min-width: 0;
		height: 100%;
		align-items: flex-start;
		text-align: left;
	}

	/* Two-column footer: keep map toward the right edge of the band. */
	.tw-site-footer__grid--no-contact .tw-site-footer__col--map {
		justify-self: end;
		align-items: stretch;
		text-align: left;
	}

	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--map .tw-home-kicker {
		justify-content: flex-start;
	}

	.tw-site-footer__grid--no-contact .tw-site-footer__col--brand {
		justify-self: start;
		height: 100%;
	}
}

/* Mobile: menu first, map, then logos / webcube. */
@media (max-width: 959px) {
	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--contact {
		order: 1;
	}

	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--map {
		order: 2;
	}

	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--brand {
		order: 3;
	}
}

.tw-site-footer__col--brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: clamp(0.65rem, 1.8vw, 1rem);
	width: fit-content;
	max-width: 100%;
}

@media (min-width: 960px) {
	.tw-site-footer__grid:not(.tw-site-footer__grid--no-contact) .tw-site-footer__col--brand {
		align-items: flex-end;
		text-align: right;
	}

}

.tw-site-footer__col--map {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tw-site-footer__col--contact {
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	text-align: left;
}

.tw-site-footer__primary-nav {
	margin-top: 0.25rem;
	align-self: stretch;
	width: 100%;
	text-align: left;
}

.tw-site-footer__menu--primary {
	align-items: flex-start;
	gap: clamp(0.45rem, 0.9vw, 0.65rem);
	text-transform: uppercase;
	font-size: clamp(0.9rem, 1.15vw, 1.05rem);
	font-weight: 600;
	letter-spacing: 0.12em;
	padding: 0;
	margin: 0;
	list-style: none;
	padding-inline-start: 0;
}

.tw-site-footer__menu--primary li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tw-site-footer__menu--primary a {
	position: relative;
	display: inline-block;
	color: #fff;
	padding-bottom: 4px;
	transition: color 0.2s ease;
}

.tw-site-footer__menu--primary:has(a:hover) a:not(:hover),
.tw-site-footer__menu--primary:has(a:focus-visible) a:not(:focus-visible) {
	color: rgba(255, 255, 255, 0.45);
}

.tw-site-footer__menu--primary a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 2px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: right center;
	transition: transform 0.32s cubic-bezier(0.33, 1, 0.68, 1);
}

.tw-site-footer__menu--primary a:hover::after,
.tw-site-footer__menu--primary a:focus-visible::after {
	transform: scaleX(1);
	transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
	.tw-site-footer__menu--primary a::after {
		transition-duration: 0.01ms;
	}
}

.tw-site-footer__social-row {
	margin-top: clamp(1rem, 2.5vw, 1.5rem);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.55rem;
	width: 100%;
	align-self: stretch;
}

@media (min-width: 960px) {
	.tw-site-footer__col--contact .tw-site-footer__social-row {
		margin-top: auto;
	}
}

.tw-site-footer__hero-logo.tw-hero-logo {
	display: block;
	max-width: 100%;
	line-height: 0;
}

.tw-site-footer .tw-hero-logo__img {
	display: block;
	width: auto;
	height: auto;
	max-height: var(--tw-site-logo-max-height, var(--tw-footer-logo-max-height, clamp(3.35rem, 7.5vw, 4.5rem)));
	max-width: var(--tw-site-logo-max-width, var(--tw-footer-logo-max-width, min(100%, 22rem)));
	object-fit: contain;
	object-position: center;
}

@supports not (width: 1dvw) {
	.tw-site-footer .tw-hero-logo__img {
		max-height: var(--tw-site-logo-max-height-fallback, var(--tw-footer-logo-max-height-fallback, clamp(3.35rem, 7.5vh, 4.5rem)));
	}
}

/* Webcube credit (matches charnallies.co.uk .webcube-link) */
.tw-site-footer .webcube-link {
	margin-top: auto;
	padding-top: clamp(0.35rem, 1vw, 0.65rem);
	line-height: 0;
}

.tw-site-footer .webcube-link a {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 1rem;
	font-weight: 500;
	letter-spacing: -0.04em;
	line-height: 1.875rem;
	color: rgba(255, 255, 255, 0.88);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.2s ease;
}

.tw-site-footer .webcube-link a:hover,
.tw-site-footer .webcube-link a:focus-visible {
	color: #fff;
}

.tw-site-footer .webcube-logo {
	display: inline-block;
	width: auto;
	height: 25px;
	vertical-align: middle;
	transform-origin: center center;
}

@media (prefers-reduced-motion: no-preference) {
	@keyframes tw-webcube-logo-spin {
		to {
			transform: rotate(120deg);
		}
	}

	.tw-site-footer .webcube-link:hover .webcube-logo,
	.tw-site-footer .webcube-link a:hover .webcube-logo,
	.tw-site-footer .webcube-link a:focus-visible .webcube-logo {
		animation: tw-webcube-logo-spin 0.8s ease forwards;
	}
}

.tw-site-footer__address {
	margin: 0 0 0.85rem;
	font-size: 0.88rem;
	line-height: 1.55;
	font-style: normal;
	color: rgba(255, 255, 255, 0.82);
}

.tw-site-footer__map {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.18);
	background: rgba(0, 0, 0, 0.15);
	aspect-ratio: 21 / 9;
	max-height: 200px;
}

.tw-site-footer__map iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	filter: grayscale(1) contrast(1.06) brightness(0.92);
}

.tw-site-footer__nav ul,
.tw-site-footer__menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.tw-site-footer__nav a {
	font-weight: 500;
	font-size: 0.92rem;
	color: rgba(255, 255, 255, 0.95);
	text-decoration: none;
}

.tw-site-footer__nav a:hover,
.tw-site-footer__nav a:focus-visible {
	text-decoration: underline;
}

.tw-site-footer .tw-hero-social {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem;
	align-items: flex-start;
}

.tw-site-footer__col--contact .tw-hero-social {
	justify-content: flex-start;
}

.tw-site-footer .tw-hero-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	border-radius: 12px;
	background: var(--tw-hero-icon-bg);
	border: 1px solid var(--tw-hero-btn-muted-border);
	color: #fff;
	text-decoration: none;
	font-size: 1.05rem;
	transition:
		background 0.2s ease,
		border-color 0.2s ease,
		color 0.2s ease,
		opacity 0.2s ease;
}

.tw-site-footer .tw-hero-social:has(.tw-hero-icon-btn:hover) .tw-hero-icon-btn:not(:hover),
.tw-site-footer .tw-hero-social:has(.tw-hero-icon-btn:focus-visible) .tw-hero-icon-btn:not(:focus-visible) {
	opacity: 0.45;
}

.tw-site-footer .tw-hero-icon-btn:hover,
.tw-site-footer .tw-hero-icon-btn:focus-visible {
	opacity: 1;
	background: rgba(255, 255, 255, 0.2);
	border-color: rgba(255, 255, 255, 0.22);
	color: #fff;
}

.tw-site-footer .tw-hero-icon-btn:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.65);
	outline-offset: 4px;
}

.tw-site-footer__legal {
	margin-top: clamp(1.5rem, 3vw, 2rem);
	padding-top: 1.25rem;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 1rem;
}

.tw-site-footer__legal-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
	justify-content: flex-end;
}

.tw-site-footer__legal-nav a {
	font-size: 0.78rem;
	color: rgba(255, 255, 255, 0.65);
	text-decoration: none;
}

.tw-site-footer__legal-nav a:hover,
.tw-site-footer__legal-nav a:focus-visible {
	color: rgba(255, 255, 255, 0.95);
	text-decoration: underline;
}
