/**
 * CFUL 2026 — Footer
 *
 * 4-column site footer on the dark band (#0C0C0C) with light text,
 * matching Figma node 421:1643. All colors/spacing/type come from
 * assets/css/tokens.css custom properties.
 */

.cful-site-footer,
.cful-footer {
	background: var(--color-footer-bg);
	color: var(--color-footer-text);
}

.cful-footer__inner {
	display: grid;
	gap: var(--space-7);
	grid-template-columns: 1.6fr 1fr 1.2fr auto;
	margin: 0 auto;
	padding: var(--space-7) var(--container-pad);
}

.cful-footer__col {
	color: var(--color-footer-text);
	font-family: var(--font-sans);
}

/* Column 1 — about + EU funding logos */

.cful-footer__brand {
	display: block;
	margin: 0 0 var(--space-7);
}

.cful-footer__brand-img {
	display: block;
	width: auto;
	height: 1.625rem;
	margin-block: 0.25rem;
}

.cful-footer__funding-logos {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-6);
	margin-bottom: var(--space-5);
	max-width: 21.25rem; /* 340px */
}

/* Each group (academic, then funding trio) is one wrapping row of logos. */
.cful-footer__funding-group {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-6);
}

.cful-footer__funding-logo {
	height: 1.25rem; /* 20px — SVGs have no intrinsic size, so pin height and let width scale from the viewBox */
	width: auto;
}

.cful-footer__funding-caption {
	color: var(--color-footer-text);
	font-size: var(--text-2xs);
	margin: var(--space-5) 0 0;
	max-width: 21.25rem; /* 340px */
}

/* Columns 2 & 3 — contact / archive blocks */

.cful-footer__block {
	margin-top: var(--space-5);
}

.cful-footer__label {
	color: var(--color-footer-label);
	font-size: var(--text-xs);
	font-weight: var(--fw-medium);
	letter-spacing: 0.04em;
	margin: 0 0 var(--space-2);
	opacity: 0.6;
	text-transform: uppercase;
}

.cful-footer__col--contact > .cful-footer__label,
.cful-footer__col--archive > .cful-footer__label {
	margin-bottom: var(--space-6);
}

.cful-footer__label a,
.cful-footer__value a {
	color: inherit;
	text-decoration: none;
}

.cful-footer__label a:hover,
.cful-footer__label a:focus,
.cful-footer__value a:hover,
.cful-footer__value a:focus {
	text-decoration: underline;
}

.cful-footer__value {
	color: var(--color-footer-text);
	font-size: var(--text-footer);
	line-height: var(--leading-snug);
	margin: 0;
}

/* Column 4 — back to top */

.cful-footer__col--top {
	display: flex;
	justify-content: flex-start;
}

.cful-back-to-top {
	align-items: center;
	color: var(--color-footer-text);
	display: flex;
	justify-content: center;
	height: 1.5rem;
	width: 1.5rem;
}

.cful-back-to-top__arrow {
	color: var(--color-primary-contrast);
	font-size: var(--text-lg);
	line-height: 1;
	padding: 0.25rem;
}

.cful-back-to-top:hover .cful-back-to-top__arrow,
.cful-back-to-top:focus .cful-back-to-top__arrow {
	text-decoration: none;
}

/* -------------------------------------------------------------------- */
/* Columnar layouts (≥ --bp-sm): grid stretches columns to equal height, */
/* so pin each column's lower content to the bottom, ≥ --space-9 clear   */
/* of the top content. Inert below 37.5em (columns become display:contents). */
/* -------------------------------------------------------------------- */

