/* HEADER - the bar across the top (NAV section) and the panel its Menu button opens (MENU section).
   Loads on: every page. */

/* NAV - the bar across the top: the logo on the left; the page links and the green Menu button on the right.
   Coded part: printed by inc/theme-nav.php. The panel the Menu button opens is the MENU section below.
   The links are the "Main menu" in Appearance > Menus. Give an item the CSS class nav-menu-only to keep it out of
   the bar (panel only), or nav-desktop-only to show it in the bar on desktops only.
   Two purple islands on the headline rail. Every value is a variable (tokens.css); no raw px or hex. */
.nav {
  /* The headline rail. Used for left/right here and by the phone panel (fixed, so % = the viewport there too). */
  --nav-rail: calc(max(var(--gap-10), 50% - var(--shell) / 2 - var(--lock-sbw) / 2) + var(--gut));
  --nav-fill-2: color-mix(in srgb, var(--white) 14%, transparent);
  position: fixed; z-index: 60; top: var(--nav-top); left: var(--nav-rail); right: var(--nav-rail);
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--gap-20);
  pointer-events: none;
}
/* Logged-in: WordPress's admin bar sits above everything, so drop below it. */
.admin-bar .nav { top: calc(var(--nav-top) + var(--wp-admin--admin-bar--height, var(--gap-20))); }
.nav > * { pointer-events: auto; }

.nav__island {
  display: flex; align-items: center; height: var(--nav-h);
  background: var(--ddc-purple); border-radius: var(--r-nav); box-shadow: var(--shadow-pill);
}
.nav__home { flex: none; padding: 0 var(--gap-20); }
.nav__logo { display: block; width: var(--logo-nav); height: auto; }
.nav__bar { position: relative; min-width: 0; padding: 0 var(--gap-8); }

.nav__links { display: flex; align-items: center; gap: calc(var(--gap-4) / 2); margin: 0; padding: 0; list-style: none; }
.nav__item { display: flex; align-items: center; }
.nav__link {
  display: flex; align-items: center; height: var(--btn-h-sm); padding: 0 calc(var(--gap-8) * 2);
  border-radius: var(--r-pill);
  font: 500 var(--fs-small)/1 var(--font); white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease);
}
/* Hello's reset recolours a:hover. White always; the page you're on (or the section it sits in) gets the fill. */
.nav .nav__link, .nav .nav__link:hover, .nav .nav__link:focus, .nav .nav__link:active { color: var(--white); text-decoration: none; }
.nav .nav__link:hover { background: var(--on-dark-fill); }
.nav .nav__link[aria-current] { background: var(--nav-fill-2); }

