/* ══════════════════════════════════════════════════════════
   Hovedmenuen – Nuance-udgaven af E-akademis header (frontend v3)
   Fra 1180 px: links i bjælken med en mint streg under og pile, og
   mega-paneler i fuld bredde under headeren (åbnes af header.js ved
   klik, hover med lille forsinkelse og tastatur; Esc og klik udenfor
   lukker). Panelerne: navn, beskrivelse og "Alle …" til venstre, et
   gitter af kort til højre (Services: foto, navn og en linje; Cases:
   k360-cases' kort). Under 1180 px: skuffe fra højre med harmonika.
   ══════════════════════════════════════════════════════════ */
.hovedmenu-nav {
	--hm-panel: color-mix(in oklab, var(--nu-teal) 82%, #04181a);
	--hm-tekst: var(--nu-creme);
	--hm-svag: rgba(245, 242, 234, .72);
	--hm-linje: rgba(245, 242, 234, .14);
	--hm-e: cubic-bezier(.2, .8, .2, 1);
	font-family: var(--nu-font);
}
.hovedmenu-nav ul, .hovedmenu-nav li { margin: 0; padding: 0; list-style: none; }
.hovedmenu-nav a { text-decoration: none; }
.hovedmenu-hylster { display: contents; }

/* Pilen på punkter med panel */
.hovedmenu > .menu-item-has-children > a::after {
	content: ''; flex: none; width: 16px; height: 16px; background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
	        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
	transition: transform .3s var(--hm-e);
}

/* Ikonerne ved services (mobilskuffen) */
.hovedmenu-ikon { flex: none; display: block; width: 20px; height: 20px; color: var(--nu-mint); }
.hovedmenu-ikon svg { display: block; width: 100%; height: 100%; }

/* Det, k360-cases selv lægger til: "Se alle cases" står i panelets intro ("Alle cases") */
.hovedmenu .kc-mega-alle { display: none; }

/* ══════════════════════ FRA 1180 PX: MENU I BJÆLKEN ══════════════════════ */
@media (min-width: 1180px) {
	.hovedmenu-knap, .hovedmenu-skygge, .hovedmenu-top, .hovedmenu-genveje, .hovedmenu-kontakt { display: none; }
	.hovedmenu-nav { display: flex; align-self: stretch; }

	.hovedmenu { display: flex; align-items: stretch; gap: 2px; }
	.hovedmenu > li { display: flex; position: static; }

	.hovedmenu > li > a {
		position: relative; display: inline-flex; align-items: center; gap: 6px;
		min-height: var(--nu-header-h); padding: 0 14px;
		color: var(--nu-hvid); font-size: 15.5px; font-weight: 500; white-space: nowrap;
		transition: color .25s var(--hm-e);
	}
	/* Stregen under (E-akademis highlight-streg) – i mint */
	.hovedmenu > li > a::before {
		content: ''; position: absolute; left: 14px; right: 14px; bottom: calc(50% - 19px); height: 2px; border-radius: 2px;
		background: var(--nu-mint); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--hm-e);
	}
	.hovedmenu > .menu-item-has-children > a::before { right: 36px; }
	.hovedmenu > li > a:hover, .hovedmenu > li > a[aria-expanded="true"] { color: var(--nu-mint); }
	.hovedmenu > li > a[aria-expanded="true"]::before,
	.hovedmenu > :is(.current-menu-item, .current-menu-ancestor, .current-menu-parent) > a::before { transform: scaleX(1); }
	.hovedmenu > li > a[aria-expanded="true"]::after { transform: rotate(180deg); }
	.hovedmenu > li > a:focus-visible { outline: 2px solid var(--nu-mint); outline-offset: -10px; border-radius: 10px; }

	/* ── Mega-panelet: fuld bredde under headeren, samme teal som bjælken med en hårfin streg imellem ── */
	.hovedmenu > li > .hovedmenu-fold {
		position: absolute; top: 100%; left: 0; right: 0; z-index: 2;
		padding-block: 40px 48px;
		background: var(--nu-teal); color: var(--hm-tekst);
		box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 34px 60px -34px rgba(0, 24, 30, .65);
		visibility: hidden; opacity: 0; transform: translateY(-6px);
		transition: opacity .16s var(--hm-e), transform .22s var(--hm-e), visibility 0s linear .22s;
	}
	.hovedmenu > li > .hovedmenu-fold.er-aaben,
	html:not(.nu-js) .hovedmenu > li:is(:hover, :focus-within) > .hovedmenu-fold {
		visibility: visible; opacity: 1; transform: none;
		transition: opacity .16s var(--hm-e), transform .22s var(--hm-e), visibility 0s;
	}

	.nu-mega {
		display: grid; grid-template-columns: minmax(220px, .9fr) minmax(0, 3.6fr); gap: 56px; align-items: start;
		max-width: calc(var(--nu-bredde) + var(--nu-side) * 2); margin-inline: auto; padding-inline: calc(var(--nu-side) + 10px);
	}
	.nu-mega-label { margin: 0 0 12px; color: var(--nu-hvid); font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
	.nu-mega-tekst { max-width: 30ch; margin: 0 0 22px; color: var(--hm-svag); font-size: 15px; line-height: 1.55; text-wrap: pretty; }
	.nu-mega-alle {
		display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 20px; border-radius: 999px;
		background: var(--nu-mint); color: var(--nu-teal-dyb); font-size: 14.5px; font-weight: 600;
		transition: background-color .2s var(--hm-e), transform .2s var(--hm-e);
	}
	.nu-mega-alle:hover { background: var(--nu-creme); color: var(--nu-teal-dyb); }
	.nu-mega-alle:active { transform: scale(.98); }
	.nu-mega-alle:focus-visible { outline: 2px solid var(--nu-mint); outline-offset: 3px; }
	.nu-mega-chev { width: 16px; height: 16px; stroke-width: 2.4; }

	/* Almindelige undermenuer (uden kort): linkene i et gitter med tynde streger */
	.nu-mega > .sub-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; align-content: start; }
	.nu-mega > .sub-menu > li > a {
		display: flex; align-items: center; gap: 12px; padding: 14px 0;
		border-bottom: 1px solid var(--hm-linje); color: var(--hm-tekst); font-size: 15px; font-weight: 500; line-height: 1.3;
		transition: color .2s var(--hm-e), padding .3s var(--hm-e);
	}
	.nu-mega > .sub-menu > li > a:is(:hover, :focus-visible) { padding-left: 6px; color: var(--nu-mint); }

	/* ── Kortene (Services og Cases ens): lille foto, navn og en linje i tre spalter ── */
	.nu-mega--kort > .sub-menu { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 24px; }
	.nu-mega--kort > .sub-menu > li { min-width: 0; }
	.nu-mega--kort > .sub-menu > li > a:is(.nu-mega-ydelse, .kc-mega-kort) {
		display: flex; align-items: center; gap: 14px; padding: 8px; border: 0; border-radius: 14px;
		background: transparent; color: var(--hm-tekst); transition: background-color .3s var(--hm-e);
	}
	.nu-mega--kort > .sub-menu > li > a:is(.nu-mega-ydelse, .kc-mega-kort):is(:hover, :focus-visible) { padding: 8px; background: rgba(245, 242, 234, .08); color: var(--hm-tekst); }
	.nu-mega--kort > .sub-menu > li > a:focus-visible { outline: 2px solid var(--nu-mint); outline-offset: 2px; }
	.nu-mega--kort :is(.nu-mega-bill, .kc-mega-bill) {
		position: relative; flex: none; display: block; width: 96px; height: 72px; overflow: hidden; border-radius: 10px;
		background: rgba(245, 242, 234, .1);
	}
	.nu-mega--kort :is(.nu-mega-bill, .kc-mega-bill) img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--hm-e); }
	.nu-mega--kort a:hover :is(.nu-mega-bill, .kc-mega-bill) img { transform: scale(1.06); }
	/* Mint-detaljen: en kort streg i fotoets bund, der vokser ved hover */
	.nu-mega--kort :is(.nu-mega-bill, .kc-mega-bill)::after {
		content: ''; position: absolute; left: 8px; bottom: 6px; width: 18px; height: 3px; border-radius: 3px;
		background: var(--nu-mint); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--hm-e);
	}
	.nu-mega--kort a:is(:hover, :focus-visible) :is(.nu-mega-bill, .kc-mega-bill)::after { transform: scaleX(1); }
	.nu-mega-ikonflade { display: grid; place-items: center; width: 100%; height: 100%; color: var(--nu-mint); }
	.nu-mega-ikonflade svg { width: 30px; height: 30px; }
	.nu-mega--kort .hovedmenu-ikon { display: none; }
	.nu-mega--kort :is(.nu-mega-ydelse-tekst, .kc-mega-tekst) { display: block; min-width: 0; }
	.nu-mega--kort :is(.nu-mega-ydelse-tekst, .kc-mega-tekst) b {
		display: -webkit-box; overflow: hidden; color: var(--hm-tekst); font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em;
		-webkit-line-clamp: 2; -webkit-box-orient: vertical; transition: color .2s var(--hm-e);
	}
	.nu-mega--kort a:is(:hover, :focus-visible) :is(.nu-mega-ydelse-tekst, .kc-mega-tekst) b { color: var(--nu-mint); }
	.nu-mega--kort :is(.nu-mega-linje, .kc-mega-tekst span) {
		display: -webkit-box; margin-top: 3px; overflow: hidden; color: rgba(245, 242, 234, .62); font-size: 12.5px; font-weight: 400; line-height: 1.35;
		white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
	}

	/* Dæmper siden under panelet */
	.nu-mega-skygge {
		position: fixed; inset: var(--nu-header-bund, var(--nu-header-h)) 0 0; z-index: -1;
		background: rgba(4, 24, 26, .32); animation: nu-mega-ind .2s var(--hm-e);
	}
}
.nu-mega-skygge[hidden] { display: none; }
@keyframes nu-mega-ind { from { opacity: 0; } }

