/* ==========================================================================
   AV-Security — site footer (parts/footer.html)
   Scoped to .av-footer only. Reuses the brand tokens from main.css
   (--av-ink, --av-primary, --av-primary-hover, --av-accent, --av-container).
   Mobile-first: 2-column grid → 3 columns (≥720) → 5 columns (≥1200).
   ========================================================================== */

.av-footer {
	--av-footer-bg: #0a1a2b;                    /* deep navy, a touch below --av-ink */
	--av-footer-text: rgba(203, 216, 232, 0.72); /* muted grey-blue */
	--av-footer-text-strong: #e6edf5;
	--av-footer-line: rgba(203, 216, 232, 0.12);

	background-color: var(--av-footer-bg);
	color: var(--av-footer-text);
	font-size: 0.9375rem;
	line-height: 1.55;
}

/* The template part follows <main> directly — no block-gap strip between
   the last section and the footer. */
.wp-site-blocks > footer.wp-block-template-part {
	margin-block-start: 0;
}

/* Flow-layout block gap is replaced by explicit spacing below. */
.av-footer .wp-block-group > *,
.av-footer .av-footer__grid > * > * {
	margin-block: 0;
}

/* Container: same left/right edges as the homepage sections (.av-container). */
.av-footer__inner {
	box-sizing: border-box;
	width: 100%;
	padding: 3rem var(--wp--preset--spacing--50) 0;
}

@media (min-width: 769px) {
	.av-footer__inner {
		padding-top: 3.5rem;
		padding-inline: max(
			calc(var(--wp--preset--spacing--50) * 3),
			calc((100% - var(--av-container)) / 2 + var(--wp--preset--spacing--50))
		);
	}
}

/* ------------------------------------------------------------------ Grid */
.av-footer__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 2rem 1.5rem;
	padding-bottom: 2.5rem;
}

.av-footer__brand,
.av-footer__company,
.av-footer__contacts {
	grid-column: 1 / -1;
}

/* Mobile: "Компания" spans the row, its links flow in two columns. */
.av-footer .av-footer__company .av-footer__links {
	columns: 2;
	column-gap: 1.5rem;
}

.av-footer__company .av-footer__links li {
	break-inside: avoid;
}

@media (min-width: 720px) {
	.av-footer__company {
		grid-column: auto;
	}

	.av-footer .av-footer__company .av-footer__links {
		columns: auto;
	}

	.av-footer__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 2.5rem 2rem;
		padding-bottom: 4rem;
	}

	.av-footer__brand {
		grid-column: 1 / 3;
	}

	.av-footer__contacts {
		grid-column: 3;
		grid-row: 1;
	}
}

@media (min-width: 1200px) {
	.av-footer__grid {
		grid-template-columns: 1.45fr 1fr 1.05fr 1.2fr 1.25fr;
		gap: 2rem;
		/* Extra height of the footer goes only here, under the columns: the
		   top of the footer stays put, the line + bottom row move down. */
		padding-bottom: 5.625rem;               /* 90px */
	}

	.av-footer__brand,
	.av-footer__contacts {
		grid-column: auto;
		grid-row: auto;
	}

	.av-footer__brand {
		padding-right: 1.5rem;
	}
}

/* ----------------------------------------------------------------- Brand */
/* Dedicated dark-background logo: av-security-logo-footer.webp (white mark,
   red V), tightly cropped from av-security-logo.webp — source box x 93, y 122,
   1972 × 391 of the 2103 × 565 original. --av-footer-logo-h stays the height
   the FULL original would render at, so the wordmark keeps its size; the
   1/565 margins keep it exactly on the column's top/left edges (the original's
   123/94 content edges, as in the header's --av-logo-trim-*). */
.av-footer__logo {
	--av-footer-logo-h: 4.5rem;

	display: inline-block;
	margin-top: calc(var(--av-footer-logo-h) * -1 / 565);
	margin-left: calc(var(--av-footer-logo-h) * -1 / 565);
	line-height: 0;
	border-radius: 2px;
}

.av-footer__logo-img {
	display: block;
	width: auto;
	height: calc(var(--av-footer-logo-h) * 391 / 565);
}

.av-footer .av-footer__lead {
	max-width: 22rem;
	margin-top: 1.25rem;
	color: var(--av-footer-text);
}

