/**
 * Footer design: Wave — .esptb-ft-wave
 *
 * A layered wavy edge above the footer, then one centred axis: brand, a row
 * of links, category chips, contact chips beside the socials; a centred
 * bottom bar with the back-to-top button riding on its top edge.
 *
 * The wave: the root keeps a top margin (--wv-h) and the decorative SVG is
 * painted into it. That margin collapses out through the block and the
 * site-footer wrapper, so whatever is behind the page shows above the
 * curve and the page itself ends in a wave. Every colour, font and size
 * comes from the kit tokens (the theme's settings) unless the block sets
 * its own.
 */

/* ------------------------------------------------------------ wave edge */

.espt-block-footer .esptb-ft.esptb-ft-wave {
	--wv-h: clamp(34px, 5.2vw, 72px);
	--wv-tint: color-mix(in srgb, var(--ftc-accent) 10%, transparent);
	--wv-rim: color-mix(in srgb, var(--ftc-accent) 30%, transparent);
	margin-top: var(--wv-h);
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-edge {
	bottom: calc(100% - 1px);
	height: var(--wv-h);
	left: 0;
	line-height: 0;
	pointer-events: none;
	position: absolute;
	right: 0;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-edge svg {
	display: block;
	height: 100%;
	max-width: none;
	width: 100%;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-l1 { fill: color-mix(in srgb, var(--ftc-accent) 16%, var(--ftc-bg)); }
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-l2 { fill: color-mix(in srgb, var(--ftc-accent) 42%, var(--ftc-bg)); }
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-l3 { fill: var(--ftc-bg); }

/* ------------------------------------------------------------- the axis */

/* The back-to-top button rides up into the body's bottom padding. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-body.has-totop { padding-bottom: calc(var(--ft-pad, var(--fk-pad-r)) + 14px); }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-stack {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: calc(var(--ftc-gap) * 1.1);
	text-align: center;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-stack > * {
	max-width: 100%;
	min-width: 0;
	width: 100%;
}

/* Brand. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-brand {
	align-items: center;
	display: flex;
	flex-direction: column;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-brand .esptb-ft-logo img { object-position: center; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-brand .esptb-ft-about {
	margin: 16px auto 0;
	max-width: 58ch;
	text-wrap: pretty;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-brand .esptb-ft-about:first-child { margin-top: 0; }

/* Group titles: centred, with a small squiggle under them. The social
   label is dressed the same way, so the two groups read as a pair. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-stack .esptb-ft-title,
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-social .esptb-ft-social-h {
	align-items: center;
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0 0 16px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-social .esptb-ft-social-h {
	color: var(--ftc-heading);
	font-family: var(--fk-display);
	font-size: var(--ft-title-size, var(--fk-title-size));
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.35;
	opacity: 1;
	text-transform: var(--fk-title-tt);
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-stack .esptb-ft-title::after,
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-social .esptb-ft-social-h::after {
	background: var(--ftc-accent-ink);
	content: "";
	flex: none;
	height: 8px;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 8' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M1.5 4c3-3.2 6-3.2 9 0s6 3.2 9 0 6-3.2 9 0 6 3.2 9 0'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 8' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M1.5 4c3-3.2 6-3.2 9 0s6 3.2 9 0 6-3.2 9 0 6 3.2 9 0'/%3E%3C/svg%3E") center / contain no-repeat;
	width: 40px;
}

/* The row of links: a small accent dot before each one. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 28px;
	justify-content: center;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-links {
	gap: 2px 28px;
	max-width: 100%;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-links li {
	align-items: center;
	display: flex;
	gap: 9px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-links li::before {
	background: var(--ftc-accent);
	border-radius: 50%;
	content: "";
	flex: none;
	height: 6px;
	opacity: 0.75;
	width: 6px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-links a {
	display: inline-block;
	font-weight: 600;
	padding: 5px 0;
}

/* Category chips. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
	list-style: none;
	margin: 0;
	padding: 0;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-chips li {
	margin: 0;
	max-width: 100%;
	min-width: 0;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-chips a {
	align-items: center;
	background: var(--wv-tint);
	border: 1px solid var(--wv-rim);
	border-radius: 999px;
	color: var(--ftc-heading);
	display: inline-flex;
	font-weight: 600;
	justify-content: center;
	line-height: 1.3;
	max-width: 100%;
	min-height: 40px;
	padding: 8px 18px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-chips a:hover {
	background: var(--ftc-fill);
	border-color: var(--ftc-fill);
	color: var(--ftc-on-fill);
	transform: translateY(-1px);
}

/* Contact chips + socials: one pair of groups. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-reach {
	display: flex;
	flex-direction: column;
	gap: calc(var(--ftc-gap) * 1.1);
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-contact.is-chips { justify-content: center; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-contact.is-chips .esptb-ft-crow {
	background: transparent;
	border: 1px solid var(--wv-rim);
	max-width: 100%;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-contact.is-chips a.esptb-ft-crow:hover { background: var(--wv-tint); }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-crow-v { font-weight: 600; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-addr {
	align-items: center;
	margin-top: 12px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-addr:first-child { margin-top: 0; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-wv-addr .esptb-ft-crow {
	align-items: center;
	color: var(--ftc-muted);
	gap: 6px;
	justify-content: center;
	min-height: 32px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-wv-addr a.esptb-ft-crow:hover { color: var(--ftc-link-h); }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-addr .esptb-ft-crow .esptb-ft-ic {
	background: transparent;
	color: var(--ftc-accent-ink);
	height: auto;
	width: auto;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-wv-addr .esptb-ft-crow-t { padding-top: 0; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-social {
	align-items: center;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-social .esptb-ft-social { justify-content: center; }

/* ----------------------------------------------------------- bottom bar */

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom { position: relative; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-bottom-in {
	flex-direction: column;
	flex-wrap: nowrap;
	gap: 10px;
	justify-content: center;
	text-align: center;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom.has-top .esptb-ft-bottom-in { padding-top: 36px; }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-bottom-l,
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-bottom-r {
	justify-content: center;
	margin-left: 0;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-policy { justify-content: center; }

/* The back-to-top button: a solid bubble — riding on the bar's top edge
   under a body band, else simply ending the bar. */
.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-totop {
	background: var(--ftc-fill);
	border-color: var(--ftc-fill);
	color: var(--ftc-on-fill);
	height: 44px;
	width: 44px;
}

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-totop:hover { filter: brightness(1.1); }

.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom.has-top > .esptb-ft-totop {
	box-shadow: 0 0 0 6px var(--ftc-bg);
	left: 0;
	margin: 0 auto;
	position: absolute;
	right: 0;
	top: -22px;
	z-index: 1;
}

/* ---------------------------------------------------------------- phones */

@media (max-width: 767px) {
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-links a,
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-policy a,
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-credit a {
		align-items: center;
		display: inline-flex;
		min-height: 40px;
		padding: 0;
	}

	/* A wrapping policy row must never leave a divider hanging at a line
	   end — on phones the links are spaced by the gap alone. */
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-policy { gap: 0 20px; }
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-bottom .esptb-ft-policy li::after { display: none; }

	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-contact .esptb-ft-wv-addr .esptb-ft-crow { min-height: 40px; }

	.espt-block-footer .esptb-ft-wave a.esptb-ft-soc {
		min-height: 40px;
		min-width: 40px;
	}

	/* Folded: the categories become one rounded, tap-to-open card. */
	.espt-block-footer .esptb-ft-wave.is-folded .esptb-ft-wv-cats.is-foldable {
		background: color-mix(in srgb, var(--ftc-accent) 6%, transparent);
		border: 1px solid var(--wv-rim);
		border-radius: calc(var(--ftc-radius) * 1.6);
		padding: 0 14px;
	}

	.espt-block-footer .esptb-ft-wave.is-folded .esptb-ft-wv-cats.is-foldable .esptb-ft-title {
		display: block;
		margin: 0;
	}

	.espt-block-footer .esptb-ft-wave.is-folded .esptb-ft-wv-cats.is-foldable .esptb-ft-title::after { display: none; }

	.espt-block-footer .esptb-ft-wave.is-folded .esptb-ft-wv-cats .esptb-ft-toggle { justify-content: center; }

	.espt-block-footer .esptb-ft-wave.is-folded .esptb-ft-wv-cats .esptb-ft-panel { padding: 2px 0 16px; }
}

/* ------------------------------------------------------- tablets and up */

@media (min-width: 768px) {
	/* Contact | socials side by side — a centred pair, titles level, split
	   by a hairline. */
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-reach.has-2 {
		display: grid;
		gap: 0;
		grid-template-columns: minmax(0, auto) minmax(0, auto);
		justify-content: center;
	}

	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-reach.has-2 > * {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		padding: 4px clamp(20px, 4vw, 56px);
	}

	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-reach.has-2 > * + * { border-left: 1px solid var(--ftc-line); }
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
	.espt-block-footer .esptb-ft-wave .esptb-ft-wv-chips a:hover { transform: none; }
}
