/*
 * Mega menu (columns + tabs), header buttons and search icon.
 * Loaded after all-styles.min.css. Markup: includes/mega-menu.php, globals/main-menu.php.
 */

/* ---------- Desktop dropdown panel ---------- */

/* Full width: the nav and its items aren't positioned, so the dropdown is placed
   against the (fixed, full-width) header, directly below it. Contents centred.
   Bottom padding matches the page blocks (.block: 120px, 80px below 1165px). */
nav.mainNav,
nav.mainNav ul.menu > li.megMen {
	position: static;
}

nav.mainNav .megaMenu.mmPanel {
	top: 100%;
	left: 0;
	right: 0;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	width: auto;
	max-width: none;
	/* Top: the same on every layout. Bottom: as the page blocks. Both smaller
	   below 1165px (see the end). The layouts inside add no top spacing of their own. */
	--mm-top: 60px;
	--mm-pad: 120px;
	padding: var(--mm-top) 0 var(--mm-pad);
	background-color: #fff;
	border-radius: 0;
	-webkit-box-shadow: 0 20px 40px -10px rgba(34, 46, 89, .18);
	box-shadow: 0 20px 40px -10px rgba(34, 46, 89, .18);
	font-size: 16px; /* everything inside follows this; smaller on laptops, see the end */
	font-weight: 400;
	line-height: 1.25;
	text-align: left;
}

/* Keyboard users: open the dropdown when tabbing into it. :focus-visible (not
   :focus-within) so a mouse click doesn't keep it open while hovering another item. */
nav.mainNav ul.menu > li.menu-item-has-children:has(:focus-visible) > .megaMenu {
	visibility: visible;
	opacity: 1;
	-webkit-transform: translateY(0);
	transform: translateY(0);
	z-index: 9995;
	max-height: -webkit-fit-content;
	max-height: -moz-fit-content;
	max-height: fit-content;
}

/* Undo the theme's default (floating) sub-menu styles inside the panel */
/* visibility: inherit (not visible), so lists follow the dropdown / tab panel they're in */
nav.mainNav .mmPanel ul.sub-menu {
	visibility: inherit;
	/* The theme fades sub-menus in/out; here that left the previous tab's links
	   showing on top of the next one, so switch instantly. */
	-webkit-transition: none;
	transition: none;
	opacity: 1;
	-webkit-transform: none;
	transform: none;
	position: static;
	width: auto;
	padding: 0;
	margin: 0;
	list-style: none;
	background: none;
	-webkit-box-shadow: none;
	box-shadow: none;
	border-radius: 0;
}

nav.mainNav .mmPanel ul.sub-menu li,
nav.mainNav .mmPanel ul.sub-menu li:last-child {
	position: relative;
	float: none;
	width: auto;
	margin: 0;
	padding: 0;
	font-size: inherit; /* from .mmPanel (the theme sets 15px) */
	line-height: 1.25;
	-webkit-column-break-inside: avoid;
	break-inside: avoid;
}

nav.mainNav .mmPanel ul.sub-menu li > a {
	display: block;
	padding: 6px 0;
	color: #222e59;
	font-weight: 400;
	text-decoration: none;
	-webkit-transition: color .2s ease;
	transition: color .2s ease;
}

nav.mainNav .mmPanel ul.sub-menu li:hover > a,
nav.mainNav .mmPanel ul.sub-menu li.active > a {
	color: #5abdd9;
}

/* ---------- Columns layout (How We Help, About Us, Knowledge Hub) ---------- */

nav.mainNav .mmColumns {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	gap: 50px;
	padding: 0 35px;
}

nav.mainNav .mmColumn {
	min-width: 200px;
	max-width: 300px;
}

/* With headings: headings across the top, links in columns below, lined up in
   one grid so the headings stay level. Each .mmColumn is "display:
   contents", so its heading and list become cells of one grid: row 1 headings,
   row 2 lists, one grid column per group. */
