/* ==========================================================================
   Andrea Paolucci - Header, menu laterale (mobile) e footer.
   ========================================================================== */

/* Footer sempre in fondo anche sulle pagine corte */
body {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}
body > * {
	flex-shrink: 0;
}
body > main {
	width: 100%;
}
body > .ap-footer,
body > .elementor-location-footer {
	margin-top: auto;
}

/* Annulla lo stile dei pulsanti di Hello Elementor (bordo rosa) */
.ap-header button,
.ap-drawer button {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1;
	cursor: pointer;
}

/* ---------- Header ---------- */

.ap-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	border-bottom: 1px solid transparent;
	background: rgba(244, 244, 242, .88);
	background: color-mix(in srgb, var(--surface-page) 88%, transparent);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	transition: border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard);
}
.ap-header.is-stuck {
	border-bottom-color: var(--border-subtle);
	box-shadow: var(--shadow-sm);
}

.ap-header__row {
	display: flex;
	align-items: center;
	gap: var(--space-6);
	min-height: var(--header-h);
}

.ap-logo {
	display: block;
	flex: none;
	line-height: 0;
}
/* "img" e non solo la classe: il logo di Personalizza può arrivare senza */
.ap-logo img {
	display: block;
	width: auto;
	height: 44px;
	max-width: 220px;
	object-fit: contain;
}

/* Menu desktop */
.ap-nav {
	margin-left: auto;
}
.ap-menu {
	display: flex;
	align-items: center;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}
.ap-menu > li {
	position: relative;
}
.ap-menu > li > a {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 10px 14px;
	border-radius: var(--radius-pill);
	color: var(--text-body);
	font-size: .9375rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.ap-menu > li > a:hover,
.ap-menu > li:focus-within > a {
	background: var(--neutral-200);
	color: var(--text-body);
}
.ap-menu > li.current-menu-item > a,
.ap-menu > li.current-menu-ancestor > a,
.ap-menu > li.current_page_parent > a {
	color: var(--brand-red-500);
}
.ap-menu > li.current-menu-item > a::after,
.ap-menu > li.current-menu-ancestor > a::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 2px;
	width: 5px;
	height: 5px;
	margin-left: -2.5px;
	border-radius: 50%;
	background: var(--brand-orange-500);
}
.ap-menu > li.menu-item-has-children > a::before {
	content: "";
	order: 2;
	width: 6px;
	height: 6px;
	margin-top: -3px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	opacity: .6;
}

.ap-menu .sub-menu {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 10;
	min-width: 220px;
	margin: 0;
	padding: var(--space-2);
	list-style: none;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	background: var(--surface-raised);
	box-shadow: var(--shadow-lg);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out), visibility 0s linear var(--duration-base);
}
.ap-menu > li:hover > .sub-menu,
.ap-menu > li:focus-within > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity var(--duration-base) var(--ease-out), transform var(--duration-base) var(--ease-out);
}
.ap-menu .sub-menu a {
	display: block;
	padding: 10px 12px;
	border-radius: var(--radius-sm);
	color: var(--text-body);
	font-size: .9375rem;
	text-decoration: none;
}
.ap-menu .sub-menu a:hover,
.ap-menu .sub-menu a:focus-visible {
	background: var(--neutral-100);
	color: var(--brand-red-500);
}

.ap-header__cta {
	flex: none;
	padding: 10px 20px;
	font-size: .9375rem;
}

.ap-header__burger {
	display: none;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-left: auto !important;
	margin-right: -10px !important;
	border-radius: 50% !important;
	color: var(--text-body);
}
.ap-header__burger .ap-icon {
	width: 26px;
	height: 26px;
}

@media (max-width: 1024px) {
	.ap-nav {
		display: none;
	}
	.ap-header__burger {
		display: grid;
	}
	.ap-header__cta {
		margin-left: auto;
	}
	.ap-header__cta + .ap-header__burger {
		margin-left: 0 !important;
	}
}

@media (max-width: 600px) {
	.ap-header__row {
		gap: var(--space-4);
	}
	.ap-logo img {
		height: 36px;
	}
	/* su telefono il pulsante sta nel menu laterale */
	.ap-header__cta {
		display: none;
	}
	.ap-header__cta + .ap-header__burger {
		margin-left: auto !important;
	}
}

/* ---------- Menu laterale (mobile) ---------- */

