/*!
 * De Korne — header and navigation
 *
 * Hand-maintained. Replaces WPCode snippet #4079 "CSS Navbar 2.0", which was
 * 454 generated lines with three separate mobile media blocks, 88 !important
 * declarations, a stray closing brace, duplicated rule blocks, and selectors
 * (.jl-logo, .jl-button) for classes the markup does not contain.
 *
 * Submenu behaviour, which is what this rewrite is really about:
 *
 *   before  the container faded in, then each <li> faded in after it on a
 *           staggered 0.05s–0.25s delay. Opening took 250ms+ to settle, the
 *           items arrived one by one, and moving along the bar restarted the
 *           cascade on every menu. Closing ran the same delays in reverse, so
 *           items lingered after the pointer had left.
 *
 *   now     the panel animates as one object over 160ms. Nothing staggers, and
 *           this file no longer decides whether a panel is open — core does,
 *           from aria-expanded. See the dropdown section below for why that
 *           mattered.
 *
 * Values (colours, radii, sizes, blur, shadows) are carried over unchanged —
 * this is a behaviour and structure rewrite, not a redesign.
 */

/* -------------------------------------------------------------------------
   Tokens
   ------------------------------------------------------------------------- */

:root {
	--dk-header-height: 90px;
	--dk-brand: #e12f18;
	--dk-ink: #1d1d1f;
	--dk-panel: #fff;
	--dk-panel-radius: 0.75rem;
	--dk-panel-shadow: 0 8px 20px rgb(0 0 0 / 8%);

	/* One place to retune how the dropdowns feel. */
	--dk-open-duration: 160ms;
	--dk-close-delay: 120ms;
	--dk-ease: cubic-bezier(0.2, 0, 0.2, 1);
}

/* -------------------------------------------------------------------------
   The bar
   ------------------------------------------------------------------------- */

/*
 * The bar is fixed, so the document needs to start below it. This was
 * `.admin-bar body`, which cannot match: body *is* the element carrying
 * .admin-bar, so the admin bar overlapped the header for logged-in editors.
 */
body {
	padding-top: var(--dk-header-height);
	scroll-padding-top: var(--dk-header-height);
}

body.admin-bar {
	padding-top: calc(var(--dk-header-height) + 32px);
}

@media (max-width: 782px) {
	body.admin-bar {
		padding-top: calc(var(--dk-header-height) + 46px);
	}
}

.jl-navbar {
	position: fixed;
	top: 0;
	left: 50%;
	z-index: 1000;
	transform: translateX(-50%);

	display: flex;
	gap: 1rem;
	align-items: center;
	justify-content: space-between;

	box-sizing: border-box;
	width: 100%;
	padding: 1.2rem 2rem;

	background: transparent;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid rgb(0 0 0 / 5%);
	border-radius: 0 0 1rem 1rem;

	transition:
		padding 0.6s var(--dk-ease),
		background 0.6s var(--dk-ease),
		box-shadow 0.6s var(--dk-ease),
		transform 0.3s ease;
}

.jl-navbar.scrolled {
	padding: 0.6rem 1.8rem;
	background: rgb(255 255 255 / 88%);
	box-shadow: 0 8px 24px rgb(0 0 0 / 8%);
}

/* -------------------------------------------------------------------------
   Logo and site title
   ------------------------------------------------------------------------- */

.jl-navbar .wp-block-site-logo,
.jl-navbar .wp-block-site-title {
	display: flex;
	align-items: center;
}

.jl-navbar .wp-block-site-logo img {
	width: auto;
	height: 44px;
	margin-right: 0.6rem;
	transition: height 0.6s var(--dk-ease);
}

.jl-navbar.scrolled .wp-block-site-logo img {
	height: 36px;
}

.jl-navbar .wp-block-site-title {
	margin: 0;
	font-size: 1.4rem;
	font-weight: 600;
	color: var(--dk-ink);
	white-space: nowrap;
}

/* -------------------------------------------------------------------------
   Top-level links
   ------------------------------------------------------------------------- */

.jl-nav-links .wp-block-navigation__container {
	gap: 1.2rem;
	align-items: center;
	overflow: visible;
	flex-wrap: nowrap;
}