/* The green Menu button; on phones it carries the word "Menu" ("Close" when open) beside it. */
.nav__more { display: flex; align-items: center; gap: calc(var(--gap-6) * 2); height: var(--btn-h-sm); border-radius: var(--r-pill); cursor: pointer; }
.nav__word { display: none; padding-left: calc(var(--gap-6) * 2); font: 500 var(--fs-small)/1 var(--font); }
.nav__circle {
  display: grid; place-items: center; width: var(--btn-h-sm); height: var(--btn-h-sm); border-radius: 50%;
  background: var(--ddc-green); color: var(--body);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav__more:hover .nav__circle { background: var(--white); color: var(--ddc-purple); }

.burger { position: relative; display: block; width: var(--gap-20); height: var(--gap-10); }
.burger i {
  position: absolute; left: 0; right: 0; height: var(--mark-w); border-radius: var(--r-pill);
  background: currentColor; transition: transform var(--dur) var(--ease);
}
.burger i:first-child { top: 0; }
.burger i:last-child { bottom: 0; }
.nav.is-open .burger i:first-child { transform: translateY(var(--gap-4)) rotate(45deg); }
.nav.is-open .burger i:last-child { transform: translateY(calc(var(--gap-4) * -1)) rotate(-45deg); }

/* Hello Elementor's reset.css styles every button (8px 16px padding, pink hover/focus background). Neutralise it on
   the Menu button so the burger sits dead centre in the 44px circle and only the circle changes colour. */
.nav .nav__more, .nav .nav__more:hover, .nav .nav__more:focus, .nav .nav__more:active {
  margin: 0 0 0 var(--gap-6); padding: 0; border: 0; background: none; color: var(--white);
  font: inherit; line-height: 1; appearance: none; -webkit-appearance: none;
}

/* Keyboard focus: the site's white ring + purple halo (mouse clicks show nothing). */
.nav :is(a, button):focus { outline: none; }
.nav :is(a, button):focus-visible {
  outline: var(--mark-w) solid var(--white); outline-offset: var(--focus-offset); box-shadow: var(--focus-halo);
}
.nav .nav__more:focus-visible { outline-offset: var(--mark-w); }

/* Tablet: items marked nav-desktop-only leave the bar (About + Careers by default); the panel still has them. */
@media (max-width: 1023px) {
  .nav__item--wide { display: none; }
}

/* Phone: logo island + "Menu". No page links in the bar; the panel holds everything. */
@media (max-width: 767px) {
  .nav { gap: var(--gap-10); }
  .nav__home { padding: 0 calc(var(--gap-8) * 2); }
  .nav__logo { width: calc(var(--logo-nav) - var(--gap-10)); }
  .nav__links { display: none; }
  .nav__bar { padding: 0 var(--gap-8) 0 var(--gap-4); }
  .nav .nav__more, .nav .nav__more:hover, .nav .nav__more:focus, .nav .nav__more:active { margin-left: 0; }
  .nav__word { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .nav, .nav * { transition-duration: 1ms !important; transition-delay: 0s !important; }
}

/* MENU - the panel the green Menu button opens.
   Coded part: printed by inc/theme-nav.php, opened and closed by assets/js/menu.js. Change with care.
   The menu's ITEMS are edited in Appearance > Menus ("Main menu"); its fixed words and the office details in
   Site text.
   One purple panel drops under the pages pill, on its right edge: a column per menu item with sub items (Services),
   Explore, and Head office with the Contact button. Tablet: two up, Head office across the bottom. Phone: full
   width, Explore as tiles, the services as chips, phone + email as buttons; it scrolls inside itself.
   Every value is a variable (tokens.css); no raw px or hex. */
.menu {
  position: absolute; top: calc(100% + var(--gap-8)); right: 0;
  width: min(calc(var(--gap-100) * 8 + var(--gap-20)), calc(100vw - 2 * (var(--gap-10) + var(--gut))));
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0 var(--gap-40);
  padding: calc(var(--gap-20) + var(--gap-10));
  background: var(--ddc-purple); color: var(--white);
  border-radius: var(--r-menu); box-shadow: var(--shadow-pill);
  clip-path: inset(0 0 100% 0 round var(--r-menu));
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: clip-path var(--dur) var(--ease-in), opacity var(--dur) var(--ease-in), visibility 0s linear var(--dur);
}
/* The usual three (Services, Explore, Head office): the outer two a touch wider, so the address and
   "Detection & Remediation" each hold one line. */
.menu--cols-3 { grid-template-columns: 1.15fr 1fr 1.15fr; }
.menu.is-open {
  clip-path: inset(0 0 0 0 round var(--r-menu)); opacity: 1; visibility: visible; pointer-events: auto;
  transition: clip-path var(--dur-slow) var(--ease), opacity var(--dur-fast) var(--ease), visibility 0s;
}

/* Columns rise in once, a beat apart, when the panel opens. */
.menu__col {
  --i: 0; min-width: 0; opacity: 0; transform: translateY(var(--gap-8));
  transition: opacity var(--dur-fast) var(--ease-in), transform var(--dur-fast) var(--ease-in);
}
.menu.is-open .menu__col {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease) calc(var(--dur-fast) * 2 / 3 + var(--i) * var(--stagger)),
              transform var(--dur-slow) var(--ease) calc(var(--dur-fast) * 2 / 3 + var(--i) * var(--stagger));
}

.menu__label {
  margin: 0 0 calc(var(--gap-6) * 2);
  font: 700 var(--fs-label)/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--ddc-purple-soft);
}
.menu__list { display: grid; gap: calc(var(--gap-4) / 2); margin: 0; padding: 0; list-style: none; }
.menu__link {
  display: block; padding: var(--gap-8) var(--gap-10); margin-inline: calc(var(--gap-10) * -1);
  border-radius: var(--r-card);
  font: 500 var(--fs-lead)/1.3 var(--font);
  transition: background-color var(--dur-fast) var(--ease);
}
.menu__all .menu__link { font-size: var(--fs-small); }
.menu__all .menu__link::after { content: " \2192"; content: " \2192" / ""; }