@media (min-width: 37.5em) {
	/* --bp-sm 600px */
	.cful-footer__col--about,
	.cful-footer__col--contact,
	.cful-footer__col--archive {
		display: flex;
		flex-direction: column;
	}

	/* minimum clear space before the pinned block */
	.cful-footer__brand {
		margin-bottom: var(--space-9);
	}

	.cful-footer__col--contact > .cful-footer__label,
	.cful-footer__col--archive > .cful-footer__label {
		margin-bottom: var(--space-9);
	}

	/* pin the lower content to the bottom of its column */
	.cful-footer__funding-logos {
		margin-top: auto;
		margin-bottom: 0; /* caption's own top margin sets the gap; flex won't collapse it */
	}

	.cful-footer__col--contact > .cful-footer__block:first-of-type, /* Contact us + phone */
	.cful-footer__col--archive > .cful-footer__block:first-of-type {
		/* Address */
		margin-top: auto;
	}
}

/* -------------------------------------------------------------------- */
/* Responsive collapse (~900px and below)                               */
/* -------------------------------------------------------------------- */

@media (max-width: 56.25em) {
	/* --bp-md 900px */
	.cful-footer__inner {
		grid-template-columns: 1fr 1fr;
	}

	.cful-footer__col--top {
		grid-column: 1 / -1;
		justify-content: flex-end;
	}
}

@media (max-width: 37.5em) {
	/* --bp-sm 600px */
	/* Single column, reordered to the Figma mobile flow. The column wrappers are
	   dissolved with display:contents so their blocks become direct flex items and
	   can be reordered across columns — no markup or content changes required. */
	.cful-footer__inner {
		display: flex;
		flex-direction: column;
		gap: var(--space-6); /* ≈ Figma 31px between sections */
	}

	.cful-footer__col {
		display: contents;
	}

	.cful-footer__brand {
		order: 1;
		margin-bottom: 0;
	}

	.cful-footer__brand-img {
		height: 2.5rem;
	}

	.cful-footer__col--contact .cful-footer__block {
		/* phone, email */
		order: 2;
		margin-top: 0;
	}

	.cful-footer__col--archive .cful-footer__block {
		/* address */
		order: 3;
		margin-top: 0;
	}

	.cful-footer__col--contact > .cful-footer__label {
		/* USER LOGIN */
		order: 4;
	}

	.cful-footer__col--archive > .cful-footer__label {
		/* ARCHIVE */
		order: 5;
	}

	.cful-footer__funding-logos {
		order: 6;
		margin-bottom: 0;
	}

	.cful-footer__funding-caption {
		order: 7;
		/* cancel the flex gap so the caption sits tight under the logo grid */
		margin-top: calc(var(--space-2) - var(--space-6));
	}

	.cful-back-to-top {
		order: 8;
		align-self: flex-end;
	}

	/* drop the desktop label spacing that fights the flex gap */
	.cful-footer__col--contact > .cful-footer__label,
	.cful-footer__col--archive > .cful-footer__label {
		margin-bottom: 0;
	}

	/* mobile-only full-viewport-width hairline dividers above the login/archive
	   and partner-logo groups. Negative inline margin bleeds the border to both
	   viewport edges (below --container-max the carousel's max() gutter term is
	   0, so --container-pad is the whole offset); the matching inline padding
	   restores content alignment with the rest of the footer. */
	.cful-footer__col--contact > .cful-footer__label,
	.cful-footer__funding-logos {
		border-top: 1px solid #fff8f3;
		margin-inline: calc(var(--container-pad) * -1);
		padding-top: var(--space-6);
		padding-inline: var(--container-pad);
	}

	/* The label's default opacity: 0.6 would dim its full-strength divider
	   border too (compositing #fff8f3 to ~#9e9a97). Express the 60% dim as a
	   text-color alpha instead — visually identical text, full-color border.
	   Value matches --color-footer-label #d4d5d9 = rgb(212, 213, 217). */
	.cful-footer__col--contact > .cful-footer__label {
		opacity: 1;
		color: rgba(212, 213, 217, 0.6);
	}

	/* partner logos: let the two rows span the full column width on mobile */
	.cful-footer__funding-logos {
		max-width: none;
	}
}