/* Lidt mindre luft mellem punkterne, før skuffen tager over */
@media (min-width: 1180px) and (max-width: 1359px) {
	.hovedmenu > li > a { padding: 0 11px; font-size: 15px; }
	.hovedmenu > li > a::before { left: 11px; right: 11px; }
	.hovedmenu > .menu-item-has-children > a::before { right: 33px; }
	.nu-mega { grid-template-columns: minmax(190px, .8fr) minmax(0, 3.4fr); gap: 36px; }
	.nu-mega--kort > .sub-menu { gap: 8px 16px; }
	.nu-mega--kort :is(.nu-mega-bill, .kc-mega-bill) { width: 80px; height: 60px; }
}

/* ══════════════════════ UNDER 1180 PX: SKUFFEN ══════════════════════ */
@media (max-width: 1179px) {
	.hovedmenu-hylster { display: block; }

	/* Burgeren */
	.hovedmenu-knap {
		position: relative; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px;
		margin: 0 -6px 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--nu-hvid);
		cursor: pointer; -webkit-tap-highlight-color: transparent;
	}
	.hovedmenu-knap:focus-visible { outline: 2px solid var(--nu-mint); outline-offset: 2px; }
	.hovedmenu-streger { position: relative; display: block; width: 24px; height: 16px; }
	.hovedmenu-streger i { position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px; background: currentColor; transition: transform .4s var(--hm-e), opacity .25s var(--hm-e), top .4s var(--hm-e); }
	.hovedmenu-streger i:nth-child(1) { top: 0; }
	.hovedmenu-streger i:nth-child(2) { top: 7px; }
	.hovedmenu-streger i:nth-child(3) { top: 14px; }
	.hovedmenu-knap[aria-expanded="true"] .hovedmenu-streger i:nth-child(1) { top: 7px; transform: rotate(45deg); }
	.hovedmenu-knap[aria-expanded="true"] .hovedmenu-streger i:nth-child(2) { opacity: 0; }
	.hovedmenu-knap[aria-expanded="true"] .hovedmenu-streger i:nth-child(3) { top: 7px; transform: rotate(-45deg); }

	.hovedmenu-skygge {
		position: fixed; inset: 0; z-index: 100000; display: block;
		background: rgba(4, 24, 26, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
		opacity: 0; transition: opacity .4s var(--hm-e);
	}
	.hovedmenu-skygge[hidden] { display: none; }
	.hovedmenu-hylster.er-aaben .hovedmenu-skygge { opacity: 1; }

	/* Skuffen (E-akademis ea-drawer): top med logo og luk, menuen, handlingerne, kontakt */
	.hovedmenu-nav {
		position: fixed; top: 0; right: 0; bottom: 0; z-index: 100001;
		display: flex; flex-direction: column; width: min(420px, 88vw); padding: 0 22px;
		overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
		background: var(--hm-panel); color: var(--hm-tekst);
		transform: translateX(100%); visibility: hidden;
		transition: transform .45s var(--hm-e), visibility .45s var(--hm-e);
	}
	.hovedmenu-hylster.er-aaben .hovedmenu-nav { transform: translateX(0); visibility: visible; }

	.hovedmenu-top {
		position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px;
		padding: calc(16px + env(safe-area-inset-top, 0px)) 0 14px; background: var(--hm-panel);
	}
	.hovedmenu-logo img { width: 118px; height: auto; }
	.hovedmenu-luk {
		display: grid; place-items: center; width: 44px; height: 44px; margin-right: -8px;
		border: 0; border-radius: 50%; background: rgba(245, 242, 234, .1); color: var(--hm-tekst); cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
	.hovedmenu-luk svg { width: 16px; height: 16px; }

	.hovedmenu { display: flex; flex-direction: column; }
	.hovedmenu > li + li { border-top: 1px solid var(--hm-linje); }
	.hovedmenu > li > a {
		display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 16px 2px;
		color: var(--hm-tekst); font-size: 18px; font-weight: 500; letter-spacing: -.01em; line-height: 1.2;
		-webkit-tap-highlight-color: transparent;
	}
	.hovedmenu > li > a::after { width: 20px; height: 20px; }
	.hovedmenu > li.is-open > a { color: var(--nu-mint); }
	.hovedmenu > li.is-open > a::after { transform: rotate(180deg); }
	.hovedmenu > :is(.current-menu-item, .current-menu-ancestor) > a { color: var(--nu-mint); }

	/* Harmonikaen: folden animerer grid-template-rows på sit ene barn (.nu-mega) */
	.hovedmenu-fold { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .4s var(--hm-e), visibility .4s; }
	.hovedmenu .menu-item-has-children.is-open > .hovedmenu-fold { grid-template-rows: 1fr; visibility: visible; }
	.nu-mega { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
	.nu-mega-label, .nu-mega-tekst { display: none; }
	.nu-mega-intro { order: 2; padding-bottom: 12px; }
	.nu-mega-alle { display: flex; align-items: center; gap: 6px; padding: 12px 2px 4px 14px; color: var(--nu-mint); font-size: 15px; font-weight: 600; }
	.nu-mega-chev { width: 16px; height: 16px; }

	.nu-mega > .sub-menu { padding-bottom: 4px; }
	.nu-mega > .sub-menu > li + li { border-top: 1px solid rgba(245, 242, 234, .08); }
	.nu-mega > .sub-menu > li > a {
		display: flex; align-items: center; gap: 12px; padding: 12px 2px 12px 14px;
		color: rgba(245, 242, 234, .86); font-size: 15.5px; line-height: 1.3; -webkit-tap-highlight-color: transparent;
	}
	/* Services i skuffen: ikon og navn – ingen fotos og linjer */
	.nu-mega-bill, .nu-mega-linje { display: none; }
	.nu-mega-ydelse-tekst b { font-weight: 400; }
	.hovedmenu-ikon { width: 18px; height: 18px; }
	.nu-mega--cases .kc-mega-kort { padding: 8px 2px 8px 14px; }
	.nu-mega--cases .kc-mega-bill { width: 56px; height: 42px; }

	.hovedmenu > li:last-child { margin-bottom: 18px; }

	/* Handlingerne nederst (E-akademis ea-drawer__actions): hovedknappen først, så de andre og kontoen */
	.hovedmenu-genveje {
		position: sticky; bottom: 0; z-index: 2; display: grid; gap: 8px; margin-top: auto;
		padding: 14px 0 10px; background: var(--hm-panel);
	}
	.nu-mobil-handling {
		display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 18px;
		border: 1.5px solid rgba(245, 242, 234, .35); border-radius: 999px; color: var(--hm-tekst);
		font-size: 15.5px; font-weight: 500; -webkit-tap-highlight-color: transparent;
		transition: background-color .25s var(--hm-e), border-color .25s var(--hm-e), transform .2s var(--hm-e);
	}
	.nu-mobil-handling .nu-ikon, .nu-mobil-handling .k3k-ikon { width: 18px; height: 18px; }
	.nu-mobil-handling--cta { border-color: var(--nu-mint); background: var(--nu-mint); color: var(--nu-teal-dyb); font-weight: 600; }
	.nu-mobil-handling:active { transform: scale(.985); }
	.hovedmenu-kontakt {
		display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 4px 0 calc(20px + env(safe-area-inset-bottom, 0px));
		background: var(--hm-panel); font-size: 13.5px;
	}
	.hovedmenu-kontakt a { display: inline-flex; align-items: center; gap: 7px; color: var(--hm-svag); }
	.hovedmenu-kontakt .nu-ikon { width: 15px; height: 15px; color: var(--nu-mint); }

	.hovedmenu-nav a:focus-visible, .hovedmenu-nav button:focus-visible { outline: 2px solid var(--nu-mint); outline-offset: 2px; border-radius: 8px; }
}
@media (max-width: 1179px) and (hover: hover) and (pointer: fine) {
	.nu-mega > .sub-menu > li > a:hover, .nu-mega-alle:hover { color: var(--nu-mint); }
	.nu-mobil-handling:hover { border-color: var(--hm-tekst); }
	.nu-mobil-handling--cta:hover { background: var(--nu-creme); border-color: var(--nu-creme); }
}

/* Når skuffen er åben, må siden bagved ikke rulle (kun på html – overflow på body ville slippe den sticky header) –
   og kurvens flydende knap (nuance-cart) må ikke ligge oven på skuffen */
html.hovedmenu-laast { overflow: hidden; }
html.hovedmenu-laast .ncart-flyd { visibility: hidden; opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
	.hovedmenu-nav, .hovedmenu-nav *, .hovedmenu-fold, .hovedmenu-skygge, .nu-mega-skygge { transition-duration: .01ms !important; animation: none !important; }
}