nav.mainNav .mmColumns.hasHeadings {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr; /* equal columns, as wide as the widest one */
	grid-template-rows: auto 1fr;
	gap: 0;
	padding: 0;
}

nav.mainNav .mmColumns.hasHeadings .mmColumn {
	display: contents;
}

/* Headings row: close to the links below */
nav.mainNav .mmHeadCell {
	padding: 0 10px 5px;
}

/* Side padding lines the links up with the heading text above
   (cell padding + 17px heading padding), and gives 54px between
   columns. "ul.menu" is needed to beat the theme's
   "nav.mainNav ul.menu>li.megMen ul.sub-menu{padding:0}". */
nav.mainNav ul.menu .mmColumns.hasHeadings ul.sub-menu {
	min-width: 200px;
	padding: 15px 27px 0;
}

nav.mainNav .mmColumn:first-child .mmHeadCell {
	padding-left: 20px;
}

nav.mainNav .mmColumn:last-child .mmHeadCell {
	padding-right: 20px;
}

nav.mainNav ul.menu .mmColumns.hasHeadings .mmColumn:first-child ul.sub-menu {
	padding-left: 37px;
}

nav.mainNav ul.menu .mmColumns.hasHeadings .mmColumn:last-child ul.sub-menu {
	padding-right: 37px;
}

/* A single column next to featured content (Knowledge Hub): placed where the
   second column of a two-column dropdown would be, closer to the featured box.
   An empty first cell (::before) the same width as the column centres the pair
   in the left half, as the two-column dropdowns are. */
nav.mainNav .mmPanel.hasFeature .mmColumns.isSingle {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0;
	padding: 0;
}

nav.mainNav .mmPanel.hasFeature .mmColumns.isSingle::before {
	content: "";
}

/* Lines up with the second column's links (27px, as its list padding) */
nav.mainNav .mmPanel.hasFeature .mmColumns.isSingle .mmColumn {
	padding: 0 0 0 27px;
}

/* ---------- Tabs layout (What We Do) ---------- */

nav.mainNav .mmTabs {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	min-height: 100%;
}

/* The grey tab column runs the full height of the dropdown (through its bottom
   padding, --mm-pad) and, with ::before, out to its left edge. */
nav.mainNav .mmTabList {
	position: relative;
	-ms-flex-negative: 0;
	flex-shrink: 0;
	width: 280px;
	/* Reaches up to the header and down to the bottom, through the dropdown's
	   padding; the tabs start at the same top spacing as everything else */
	margin: calc(-1 * var(--mm-top)) 0 calc(-1 * var(--mm-pad));
	/* 40px on the right (30px on small laptops) */
	padding: var(--mm-top) 40px var(--mm-pad) 20px;
	list-style: none;
	background-color: #f6f6f6;
}

nav.mainNav .mmTabList::before {
	content: "";
	position: absolute;
	top: 0;
	right: 100%;
	bottom: 0;
	width: 100vw;
	background-color: #f6f6f6;
}

nav.mainNav .mmTabList li.mmTab {
	float: none;
	margin: 0 0 8px;
	padding: 0;
	font-size: inherit;
}

nav.mainNav .mmTabList li.mmTab:last-child {
	margin-bottom: 0;
}

/* ---------- Heading pills (tabs + column headings) ---------- */

/* The site's banner gradient image (same as .allGrad) */
nav.mainNav .mmPanel {
	--mm-gradient: url(../images/allgrad.jpg) center / cover no-repeat;
}

/* White with a gradient border: white fill on the padding box, gradient behind
   on the border box. Sizes in em, so they scale with the dropdown text on laptops. */
