/*
 * TPM footer v2 (inc/tpm-footer-v2.php) — Hub s677.
 *
 * Layout chosen by references, not by hand (Alex 21.11: the problem is named, the solution is researched):
 *  - Apple (1440): short groups stack inside one column, columns of different height stay tight, no
 *    vertical dividers, one hairline above the legal row  → groups packed in CSS columns (break-inside: avoid).
 *  - Monday (393): the phone keeps two open columns, each stacks its groups on its own → 2 columns on phones,
 *    no table of equal cells. NN/g «Footers 101»: do not collapse a footer of ~30 links → no accordion.
 *  - GitHub (393 / 768): ~40 px link rows on touch screens → tap height 40 px on phones, 32 px on desktop.
 * Dividers: the brand tree lines (rail + rounded elbow per link, as in the header panels and the mobile menu)
 * are the only structure; one hairline between the navigation and the bottom row.
 */

.tpm-foot3 {
	--tf3-bg: #edf1f4;
	--tf3-ink: #23445d;
	--tf3-muted: #4a6478;
	--tf3-line: #8fa9ba;
	--tf3-gap: 48px;
	--tf3-row: 32px;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 48px 32px 28px;
	background: var(--tf3-bg);
	color: var(--tf3-ink);
	font: 400 15px/1.35 Arial, "Helvetica Neue", sans-serif;
	clear: both;
}

.tpm-foot3 *,
.tpm-foot3 *::before,
.tpm-foot3 *::after {
	box-sizing: border-box;
}

.tpm-foot3 a {
	color: inherit;
	text-decoration: none;
}

.tpm-foot3 a:hover .tf3-label,
.tpm-foot3 .tf3-title a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.tpm-foot3 a:focus-visible {
	outline: 3px solid #e0b164;
	outline-offset: 2px;
	border-radius: 4px;
}

.tpm-foot3 ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tpm-foot3 .tf3-wrap {
	max-width: 1280px;
	margin: 0 auto;
}

/* Brand */
.tpm-foot3 .tf3-brand {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px 28px;
	margin: 0 0 36px;
}

.tpm-foot3 .tf3-brand img {
	display: block;
	width: 220px;
	max-width: 100%;
	height: auto;
}

.tpm-foot3 .tf3-brand p {
	margin: 0;
	color: var(--tf3-muted);
	font-size: 16px;
}

/* Navigation zones: the wide group (System with sub-groups) and the flow of the other groups */
.tpm-foot3 .tf3-nav {
	display: block;
}

.tpm-foot3 .tf3-flow {
	column-count: 2;
	column-gap: var(--tf3-gap);
}

.tpm-foot3 .tf3-group {
	break-inside: avoid;
	page-break-inside: avoid;
	display: inline-block; /* keeps a group whole inside a column in every engine */
	width: 100%;
	margin: 0 0 32px;
	vertical-align: top;
}

.tpm-foot3 .tf3-group--wide {
	display: block;
	margin-bottom: 36px;
}

.tpm-foot3 .tf3-title,
.tpm-foot3 .tf3-subtitle {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 6px;
	padding: 0;
	color: var(--tf3-ink);
	font: 700 16px/1.25 Arial, "Helvetica Neue", sans-serif;
	letter-spacing: 0;
	text-transform: none;
}

.tpm-foot3 .tf3-subtitle {
	font-size: 15px;
	margin-top: 4px;
}

.tpm-foot3 .tf3-ico {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	color: #385a72;
}

.tpm-foot3 .tf3-ico svg {
	display: block;
	width: 26px;
	height: 26px;
	fill: none;
}

.tpm-foot3 .tf3-ico svg[data-tpm-nav-icon*="+"],
.tpm-foot3 .tf3-ico svg[viewBox="0 0 62 40"],
.tpm-foot3 .tf3-ico svg[viewBox="0 0 200 160"] {
	width: 34px;
	height: 26px;
}

.tpm-foot3 .tf3-title .tf3-ico svg,
.tpm-foot3 .tf3-subtitle .tf3-ico svg {
	width: 30px;
	height: 28px;
}

.tpm-foot3 .tf3-title .tf3-ico svg[viewBox="0 0 200 160"],
.tpm-foot3 .tf3-title .tf3-ico svg[viewBox="0 0 62 40"] {
	width: 40px;
}

/* Plaque: the group's highlighted first link (no frame lines, a soft card) */
.tpm-foot3 .tf3-plaque {
	display: flex;
	align-items: center;
	gap: 10px;
	width: fit-content;
	max-width: 100%;
	min-height: 40px;
	margin: 6px 0 10px;
	padding: 6px 14px 6px 10px;
	border-radius: 12px;
	background: #fff;
	font-weight: 700;
}

.tpm-foot3 .tf3-plaque .tf3-ico svg {
	width: 40px;
	height: 32px;
}

/* Sub-groups of a wide group */
.tpm-foot3 .tf3-subs {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px var(--tf3-gap);
}

