/**
 * Kubota Europe site footer.
 *
 * Built from the approved design (Figma `r3kgqCOuXcGPBzXEFeHlgb`, footer node
 * `4516:2133`).
 *
 * SCALE. Same convention as the header (`kbeu-header.css`): the artboard is
 * 2560 px wide, so every size is a `clamp()` whose maximum is the design value
 * and whose `vw` term reaches it right around the artboard width.
 *
 * LAYOUT. On the artboard the content spans 53 → 2509: logo column 53 → 484,
 * link columns 703 → ~1886, social / company column 2105 → 2509, i.e. three
 * tracks of 431 / 1183 / 404 separated by 219 px gutters. The legal links sit
 * under the link columns and the company block under the social icons, both
 * aligned to the bottom of the band. Below the desktop breakpoint the areas
 * stack; that layout is not in the Figma file and follows the same type scale.
 */

/* us-core still prints its `<footer class="l-footer">` with no Reusable Block
   in it (see KubotaEu\Footer\Footer); keep the empty element out of the way. */
.l-footer:empty {
	display: none;
}

.kbeu-footer {
	--kbeu-footer-bg: #f4f4f4;
	--kbeu-footer-ink: #000;
	--kbeu-footer-hover: var( --kbeu-color-teal );
	/* Impreza's `.no-touch a:hover` ties with `.kbeu-footer a:hover` below, wins on load
	   order and paints the link with this variable (see `kbeu-buttons.css`). */
	--color-content-link-hover: var( --kbeu-footer-hover );

	/* Design: 23px bold headings, 20px light links, 25px tagline. */
	--kbeu-footer-fs-heading: clamp( 15px, 0.9vw, 23px );
	--kbeu-footer-fs: clamp( 14px, 0.78vw, 20px );
	--kbeu-footer-fs-tagline: clamp( 16px, 0.98vw, 25px );
	/* Design: 51px side margin, 90px above the content, ~70px below it. */
	--kbeu-footer-pad: clamp( 20px, 2vw, 51px );
	--kbeu-footer-pad-top: clamp( 40px, 3.55vw, 91px );
	--kbeu-footer-pad-bottom: clamp( 32px, 2.8vw, 72px );
	/* Design: 219px gutter between the three tracks. */
	--kbeu-footer-gutter: clamp( 24px, 8.55vw, 219px );
	/* Design: 18px heading → list, 19px between links. */
	--kbeu-footer-gap-heading: clamp( 8px, 0.7vw, 18px );
	--kbeu-footer-gap-links: clamp( 6px, 0.74vw, 19px );
	/* Design: 57.67px social badges, 20.7px apart. */
	--kbeu-footer-social: clamp( 40px, 2.25vw, 58px );
	--kbeu-footer-social-gap: clamp( 10px, 0.81vw, 21px );

	background: var( --kbeu-footer-bg );
	color: var( --kbeu-footer-ink );
	font-family: var( --kbeu-font-principal );
	font-size: var( --kbeu-footer-fs );
	font-weight: 300;
	line-height: 1.56;
}

.kbeu-footer__container {
	display: grid;
	grid-template-columns: minmax( 0, 431fr ) minmax( 0, 1183fr ) minmax( 0, 404fr );
	grid-template-areas:
		"brand columns social"
		"brand legal   company";
	grid-template-rows: auto 1fr;
	column-gap: var( --kbeu-footer-gutter );
	row-gap: clamp( 24px, 1.8vw, 46px );
	max-width: 2560px;
	margin: 0 auto;
	padding: var( --kbeu-footer-pad-top ) var( --kbeu-footer-pad ) var( --kbeu-footer-pad-bottom );
	box-sizing: border-box;
}

.kbeu-footer p,
.kbeu-footer ul {
	margin: 0;
	padding: 0;
}

.kbeu-footer ul {
	list-style: none;
}

.kbeu-footer li {
	margin: 0;
}

.kbeu-footer a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}

.kbeu-footer a:hover,
.kbeu-footer a:focus-visible {
	color: var( --kbeu-footer-hover );
}

.kbeu-footer a:focus-visible {
	outline: 2px solid var( --kbeu-footer-hover );
	outline-offset: 2px;
}

/* --- Brand ----------------------------------------------------------- */

.kbeu-footer__brand {
	grid-area: brand;
}