nav.mainNav .mmTabLink,
nav.mainNav .mmHeadCell .mmHeading {
	display: block;
	padding: 10px 15px;
	border: 2px solid transparent;
	border-radius: 8px;
	background: linear-gradient(#fff, #fff) padding-box, var(--mm-gradient) border-box;
	color: #222e59;
	font-size: 1em;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	-webkit-transition: color .2s ease;
	transition: color .2s ease;
}

/* Column heading pills fill their column; text centred. Regular weight; only
   the What We Do tabs are bold (the site font only has 400 and 700). */
nav.mainNav .mmHeadCell .mmHeading {
	font-weight: 400;
	text-align: center;
}

/* Hovered / open tab, hovered linked heading: full gradient, white text */
nav.mainNav .mmTab.open .mmTabLink,
nav.mainNav .mmHeadCell a.mmHeading:hover {
	background: var(--mm-gradient) border-box;
	color: #fff;
}

/* All panels share one grid cell, so the dropdown is as wide (and tall) as the
   largest one and doesn't change size when moving between tabs. */
nav.mainNav .mmTabPanels {
	display: grid;
	min-width: 320px;
	padding: 0 35px;
}

nav.mainNav .mmTabPanel {
	grid-area: 1 / 1;
	visibility: hidden;
}

/* inherit (not visible) so it stays hidden while the dropdown itself is closed */
nav.mainNav .mmTabPanel.open {
	visibility: inherit;
}

/* ---------- Featured content (desktop) ----------
   With featured content the dropdown is split in two: the menu (.mmMain) centred
   in the left half, the featured box in the right half, with the same space on
   its right as the dropdown's bottom padding (--mm-pad). If the menu needs more
   than half, it keeps its width and the box gets what's left. */

nav.mainNav .mmMain {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
}

nav.mainNav .mmPanel.hasFeature .mmMain,
nav.mainNav .mmFeatureCol {
	-webkit-box-flex: 1;
	-ms-flex: 1 1 50%;
	flex: 1 1 50%;
}

nav.mainNav .mmPanel.hasFeature .mmMain {
	min-width: -webkit-max-content;
	min-width: -moz-max-content;
	min-width: max-content;
}

/* At least the dropdown's padding (--mm-pad) between the window edge and the
   menu, as on the right of the featured box, so it isn't pushed to the edge on
   smaller screens */
nav.mainNav .mmMain {
	padding: 0 var(--mm-pad);
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}

nav.mainNav .mmPanel.hasFeature .mmMain {
	padding-right: 0;
}

nav.mainNav .mmFeatureCol {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	min-width: 0;
	padding: 0 var(--mm-pad) 0 0;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
}

/* Like the post's own banner: label top left, title, then the banner image.
   Background from the theme's classes (blueGrad, orangeGrad, allGrad, navyBg,
   lGreyBg), the same options as the post Background Colour. */
nav.mainNav a.mmFeature {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-orient: vertical;
	-ms-flex-direction: column;
	flex-direction: column;
	/* Label and title centred vertically (at the top when there's an image) */
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	-webkit-box-flex: 1;
	-ms-flex: 1;
	flex: 1;
	position: relative;
	overflow: hidden; /* crops the image where it runs past the edges */
	min-width: 300px; /* 200px below 1450px, see the end */
	min-height: 220px;
	padding: 40px;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	border-radius: 15px;
	color: #fff;
	text-decoration: none;
	-webkit-transition: all .3s ease;
	transition: all .3s ease;
}

/* With an image: label and title at the top */
nav.mainNav a.mmFeature.hasImage {
	-webkit-box-pack: start;
	-ms-flex-pack: start;
	justify-content: flex-start;
}

/* Same hover as the hub's featured boxes (.mainBlog .box:hover) */
nav.mainNav a.mmFeature:hover {
	-webkit-transform: scale(1.01);
	-ms-transform: scale(1.01);
	transform: scale(1.01);
	-webkit-box-shadow: 0 0 15px 0 rgba(0, 0, 0, .05);
	box-shadow: 0 0 15px 0 rgba(0, 0, 0, .05);
}

/* Light background: navy text */
nav.mainNav a.mmFeature.lGreyBg {
	color: #222e59;
}

/* Label and title above the image where they overlap */
nav.mainNav .mmFeatureLabel,
nav.mainNav .mmFeatureTitle {
	position: relative;
	z-index: 1;
}

/* With an image: tall enough to show it well */
nav.mainNav a.mmFeature.hasImage {
	min-height: 360px;
}

nav.mainNav .mmFeatureLabel {
	margin-bottom: 12px;
	font-size: .875em;
	font-weight: 700;
	line-height: 1.2;
}

/* Like the banner heading: impact, uppercase */
nav.mainNav .mmFeatureTitle {
	font-family: "impact", sans-serif;
	font-size: 2.25em;
	font-weight: 400;
	line-height: 1;
	letter-spacing: -.5px;
	text-transform: uppercase;
}

/* The banner image, kept whole, in the bottom right. It fills the lower right of
   the box from about a quarter of the way down, so it can overlap the title a
   little (the title stays on top), and runs past the bottom edge, where the box
   crops it, as on the site's featured post banners. */
nav.mainNav .mmFeatureImg {
	position: absolute;
	top: 25%;
	right: 0;
	bottom: -30px; /* -16px on small laptops */
	left: 30%;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: end;
	-ms-flex-align: end;
	align-items: flex-end;
	-webkit-box-pack: end;
	-ms-flex-pack: end;
	justify-content: flex-end;
}

nav.mainNav .mmFeatureImg img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	-o-object-fit: contain;
	object-fit: contain;
}