/* Links on a branch: rail + rounded elbow per link, inside the link's tap area */
.tpm-foot3 .tf3-tree {
	margin: 2px 0 0 14px;
}

.tpm-foot3 .tf3-tree > li {
	position: relative;
	padding-left: 22px;
}

.tpm-foot3 .tf3-tree > li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	border-left: 2px solid var(--tf3-line);
}

.tpm-foot3 .tf3-tree > li:last-child::before {
	bottom: auto;
	height: calc(var(--tf3-row) / 2 - 6px);
}

.tpm-foot3 .tf3-tree > li::after {
	content: "";
	position: absolute;
	left: 0;
	top: calc(var(--tf3-row) / 2 - 7px);
	width: 15px;
	height: 8px;
	border-left: 2px solid var(--tf3-line);
	border-bottom: 2px solid var(--tf3-line);
	border-bottom-left-radius: 8px;
}

.tpm-foot3 .tf3-tree--sub {
	margin-left: 10px;
}

.tpm-foot3 .tf3-link {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: var(--tf3-row);
	padding: 4px 0;
	overflow-wrap: break-word;
	hyphens: manual;
}

.tpm-foot3 .tf3-link .tf3-label {
	min-width: 0;
}

.tpm-foot3 .tf3-link[aria-current="page"] .tf3-label {
	font-weight: 700;
}

/* Bottom row: languages + legal; the one hairline of the footer */
.tpm-foot3 .tf3-bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 32px;
	margin-top: 8px;
	padding-top: 18px;
	border-top: 1px solid #c7d5df;
	font-size: 14px;
}

.tpm-foot3 .tf3-langs,
.tpm-foot3 .tf3-legal {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 22px;
}

.tpm-foot3 .tf3-lang {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
}

.tpm-foot3 .tf3-lang[aria-current="true"] {
	font-weight: 700;
}

.tpm-foot3 .tf3-legal .tf3-link {
	min-height: 32px;
	gap: 6px;
}

.tpm-foot3 .tf3-legal .tf3-ico svg {
	width: 22px;
	height: 22px;
}

/* ≥ 900: the flow takes three columns */
@media (min-width: 900px) {
	.tpm-foot3 .tf3-flow {
		column-count: 3;
	}
}

/* ≥ 1200: two zones — the wide groups (sub-groups in columns) left, the other groups stacked right;
   without a wide group the flow takes four columns */
@media (min-width: 1200px) {
	.tpm-foot3 .tf3-nav--split {
		display: grid;
		grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr);
		gap: 0 var(--tf3-gap);
		align-items: start;
	}

	.tpm-foot3 .tf3-nav--split .tf3-flow {
		column-count: 1;
	}

	.tpm-foot3 .tf3-nav:not(.tf3-nav--split) .tf3-flow {
		column-count: 4;
	}
}

/* ≤ 767: tighter, the wide group's sub-groups pack like the rest */
@media (max-width: 767px) {
	.tpm-foot3 {
		--tf3-gap: 28px;
		padding: 36px 20px 24px;
	}

	.tpm-foot3 .tf3-subs {
		display: block;
		column-count: 2;
		column-gap: var(--tf3-gap);
	}

	.tpm-foot3 .tf3-sub {
		break-inside: avoid;
		display: inline-block;
		width: 100%;
		margin-bottom: 16px;
	}
}

/* Phones: two open columns, 40 px tap rows, labels wrap under themselves (never cut) */
@media (max-width: 600px) {
	.tpm-foot3 {
		--tf3-gap: 20px;
		--tf3-row: 40px;
		padding: 32px 14px 20px;
		font-size: 15px;
	}

	.tpm-foot3 .tf3-brand {
		margin-bottom: 28px;
	}

	.tpm-foot3 .tf3-brand img {
		width: 180px;
	}

	.tpm-foot3 .tf3-brand p {
		font-size: 15px;
	}

	.tpm-foot3 .tf3-group {
		margin-bottom: 24px;
	}

	.tpm-foot3 .tf3-tree {
		margin-left: 8px;
	}

	.tpm-foot3 .tf3-tree > li {
		padding-left: 18px;
	}

	.tpm-foot3 .tf3-tree > li::after {
		width: 12px;
	}

	.tpm-foot3 .tf3-link {
		gap: 8px;
		align-items: center;
	}

	.tpm-foot3 .tf3-link .tf3-ico svg {
		width: 22px;
		height: 22px;
	}

	.tpm-foot3 .tf3-link .tf3-ico svg[viewBox="0 0 62 40"],
	.tpm-foot3 .tf3-link .tf3-ico svg[viewBox="0 0 200 160"] {
		width: 30px;
	}

	.tpm-foot3 .tf3-title {
		font-size: 15px;
	}

	.tpm-foot3 .tf3-bottom {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* Very narrow phones (≤ 340): one column rather than broken words */
@media (max-width: 340px) {
	.tpm-foot3 .tf3-flow,
	.tpm-foot3 .tf3-subs {
		column-count: 1;
	}
}
