/* ─── Mega Nav: wrapper ───────────────────────────────────────────────────────
   position:relative lets the panel use position:absolute relative to this
   element, which is full-width inside the sticky header template-part.        */

.dmk-mega-nav {
	position: relative;
	flex: 1;
	min-width: 0;
	z-index: 100;
}

/* ─── Bar ────────────────────────────────────────────────────────────────────── */

.dmk-mega-nav__bar {
	display: flex;
	align-items: center;
	height: 72px;
	padding-inline: clamp(16px, 4.166667vw, 48px);
}

/* ─── Nav list ───────────────────────────────────────────────────────────────── */

.dmk-mega-nav__list {
	display: flex;
	align-self: stretch;
	align-items: stretch;
	gap: 2px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1;
	justify-content: flex-end;
}

.dmk-mega-nav__item {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
	position: relative;
}

/* Transparent bridge — extends the item's pointer area down to the panel top */
.dmk-mega-nav__item.has-panel::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	height: 24px;
}

/* ─── Nav link ───────────────────────────────────────────────────────────────── */

.dmk-mega-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 6px;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 1rem;
	font-weight: 400;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease;
}

/* Voce che apre solo il pannello (<button>): stesso aspetto dei link */
button.dmk-mega-nav__link {
	background: none;
	border: 0;
	cursor: pointer;
}

.dmk-mega-nav__link:hover {
	background: #eaf3fc;
	color: var(--wp--preset--color--secondary);
}

/* Current page / ancestor */
.dmk-mega-nav__item.is-current .dmk-mega-nav__link {
	color: var(--wp--preset--color--secondary);
	font-weight: 500;
}

/* Active state when panel is open */
.dmk-mega-nav__item.has-panel:has(.dmk-mega-nav__panel:not([hidden])) .dmk-mega-nav__link,
.dmk-mega-nav__link[aria-expanded="true"] {
	background: #eaf3fc;
	color: var(--wp--preset--color--secondary);
}

/* Chevron rotation when open */
.dmk-mega-nav__item.has-panel:has(.dmk-mega-nav__panel:not([hidden])) .dmk-chevron,
.dmk-mega-nav__link[aria-expanded="true"] .dmk-chevron {
	transform: rotate(180deg);
}