.menu__address { margin: 0 0 calc(var(--gap-10) + var(--gap-4)); font: 400 var(--fs-small)/1.55 var(--font); font-style: normal; color: var(--ddc-purple-soft); }
.menu__lines { display: grid; gap: calc(var(--gap-4) / 2); }
.menu__line { display: block; padding: var(--gap-6) 0; font: 500 var(--fs-body)/1.3 var(--font); transition: color var(--dur-fast) var(--ease); }
.menu__cta {
  display: inline-flex; align-items: center; justify-content: center;
  height: var(--btn-h); margin-top: calc(var(--gap-8) + var(--gap-10)); padding: 0 calc(var(--gap-20) + var(--gap-6));
  border-radius: var(--r-btn);
  font: 700 var(--fs-small)/1 var(--font); letter-spacing: .06em; text-transform: uppercase;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

/* Colours carry `.nav .menu` so Hello's reset (a:hover recoloured) never wins. */
.nav .menu :is(.menu__link, .menu__line), .nav .menu :is(.menu__link, .menu__line):is(:hover, :focus, :active) { color: var(--white); text-decoration: none; }
.nav .menu .menu__all .menu__link { color: var(--ddc-purple-soft); }
.nav .menu .menu__link:hover, .nav .menu .menu__link[aria-current] { background: var(--on-dark-fill); }
.nav .menu .menu__line:hover { color: var(--ddc-purple-soft); }
.nav .menu .menu__cta, .nav .menu .menu__cta:focus, .nav .menu .menu__cta:active { background: var(--ddc-green-fill); color: var(--white); text-decoration: none; }
.nav .menu .menu__cta:hover { background: var(--white); color: var(--ddc-purple); }
/* Inside the panel the ring sits inside each link (the halo would bleed into its neighbours); the button ring sits
   outside it, on the purple, so it still shows when the button turns white on hover. */
.nav .menu a:focus-visible { outline: var(--mark-w) solid var(--white); outline-offset: calc(var(--mark-w) * -1); box-shadow: none; }
.nav .menu .menu__cta:focus-visible { outline-offset: var(--mark-w); }

/* Tablet: two columns, Head office across the bottom on one line. */
@media (max-width: 1023px) {
  .menu, .menu--cols-3 { grid-auto-flow: row; grid-template-columns: 1fr 1fr; gap: calc(var(--gap-20) + var(--gap-6)) calc(var(--gap-20) + var(--gap-10)); }
  .menu__col--office { grid-column: 1 / -1; padding-top: calc(var(--gap-20) + var(--gap-4)); border-top: var(--hair) solid var(--on-purple-line); }
  .menu__office { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-10) calc(var(--gap-20) + var(--gap-10)); }
  .menu__address { margin: 0; }
  .menu__cta { margin: 0 0 0 auto; }
}

/* Phone: full rail width under the bar; services as chips, Explore as tiles, phone + email as buttons. Columns keep
   their DOM order (the mock put Explore first; CSS order would make the screen and the Tab order disagree). */
@media (max-width: 767px) {
  .menu {
    position: fixed; top: calc(var(--nav-top) + var(--nav-h) + var(--gap-8));
    left: calc(var(--gap-10) + var(--gut)); right: calc(var(--gap-10) + var(--gut)); width: auto;
    grid-template-columns: 1fr; gap: calc(var(--gap-20) + var(--gap-4)); padding: var(--gap-20);
    max-height: calc(100vh - var(--nav-top) - var(--nav-h) - var(--gap-8) - var(--gut));
    max-height: calc(100dvh - var(--nav-top) - var(--nav-h) - var(--gap-8) - var(--gut));
    overflow-y: auto; overscroll-behavior: contain;
  }
  .admin-bar .menu {
    top: calc(var(--nav-top) + var(--nav-h) + var(--gap-8) + var(--wp-admin--admin-bar--height, var(--gap-20)));
    max-height: calc(100dvh - var(--nav-top) - var(--nav-h) - var(--gap-8) - var(--gut) - var(--wp-admin--admin-bar--height, var(--gap-20)));
  }
  .menu, .menu--cols-3 { grid-template-columns: 1fr; }
  .menu__col--explore .menu__list { grid-template-columns: 1fr 1fr; gap: var(--gap-8); }
  .menu__col--explore .menu__link {
    display: flex; align-items: center; min-height: calc(var(--btn-h) + var(--gap-4)); margin: 0;
    padding: calc(var(--gap-6) * 2) calc(var(--gap-10) + var(--gap-4)); border-radius: var(--r-card);
    font-size: var(--fs-body); line-height: 1.2;
  }
  .nav .menu .menu__col--explore .menu__link { background: var(--on-dark-fill); }
  .nav .menu .menu__col--explore .menu__link:is(:hover, [aria-current]) { background: var(--nav-fill-2); }
  .menu__col--section .menu__list { display: flex; flex-wrap: wrap; gap: var(--gap-8); }
  .menu__col--section .menu__link {
    margin: 0; padding: var(--gap-10) calc(var(--gap-8) * 2);
    border: var(--hair) solid var(--on-purple-line); border-radius: var(--r-pill);
    font-size: var(--fs-small); line-height: 1.2;
  }
  .menu__col--section .menu__all .menu__link { border-color: transparent; padding-inline: var(--gap-6); }
  .menu__col--office { padding-top: calc(var(--gap-8) + var(--gap-10)); }
  .menu__office { display: grid; gap: calc(var(--gap-6) * 2); }
  .menu__lines { display: flex; flex-wrap: wrap; gap: var(--gap-8); }
  .menu__line {
    flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
    min-height: calc(var(--btn-h-sm) + var(--gap-4)); padding: 0 calc(var(--gap-10) + var(--gap-4));
    border-radius: var(--r-pill); font-size: var(--fs-small); white-space: nowrap;
  }
  .nav .menu .menu__line { background: var(--on-dark-fill); }
  .menu__cta { width: 100%; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .menu, .menu.is-open { clip-path: none; }
  .menu__col { transform: none; }   /* the NAV section already cuts every transition under .nav to 1ms */
}
