/*
 * Arton Mega Menu: desktop menu (.amm) and mobile menu (.ammm, at the bottom of this file).
 * Colours are artonheat.co.uk's brand colours; change the variables on .amm / .ammm to restyle.
 * The JS adds three classes: .amm-js on the menu, .is-open on an open top-level item, and .is-active on the
 * Services category being shown. WP Rocket's "Remove unused CSS" must keep them (see README.md).
 */
.amm {
  --amm-navy: #022656;      /* brand navy: active category, footer link, search button */
  --amm-accent: #27a5df;    /* brand blue: hovers, "View all", focus outline */
  --amm-text: #1f2633;
  --amm-muted: #6b7486;
  --amm-label: #4f7aa8;     /* column titles */
  --amm-line: #dbe5ef;
  --amm-tint: #eef3f9;      /* active category background */
  --amm-icon-bg: #e6eff8;
  --amm-promo: #022656;     /* "Not sure what's wrong?" card: navy background… */
  --amm-promo-head: #26a5df; /* …light blue heading and chevron circle (text is white) */
  --amm-bar-text: #fff;     /* top bar sits on the navy header */
  --amm-bar-hover: rgba(255, 255, 255, .12);
  --amm-side: 270px;        /* width of the Services category column */
  --amm-radius: 16px;
  position: relative;
  font-family: inherit;     /* Lato, from Divi */
  line-height: 1.4;
}
.amm *, .amm *::before, .amm *::after { box-sizing: border-box; }
/* Divi styles lists, paragraphs and buttons inside its modules; reset them inside the menu. */
.amm ul, .amm li { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.amm p { margin: 0; padding: 0; }
.amm button { font: inherit; color: inherit; background: none; border: 0; margin: 0; cursor: pointer; }
.amm a { text-decoration: none; }
.amm svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.amm .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.amm :focus-visible { outline: 2px solid var(--amm-accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.amm-bar { display: flex; align-items: center; gap: 4px; }
.amm-top { position: relative; }                 /* dropdowns open under their own button… */
.amm-has-alpha { position: static; }             /* …but Services lines up with the left edge of the whole menu */
.amm .amm-top-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px;
  color: var(--amm-bar-text); font-size: 17px; font-weight: 700; white-space: nowrap;
  transition: background-color .15s;
}
/* Hovered, open, or containing the current page */
.amm .amm-top-link:hover, .amm .is-open > .amm-top-link, .amm .amm-top-link.is-current, .amm .is-current > .amm-top-link { background: var(--amm-bar-hover); color: var(--amm-bar-text); }
.amm-top-link .amm-chev { font-size: 14px; transition: transform .2s; }
.is-open > .amm-top-link .amm-chev { transform: rotate(180deg); }
.amm-search-btn svg { font-size: 20px; }

/* ---------- Panels (shared) ---------- */
/* Hidden until open. With the JS, .is-open shows them; without it (not loaded yet, or delayed by WP Rocket)
   they still open on hover and keyboard focus. --amm-shift is set by the JS to keep a panel inside the window. */
.amm-panel {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 9999;
  transform: translateX(var(--amm-shift, 0));
  background: #fff; color: var(--amm-text);
  border-radius: var(--amm-radius); box-shadow: 0 18px 50px rgba(2, 38, 86, .18), 0 2px 8px rgba(2, 38, 86, .08);
  font-size: 16px; font-weight: 400; text-align: left;
}
.amm-panel::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 10px; } /* invisible bridge over the 8px gap, so moving the mouse down doesn't close the panel */
.amm.amm-js .is-open > .amm-panel,
.amm:not(.amm-js) .amm-top:hover > .amm-panel,
.amm:not(.amm-js) .amm-top:focus-within > .amm-panel { display: block; animation: amm-in .16s ease-out; }
@keyframes amm-in { from { opacity: 0; translate: 0 -4px; } }
@media (prefers-reduced-motion: reduce) { .amm-panel { animation: none !important; } .amm * { transition: none !important; } }

/* Submenu links get the same tinted pill on hover as the Services categories. The negative side margin lets the
   pill reach past the text while the text itself stays lined up with the column titles. */
.amm .amm-link { display: block; margin: 0 -12px; padding: 7px 12px; border-radius: 10px; color: var(--amm-text); font-size: 16px; transition: background-color .15s, color .15s; }
.amm .amm-link:hover, .amm .amm-link:focus-visible { background: var(--amm-tint); color: var(--amm-navy); }
.amm .amm-link.is-current { color: var(--amm-accent); }
.amm-label { color: var(--amm-label); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px !important; }
.amm-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 32px; } /* as many columns as fit */