.dmk-chevron {
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

/* ─── CTA item (class: is-cta) ───────────────────────────────────────────────── */

.dmk-mega-nav__item.is-cta {
	margin-left: 8px;
}

.dmk-mega-nav__item.is-cta .dmk-mega-nav__link {
	background: var(--wp--preset--color--primary);
	color: #fff;
	padding: 10px 20px;
	font-weight: 500;
}

.dmk-mega-nav__item.is-cta .dmk-mega-nav__link:hover {
	background: var(--wp--preset--color--dark);
	color: #fff;
}

/* ─── Hamburger (mobile only) ─────────────────────────────────────────────────  */

.dmk-mega-nav__hamburger {
	display: none;
	margin-left: auto;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	color: var(--wp--preset--color--primary);
	line-height: 0;
}

/* ─── Mega panel ─────────────────────────────────────────────────────────────── */

@keyframes dmk-panel-enter {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.dmk-mega-nav__panel:not([hidden]) {
	animation: dmk-panel-enter 0.22s ease-out both;
}

.dmk-mega-nav__panel {
	position: fixed;
	/* top is set by JS to the header bar's bottom edge */
	top: 0;
	left: 0;
	right: 0;
	background: #fff;
	box-shadow: 0 12px 40px rgba(41, 76, 116, 0.1);
	border-top: 2px solid var(--wp--preset--color--secondary);
	z-index: 200;
}

.dmk-mega-nav__panel[hidden] {
	display: none;
}

/* Transparent bridge — covers any gap between nav bar and panel top */
.dmk-mega-nav__panel:not([hidden])::before {
	content: '';
	position: absolute;
	top: -10px;
	left: 0;
	right: 0;
	height: 10px;
}

.dmk-mega-nav__panel-inner {
	display: grid;
	grid-template-columns: 280px 1fr 1fr;
	max-width: 1450px;
	margin: 0 auto;
	padding: clamp(28px, 3vw, 40px) clamp(16px, 4.166667vw, 48px);
	min-height: 280px;
	gap: 0;
}

/* ─── Panel col 1: intro ─────────────────────────────────────────────────────── */

.dmk-mega-nav__intro {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding-right: 40px;
	border-right: 1px solid var(--wp--preset--color--light-gray);
}

.dmk-mega-nav__intro-title {
	font-family: var(--wp--preset--font-family--kanit);
	font-size: clamp(1.375rem, 2vw, 1.75rem);
	font-weight: 400;
	color: #1479CF;
	line-height: 1.15;
}

.dmk-mega-nav__intro-desc {
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 0.9375rem;
	font-weight: 300;
	color: #6b7280;
	line-height: 1.55;
	margin: 0;
}

/* ─── Panel col 2: main items ────────────────────────────────────────────────── */

.dmk-mega-nav__col-items {
	list-style: none;
	margin: 0;
	padding: 0 32px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.dmk-mega-nav__col-item a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border-radius: 6px;
	font-family: var(--wp--preset--font-family--kanit);
	font-weight: 400;
	text-transform: uppercase;
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
	transition: background 0.12s ease;
}

.dmk-mega-nav__col-item a:hover,
.dmk-mega-nav__col-item.is-active a {
	background: #eaf3fc;
}

.dmk-mega-nav__col-item.is-current a {
	background: #eaf3fc;
	font-weight: 500;
}

.dmk-arrow-right {
	flex-shrink: 0;
	opacity: 0.5;
}

.dmk-mega-nav__col-item.is-active .dmk-arrow-right {
	opacity: 1;
}

/* ─── Panel col 3: sub-items ─────────────────────────────────────────────────── */

.dmk-mega-nav__col-subs {
	padding-left: 32px;
}

.dmk-mega-nav__sub-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.dmk-mega-nav__sub-list[hidden] {
	display: none;
}

.dmk-mega-nav__sub-item a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 4px;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 0.9375rem;
	font-weight: 300;
	color: #374151;
	text-decoration: none;
	transition: color 0.12s ease;
}

.dmk-mega-nav__sub-item a::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #94a3b8;
	flex-shrink: 0;
	transition: background 0.12s ease;
}

.dmk-mega-nav__sub-item a:hover {
	color: var(--wp--preset--color--secondary);
}

.dmk-mega-nav__sub-item a:hover::before {
	background: var(--wp--preset--color--secondary);
}

.dmk-mega-nav__sub-item.is-current a {
	color: var(--wp--preset--color--secondary);
	font-weight: 500;
}

.dmk-mega-nav__sub-item.is-current a::before {
	background: var(--wp--preset--color--secondary);
}

/* ─── Pre-header right: contact info + language ──────────────────────────────── */

.dmk-preheader-right {
	display: flex;
	align-items: center;
	gap: 0;
}

.dmk-preheader-sep {
	padding: 0 12px;
	color: rgba(255, 255, 255, 0.25);
	font-size: 0.75rem;
	user-select: none;
}

.dmk-preheader-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 0.75rem;
	font-weight: 400;
	letter-spacing: 0.02em;
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	transition: color 0.12s ease;
}

a.dmk-preheader-item:hover {
	color: #fff;
}

@media (max-width: 640px) {
	/* Doppia classe: il layout flex del gruppo stampa body .is-layout-flex { display: flex }. */
	.wp-block-group.dmk-preheader-right {
		display: none;
	}
}

/* ─── Responsive: hide desktop nav, show hamburger ──────────────────────────── */

@media (max-width: 1024px) {
	.dmk-mega-nav__list {
		display: none;
	}

	.dmk-mega-nav__hamburger {
		display: flex;
	}
}

