/**
 * Revita: footer parts (footer.html, footer-minimal.html).
 * Purple footer with a honey drip on its top edge, four columns (brand, two menus,
 * contact details bound to revita/site-info), trust strip, night-purple bottom bar
 * and the optional floating cart button (printed by inc/floating-cart.php; its
 * add-to-cart bump is in the motion system). Menu, phone and e-mail links are 44px
 * tall tap targets. Words never break inside: headings and the e-mail keep their words
 * whole (the e-mail may wrap only after "@", see revita_mail_link_break() in inc/setup.php),
 * and from 782 to 1023px the brand column sits above the other three, which would be too
 * narrow beside it.
 *
 * @package Revita
 */

/* The footer starts where the content ends (no global block gap above it). */
.wp-site-blocks > .wp-block-template-part:has(> :is(.revita-footer, .revita-footer-minimal)) {
	margin-block-start: 0;
}

.revita-footer {
	color: var(--wp--preset--color--base);
	overflow-x: clip;
}

/* Honey drip over the top edge (shape and colour from is-style-honey-drip). */
.revita-footer > .revita-footer__drip {
	position: relative;
	z-index: 1;
	margin-block: 0 calc(-1 * var(--wp--preset--spacing--40));
}

.revita-footer__main {
	background-image: url("../../images/honeycomb.svg");
	background-size: 84px 48px;
}

.wp-block-heading.revita-footer__heading {
	position: relative;
	margin-block: 0 var(--wp--preset--spacing--30);
	padding-block-end: 0.7em;
	color: var(--wp--preset--color--base);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	/* One-word headings: never split inside the word (core columns and global.css let long
	 * words break anywhere). */
	overflow-wrap: normal;
	word-break: normal;
	-webkit-hyphens: manual;
	hyphens: manual;
}

.revita-footer__heading::after {
	content: "";
	position: absolute;
	inset-block-end: 0;
	inset-inline-start: 0;
	inline-size: 1.75rem;
	block-size: 3px;
	border-radius: 3px;
	background-color: var(--wp--preset--color--accent);
}

/* Brand column: logo (or the title as a honey wordmark), about text, socials. */
.wp-block-column.revita-footer__brand > * + * {
	margin-block-start: var(--wp--preset--spacing--30);
}

.revita-footer .wp-block-site-logo img {
	display: block;
	block-size: auto;
	filter: drop-shadow(0 10px 20px color-mix(in srgb, var(--wp--preset--color--primary-dark) 45%, transparent));
}

/* The title is the wordmark only while no logo is set. A long name ("Ревита Македонија")
 * wraps between its words onto balanced lines and never past the column. */
.revita-footer__title {
	max-inline-size: 100%;
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.02em;
	overflow-wrap: break-word;
	text-transform: lowercase;
	text-wrap: balance;
	color: var(--wp--preset--color--accent);
}

/* With a logo, its home link already carries the name (the logo's alt text). */
.revita-footer__brand:has(.wp-block-site-logo img) .revita-footer__title {
	display: none;
}

.revita-footer__about {
	max-inline-size: 30rem;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.7;
}

.revita-footer .revita-footer__social .wp-social-link a {
	display: grid;
	place-items: center;
	inline-size: 2.75rem;
	block-size: 2.75rem;
	padding: 0;
	border: 1.5px solid color-mix(in srgb, var(--wp--preset--color--accent) 70%, transparent);
	border-radius: 50%;
}

.revita-footer .revita-footer__social .wp-social-link a:hover {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--primary-deep);
}

/* Menus: sentence case, white, honey on hover; each link is a 44px tap target. */
.revita-footer .revita-footer__menu {
	gap: 0;
	font-family: var(--wp--preset--font-family--body);
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
}

/* A link that wraps onto two lines keeps its lines close together and stays apart from the
 * next link (single-line links are still 44px rows with the text in the middle). */
.revita-footer .revita-footer__menu .wp-block-navigation-item__content {
	display: inline-flex;
	box-sizing: border-box;
	align-items: center;
	min-block-size: 44px;
	padding-block: 0.375rem;
	line-height: 1.35;
	text-underline-offset: 0.25em;
}

/* Phones and touch screens: a short link ("Блог") is 44px wide too, not only 44px tall. */
@media (max-width: 781.98px), (pointer: coarse) {
	.revita-footer .revita-footer__menu .wp-block-navigation-item__content {
		min-inline-size: 2.75rem;
	}
}

.revita-footer :is(.revita-footer__menu .wp-block-navigation-item__content, .revita-footer__link .wp-block-button__link):hover {
	color: var(--wp--preset--color--accent);
	text-decoration: underline;
}

/* Contact: bound buttons reset to links; honey icons drawn with masks. */
.wp-block-column.revita-footer__contact > * {
	margin-block: 0 var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--small);
}

.revita-footer__contact p,
.revita-footer__bottom p {
	margin: 0;
}

/* Call and e-mail links: 44px rows, stacked without gaps. */
.revita-footer .wp-block-buttons.revita-footer__links {
	gap: 0;
	margin-block-end: 0;
}

.revita-footer .revita-footer__link .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
	padding: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font-family: var(--wp--preset--font-family--body);
	font-size: inherit;
	letter-spacing: 0;
	text-align: start;
	text-underline-offset: 0.25em;
	/* Core lets button text break anywhere; numbers and the e-mail stay whole. */
	overflow-wrap: normal;
	word-break: normal;
}

.revita-footer .revita-icon {
	position: relative;
	padding-inline-start: 2rem;
}

.revita-footer .revita-icon::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	inset-block-start: 0.15em;
	inline-size: 1.25rem;
	block-size: 1.25rem;
	background-color: var(--wp--preset--color--accent);
	-webkit-mask: var(--revita-icon-mask) center / contain no-repeat;
	mask: var(--revita-icon-mask) center / contain no-repeat;
}