/* ---------- Services (mega-menu-alpha) ---------- */
.amm-panel-alpha { width: min(920px, calc(100vw - 32px)); }
.amm-alpha { position: relative; } /* the JS sets min-height to fit the open category */
.amm-side { width: var(--amm-side); padding: 16px; }
.amm-alpha::before { content: ""; position: absolute; top: 0; bottom: 0; left: var(--amm-side); border-left: 1px solid var(--amm-line); } /* divider, full height */
.amm-cats { display: grid; gap: 4px; }
.amm .amm-cat-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--amm-text); font-size: 16px; transition: background-color .15s, color .15s;
}
.amm .amm-cat-link .amm-chev { margin-left: auto; color: var(--amm-muted); font-size: 14px; }
.amm .is-active > .amm-cat-link { background: var(--amm-tint); color: var(--amm-navy); font-weight: 700; }
.amm-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--amm-icon-bg); font-size: 18px; flex: none; }
.amm-icon:empty { display: none; } /* no ACF image and no emoji */
/* ACF icon files bring their own rounded background, so drop the tinted box and let the image fill the space.
   The tinted box stays for emoji icons. */
.amm-icon:has(img) { background: none; }
.amm-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Each category's links live inside its <li> in the HTML, but are shown on the right, over the empty space. */
.amm-cat-panel { display: none; position: absolute; top: 0; right: 0; left: var(--amm-side); padding: 26px 30px; }
.amm-cat.is-active > .amm-cat-panel { display: block; }
.amm-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.amm-panel-title { font-size: 19px; font-weight: 700; color: var(--amm-text); }
.amm .amm-viewall { color: var(--amm-accent); font-weight: 700; white-space: nowrap; }
.amm .amm-viewall:hover { color: var(--amm-navy); }
/* "Not sure what's wrong?" card, shared with the mobile drawer: navy, light blue heading, white text,
   and a white chevron in a blue circle next to the heading that nudges right on hover. */
.amm .amm-promo, .ammm .amm-promo { display: block; margin-top: 16px; padding: 16px 18px; border-radius: 12px; background: var(--amm-promo); color: #fff; }
.amm-promo strong { display: block; margin-bottom: 4px; color: var(--amm-promo-head); font-size: 16px; font-weight: 700; }
.amm-promo-text { display: block; color: #fff; font-size: 14px; line-height: 1.5; }
/* The heading's last word + chevron: kept on one line, and the circle centred on the text with flexbox rather
   than nudged by eye, so it stays centred whatever the font size. */
.amm-promo-end { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; vertical-align: top; }
.amm-promo-go { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--amm-promo-head); color: #fff; font-size: 12px; transition: transform .2s; }
.amm-promo-go svg { stroke-width: 3.2; }
a.amm-promo:hover .amm-promo-go, a.amm-promo:focus-visible .amm-promo-go { transform: translateX(3px); }

/* ---------- Areas (mega-menu-beta) ---------- */
.amm-panel-beta { width: min(480px, calc(100vw - 32px)); padding: 24px 28px 18px; }
.amm-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--amm-line); }
.amm .amm-foot-link { color: var(--amm-navy); font-weight: 700; white-space: nowrap; }
.amm a.amm-foot-link:hover { color: var(--amm-accent); }
.amm-foot-note { color: var(--amm-muted); font-size: 14px; }

/* ---------- Plain dropdowns ---------- */
.amm-panel-drop { min-width: 220px; padding: 12px 22px; }