.jl-nav-links a {
	position: relative;
	padding: 0.4rem 0.8rem;
	border-radius: 999px;
	font-size: clamp(0.9rem, 0.8rem + 0.3vw, 1.5rem);
	font-weight: 500;
	line-height: 1;
	color: var(--dk-ink);
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.jl-nav-links a:hover {
	background-color: rgb(0 0 0 / 5%);
	color: var(--dk-ink);
}

/* -------------------------------------------------------------------------
   Focus

   Clicking a control should not leave a ring behind it. Buttons take focus on
   mousedown, and core styles the submenu chevron with nothing but
   `cursor: pointer` — so clicking one left the browser's own dark focus
   outline sitting around it until you clicked somewhere else. That is the
   black box.

   The fix is not to delete focus styling: a keyboard user needs to see where
   they are. `:focus:not(:focus-visible)` removes the ring for pointer clicks
   only, and every control in the bar gets a designed ring when reached by
   keyboard.
   ------------------------------------------------------------------------- */

.jl-navbar :is(a, button):focus:not(:focus-visible) {
	outline: none;
}

.jl-navbar :is(a, button):focus-visible {
	outline: 2px solid var(--dk-brand);
	outline-offset: 2px;
	border-radius: 999px;
}

/* Inside a panel an offset ring would clip on the container edge. */
.jl-nav-links .wp-block-navigation__submenu-container :is(a, button):focus-visible {
	outline-offset: -2px;
	border-radius: 6px;
}

/*
 * The chevron is a control, not a box. Core resets the open/close buttons but
 * not this one, so it inherits the user agent's button chrome.
 */
.jl-nav-links .wp-block-navigation-submenu__toggle {
	background: transparent;
	border: 0;
	color: inherit;
	box-shadow: none;
}

/* -------------------------------------------------------------------------
   Contact button
   ------------------------------------------------------------------------- */

.jl-nav-links .wp-block-button {
	display: inline-flex;
	flex: 0 0 auto;
	width: auto;
	margin: 0;
	white-space: nowrap;
}

.jl-nav-links .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: auto;
	padding: 0.55rem 1.25rem;
	border-radius: 999px;
	background: var(--dk-brand);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

/* The button keeps its colour on hover; only the top-level links tint. */
.jl-nav-links .wp-block-button__link:hover,
.jl-nav-links .wp-block-button__link:focus {
	background: var(--dk-brand);
	color: #fff;
}

/* -------------------------------------------------------------------------
   Dropdown panels

   Open and closed is WordPress's job, not ours. The navigation block is set to
   "open on hover and click", and in that mode core does not use a CSS :hover
   rule at all — its Interactivity API sets aria-expanded on the toggle button,
   and core's stylesheet keys off that:

       .has-child .wp-block-navigation-submenu__toggle[aria-expanded=true]
           ~ .wp-block-navigation__submenu-container
           { height:auto; width:auto; opacity:1; overflow:visible; visibility:visible }

   The previous snippet added its own `:hover` rules for opacity and transform
   on top of that. Two mechanisms then drove the same panel: core's, following
   a JavaScript state change, and the snippet's, following the pointer exactly.
   They disagreed on timing on every open and close, which is what made the
   menus feel unreliable — and the snippet's rules could not restore the
   height:0/width:0 core uses to hide, so its effects only ever partly applied.

   So this file styles the panel and gives it motion, and touches nothing that
   decides whether it is shown.
   ------------------------------------------------------------------------- */

.jl-nav-links .wp-block-navigation__submenu-container {
	min-width: 180px;
	max-width: min(90vw, 420px);
	padding: 0.5rem 0;
	background: var(--dk-panel);
	border: 0;
	border-radius: var(--dk-panel-radius);
	box-shadow: var(--dk-panel-shadow);
	white-space: nowrap;

	/* Motion only. opacity, visibility, height and width belong to core. */
	transition:
		opacity var(--dk-open-duration) var(--dk-ease),
		transform var(--dk-open-duration) var(--dk-ease);
}

/*
 * Alignment. The navigation is `items-justified-right`, and for that variant
 * core anchors panels to the parent's right edge:
 *
 *     .items-justified-right ... .has-child .submenu-container { left:auto; right:0 }
 *
 * which hangs a wide panel out to the left of a mid-bar item like "Producten".
 * The site has always shown these left-aligned under their parent, so that is
 * kept. The panel is capped at 420px and the last items in the bar are the
 * Contact button and the language switcher, so there is nothing wide enough
 * near the right edge to overflow.
 */
/*
 * These two selectors deliberately mirror the shape of core's, with
 * `.jl-nav-links` added on the front. Core's are four and five class
 * selectors; ours need to be one step more specific to win. Matching the
 * shape is why — it is not decoration, and it is the alternative to the
 * `!important` the old snippet used for the same job.
 */
.jl-nav-links.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child > .wp-block-navigation__submenu-container {
	left: 0;
	right: auto;
	top: 100%;
}

.jl-nav-links.wp-block-navigation.items-justified-right .wp-block-navigation__container .has-child .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
	left: 100%;
	right: auto;
	top: 0;
}