/* ---------- Header buttons + search icon ---------- */

nav.mainNav a.button + a.button {
	margin-left: 10px;
}

/* Header items styled "Text link" in Theme Options: look like the menu items */
nav.mainNav a.headLink {
	display: inline-block;
	vertical-align: middle;
	margin-left: 20px;
	padding: 11px 0;
	font-size: var(--text-md);
	font-weight: 500;
	line-height: 1;
	color: var(--color-navy);
	text-decoration: none;
}

nav.mainNav a.headLink:hover,
nav.mainNav a.headLink:focus-visible {
	text-decoration: underline;
	text-underline-offset: 4px;
}

header .searchButt.searchIcon {
	position: relative;
	display: inline-block;
	vertical-align: middle;
	width: 40px;
	height: 40px;
	margin-left: 10px;
	padding: 0;
	background: none;
	border-radius: 0;
}

header .searchButt.searchIcon form {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 5;
	width: 40px;
	height: 40px;
	overflow: hidden;
	background-color: #fff;
	border-radius: 8px;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	-webkit-transition: width .3s ease, -webkit-box-shadow .3s ease;
	transition: width .3s ease, box-shadow .3s ease;
}

header .searchButt.searchIcon.open form {
	width: 260px;
	-webkit-box-shadow: 0 2px 10px rgba(34, 46, 89, .15);
	box-shadow: 0 2px 10px rgba(34, 46, 89, .15);
}

header .searchButt.searchIcon input.search-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 40px;
	padding: 0 40px 0 15px;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	opacity: 0;
	background: none;
	-webkit-transition: opacity .2s ease;
	transition: opacity .2s ease;
}

header .searchButt.searchIcon.open input.search-input {
	opacity: 1;
}

header .searchButt.searchIcon .search-toggle {
	position: absolute;
	top: 0;
	right: 0;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	cursor: pointer;
	background: transparent url(../images/mag.svg) no-repeat center / 16px;
}

header .searchButt.searchIcon .search-toggle:focus-visible {
	outline: 2px solid #222e59;
	outline-offset: -2px;
	border-radius: 8px;
}

/* ---------- Mobile side menu ---------- */

.sideMenu .butt .button {
	margin: 0 10px 10px 0;
}

