/**
 * Site footer: widget columns, footer navigation, and the copyright bar
 * (04-content-areas/02-footer-system.md §2-5).
 *
 * The footer renders on every page, so it is enqueued unconditionally by
 * Kivora\Assets\Manager (04-css-architecture.md §5).
 */

.kivora-site-footer {
	margin-block-start: var(--kivora-spacing-xl);
	padding-block: var(--kivora-spacing-lg);
	border-block-start: 1px solid color-mix(in srgb, var(--kivora-color-border-muted) 30%, transparent);
}

/* Matches the header: footer columns line up with the page content above
   them, which uses the wide container. */
.kivora-site-footer .kivora-container {
	max-width: var(--wp--style--global--wide-size, 1200px);
}

/*
 * Auto-fit grid: the rendered column count follows how many footer widget
 * areas the user filled, so no count is hardcoded (§3, §8).
 */
.kivora-footer-widgets {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
	gap: var(--kivora-spacing-lg);
	margin-block-end: var(--kivora-spacing-lg);
}

.kivora-footer-widgets__column {
	display: flex;
	flex-direction: column;
	gap: var(--kivora-spacing-md);
}

/* Bottom bar: navigation and copyright side by side once there is room. */
.kivora-footer-bottom {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--kivora-spacing-sm);
	text-align: center;
}

@media (min-width: 600px) {
	.kivora-footer-bottom {
		flex-direction: row;
		justify-content: space-between;
		text-align: start;
	}
}

.kivora-footer-nav__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--kivora-spacing-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.kivora-footer-nav__list a {
	color: var(--kivora-color-foreground);
	text-decoration: none;
}

.kivora-footer-nav__list a:hover,
.kivora-footer-nav__list a:focus-visible {
	color: var(--kivora-color-primary);
	text-decoration: underline;
}

.kivora-copyright {
	margin: 0;
	font-size: var(--kivora-font-size-small);
	color: var(--kivora-color-border-muted);
}

/*
 * Back to top: fixed in the bottom corner, revealed by script past the
 * first screen (the hidden attribute keeps it out of the tab order until
 * then). Same round treatment as the slider arrows.
 */
.kivora-back-to-top {
	position: fixed;
	inset-inline-end: var(--kivora-spacing-md);
	bottom: var(--kivora-spacing-md);
	z-index: 600;
	width: 3rem;
	height: 3rem;
	border: 2px solid var(--kivora-color-background);
	border-radius: 50%;
	background: var(--kivora-color-primary);
	color: var(--kivora-color-background);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
}

.kivora-back-to-top:hover,
.kivora-back-to-top:focus-visible {
	background: var(--kivora-color-secondary);
	border-color: var(--kivora-color-secondary);
	color: var(--kivora-color-foreground);
}

/*
 * The resting drop shadow above has the same specificity as the global
 * :focus-visible ring and loads later, so it replaced the ring's dark outer
 * band. Put the band back, keeping the shadow underneath it.
 */
.kivora-back-to-top:focus-visible {
	box-shadow: 0 0 0 4px var(--kivora-color-foreground), 0 2px 8px rgb(0 0 0 / 20%);
}

.kivora-back-to-top[hidden] {
	display: none;
}
