/*
 * TAF Machinery – Header restyling 2026
 * Figma "TAF Restyling 2026": Homepage (1:12), menu noleggio (1:390),
 * menu vendita (24:39), Menu mobile (24:118).
 * Ambito: .taf-topbar, .taf-header, .taf-cta-bar, .taf-skip-link.
 * Desktop da 1200px; sotto: burger + pannello laterale + barra CTA in basso.
 */

.taf-topbar,
.taf-header,
.taf-cta-bar {
	--taf-dark: #1e1e1e;
	--taf-white: #ffffff;
	--taf-accent: #e65100;
	--taf-highlight: #ffb509;
	--taf-whatsapp: #25d366;
	--taf-shadow: 0 4px 15px rgba(161, 161, 161, 0.25);
	--taf-container: 1680px;
	--taf-gutter: clamp(20px, 6.25vw, 120px);
	--taf-logo-w: 181px;
	--taf-nav-gap: clamp(24px, 3.1vw, 60px);
	--taf-focus: 2px solid var(--taf-accent);
	font-family: 'manrope', 'Manrope', sans-serif;
	box-sizing: border-box;
}

.taf-topbar *,
.taf-header *,
.taf-cta-bar * {
	box-sizing: border-box;
}

.taf-container {
	width: 100%;
	max-width: calc(var(--taf-container) + (2 * var(--taf-gutter)));
	margin: 0 auto;
	padding: 0 var(--taf-gutter);
}

/* Reset elementi (evita stili generici di Enfold e di custom.css). */
.taf-topbar ul,
.taf-header ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.taf-topbar li,
.taf-header li {
	margin: 0;
	padding: 0;
	border: 0;
}

.taf-header button,
.taf-topbar button {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	cursor: pointer;
	box-shadow: none;
	text-transform: none;
	letter-spacing: 0;
}

.taf-topbar a,
.taf-header a,
.taf-cta-bar a {
	text-decoration: none;
}

.taf-topbar :focus-visible,
.taf-header :focus-visible,
.taf-cta-bar :focus-visible {
	outline: var(--taf-focus);
	outline-offset: 3px;
	border-radius: 4px;
}

.taf-topbar .screen-reader-text,
.taf-header .screen-reader-text,
.taf-cta-bar .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.taf-svg {
	display: block;
	flex: 0 0 auto;
}

/* Link "Vai al contenuto" */
.taf-skip-link {
	position: absolute;
	left: 16px;
	top: -100px;
	z-index: 100002;
	padding: 12px 18px;
	background: #ffffff;
	color: #1e1e1e;
	font-weight: 700;
	border-radius: 4px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.taf-skip-link:focus {
	top: 16px;
	outline: 2px solid #e65100;
	outline-offset: 2px;
}

/* ===================================================================
 * TOP BAR (#1e1e1e, 52px)
 * ================================================================= */
.taf-topbar {
	background: var(--taf-dark);
	color: var(--taf-white);
	font-size: 16px;
	line-height: 28px;
}

.taf-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-height: 52px;
	padding-top: 6px;
	padding-bottom: 6px;
}

.taf-topbar a {
	color: var(--taf-white);
}

.taf-topbar a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.taf-topbar :focus-visible {
	outline-color: var(--taf-highlight);
}

.taf-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.taf-links__link {
	display: inline-flex;
	align-items: center;
	gap: 12px;
}

/* Contatti (sinistra): grassetto con icona */
.taf-links--contacts {
	gap: 8px 50px;
}

.taf-links--contacts .taf-links__link {
	font-weight: 700;
}

.taf-icon {
	flex: 0 0 auto;
	width: 24px;
	font-size: 16px;
	line-height: 1;
	text-align: center;
	padding: 0;
}

.taf-icon.fa-whatsapp {
	font-size: 24px;
	color: var(--taf-whatsapp);
}

/* Link (destra) */
.taf-topbar__right {
	display: flex;
	align-items: center;
	gap: 34px;
}

.taf-links--topbar {
	gap: 6px 34px;
}

.taf-links--topbar .taf-links__link {
	font-weight: 400;
}