/* Closed offset, per level. */
.jl-nav-links > .wp-block-navigation-submenu > .wp-block-navigation__submenu-container {
	transform: translateY(-6px);
}

.jl-nav-links .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
	transform: translateX(-6px);
}

/* Settled position, on the same signal core opens with. */
.jl-nav-links .wp-block-navigation-submenu__toggle[aria-expanded="true"] ~ .wp-block-navigation__submenu-container {
	transform: none;
}

/* Items inside a panel. No stagger: the panel arrives as one object. */
.jl-nav-links .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	display: block;
	padding: 0.45rem 1rem;
	border-radius: 0;
	font-weight: 400;
}

.jl-nav-links .wp-block-navigation__submenu-container .wp-block-navigation-item__content:hover {
	background-color: rgb(0 0 0 / 4%);
}

/* -------------------------------------------------------------------------
   Mobile — one media block, where there used to be three
   ------------------------------------------------------------------------- */

@media (max-width: 768px) {
	.jl-navbar,
	.jl-navbar.scrolled {
		padding: 0.9rem 1.2rem;
		background: rgb(255 255 255 / 96%);
		border-radius: 0 0 0.75rem 0.75rem;
		box-shadow: none;
	}

	.jl-navbar .wp-block-site-logo img,
	.jl-navbar.scrolled .wp-block-site-logo img {
		height: 40px;
	}

	.jl-nav-links a {
		font-size: 1.05rem;
	}

	/* The collapsed menu is not in the layout until it is opened. */
	.wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none;
	}

	/* Full-screen overlay. */
	.wp-block-navigation__responsive-container.is-menu-open {
		position: fixed;
		inset: 0;
		z-index: 9999;
		display: block;
		box-sizing: border-box;
		width: 100vw;
		height: 100dvh;
		padding: 1.5rem;
		background: #fff;
		overflow-y: auto;
	}

	.wp-block-navigation__responsive-dialog {
		position: static;
		width: 100%;
		height: auto;
		margin: 0;
		padding: 0;
		background: transparent;
	}

	.wp-block-navigation__responsive-close {
		display: block;
		position: relative;
		z-index: 10000;
		margin-bottom: 1.25rem;
	}

	.wp-block-navigation__responsive-container-content {
		display: block;
		max-height: calc(100dvh - 20px);
		padding-bottom: 4rem;
		overflow-y: auto;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		display: block;
		width: 100%;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		margin: 0 0 0.75rem;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		display: block;
		width: 100%;
		padding: 0.8rem 0;
	}

	/*
	 * Every level is expanded in the overlay, so the disclosure arrows would
	 * do nothing — they are hidden, and the panels are laid out inline rather
	 * than floated over the page.
	 */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
		position: static;
		max-width: none;
		width: 100%;
		margin: 0.25rem 0 0.5rem;
		padding-left: 1.2rem;
		background: transparent;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		transition: none;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item {
		margin: 0.3rem 0;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-submenu__toggle,
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-icon {
		display: none;
	}

	/* Contact button spans the overlay. */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-button {
		display: block;
		width: 100%;
		margin-top: 1.5rem;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-button__link {
		display: block;
		width: 100%;
		padding: 1rem 1.2rem;
		border-radius: 999px;
		text-align: center;
	}

	/* Nothing hover-tints on a touch screen. */
	.jl-nav-links a:hover {
		background: none;
		color: inherit;
	}

	/* Hidden while scrolling down; header.js toggles the class. */
	.jl-navbar.is-hidden {
		transform: translate(-50%, -120%);
	}

	/* The page must not scroll behind the open overlay. */
	body.navigation-open {
		overflow: hidden;
	}
}

/* -------------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.jl-navbar,
	.jl-navbar .wp-block-site-logo img,
	.jl-nav-links a,
	.jl-nav-links .wp-block-navigation__submenu-container {
		transition-duration: 0.01ms;
	}

	.jl-nav-links .wp-block-navigation__submenu-container {
		transform: none;
	}
}