.kbeu-footer__logo {
	display: inline-block;
	/* Design: 342 × 71. */
	width: clamp( 160px, 13.36vw, 342px );
}

.kbeu-footer__logo-img {
	display: block;
	width: 100%;
	height: auto;
}

.kbeu-footer__logo-text {
	font-size: var( --kbeu-footer-fs-tagline );
	font-weight: 700;
}

.kbeu-footer .kbeu-footer__tagline {
	/* Design: 48px under the logo, 44px between the two 25px lines. */
	margin-top: clamp( 18px, 1.88vw, 48px );
	font-size: var( --kbeu-footer-fs-tagline );
	font-weight: 400; /* Design: Regular. */
	line-height: 1.76;
}

/* --- Link columns ------------------------------------------------------ */

/* `space-between` sets the spacing whenever the columns fit; the gap is only the
   minimum, kept small so the four columns still fit on one line each down to the
   1400px breakpoint. */
.kbeu-footer__columns {
	grid-area: columns;
	display: flex;
	justify-content: space-between;
	gap: clamp( 16px, 1.3vw, 33px );
}

/* The columns keep their natural width on wide screens and wrap their text
   rather than overflow when the track gets tight (just above the breakpoint). */
.kbeu-footer__column {
	min-width: 0;
}

.kbeu-footer__heading {
	margin: 0 0 var( --kbeu-footer-gap-heading );
	padding: 0;
	color: inherit;
	font-family: inherit;
	font-size: var( --kbeu-footer-fs-heading );
	font-weight: 700;
	line-height: 1.68;
	letter-spacing: 0;
}

.kbeu-footer__list {
	display: flex;
	flex-direction: column;
	gap: var( --kbeu-footer-gap-links );
}

/* --- Social ------------------------------------------------------------ */

.kbeu-footer__social {
	grid-area: social;
}

.kbeu-footer__social-list {
	display: flex;
	flex-wrap: wrap;
	gap: var( --kbeu-footer-social-gap );
}

.kbeu-footer__social-link {
	display: block;
	width: var( --kbeu-footer-social );
	height: var( --kbeu-footer-social );
}

.kbeu-footer__social-icon {
	display: block;
	width: 100%;
	height: 100%;
}

.kbeu-footer__social-link:hover .kbeu-footer__social-ring,
.kbeu-footer__social-link:focus-visible .kbeu-footer__social-ring {
	opacity: 1;
}

/* --- Legal row ----------------------------------------------------------- */

.kbeu-footer__legal {
	grid-area: legal;
	align-self: end;
}

.kbeu-footer__legal-list {
	display: flex;
	flex-wrap: wrap;
	/* Design: ~42px between the underlined links. */
	gap: 8px clamp( 16px, 1.64vw, 42px );
}

.kbeu-footer__legal-link {
	text-decoration: underline !important;
	text-underline-position: from-font;
}

/* The DB-IP attribution ships with inline styles for pages without this
   footer; here it joins the legal row. */
.kbeu-footer .kbeu-geo-attribution {
	margin-top: 8px !important;
	padding: 0 !important;
	text-align: left !important;
}

/* --- Company ------------------------------------------------------------- */

.kbeu-footer__company {
	grid-area: company;
	align-self: end;
}

.kbeu-footer__company-name {
	font-size: var( --kbeu-footer-fs-heading );
	font-weight: 700;
	line-height: 1.68;
}

.kbeu-footer .kbeu-footer__copyright {
	/* Design: the line wraps into two at 373px. */
	max-width: 19em;
	margin-top: 4px;
}

/* --- Tablet and mobile ----------------------------------------------------- */

@media ( max-width: 1400px ) {
	.kbeu-footer__container {
		grid-template-columns: minmax( 0, 1fr ) minmax( 0, 1fr );
		grid-template-areas:
			"brand   social"
			"columns columns"
			"legal   company";
		grid-template-rows: auto;
		column-gap: 32px;
		row-gap: 40px;
	}

	.kbeu-footer__columns {
		display: grid;
		grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
		gap: 32px 24px;
	}
}

@media ( max-width: 782px ) {
	.kbeu-footer__container {
		grid-template-columns: minmax( 0, 1fr );
		grid-template-areas:
			"brand"
			"columns"
			"social"
			"company"
			"legal";
		padding-left: 16px;
		padding-right: 16px;
		row-gap: 32px;
	}

	.kbeu-footer__columns {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}