.taf-links--topbar .taf-links__link[aria-current="page"] {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Selettore lingua di WPML aggiunto in coda al menu della top bar */
.taf-links__link--lang {
	gap: 6px;
}

.taf-links__link--lang .wpml-ls-flag {
	display: block;
	width: 18px;
	height: auto;
	margin: 0;
}

/* Solo bandierina: eventuali nomi lingua restano per i lettori di schermo */
.taf-links__link--lang .wpml-ls-display,
.taf-links__link--lang .wpml-ls-native {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.taf-links__link--lang {
	position: relative;
	min-height: 24px;
}

.taf-links--topbar .taf-links__item--lang + .taf-links__item--lang {
	margin-left: -20px;
}

.taf-links .wpml-ls-current-language > .taf-links__link--lang {
	font-weight: 700;
}

/* ===================================================================
 * BARRA PRINCIPALE (bianca, ombra, 94px)
 * ================================================================= */
.taf-header {
	position: relative;
	z-index: 1000;
	padding: 0;
	margin: 0;
	background: transparent;
	color: var(--taf-dark);
}

.taf-header__bar {
	position: relative;
	z-index: 1000;
	background: var(--taf-white);
	box-shadow: var(--taf-shadow);
}

.taf-header.is-stuck .taf-header__bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
}

.admin-bar .taf-header.is-stuck .taf-header__bar {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .taf-header.is-stuck .taf-header__bar {
		top: 46px;
	}
}

@media screen and (max-width: 600px) {
	.admin-bar .taf-header.is-stuck .taf-header__bar {
		top: 0;
	}
}

.taf-header__inner {
	display: flex;
	align-items: center;
	min-height: 94px;
	padding-top: 6px;
	padding-bottom: 6px;
}

.taf-header__logo {
	display: block;
	flex: 0 0 auto;
	width: var(--taf-logo-w);
	max-width: 46vw;
}

.taf-header__logo img {
	display: block;
	width: 100%;
	height: auto;
}

/* Navigazione desktop */
.taf-nav--desktop {
	display: none;
	flex: 1 1 auto;
	min-width: 0;
	margin-left: var(--taf-nav-gap);
}

.taf-nav__list--desktop {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: clamp(20px, 3.5vw, 68px);
}

.taf-nav__row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.taf-nav__link,
.taf-nav__toggle--label {
	color: var(--taf-dark);
	font-size: 18px;
	font-weight: 700;
	line-height: 28px;
	white-space: nowrap;
}

.taf-nav__link:hover {
	color: var(--taf-dark);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.taf-nav__link[aria-current="page"],
.taf-nav__item.is-current > .taf-nav__row .taf-nav__link {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
}

.taf-nav__toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	min-height: 28px;
	color: var(--taf-dark);
	border-radius: 4px;
}

.taf-nav__toggle--label {
	gap: 10px;
}

.taf-nav__toggle .taf-svg--chevron {
	transition: transform 0.2s ease;
}

.taf-nav__toggle[aria-expanded="true"] .taf-svg--chevron {
	transform: rotate(180deg);
}

/* Voce evidenziata (classe CSS "taf-nav-highlight" impostata dal backend) */
.taf-nav-highlight > .taf-nav__row {
	gap: 10px;
	padding: 10px 20px;
	background: var(--taf-highlight);
	border-radius: 20px;
}

.taf-nav-highlight > .taf-nav__row .taf-nav__link:hover {
	text-decoration: underline;
}

/* Mega menu desktop */
.taf-mega[hidden] {
	display: none;
}

.taf-nav--desktop .taf-mega {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 999;
	background: var(--taf-white);
	box-shadow: var(--taf-shadow);
	clip-path: inset(0 0 -40px 0);
}

.taf-nav--desktop .taf-mega__inner {
	width: 100%;
	max-width: calc(var(--taf-container) + (2 * var(--taf-gutter)));
	margin: 0 auto;
	padding: 17px var(--taf-gutter) 34px calc(var(--taf-gutter) + var(--taf-logo-w) + var(--taf-nav-gap) + 9px);
}

.taf-nav--desktop .taf-mega__cols {
	display: flex;
	flex-wrap: wrap;
	gap: 24px clamp(40px, 5vw, 96px);
}

.taf-mega__col {
	min-width: 0;
}

.taf-mega__title {
	display: block;
	margin: 0 0 9px;
	color: var(--taf-dark);
	font-size: 18px;
	font-weight: 700;
	line-height: 28px;
}

a.taf-mega__title:hover {
	text-decoration: underline;
}

.taf-mega__list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.taf-mega__link {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: var(--taf-dark);
	font-size: 16px;
	font-weight: 400;
	line-height: 20px;
}

.taf-mega__link:hover {
	color: var(--taf-dark);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.taf-mega__link[aria-current="page"] {
	font-weight: 700;
}

/* Azioni: CTA + burger */
.taf-header__actions {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-left: auto;
	padding-left: 24px;
}

.taf-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: var(--taf-white);
	background: var(--taf-accent);
	font-size: 18.67px; /* testo "grande" WCAG (14pt bold) per il contrasto bianco su #e65100 */
	font-weight: 700;
	line-height: 28px;
	white-space: nowrap;
}

.taf-cta:hover,
.taf-cta:focus {
	color: var(--taf-white);
	background: #c94600;
}

.taf-cta--header {
	display: none;
	padding: 16px clamp(20px, 3vw, 58px);
	border-radius: 20px;
}

.taf-burger {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	color: var(--taf-dark);
	border-radius: 6px;
}

/* ===================================================================
 * PANNELLO MOBILE (dialog)
 * ================================================================= */
.taf-drawer[hidden] {
	display: none;
}

.taf-drawer {
	position: fixed;
	inset: 0;
	z-index: 100000;
}

.admin-bar .taf-drawer {
	top: 46px;
}

@media screen and (min-width: 783px) {
	.admin-bar .taf-drawer {
		top: 32px;
	}
}

.taf-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(30, 30, 30, 0.55);
}