/* The «в …» region phrase can be empty (bare "other" region): drop the
   wrapper with its leading space so the sentence ends right after «объектов». */
.av-footer__region-in:has(> [data-av-region-field]:empty) {
	display: none;
}

.av-footer .av-footer__meta {
	margin-top: 1rem;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
}

.av-footer__meta li + li {
	margin-top: 0.25rem;
}

/* ---------------------------------------------------------- Link columns */
/* Column headings: white, compact caps, with a short red brand dash. */
.av-footer .av-footer__title {
	position: relative;
	margin-bottom: 1.1rem;
	padding-bottom: 0.7rem;
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.av-footer__title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 1.5rem;
	height: 2px;
	background-color: var(--av-accent);
}

.av-footer .av-footer__links {
	margin: 0;
	padding: 0;
	list-style: none;
}

.av-footer__links li + li {
	margin-top: 0.55rem;
}

.av-footer a {
	color: var(--av-footer-text);
	text-decoration: none;
	transition: color 0.2s ease;
}

.av-footer__links a,
.av-footer__legal a {
	text-decoration-line: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.av-footer__links a:hover,
.av-footer__links a:focus-visible,
.av-footer__legal a:hover,
.av-footer__legal a:focus-visible {
	color: #fff;
	text-decoration-color: var(--av-accent);
}

.av-footer a:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
	border-radius: 2px;
}

/* -------------------------------------------------------------- Contacts */
.av-footer__contact-list {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	font-style: normal;
}

.av-footer .av-footer__phone {
	color: #fff;
	font-size: 1.25rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.3;
	white-space: nowrap;
}

.av-footer .av-footer__email {
	color: var(--av-footer-text-strong);
}

.av-footer .av-footer__phone:hover,
.av-footer .av-footer__email:hover {
	color: #fff;
	text-decoration: underline;
	text-decoration-color: var(--av-accent);
	text-underline-offset: 0.3em;
}

.av-footer__area {
	font-size: 0.875rem;
}

/* Office address → Яндекс Карты. Reads as plain contact text: muted colour,
   no underline; only a slight lightening on hover. Focus ring comes from the
   shared `.av-footer a:focus-visible` rule. */
.av-footer .av-footer__address {
	align-self: flex-start;
	color: var(--av-footer-text);
	text-decoration: none;
	cursor: pointer;
}

.av-footer .av-footer__address:hover,
.av-footer .av-footer__address:focus-visible {
	color: var(--av-footer-text-strong);
}

/* ------------------------------------------------------------ Bottom row */
.av-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem 1.5rem;
	padding-block: 1.25rem;
	border-top: 1px solid var(--av-footer-line);
	font-family: inherit;
	font-size: 0.8125rem;                       /* 13px */
	font-weight: 400;
	line-height: 1.55;
	letter-spacing: normal;
	color: rgba(203, 216, 232, 0.62);           /* 5.4:1 on --av-footer-bg */
}

/* Licence: type and colour are inherited from .av-footer__bottom. Narrow
   screens: it follows the copyright in the wrapping flex row (stacked on
   phones). From 900px: three-zone grid with equal side columns, so the
   licence is centred on the whole container, not on the gap between the
   copyright and the privacy link. */
.av-footer__license {
	margin-right: auto;
	overflow-wrap: anywhere;
}

@media (min-width: 900px) {
	.av-footer__bottom {
		display: grid;
		grid-template-columns: 1fr auto 1fr;
	}

	.av-footer__copy {
		justify-self: start;
	}

	.av-footer__license {
		justify-self: center;
		margin-right: 0;
		text-align: center;
	}

	.av-footer__legal {
		justify-self: end;
	}
}

/* One type style for the whole legal row: ©, licence and the privacy link
   take font, size, weight, line-height, spacing and colour from
   .av-footer__bottom — the link is no brighter than the text around it and
   only lights up (white + red underline) on hover / focus. */
.av-footer__bottom > *,
.av-footer .av-footer__bottom a {
	font-family: inherit;
	font-size: inherit;
	font-weight: 400;
	line-height: inherit;
	letter-spacing: inherit;
	color: inherit;
}

.av-footer .av-footer__bottom a:hover,
.av-footer .av-footer__bottom a:focus-visible {
	color: #fff;
}

@media (prefers-reduced-motion: reduce) {
	.av-footer a {
		transition: none;
	}
}