/* On link rows the icon sits beside the first 44px row. */
.revita-footer .revita-footer__links.revita-icon::before {
	inset-block-start: calc(22px - 0.625rem);
}

.revita-footer .revita-icon--phone { --revita-icon-mask: url("../../images/icons/phone.svg"); }
.revita-footer .revita-icon--mail { --revita-icon-mask: url("../../images/icons/mail.svg"); }
.revita-footer .revita-icon--pin { --revita-icon-mask: url("../../images/icons/pin.svg"); }
.revita-footer .revita-icon--clock { --revita-icon-mask: url("../../images/icons/clock-24.svg"); }
.revita-footer .revita-icon--cash { --revita-icon-mask: url("../../images/icons/cash.svg"); }
.revita-footer .revita-icon--truck { --revita-icon-mask: url("../../images/icons/truck.svg"); }

/* Trust strip. */
.wp-block-group.revita-footer__trust {
	margin-block-start: var(--wp--preset--spacing--60);
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--base) 18%, transparent);
	border-radius: var(--wp--custom--radius--xl);
	background-color: color-mix(in srgb, var(--wp--preset--color--primary-dark) 28%, transparent);
}

.revita-footer .revita-footer__trust-item {
	margin: 0;
	padding-inline-start: 2.1rem;
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
}

.revita-footer .revita-footer__trust-item::before {
	inset-block-start: calc(50% - 0.7rem);
	inline-size: 1.4rem;
	block-size: 1.4rem;
}

/* Bottom bar. */
.revita-footer__bottom {
	color: color-mix(in srgb, var(--wp--preset--color--base) 85%, transparent);
}

.revita-footer__made::before {
	content: "";
	display: inline-block;
	inline-size: 0.75em;
	block-size: 0.65em;
	margin-inline-end: 0.5em;
	background-color: var(--wp--preset--color--accent);
	clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

/* Floating cart: round purple button, bottom right, only with the option on
 * (inc/floating-cart.php prints it after the footer; it is not in the Site Editor).
 * <body> carries the option class "revita-floating-cart" too, so every selector
 * reaches the group as a descendant ("body .revita-floating-cart"), never body itself. */
body .revita-floating-cart {
	display: none;
}

body.revita-floating-cart .revita-floating-cart {
	display: block;
	position: fixed;
	inset-block-end: max(20px, env(safe-area-inset-bottom));
	inset-inline-end: 20px;
	z-index: var(--wp--custom--z--floating, 60);
	margin: 0;
}

/* The reCAPTCHA badge (Contact Form 7) sits in the same corner: lift the button above it.
 * Not where revita-core prints Google's notice under the form, because the badge is hidden there. */
body.revita-floating-cart:has(.grecaptcha-badge):not(:has(.revita-recaptcha-notice)) .revita-floating-cart {
	inset-block-end: calc(max(20px, env(safe-area-inset-bottom)) + 70px);
}

:is(body.woocommerce-cart, body.woocommerce-checkout) .revita-floating-cart {
	display: none;
}

body .revita-floating-cart .wc-block-mini-cart__button {
	display: grid;
	place-items: center;
	inline-size: 3.5rem;
	block-size: 3.5rem;
	padding: 0;
	border-radius: 50%;
	background: var(--wp--preset--gradient--royal);
	box-shadow: var(--wp--preset--shadow--lifted), 0 0 0 4px color-mix(in srgb, var(--wp--preset--color--base) 75%, transparent);
	color: var(--wp--preset--color--base);
}

body .revita-floating-cart .wc-block-mini-cart__button:hover {
	box-shadow: var(--wp--preset--shadow--glow), 0 0 0 4px var(--wp--preset--color--accent);
}

body .revita-floating-cart .wc-block-mini-cart__icon {
	inline-size: 1.6rem;
	block-size: 1.6rem;
}

body .revita-floating-cart .wc-block-mini-cart__badge {
	background-color: var(--wp--preset--color--accent);
	box-shadow: 0 0 0 2px var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary-deep);
	font-weight: 700;
}

.revita-footer-minimal {
	color: var(--wp--preset--color--base);
}

.revita-footer-minimal p {
	margin: 0;
}

/* Focus: the theme ring (global.css), Honey Cream on the purple footer. The floating cart
 * floats over any section, so its ring is the two-colour pair that shows on all of them:
 * Deep Purple outside its white edge. */
body .revita-floating-cart .wc-block-mini-cart__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary-deep);
	outline-offset: 4px;
	box-shadow: var(--wp--preset--shadow--lifted), 0 0 0 4px var(--wp--preset--color--base);
}

/* 782 to 1023px: beside the 34% brand column the three other columns were only 123 to 165px
 * wide, too narrow for their headings, longer links and the e-mail. The brand column takes the
 * first row and the other three share the second (about 220px each at 782px). Core sets the
 * column wrapping and the brand's 34% basis (inline) with !important or inline styles. */
@media (min-width: 782px) and (max-width: 1023.98px) {
	.wp-block-columns.revita-footer__columns {
		flex-wrap: wrap !important;
	}

	.wp-block-columns.revita-footer__columns > .wp-block-column.revita-footer__brand {
		flex-basis: 100% !important;
	}

	.wp-block-columns.revita-footer__columns > .wp-block-column:not(.revita-footer__brand) {
		flex: 1 1 0 !important;
	}
}

@media (max-width: 781px) {
	.wp-block-group.revita-footer__trust {
		justify-content: flex-start;
		border-radius: var(--wp--custom--radius--lg);
	}

	.revita-footer__bottom .is-layout-flex {
		justify-content: center;
		text-align: center;
	}
}