.taf-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 24px;
	width: min(420px, 100%);
	padding: 16px 20px calc(32px + env(safe-area-inset-bottom, 0px));
	background: var(--taf-white);
	overflow-y: auto;
	overscroll-behavior: contain;
	box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
}

.taf-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 48px;
}

.taf-drawer__title {
	font-size: 18px;
	font-weight: 700;
	color: var(--taf-dark);
}

.taf-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	color: var(--taf-dark);
	border-radius: 6px;
}

.taf-nav__list--mobile {
	display: flex;
	flex-direction: column;
}

.taf-nav__list--mobile > .taf-nav__item {
	border-bottom: 1px solid #e1e1e1;
}

.taf-nav__list--mobile .taf-nav__row {
	justify-content: space-between;
	min-height: 56px;
	padding: 6px 0;
}

.taf-nav__list--mobile .taf-nav__link,
.taf-nav__list--mobile .taf-nav__toggle--label {
	white-space: normal;
	overflow-wrap: anywhere;
}

.taf-nav__list--mobile .taf-nav__toggle {
	min-width: 44px;
	min-height: 44px;
}

.taf-nav__list--mobile .taf-nav__toggle--label {
	flex: 1 1 auto;
	justify-content: space-between;
	text-align: left;
}

.taf-nav__list--mobile .taf-nav-highlight > .taf-nav__row {
	margin: 8px 0;
	padding: 6px 6px 6px 16px;
	border-radius: 20px;
}

.taf-nav__list--mobile .taf-mega {
	padding: 4px 0 18px 4px;
}

.taf-nav__list--mobile .taf-mega__cols {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.taf-nav__list--mobile .taf-mega__title {
	margin-bottom: 6px;
	font-size: 16px;
	line-height: 24px;
}

.taf-nav__list--mobile .taf-mega__list {
	gap: 4px;
}

.taf-nav__list--mobile .taf-mega__link {
	min-height: 36px;
	overflow-wrap: anywhere;
}

.taf-drawer__secondary {
	display: flex;
	flex-direction: column;
	gap: 20px;
	color: var(--taf-dark);
}

.taf-links--drawer {
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.taf-links--drawer .taf-links__link,
.taf-links--drawer-contacts .taf-links__link {
	min-height: 40px;
	color: var(--taf-dark);
	font-size: 16px;
}

.taf-links--drawer-contacts {
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

.taf-links--drawer-contacts .taf-links__link {
	font-weight: 700;
}

.taf-links--drawer .taf-links__link:hover,
.taf-links--drawer-contacts .taf-links__link:hover {
	text-decoration: underline;
}

html.taf-drawer-open,
html.taf-drawer-open body {
	overflow: hidden;
}

/* ===================================================================
 * BARRA CTA MOBILE (#e65100, in basso)
 * ================================================================= */
.taf-cta-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 900;
	background: var(--taf-accent);
}

.taf-cta--bar {
	display: flex;
	width: 100%;
	min-height: 64px;
	padding: 18px 20px calc(18px + env(safe-area-inset-bottom, 0px));
}

.taf-cta-bar :focus-visible {
	outline-color: var(--taf-white);
	outline-offset: -6px;
}

body.taf-has-cta-bar {
	padding-bottom: 80px;
}

/* ===================================================================
 * RESPONSIVE
 * ================================================================= */

/* Mobile/tablet (< 1200px): burger, top bar con soli contatti */
@media only screen and (max-width: 1199px) {
	.taf-topbar__right {
		display: none;
	}

	.taf-topbar__inner {
		justify-content: center;
	}

	.taf-header__inner {
		min-height: 79px;
	}
}

@media only screen and (max-width: 767px) {
	.taf-links--contacts .taf-icon-whatsapp-item {
		display: none;
	}

	.taf-links--contacts {
		justify-content: center;
	}

	.taf-header__logo {
		width: 160px;
	}
}

/* Desktop (>= 1200px) */
@media only screen and (min-width: 1200px) {
	.taf-nav--desktop {
		display: block;
	}

	.taf-cta--header {
		display: inline-flex;
	}

	.taf-burger,
	.taf-drawer,
	.taf-cta-bar {
		display: none;
	}

	body.taf-has-cta-bar {
		padding-bottom: 0;
	}
}

/* Desktop compatto: riduce ingombri tra 1200 e 1499px */
@media only screen and (min-width: 1200px) and (max-width: 1499px) {
	.taf-topbar,
	.taf-header {
		--taf-logo-w: 150px;
	}

	.taf-nav__link,
	.taf-nav__toggle--label {
		font-size: 17px;
	}

	.taf-nav-highlight > .taf-nav__row {
		padding: 8px 14px;
	}

	.taf-cta {
		font-size: 18.67px;
	}

	.taf-cta--header {
		padding: 12px 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.taf-nav__toggle .taf-svg--chevron {
		transition: none;
	}
}