/* ---------- Search ---------- */
.amm-panel-search { left: auto; right: 0; padding: 12px; } /* opens leftwards from the icon */
.amm-panel-search form { display: flex; gap: 8px; }
.amm-panel-search input[type="search"] { width: 260px; padding: 10px 12px; border: 1px solid var(--amm-line); border-radius: 10px; font: inherit; color: var(--amm-text); background: #fff; }
.amm .amm-panel-search button[type="submit"] { padding: 10px 16px; border-radius: 10px; background: var(--amm-navy); color: #fff; font-weight: 700; }

/* =====================================================================================================
 * Mobile menu: [arton_mobile_menu]
 * The drawer is a popover: the browser opens and closes it, puts it above everything else on the page
 * (so it can't end up behind Divi's sticky header), and handles Escape and tap-outside. No JavaScript.
 * It shares some classes with the desktop menu (.amm-link, .amm-label, .amm-icon, .amm-viewall).
 * ===================================================================================================== */
.ammm {
  --amm-navy: #022656;
  --amm-accent: #27a5df;
  --amm-text: #1f2633;
  --amm-muted: #6b7486;
  --amm-label: #4f7aa8;
  --amm-line: #dbe5ef;
  --amm-tint: #eef3f9;
  --amm-icon-bg: #e6eff8;
  --amm-promo: #022656;      /* promo card, as on desktop */
  --amm-promo-head: #26a5df;
  --ammm-burger: var(--amm-navy); /* hamburger colour: navy on the white mobile header */
  --ammm-width: min(420px, 86vw);
  font-family: inherit;
  line-height: 1.4;
}
.ammm *, .ammm *::before, .ammm *::after { box-sizing: border-box; }
.ammm ul, .ammm li { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.ammm p { margin: 0; padding: 0; }
.ammm button { font: inherit; color: inherit; background: none; border: 0; margin: 0; cursor: pointer; }
.ammm a { text-decoration: none; }
.ammm svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ammm :focus-visible { outline: 2px solid var(--amm-accent); outline-offset: 2px; }

.ammm .ammm-burger { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: var(--ammm-burger); font-size: 28px; }

/* The drawer. Undo the browser's default popover box (centred, bordered), then pin it to the right edge. */
.ammm-drawer {
  position: fixed; inset: 0 0 0 auto; width: var(--ammm-width); height: 100dvh; max-height: none;
  margin: 0; border: 0; padding: 22px 22px 32px; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; color: var(--amm-text); box-shadow: -12px 0 40px rgba(2, 38, 86, .2);
  /* Slide in from the right. The display/overlay lines let the slide-out finish before it's hidden. */
  transform: translateX(100%);
  transition: transform .3s ease, display .3s allow-discrete, overlay .3s allow-discrete;
}
.ammm-drawer:popover-open { transform: none; }
@starting-style { .ammm-drawer:popover-open { transform: translateX(100%); } }
/* The dimmed page behind. (Colours are written out: the backdrop can't always read the variables.) */
.ammm-drawer::backdrop { background: rgba(2, 38, 86, 0); transition: background-color .3s, display .3s allow-discrete, overlay .3s allow-discrete; }
.ammm-drawer:popover-open::backdrop { background: rgba(2, 38, 86, .45); }
@starting-style { .ammm-drawer:popover-open::backdrop { background: rgba(2, 38, 86, 0); } }
html:has(.ammm-drawer:popover-open) { overflow: hidden; } /* stop the page scrolling behind the drawer */
@media (prefers-reduced-motion: reduce) { .ammm-drawer, .ammm-drawer::backdrop { transition: none; } }

.ammm-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.ammm-logo img { display: block; width: 184px; height: auto; }
.ammm .ammm-close { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--amm-tint); color: var(--amm-navy); font-size: 22px; }

/* Schedule Now / Call buttons */
.ammm .ammm-cta { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; margin-bottom: 12px; border-radius: 999px; font-size: 18px; font-weight: 700; }
.ammm .ammm-book { background: var(--amm-accent); color: #fff; }
.ammm .ammm-call { border: 2px solid var(--amm-navy); color: var(--amm-navy); }

/* Menu list */
.ammm-list { margin-top: 14px !important; }
.ammm-list > li { border-bottom: 1px solid var(--amm-line); }
.ammm a.ammm-top, .ammm details.ammm-top > summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; color: var(--amm-navy); font-size: 19px; font-weight: 700; }
.ammm details > summary { list-style: none; cursor: pointer; }
.ammm details > summary::-webkit-details-marker { display: none; }
.ammm details > summary .amm-chev { font-size: 20px; transition: transform .2s; }
.ammm details[open] > summary .amm-chev { transform: rotate(180deg); }
.ammm a.ammm-top.is-current { color: var(--amm-accent); }
.ammm-body { padding: 0 0 14px 2px; }
.ammm .amm-link { display: block; padding: 7px 0; color: var(--amm-text); font-size: 16px; }
.ammm .amm-link.is-current { color: var(--amm-accent); }
.ammm .amm-label { color: var(--amm-label); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 14px 0 4px !important; }
.ammm .amm-viewall { display: inline-block; padding: 8px 0; color: var(--amm-accent); font-weight: 700; }

/* Services categories (sections inside the Services section) */
.ammm-cats { display: grid; gap: 4px; }
.ammm-cat > summary { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--amm-text); font-size: 17px; }
.ammm-cat > summary .amm-chev { margin-left: auto; color: var(--amm-muted); font-size: 16px; }
.ammm-cat[open] > summary { background: var(--amm-tint); color: var(--amm-navy); font-weight: 700; }
.ammm-cat > .ammm-body { padding: 4px 10px 10px 58px; } /* lines up with the category name, past the icon */
.ammm .amm-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--amm-icon-bg); font-size: 18px; flex: none; }
.ammm .amm-icon:empty { display: none; }
.ammm .amm-icon:has(img) { background: none; } /* icon files have their own background (see the desktop note) */
.ammm .amm-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Trust line (the promo card is styled with the desktop one, above) */
.ammm-trust { margin-top: 18px !important; color: var(--amm-muted); font-size: 14px; }

/* Hover colours only where there's a real mouse; on phones they'd stay stuck on after a tap. */
@media (hover: hover) {
  .ammm .ammm-book:hover { background: var(--amm-navy); color: #fff; }
  .ammm .ammm-call:hover { background: var(--amm-tint); }
  .ammm details.ammm-top > summary:hover, .ammm a.ammm-top:hover, .ammm .amm-link:hover { color: var(--amm-accent); }
}
