/* ==========================================================================
   Header: responsive navigation.
   Above 1119px the header is unchanged (hover dropdowns).
   At 1119px and below: a menu button opens a full-screen panel. Items with
   children (Services) expand in place, so every service is reachable on a phone.
   Overrides the older pill-row rules in main.css with more specific selectors.
   ========================================================================== */

:root { --hdr-ease: cubic-bezier(.2, .7, .2, 1); --hdr-h: 76px; }

/* Desktop: the menu button, the panel's consultation button and the dropdown toggles stay hidden */
.menu-toggle { display: none !important; }
.sub-toggle { display: none; }
.primary-nav__foot { display: none; }

@media (max-width: 1119px) {
	.site-header { z-index: 1000; }
	.site-header .container { flex-wrap: nowrap !important; row-gap: 0; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
	.site-header .site-logo img { height: 44px !important; width: auto; max-width: 180px; }
	.site-header .header-cta { display: none !important; }
	.site-header .header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
	.site-header .header-actions .icon-btn { width: 42px; height: 42px; }

	/* The menu button: three bars that become a cross when open */
	.site-header .menu-toggle {
		display: inline-flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
		width: 44px; height: 44px; padding: 0; cursor: pointer; border-radius: 50%;
		background: var(--cream-50, #faf7ef); border: 1px solid rgba(21, 58, 99, .2); color: var(--navy-800, #153a63);
		transition: background .3s, border-color .3s, transform .3s var(--hdr-ease);
	}
	.site-header .menu-toggle:hover { border-color: rgba(21, 58, 99, .45); }
	.site-header .menu-toggle:focus-visible { outline: 2px solid var(--gold-500, #ce3729); outline-offset: 3px; }
	.menu-toggle__bar { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--navy-800, #153a63); transition: transform .45s var(--hdr-ease), opacity .25s; }
	body.mobile-nav-open .menu-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	body.mobile-nav-open .menu-toggle__bar:nth-child(2) { opacity: 0; transform: scaleX(.2); }
	body.mobile-nav-open .menu-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

	/* The panel: full screen, under the header */
	body .site-header .primary-nav {
		display: block !important; position: fixed; left: 0; right: 0; top: var(--hdr-h); bottom: 0; z-index: 999;
		order: initial; flex: none !important; width: auto !important; min-width: 0 !important; overflow-y: auto; overflow-x: hidden;
		-webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 22px 40px;
		background: radial-gradient(420px 260px at 100% 0%, rgba(122, 29, 49, .55), transparent 70%), linear-gradient(170deg, #0c1d38 0%, #071225 75%, #2a0f19 100%);
		opacity: 0; visibility: hidden; transform: translateY(-10px);
		transition: opacity .35s ease, transform .5s var(--hdr-ease), visibility 0s linear .35s;
	}
	body.mobile-nav-open .site-header .primary-nav { opacity: 1; visibility: visible; transform: none; transition: opacity .35s ease, transform .5s var(--hdr-ease), visibility 0s; }
	body.mobile-nav-open { overflow: hidden; }

	body .site-header .primary-nav ul { display: block !important; width: auto !important; min-width: 0 !important; margin: 0; padding: 0; list-style: none; gap: 0 !important; justify-content: flex-start !important; }
	body .site-header .primary-nav li { display: block !important; flex: none !important; position: relative; border-bottom: 1px solid rgba(246, 239, 223, .12); }
	body .site-header .primary-nav > ul > li:last-child { border-bottom: 0; }

	body .site-header .primary-nav a {
		display: block !important; padding: 16px 0; border: 0 !important; border-radius: 0 !important; background: none !important;
		font: 500 clamp(20px, 5.4vw, 24px)/1.2 var(--font-serif, Georgia, serif); letter-spacing: .005em; white-space: normal !important;
		color: var(--cream-50, #faf7ef) !important;
	}
	body .site-header .primary-nav a::after { display: none !important; }
	body .site-header .primary-nav a:hover, body .site-header .primary-nav .current-menu-item > a { color: #e9cdd1 !important; }

	/* Items with children: room for the expand button */
	body .site-header .primary-nav .menu-item-has-children > a { padding-right: 52px !important; }
	body .site-header .primary-nav .menu-item-has-children > a::before { display: none !important; }
	body .site-header .primary-nav .sub-toggle {
		display: grid !important; place-items: center; position: absolute; right: 0; top: 6px; width: 44px; height: 44px; padding: 0;
		border: 0; background: none; cursor: pointer; color: #e9cdd1;
	}
	body .site-header .primary-nav .sub-toggle:focus-visible { outline: 2px solid #e9cdd1; outline-offset: 2px; border-radius: 50%; }
	body .site-header .primary-nav .sub-toggle::before {
		content: ""; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
		transform: translateY(-3px) rotate(45deg); transition: transform .4s var(--hdr-ease);
	}
	body .site-header .primary-nav .menu-item-has-children.is-open > .sub-toggle::before { transform: translateY(3px) rotate(225deg); }

	/* The dropdown: shown in place, animated open and closed */
	body .site-header .primary-nav .sub-menu {
		display: block !important; position: static !important; opacity: 1 !important; visibility: visible !important; transform: none !important;
		background: none !important; border: 0 !important; box-shadow: none !important; min-width: 0 !important; max-height: 0; overflow: hidden !important;
		padding: 0 0 0 14px !important; margin: 0 !important; transition: max-height .55s var(--hdr-ease), padding .4s;
	}
	body .site-header .primary-nav .menu-item-has-children.is-open > .sub-menu { max-height: 1600px; padding: 0 0 12px 14px !important; }
	body .site-header .primary-nav .sub-menu li { border-bottom: 1px dashed rgba(246, 239, 223, .12); }
	body .site-header .primary-nav .sub-menu li:last-child { border-bottom: 0; }
	body .site-header .primary-nav .sub-menu a { font: 400 16px/1.4 var(--font-sans, Inter, sans-serif) !important; padding: 11px 0 !important; color: rgba(246, 239, 223, .84) !important; }
	body .site-header .primary-nav .sub-menu a:hover { color: #fff !important; }
	/* The mega panel (two columns on desktop) becomes one list on phones */
	body .site-header .primary-nav .gbp-mega > .sub-menu,
	body .site-header .primary-nav .gbp-mega:hover > .sub-menu,
	body .site-header .primary-nav .gbp-mega:focus-within > .sub-menu { display: block !important; grid-template-columns: none !important; min-width: 0 !important; }
	body .site-header .primary-nav .gbp-mega > .sub-menu > li:first-child { grid-column: auto !important; }
	body .site-header .primary-nav .gbp-mega > .sub-menu > li:first-child a { background: none !important; color: rgba(246, 239, 223, .84) !important; padding: 11px 0 !important; }
	body .site-header .primary-nav .sub-menu .gbp-mi { display: none !important; }

	/* Footer of the panel: the consultation button */
	body .site-header .primary-nav__foot { display: block; margin-top: 28px; }
	body .site-header .primary-nav .primary-nav__foot a.btn {
		display: flex; justify-content: center; align-items: center; width: 100%; min-height: 52px; padding: 15px 20px;
		border-radius: 2px !important; font: 600 15px/1 var(--font-sans, Inter, sans-serif) !important; letter-spacing: .02em !important;
		background: var(--gold-500, #ce3729) !important; color: #fff !important; text-align: center;
	}
}

/* On phones, the logo and buttons must not crowd each other */
@media (max-width: 380px) {
	.site-header .site-logo img { height: 38px !important; }
	.site-header .header-actions { gap: 6px; }
	.site-header .menu-toggle, .site-header .header-actions .icon-btn { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
	body .site-header .primary-nav, body .site-header .primary-nav .sub-menu, .menu-toggle__bar, .sub-toggle::before { transition: none !important; }
}