@media (max-width: 640px) {
	.dmk-mega-nav__bar {
		height: 60px;
	}
}

/* ─── Mobile overlay ─────────────────────────────────────────────────────────── */

.dmk-mobile-nav {
	position: fixed;
	top: 72px; /* overridden by JS with the real sticky header height */
	left: 0;
	right: 0;
	bottom: 0;
	background: #fff;
	z-index: 999;
	overflow: hidden;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.dmk-mobile-nav.is-open {
	visibility: visible;
	opacity: 1;
	transition-delay: 0s;
}

/* ─── Track: 3 panes side by side, slides horizontally ──────────────────────── */

.dmk-mobile-nav__track {
	display: flex;
	width: 100%;
	height: 100%;
	transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Single pane ────────────────────────────────────────────────────────────── */

.dmk-mobile-nav__pane {
	flex-shrink: 0;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	display: flex;
	flex-direction: column;
}

/* ─── Pane header (back button row) ─────────────────────────────────────────── */

.dmk-mobile-nav__pane-header {
	display: flex;
	align-items: center;
	padding: 0 20px;
	height: 52px;
	flex-shrink: 0;
	background: #f4f8fc;
	border-bottom: 1px solid var(--wp--preset--color--light-gray);
}

.dmk-mobile-nav__back {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
}

/* ─── Item list ──────────────────────────────────────────────────────────────── */

.dmk-mobile-nav__list {
	list-style: none;
	margin: 0;
	padding: 0 20px;
	flex: 1;
}

.dmk-mobile-nav__item {
	border-bottom: 1px solid var(--wp--preset--color--light-gray);
}

/* Row: link text + optional chevron button side by side */
.dmk-mobile-nav__row {
	display: flex;
	align-items: center;
}

.dmk-mobile-nav__link {
	display: block;
	flex: 1;
	padding: 16px 0;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 1rem;
	font-weight: 400;
	text-transform: uppercase;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	transition: color 0.12s ease;
}

button.dmk-mobile-nav__link {
	background: none;
	border: 0;
	text-align: left;
	cursor: pointer;
}

.dmk-mobile-nav__item:hover .dmk-mobile-nav__link,
.dmk-mobile-nav__item:focus-within .dmk-mobile-nav__link {
	color: #1069BB;
}

.dmk-mobile-nav__item:hover,
.dmk-mobile-nav__item:focus-within {
	background: #EAF3FC;
}

/* Chevron button that triggers a slide */
.dmk-mobile-nav__expand {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: none;
	border: none;
	cursor: pointer;
	color: #94a3b8;
	transition: color 0.12s ease;
}

.dmk-mobile-nav__item:hover .dmk-mobile-nav__expand,
.dmk-mobile-nav__item:focus-within .dmk-mobile-nav__expand {
	color: #1069BB;
}

/* ─── CTA at the bottom of pane 0 ───────────────────────────────────────────── */

.dmk-mobile-nav__cta {
	display: block;
	margin: 20px 20px 32px;
	padding: 14px 20px;
	background: var(--wp--preset--color--primary);
	color: #fff;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 1rem;
	font-weight: 500;
	border-radius: 6px;
	text-decoration: none;
	text-align: center;
	flex-shrink: 0;
}

.dmk-mobile-nav__cta:active {
	background: var(--wp--preset--color--dark);
	color: #fff;
}

/* ─── Mobile overlay: lingue (copiate da demak/lang-switcher) ────────────────── */

.dmk-mobile-nav__langs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin: auto 0 0;
	padding: 20px 20px 32px;
	list-style: none;
	border-top: 1px solid var(--wp--preset--color--light-gray);
	flex-shrink: 0;
}

.dmk-mobile-nav__langs .dmk-lang__item {
	padding: 0;
	font-family: var(--wp--preset--font-family--kanit);
	font-size: 0.9375rem;
}