.sideMenu .butt .headLink {
	display: inline-block;
	margin: 0 20px 10px 0;
	padding: 11px 0;
	font-weight: 500;
	color: var(--color-navy);
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* Second-tier titles (What We Do services, column headings): bold.
   The site font only has 400 and 700. */
.sideMenu nav ul.menu li ul.sub-menu li.mmGroup > .mmGroupTitle,
.sideMenu nav ul.menu li ul.sub-menu li.mmGroupHeading > .mmGroupTitle {
	display: inline-block;
	padding-left: 0;
	font-weight: 700;
}

/* Sit the arrow straight after the text (the theme makes these spans blocks, which
   put the arrow over the start of the text) */
.sideMenu nav ul.menu li ul.sub-menu li.mmGroup > .dropArrow {
	position: static;
	display: inline-block;
	vertical-align: middle;
	margin: 0 0 0 8px;
	padding: 2px 6px;
	font-size: 14px;
	line-height: 1;
}

.sideMenu nav ul.menu li ul.sub-menu li.mmGroup > ul.sub-menu {
	margin: 12px 0 5px 15px;
}

.sideMenu nav ul.menu li ul.sub-menu li.mmGroupHeading {
	margin-top: 20px;
}

.sideMenu nav ul.menu li ul.sub-menu li.mmGroupHeading:first-child {
	margin-top: 0;
}

/* Links under a column heading (e.g. under Sectors): indented like the
   links under a What We Do service. Menus without headings aren't indented. */
.sideMenu nav ul.menu li.mm-columns > ul.sub-menu > li.mmGroupHeading ~ li:not(.mmGroupHeading) > a {
	padding-left: 15px;
}

.sideMenu nav ul.menu li ul.sub-menu li.mmGroupHeading > span.mmGroupTitle {
	display: block;
	text-transform: none;
	font-size: 18px;
	font-family: "arial_nova", sans-serif;
}

.sideMenu nav ul.menu li ul.sub-menu li.mmGroupHeading > a.mmGroupTitle {
	color: #222e59;
}

/* No icons in the menu, so no space reserved for them */
.sideMenu nav ul.menu li.megMen ul.sub-menu li a {
	padding-left: 0;
}

/* Don't repeat what the header already shows above the open side menu.
   The theme hides the header buttons below 768px (below(tablet)) and the whole header nav
   (including search) below 568px (below(sm)), so the side menu copies show again there.
   Keep these in step with src/scss/layout/_header.scss.
   "sideOnly" buttons are never in the header at these sizes, so they always show. */
@media (min-width: 768px) {
	.sideMenu .butt .button:not(.sideOnly),
	.sideMenu .butt .headLink:not(.sideOnly) {
		display: none;
	}
}

/* Buttons ticked "Slide-out menu only on smaller screens" (e.g. Customer Login):
   hidden from the header once the menu collapses (burger below 1024px, see below). */
@media (max-width: 1023.99px) {
	nav.mainNav a.button.sideOnly {
		display: none;
	}
}

@media (min-width: 568px) {
	.sideMenu .searchBar {
		display: none;
	}
}

/* Top-level items without a link (no href): same pointer cursor as the other
   menu items. In the side menu, tapping them opens their sub-menu. */
nav.mainNav ul.menu > li.no-link > a,
.sideMenu nav ul.menu > li.no-link > a {
	cursor: pointer;
}

/* ---------- Mobile menu breakpoint: 1024px (the theme's is 1450px) ----------
   Keeps the full desktop header on laptops down to 1024px by undoing the theme's
   "max-width: 1449.99px" header rules, with smaller text below 1450px so it fits
   on one line. Widths were measured with the site font: at 1024px the header
   needs ~950px of the 976px available.
   To change the breakpoint, change 1024px here and 1023.99px in the "sideOnly"
   rule above. */
@media (min-width: 1024px) and (max-width: 1449.99px) {
	body:before {
		height: 80px;
	}

	header {
		padding: 0;
	}

	header a.logo {
		margin-top: 20px;
	}

	nav.mainNav {
		padding-right: 0;
		padding-top: 0;
	}

	nav.mainNav ul.menu {
		display: inline-block;
	}

	.mobButton,
	.sideMenu {
		display: none;
	}
}

/* 1300–1449px: a little smaller than the theme's 18px text / 20px gaps */
@media (min-width: 1300px) and (max-width: 1449.99px) {
	nav.mainNav ul.menu > li {
		margin-right: 12px;
		font-size: 16px;
	}

	nav.mainNav a.button {
		margin-left: 15px;
	}

	nav.mainNav a.button.smallButt {
		font-size: 16px;
		padding: 12px 24px;
	}

	nav.mainNav .megaMenu.mmPanel {
		font-size: 15px;
	}
}

/* 1024–1299px (small laptops): compact header */
@media (min-width: 1024px) and (max-width: 1299.99px) {
	header .bigContainer {
		margin: 0 24px;
	}

	header a.logo {
		margin-top: 22px;
	}

	header a.logo svg,
	header a.logo img {
		height: 32px;
	}

	nav.mainNav ul.menu {
		margin-right: 0;
	}

	nav.mainNav ul.menu > li {
		margin-right: 10px;
		font-size: 15px;
	}

	nav.mainNav ul.menu > li.menu-item-has-children > a:after {
		margin-left: 6px;
	}

	nav.mainNav a.button {
		margin-left: 12px;
	}

	nav.mainNav a.button + a.button {
		margin-left: 8px;
	}

	nav.mainNav a.button.smallButt {
		font-size: 14px;
		padding: 12px 18px;
	}

	header .searchButt.searchIcon {
		margin-left: 8px;
	}

	/* Dropdowns: smaller text and a more compact What We Do */
	nav.mainNav .megaMenu.mmPanel {
		font-size: 14px;
	}

	nav.mainNav .mmPanel ul.sub-menu li > a {
		padding: 5px 0;
	}

	nav.mainNav .mmTabList {
		width: 240px;
		padding: var(--mm-top) 30px var(--mm-pad) 16px;
	}

	nav.mainNav .mmTabList li.mmTab {
		margin-bottom: 6px;
	}

	nav.mainNav .mmTabLink {
		padding: 8px 12px;
	}

	nav.mainNav .mmTabPanels {
		padding: 0 28px;
	}

	nav.mainNav a.mmFeature {
		padding: 24px;
	}

	nav.mainNav .mmFeatureImg {
		bottom: -16px;
	}

	nav.mainNav a.mmFeature.hasImage {
		min-height: 300px;
	}
}

/* ---------- Logged in: keep the fixed header below the WP admin bar ----------
   Otherwise the admin bar covers the top of the header and leaves a gap under it.
   The admin bar is 32px tall, 46px on small screens. Below 600px WordPress lets it
   scroll away with the page, which would leave the header partly covered or a gap
   above it, so it's kept fixed there too. */
body.admin-bar header.siteHead {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar header.siteHead {
		top: 46px;
	}
}

@media (max-width: 600px) {
	body.admin-bar #wpadminbar {
		position: fixed;
	}
}

/* Featured content box: narrower minimum below 1450px */
@media (max-width: 1449.99px) {
	nav.mainNav a.mmFeature {
		min-width: 200px;
	}
}

/* Dropdown top and bottom padding below 1165px (bottom as the page blocks) */
@media (max-width: 1164.99px) {
	nav.mainNav .megaMenu.mmPanel {
		--mm-top: 40px;
		--mm-pad: 80px;
	}
}

/* Narrower screens: fade the image behind the title, as the site's featured
   post banners do (.mainBlog .box.bigPost .banx), and make it larger */
@media (max-width: 1279.99px) {
	nav.mainNav .mmFeatureImg {
		opacity: .3;
		/* the box is narrower, so let the faded image use most of it */
		top: 15%;
		left: 0;
	}
}
