/**
 * Foliora: footer with four widget areas and a bottom bar.
 *
 * Look (Customizer > Footer): Tinted (default), Plain or Dark band; equal
 * columns or a wide first one; the bottom bar split or centred.
 *
 * Widgets can hold any block, so common core blocks are styled here and
 * the template's global list and link rules are reset.
 */

.foliora-footer {
	margin-top: 0;
	background: var(--foliora-surface, #f4f5f9);
	border-top: 1px solid var(--foliora-line, #dfe2ec);
	color: var(--foliora-body, #4a5175);
	font-size: 15px;
	line-height: 1.7;
}

/* ---------- Widget columns ---------- */
.foliora-footer__widgets {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 48px;
	padding: 72px 0 56px;
}

.foliora-footer__widgets--1 { grid-template-columns: minmax(0, 1fr); }
.foliora-footer__widgets--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.foliora-footer__widgets--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.foliora-footer__column {
	min-width: 0;
}

/* Reset the template's sidebar-widget card (style.css: .widget) and its
   section { padding: 50px 0 } (default.css); widgets are <section> elements. */
.foliora-footer .widget {
	position: static;
	overflow: visible;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
}

.foliora-footer .widget + .widget {
	margin-top: 32px;
}

/* A heading added on its own in the block widget editor becomes a separate
   widget. Treat it as the title of the widget below: no gap between them. */
.foliora-footer .widget:has(> .wp-block-heading):not(:has(> :not(.wp-block-heading, .customize-partial-edit-shortcut))) + .widget {
	margin-top: 0;
}

/* Widget titles: classic widgets use .widget-title, block widgets use heading blocks. */
.foliora-footer .widget-title,
.foliora-footer .widget .wp-block-heading,
.foliora-footer .widget h2,
.foliora-footer .widget h3 {
	margin: 0 0 14px;
	font-family: var(--foliora-font-heading);
	font-size: calc(18px * var(--foliora-heading-scale, 1));
	line-height: 1.35;
	font-weight: var(--foliora-heading-weight, 700);
	color: var(--foliora-text, #262f5c);
}

.foliora-footer .widget p {
	margin: 0 0 12px;
	font-size: calc(15px * var(--foliora-text-scale, 1));
	line-height: calc(1.7 + var(--foliora-leading-adjust, 0));
	font-weight: 400;
	color: var(--foliora-body, #4a5175);
}

.foliora-footer .widget p:last-child {
	margin-bottom: 0;
}

/* Links: undo the template's animated underline and padding. */
.foliora-footer a {
	padding-bottom: 0;
	background-image: none;
	color: var(--foliora-text, #262f5c);
	text-decoration: none;
	transition: color 0.2s ease;
}

.foliora-footer a:hover {
	color: var(--foliora-link, #0a6fab);
	background: none;
}

.foliora-footer a:focus-visible {
	outline: 3px solid var(--foliora-link, #0a6fab);
	outline-offset: 3px;
}

/* Lists (menus, categories, archives, latest posts, pages). The template
   makes every "ul li" inline-block with a grey !important colour. */
.foliora-footer .widget ul,
.foliora-footer .widget ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

.foliora-footer .widget li {
	display: block;
	margin: 0 0 10px;
	padding: 0;
	font-size: 15px;
	line-height: 1.5;
	font-weight: 400;
	color: var(--foliora-body, #4a5175) !important;
}

.foliora-footer .widget li:last-child {
	margin-bottom: 0;
}

.foliora-footer .widget li li {
	margin: 10px 0 0;
	margin-inline-start: 16px;
}

.foliora-footer .widget li a {
	font-weight: 500;
}

/* Dates under a title (classic Recent Posts). The Latest Posts block is
   styled in blocks.css. */
.foliora-footer .post-date {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: var(--foliora-muted, #5c6286);
}

/* Images and galleries. */
.foliora-footer .widget img {
	max-width: 100%;
	height: auto;
	border-radius: calc(10px * var(--foliora-corner-scale, 1));
}

/* WordPress sizes each photo from its gap variable, so the variable must
   match the real gap or the last photo of a row wraps (4 columns showed as
   3). Photos keep one size: a short last row does not stretch to fill. */
.foliora-footer .wp-block-gallery {
	--wp--style--gallery-gap-default: 8px;
	gap: 8px;
}

.foliora-footer .wp-block-gallery.has-nested-images figure.wp-block-image {
	flex-grow: 0;
}

.foliora-footer .wp-block-gallery .wp-block-image img {
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

/* Tag cloud: chips. */
.foliora-footer .wp-block-tag-cloud,
.foliora-footer .tagcloud {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.foliora-footer .wp-block-tag-cloud a,
.foliora-footer .tagcloud a {
	display: inline-flex;
	align-items: center;
	height: 34px;
	margin: 0;
	padding: 0 14px;
	border: 1px solid var(--foliora-line-strong);
	border-radius: 999px;
	background: var(--foliora-bg);
	font-size: 13px !important;
	font-weight: 500;
}

/* Search block and form. */
.foliora-footer .wp-block-search__inside-wrapper {
	display: flex;
	gap: 8px;
}

.foliora-footer .wp-block-search__input {
	min-width: 0;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--foliora-field);
	border-radius: calc(10px * var(--foliora-corner-scale, 1));
	background: var(--foliora-bg);
	font-size: 15px;
}

.foliora-footer .wp-block-search__button {
	height: 44px;
	margin: 0;
	padding: 0 18px;
	border: 0;
	border-radius: calc(10px * var(--foliora-corner-scale, 1));
	background: var(--foliora-accent, #262f5c);
	color: var(--foliora-on-accent);
	font-family: var(--foliora-font-heading);
	font-size: 14px;
	font-weight: 600;
}

/* Core social icons block keeps its own colours; just space it. */
.foliora-footer .wp-block-social-links {
	margin: 0;
	gap: 8px;
}

.foliora-footer .wp-block-social-links li {
	display: inline-flex;
	margin: 0;
}

/* ---------- Bottom bar ---------- */
.foliora-footer__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px 24px;
	padding: 24px 0;
	border-top: 1px solid var(--foliora-line, #dfe2ec);
}

/* No widgets: the bottom bar is the whole footer. */
.foliora-footer__widgets + .foliora-footer__bottom {
	border-top: 1px solid var(--foliora-line, #dfe2ec);
}

.foliora-footer > .container > .foliora-footer__bottom:first-child {
	border-top: 0;
}

.foliora-footer .foliora-footer__copy {
	margin: 0;
	font-size: 14px;
	font-weight: 400;
	color: var(--foliora-muted, #5c6286);
}

/* Links in the copyright text (Customizer > Footer > Copyright text) are
   underlined, so they don't rely on colour alone (WCAG 1.4.1). The
   template's sliding background line (default.css) is off. */
.foliora-footer .foliora-footer__copy a {
	padding-bottom: 0;
	background-image: none;
	color: var(--foliora-text);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.foliora-footer .foliora-footer__copy a:hover {
	text-decoration-thickness: 2px;
}

.foliora-social__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.foliora-social__list li {
	display: block;
	margin: 0;
}

.foliora-footer .foliora-social__list a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--foliora-line-strong);
	border-radius: 999px;
	background: var(--foliora-bg);
	color: var(--foliora-text, #262f5c);
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.foliora-social__icon {
	display: block;
	width: 16px;
	height: 16px;
}

.foliora-footer .foliora-social__list a:hover,
.foliora-footer .foliora-social__list a:focus-visible {
	border-color: var(--foliora-accent, #262f5c);
	background: var(--foliora-accent, #262f5c);
	color: var(--foliora-on-accent);
}

/* Icons stay at the end even when the copyright is hidden. */
.foliora-footer__bottom .foliora-social {
	margin-inline-start: auto;
}

/* Footer Menu: one row of small links. With links, they go to the end and
   the icons follow them. Each link is at least 24px tall (target size). */
.foliora-footer-menu__list {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.foliora-footer-menu__list li {
	display: block;
	margin: 0;
}

.foliora-footer .foliora-footer-menu a {
	display: inline-block;
	min-height: 24px;
	font-size: 14px;
	line-height: 24px;
	font-weight: 500;
	color: var(--foliora-body, #4a5175);
}

.foliora-footer .foliora-footer-menu a:hover {
	color: var(--foliora-link, #0a6fab);
}

.foliora-footer__bottom .foliora-footer-menu {
	margin-inline-start: auto;
}

.foliora-footer__bottom .foliora-footer-menu + .foliora-social {
	margin-inline-start: 0;
}

/* ---------- Style: Plain ----------
   The page background with only the hairline on top: for minimal sites. */
.foliora-footer--plain {
	background: var(--foliora-bg, #fff);
}

/* ---------- Style: Dark band ----------
   A deep band made from the accent colour, so Forest gets a deep green
   footer and Crimson a deep red one. Everything inside is built on the
   colour variables, so the variables are set again here for the band:
   white headings, softened body text, faint lines and fields. In dark mode
   the deep accent is used (dark.css), like other large accent areas. */
.foliora-footer--dark {
	--foliora-footer-base: var(--foliora-accent, #262f5c);
	--foliora-footer-bg: color-mix(in srgb, var(--foliora-footer-base) 40%, #0a0b10);
	--foliora-text: #fff;
	--foliora-body: color-mix(in srgb, #fff 80%, var(--foliora-footer-bg));
	--foliora-muted: color-mix(in srgb, #fff 68%, var(--foliora-footer-bg));
	--foliora-link: color-mix(in srgb, var(--foliora-footer-base) 22%, #fff);
	--foliora-line: color-mix(in srgb, #fff 14%, var(--foliora-footer-bg));
	--foliora-line-strong: color-mix(in srgb, #fff 26%, var(--foliora-footer-bg));
	--foliora-field: color-mix(in srgb, var(--foliora-muted) 80%, var(--foliora-bg));
	--foliora-bg: color-mix(in srgb, #fff 6%, var(--foliora-footer-bg));
	--foliora-surface: color-mix(in srgb, #fff 9%, var(--foliora-footer-bg));
	--foliora-faint: color-mix(in srgb, #fff 50%, var(--foliora-footer-bg));
	border-top-color: var(--foliora-footer-bg);
	background: var(--foliora-footer-bg);
	color: var(--foliora-body);
}

/* Links in the band: underline on hover too, the colour change alone is
   small on a dark background. */
.foliora-footer--dark a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.foliora-footer--dark .foliora-social__list a:hover {
	text-decoration: none;
}

/* Filled controls turn white with the band colour as text. */
.foliora-footer--dark .foliora-social__list a:hover,
.foliora-footer--dark .foliora-social__list a:focus-visible {
	border-color: #fff;
	background: #fff;
	color: var(--foliora-footer-bg);
}

.foliora-footer--dark .wp-block-search__button {
	background: #fff;
	color: var(--foliora-footer-bg);
}

/* ---------- Column widths: Wide first ----------
   The first column takes twice the width, for an About text. Its lines
   stay readable on the two-column footer. */
.foliora-footer--wide .foliora-footer__widgets--4 {
	grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
}

.foliora-footer--wide .foliora-footer__widgets--3 {
	grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
}

.foliora-footer--wide .foliora-footer__widgets--2 {
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.foliora-footer--wide .foliora-footer__column:first-child {
	max-inline-size: 560px;
}

/* Two columns on wide screens: 2 : 1 would make the first column longer
   than a comfortable line, so it keeps its readable width and the second
   column starts right after it (no hole between them). */
@media (min-width: 1200px) {
	.foliora-footer--wide .foliora-footer__widgets--2 {
		grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
	}
}

/* ---------- Bottom bar: Centred ----------
   Links, icons and the copyright line stacked in the middle (the order is
   set in foliora_footer_bottom(), so the keyboard follows the screen). */
.foliora-footer--center .foliora-footer__bottom {
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 16px;
	text-align: center;
}

.foliora-footer--center .foliora-footer__bottom .foliora-social,
.foliora-footer--center .foliora-footer__bottom .foliora-footer-menu {
	margin-inline-start: 0;
}

.foliora-footer--center :is(.foliora-social__list, .foliora-footer-menu__list) {
	justify-content: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
	.foliora-footer__widgets,
	.foliora-footer__widgets--3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 40px 32px;
		padding: 56px 0 40px;
	}

	.foliora-footer__widgets--1 {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Wide first: the first column takes a row of its own, the others share
	   the row below (three or two of them). Two columns keep 2 : 1. */
	.foliora-footer--wide .foliora-footer__widgets--4 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.foliora-footer--wide .foliora-footer__widgets--3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.foliora-footer--wide :is(.foliora-footer__widgets--3, .foliora-footer__widgets--4) > .foliora-footer__column:first-child {
		grid-column: 1 / -1;
	}

	/* With menu links the bar no longer fits one row: stack it in order
	   (as on phones) instead of leaving the icons alone on a second row. */
	.foliora-footer__bottom:has(.foliora-footer-menu) {
		flex-direction: column;
		align-items: flex-start;
	}

	.foliora-footer__bottom:has(.foliora-footer-menu) > * {
		margin-inline-start: 0;
	}

	.foliora-footer--center .foliora-footer__bottom {
		align-items: center;
	}
}

@media (max-width: 575px) {
	.foliora-footer__widgets,
	.foliora-footer__widgets--2,
	.foliora-footer__widgets--3 {
		grid-template-columns: minmax(0, 1fr);
		gap: 36px;
		padding: 48px 0 32px;
	}

	.foliora-footer--wide :is(.foliora-footer__widgets--2, .foliora-footer__widgets--3, .foliora-footer__widgets--4) {
		grid-template-columns: minmax(0, 1fr);
	}

	.foliora-footer__bottom {
		flex-direction: column;
		align-items: flex-start;
	}

	/* Centred: at the very end of the page the back-to-top button (45px,
	   20px from the corner) would sit over the centred copyright line, so
	   the bar ends with room for it. Not when the button is hidden on
	   phones. */
	body:has(.foliora-up:not(.foliora-up--wide-only)) .foliora-footer--center .foliora-footer__bottom {
		padding-bottom: 80px;
	}

	/* Stacked: links and icons line up under the copyright. */
	.foliora-footer__bottom .foliora-footer-menu,
	.foliora-footer__bottom .foliora-footer-menu + .foliora-social {
		margin-inline-start: 0;
	}

	.foliora-footer--center .foliora-footer__bottom {
		align-items: center;
	}
}
