/*
 * "Smart hover" header navigation (body.acc-nav-desktop-smart).
 * Desktop: a dropdown is visible only while its item has .is-open (set by assets/js/nav-smart.js),
 * never through CSS :hover — that is what keeps menus from popping open after a Barba transition.
 * The panels keep the existing look (full-width mega panel under the header).
 */

/* "… overview" link: touch screens with the desktop layout only */
.acc-nav-overview {
	display: none !important;
}

@media (min-width: 992px) {
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container,
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation-submenu > .wp-block-navigation__submenu-container {
		opacity: 0 !important;
		visibility: hidden !important;
		pointer-events: none !important;
		transform: translateY(8px);
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
	}

	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation-item.has-child.is-open > .wp-block-navigation__submenu-container,
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation-submenu.is-open > .wp-block-navigation__submenu-container {
		height: auto !important;
		overflow: visible !important;
		opacity: 1 !important;
		visibility: visible !important;
		pointer-events: auto !important;
		transform: translateY(0);
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
		z-index: var(--acc-z-header-nav, 10000);
	}

	/* Invisible bridge over the gap between the header and the panel, so the pointer never "falls out". */
	body.acc-nav-desktop-smart .site-header .wp-block-navigation__container > .wp-block-navigation-item.is-open > .wp-block-navigation__submenu-container::before {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 100%;
		height: 24px;
	}

	/* Second level (e.g. Services → Clinical Trials): exactly under its row, same width, never wider than the screen. */
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
		position: absolute !important;
		top: 100% !important;
		left: 0 !important;
		right: 0 !important;
		width: 100% !important;
		min-width: 0 !important;
		max-width: 100% !important;
		z-index: var(--acc-z-nested-submenu, 10001);
	}

	/* Chevron turns while open */
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation__submenu-icon svg {
		transition: transform 0.2s ease;
	}

	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation-item.is-open > .wp-block-navigation__submenu-icon svg {
		transform: rotate(180deg);
	}

	/* A parent that is also a page shows it on hover; one without a page does not look like a link. */
	body.acc-nav-desktop-smart .site-header .wp-block-navigation__container > .wp-block-navigation-item > a.wp-block-navigation-item__content[href]:hover .wp-block-navigation-item__label,
	body.acc-nav-desktop-smart .site-header .wp-block-navigation__container > .wp-block-navigation-item > a.wp-block-navigation-item__content[href]:focus-visible .wp-block-navigation-item__label {
		text-decoration: underline;
		text-decoration-thickness: 2px;
		text-underline-offset: 6px;
	}

	body.acc-nav-desktop-smart .site-header .wp-block-navigation a.wp-block-navigation-item__content:not([href]) {
		cursor: default;
	}
}

/* Touch screen, desktop layout (e.g. iPad landscape): show the "… overview" link */
@media (min-width: 992px) and (hover: none), (min-width: 992px) and (pointer: coarse) {
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation__responsive-container:not(.is-menu-open) .acc-nav-overview {
		display: block !important;
	}

	body.acc-nav-desktop-smart .site-header .acc-nav-overview .wp-block-navigation-item__label {
		font-weight: 700;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.acc-nav-desktop-smart .site-header .wp-block-navigation .wp-block-navigation__submenu-container {
		transition: none !important;
		transform: none !important;
	}
}