.ap-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
	visibility: hidden;
	transition: visibility 0s linear var(--duration-slow);
}
.ap-drawer.is-open {
	visibility: visible;
	transition: none;
}
.ap-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(37, 38, 38, .45);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity var(--duration-slow) var(--ease-out);
}
.ap-drawer.is-open .ap-drawer__overlay {
	opacity: 1;
}
.ap-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(88vw, 380px);
	padding-bottom: env(safe-area-inset-bottom);
	background: var(--surface-page);
	overflow-y: auto;
	transform: translateX(100%);
	transition: transform var(--duration-slow) var(--ease-out);
}
.ap-drawer.is-open .ap-drawer__panel {
	transform: translateX(0);
}
.ap-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	padding: 12px 10px 12px 20px;
	border-bottom: 1px solid var(--border-subtle);
}
.ap-drawer .ap-logo img {
	height: 36px;
}
.ap-drawer__close {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50% !important;
}
.ap-drawer__close .ap-icon {
	width: 24px;
	height: 24px;
}
.ap-drawer-menu {
	margin: 0;
	padding: var(--space-2) 0;
	list-style: none;
}
.ap-drawer-menu li {
	position: relative;
}
.ap-drawer-menu > li {
	border-bottom: 1px solid var(--border-subtle);
}
.ap-drawer-menu a {
	display: block;
	padding: 16px 60px 16px 20px;
	color: var(--text-body);
	font-size: 1.125rem;
	font-weight: 700;
	text-decoration: none;
}
.ap-drawer-menu .current-menu-item > a {
	color: var(--brand-red-500);
}
.ap-drawer-menu .sub-menu {
	display: none;
	margin: 0;
	padding: 0 0 var(--space-2);
	list-style: none;
}
.ap-drawer-menu li.is-open > .sub-menu {
	display: block;
}
.ap-drawer-menu .sub-menu a {
	padding: 10px 20px 10px 32px;
	font-size: 1rem;
	font-weight: 400;
}
.ap-drawer .ap-submenu-toggle {
	position: absolute;
	top: 0;
	right: 0;
	display: grid;
	place-items: center;
	width: 56px;
	height: 60px;
	color: var(--text-muted);
}
.ap-submenu-toggle .ap-icon {
	transition: transform var(--duration-base) var(--ease-standard);
}
.ap-drawer-menu li.is-open > .ap-submenu-toggle .ap-icon {
	transform: rotate(180deg);
}
.ap-drawer__foot {
	display: grid;
	gap: var(--space-5);
	margin-top: auto;
	padding: var(--space-5) 20px;
}
.ap-drawer__contacts {
	display: grid;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}
.ap-drawer__contacts li {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	color: var(--text-muted);
	font-size: .9375rem;
}
.ap-drawer__contacts a {
	color: var(--text-body);
	text-decoration: none;
}
.ap-drawer__contacts .ap-icon {
	width: 18px;
	height: 18px;
	color: var(--brand-red-500);
}

body.ap-drawer-open {
	overflow: hidden;
}

/* ---------- Footer (sempre il blocco scuro) ---------- */

.ap-footer {
	background: var(--surface-inverse);
	color: var(--neutral-300);
	font-size: .9375rem;
	line-height: 1.6;
}
.ap-footer a {
	color: var(--neutral-300);
	text-decoration: none;
}
.ap-footer a:hover,
.ap-footer a:focus-visible {
	color: var(--neutral-000);
}

.ap-footer__main {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
	gap: var(--space-7);
	padding-block: var(--space-8) var(--space-7);
}
.ap-footer .ap-logo img {
	height: 48px;
}
.ap-footer__text {
	max-width: 38ch;
	margin: var(--space-5) 0;
	font-family: var(--font-serif);
	font-size: 1rem;
	line-height: 1.6;
}
.ap-footer__title {
	margin: 4px 0 var(--space-4);
	color: var(--brand-yellow-500);
	font-size: var(--text-eyebrow-size);
	font-weight: 800;
	letter-spacing: .16em;
	text-transform: uppercase;
}
.ap-footer__menu,
.ap-footer__contacts {
	display: grid;
	gap: var(--space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}
.ap-footer__contacts li {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
}
.ap-footer__contacts .ap-icon {
	width: 18px;
	height: 18px;
	margin-top: 3px;
	color: var(--brand-orange-500);
}

.ap-social {
	display: flex;
	gap: var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}
.ap-social a {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1px solid rgba(255, 255, 255, .12);
	border-radius: 50%;
	transition: background-color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.ap-footer .ap-social a:hover {
	border-color: transparent;
	background: var(--brand-red-500);
	color: var(--neutral-000);
}
.ap-social .ap-icon {
	width: 18px;
	height: 18px;
}

.ap-footer__bottom {
	border-top: 1px solid rgba(255, 255, 255, .12);
}
.ap-footer__bottom-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3) var(--space-5);
	padding-block: var(--space-5);
	font-size: .8125rem;
	color: var(--neutral-400);
}
.ap-footer__legal {
	margin: 0;
}
.ap-footer__legal-menu {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-5);
	margin: 0;
	padding: 0;
	list-style: none;
}
.ap-footer__legal-menu a {
	color: var(--neutral-400);
}
.ap-footer__legal-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3) var(--space-5);
}

@media (max-width: 820px) {
	.ap-footer__main {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--space-6) var(--space-5);
	}
	.ap-footer__brand {
		grid-column: 1 / -1;
	}
}

@media (max-width: 480px) {
	.ap-footer__main {
		grid-template-columns: minmax(0, 1fr);
	}
}
