/* Mobiel menu (schermen smaller dan 960px), naar het voorbeeld van lensenredesign.
   Markup: app/Views/partials/navigation.php, gedrag: js/mobile-menu.js.
   Vervangt het oude mobiele menu van het thema ("Open het menu"-link met slide).
   Op desktop (960px en breder) verandert er niets: daar worden alleen de mobiele
   knoppen verborgen en blijft het menu van het thema (ddsmoothmenu) actief.
   Kleuren: accentkleur van het profiel (--hm-...), met neutrale terugvalwaarden. */

/* Desktop: mobiele onderdelen verbergen */
.m-menu-toggle,
.m-sub-toggle,
#nav > li.m-menu-cta { display: none; }

@media only screen and (max-width: 959px) {

	/* --- Kopregel: logo links, knop "Menu" rechts --------------------------- */
	header:not(.style-3) .main-header .container {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: space-between;
	}
	header:not(.style-3) .main-header .container:before,
	header:not(.style-3) .main-header .container:after { display: none; }
	header:not(.style-3) .main-header .container > .down-button { flex: 0 0 100%; }
	/* Logo neemt de resterende ruimte en krimpt zo nodig, zodat de knop ernaast past */
	header:not(.style-3) .main-header .one-third.column {
		flex: 1 1 0%;
		float: none;
		width: auto;
		min-width: 0;
		margin-right: 16px;
	}
	header:not(.style-3) .main-header .two-thirds.column {
		flex: 0 0 auto;
		float: none;
		width: auto;
	}
	/* zelfde maximale breedte als op desktop (custom.css: 300px) */
	header:not(.style-3) .main-header .logo img { display: block; width: 300px; max-width: 100%; height: auto; padding-top: 0; }
	/* gelijke ruimte boven en onder het logo, zodat logo en knop precies op één lijn staan */
	header:not(.style-3) .main-header .logo { margin: 22px 0; }

	/* Het paneel hangt onder de hele kopregel (volle breedte) */
	header .main-header,
	header .down-header { position: relative; }
	header .main-header .container,
	header .down-header .container { position: static; }
	header #menu { position: static; float: none; }

	/* --- Knop "Menu" ------------------------------------------------------------ */
	header #menu .m-menu-toggle {
		display: inline-flex;
		align-items: center;
		gap: 12px;
		margin: 0;
		padding: 8px 12px;
		border: 1px solid #dedfe1;
		border-radius: 0;
		background: #fff;
		color: #22282d;
		font-size: 14px;
		line-height: 1.5;
		text-transform: none;
		cursor: pointer;
	}
	header #menu .m-menu-toggle svg { display: block; width: 22px; height: 22px; }
	header #menu .m-menu-toggle:focus-visible { outline: 3px solid var(--hm-accent, #378ac4); outline-offset: 3px; }
	/* Gecentreerde header: knop in het midden van de menubalk */
	header.style-3 #menu .m-menu-toggle { display: flex; margin: 10px auto; }

	/* --- Paneel ------------------------------------------------------------------ */
	header #menu #nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 1001;
		float: none;
		width: auto;
		margin: 0;
		/* tekst lijnt uit met het logo: zelfde marge als de container van het thema */
		padding: 20px calc((100% - 768px) / 2 + 10px) 28px;
		border-top: 1px solid #dedfe1;
		background: #fff;
		box-shadow: 0 15px 20px rgba(0, 0, 0, .07);
		text-align: left;
	}
	header #menu.is-open #nav { display: block; }

	header #menu #nav > li {
		display: flex !important;
		flex-wrap: wrap;
		align-items: center;
		position: static;
		float: none;
		margin: 0;
		text-transform: none;
	}

	header #menu #nav > li > a {
		display: block;
		flex: 1 1 auto;
		position: relative;
		width: auto;
		padding: 9px 0;
		border: 0 !important;
		background: none !important;
		color: #22282d !important;
		font-size: 15px;
		font-weight: 600;
		line-height: 1.5;
		text-transform: none;
	}
	header #menu #nav > li > a:hover { color: var(--hm-accent-text, #22282d) !important; }

	/* Actieve pagina: accentkleur met een streepje eronder */
	header #menu #nav > li.active > a { color: var(--hm-accent-text, #22282d) !important; }
	header #menu #nav > li.active > a:after {
		content: '';
		position: absolute;
		left: 0;
		bottom: 4px;
		width: 22px;
		height: 2px;
		background: var(--hm-accent, #22282d);
	}

	/* Pijltjes van het oude menu verbergen */
	header #menu #nav img.downarrowclass,
	header #menu #nav i.icon-angle-down { display: none !important; }

	/* --- Submenu's: openklappen met het pijltje ------------------------------- */
	header #menu #nav .m-sub-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex: 0 0 auto;
		width: 40px;
		height: 40px;
		margin: 0 -10px 0 0;
		padding: 0;
		border: 0;
		background: none;
		color: #22282d;
		cursor: pointer;
	}
	header #menu #nav .m-sub-toggle svg { width: 20px; height: 20px; transition: transform .2s; }
	header #menu #nav li.is-open > .m-sub-toggle svg { transform: rotate(180deg); }

	/* !important: ddsmoothmenu zet bij aanraken eigen inline-stijlen op de submenu's */
	header #menu #nav > li > ul {
		display: none !important;
		order: 3;
		flex: 0 0 100%;
		position: static !important;
		top: auto !important;
		left: auto !important;
		visibility: visible !important;
		width: auto !important;
		margin: 0 0 8px;
		padding: 2px 0 2px 16px;
		border-left: 2px solid #dedfe1;
		background: none;
		box-shadow: none;
	}
	header #menu #nav > li.is-open > ul { display: block !important; }
	header #menu #nav > li > ul > li { display: block; margin: 0; }
	header #menu #nav > li > ul > li > a {
		display: block;
		width: auto;
		padding: 7px 0;
		border: 0 !important;
		background: none !important;
		color: #5f666c !important;
		font-size: 14px;
		font-weight: 400;
		line-height: 1.5;
		text-transform: none;
	}
	header #menu #nav > li > ul > li > a:hover { color: var(--hm-accent-text, #22282d) !important; }

	/* --- Knop onderaan ------------------------------------------------------------ */
	header #menu #nav > li.m-menu-cta { display: block !important; margin-top: 14px; }
	header #menu #nav > li.m-menu-cta > a {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 16px;
		padding: 13px 20px;
		border-radius: 3px;
		background: var(--hm-accent, #22282d) !important;
		color: var(--hm-on-accent, #fff) !important;
		font-size: 15px;
		font-weight: 600;
	}
	header #menu #nav > li.m-menu-cta > a:hover { filter: brightness(.92); }
	header #menu #nav > li.m-menu-cta svg { width: 20px; height: 20px; }
}

/* Paneelmarge per containerbreedte van het thema (skeleton.css) */
@media only screen and (min-width: 480px) and (max-width: 767px) {
	header #menu #nav { padding-left: calc((100% - 420px) / 2); padding-right: calc((100% - 420px) / 2); }
}
@media only screen and (max-width: 479px) {
	header #menu #nav { padding-left: calc((100% - 260px) / 2); padding-right: calc((100% - 260px) / 2); }
}

@media (prefers-reduced-motion: reduce) {
	header #menu #nav .m-sub-toggle svg { transition: none; }
}
