/* ============================================================================
   Services mega menu

   Two panes: the service lines on the left, the chosen line's sub-services on
   the right. The layout exists to answer one question — "which desk do I
   need?" — before asking the visitor to pick a specific service.

   Measurements worth keeping if this is ever reworked:

   - The rail is 300px because the longest line name, "Tax Audit, Dispute &
     Litigation", sets on two lines below that and the rail starts to look
     ragged.
   - The pane list goes to two columns only above 1180px. Below that, two
     columns of 20-character links read as a word search.
   - Rows are 44px minimum. These are pointer targets as much as text.
   - Orange appears as a 2px active bar and nothing else. The brand rules
     forbid it as a large area, and white on it fails contrast, so it marks
     position rather than filling anything.
   ========================================================================= */

.has-mega {
  position: static; /* the panel spans the bar, not this one item */
}

.mega-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.mega-chev {
  transition: transform .18s var(--ease, ease);
  opacity: .6;
}

.mega-toggle[aria-expanded="true"] .mega-chev {
  transform: rotate(180deg);
  opacity: 1;
}

/* ---- the panel ---------------------------------------------------------- */

.dropdown-menu.mega {
  /* Bootstrap's .dropdown-menu sets min-width, padding, border, radius and a
     white background. The panel spans the bar, so every one of those has to
     go or the design sits inside a 10rem rounded card. */
  min-inline-size: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.mega {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 100%;
  z-index: 60;
  background: var(--paper, #faf9f7);
  border-block-start: 1px solid var(--line, #e3e1dc);
  box-shadow: 0 24px 48px -24px rgba(13, 13, 13, .28);
}

/* Bootstrap toggles .show; [hidden] is the no-JS and pre-init state. */
.mega[hidden]:not(.show) {
  display: none;
}

.dropdown-menu.mega.show {
  display: block;
}

@media (prefers-reduced-motion: no-preference) {
  .dropdown-menu.mega.show {
    animation: mega-in .16s var(--ease, ease) both;
  }
  @keyframes mega-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }
}

.mega-in {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(24px, 3vw, 48px);
  max-inline-size: 1180px;
  margin-inline: auto;
  padding: clamp(22px, 2.4vw, 34px) clamp(16px, 2vw, 24px);
}

/* ---- left rail: the service lines --------------------------------------- */

.mega-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-inline-end: 1px solid var(--hair, #ece9e4);
  padding-inline-end: clamp(12px, 1.4vw, 20px);
}

.mega-line {
  display: grid;
  grid-template-columns: 1fr auto;
  /* The count sits on the name's row, not spanning both. Spanning centred it
     between the two lines when a name wrapped - "Transfer Pricing &
     International Tax" - so it read as floating rather than belonging to
     anything. */
  grid-template-areas:
    "code  ."
    "name  count";
  align-items: center;
  /* Negative row gap would be wrong, so the two lines are pulled together by
     their own line-heights instead. Nine rows at the original 68px made the
     rail 610px against a pane of about 460, and the panel wore the
     difference as dead white space on the right. */
  gap: 0 .75rem;
  inline-size: 100%;
  min-block-size: 44px;
  padding: .36rem .75rem;
  background: none;
  border: 0;
  border-inline-start: 2px solid transparent;
  border-radius: var(--r, 2px);
  cursor: pointer;
  text-align: start;
  text-decoration: none;
  color: var(--ink, #2a2a2a);
  transition: background .14s ease, border-color .14s ease;
}

/* No underline on the rail: it switches panes rather than navigating, and
   dressing it as a link is what made one row appear to do two things. */

.ml-code {
  grid-area: code;
  font-family: var(--mono, monospace);
  font-size: .58rem;
  line-height: 1.3;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted, #6b6b6b);
}

.ml-name {
  grid-area: name;
  font-family: var(--display, system-ui);
  font-size: .92rem;
  line-height: 1.2;
  font-weight: 500;
}

.ml-count {
  grid-area: count;
  align-self: baseline;
  font-family: var(--mono, monospace);
  font-size: .68rem;
  color: var(--muted, #6b6b6b);
  font-variant-numeric: tabular-nums;
}

.mega-line:hover,
.mega-line:focus-visible {
  background: var(--off-white, #f1efea);
  border-inline-start-color: color-mix(in srgb, var(--acme-orange, #f49200) 45%, transparent);
}

.mega-line.is-on {
  background: var(--cream, #fdf3e0);
  border-inline-start-color: var(--acme-orange, #f49200);
}

.mega-line.is-on .ml-name {
  color: var(--brand-black, #0d0d0d);
  font-weight: 600;
}

.mega-line.is-on .ml-code {
  color: #8b6914; /* the accent at a weight that passes as text */
}

/* ---- right pane: one line's services ------------------------------------ */

.mega-pane[hidden] {
  display: none;
}

.mp-lede {
  margin: 0 0 1rem;
  max-inline-size: 62ch;
  color: var(--muted, #6b6b6b);
  font-size: .92rem;
  line-height: 1.55;
}

.mp-list {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: grid;
  /* Row gap stays at zero: the links carry their own padding, and anything
     more spaced them about 80px apart, which read as nine unrelated items
     rather than one list. */
  gap: 0 clamp(16px, 2vw, 32px);
  align-content: start;
}

@media (min-width: 1180px) {
  .mp-list {
    grid-template-columns: 1fr 1fr;
  }
}

/* Each service is a destination, and these were reading as a paragraph of
   links: same weight as body copy, no marker, and a flat grey block on hover.
   Three changes give them the structure of a menu.

   A rule in the accent colour sits at the head of every row, short and faint
   at rest so the column reads as a list, extending and firming on hover so
   the pointer has something to land on. It replaces an arrow or a bullet: at
   this size a glyph is noise, a line is structure.

   The text carries slightly more weight than body copy, which is what stops
   nine of them reading as a paragraph.

   And the row indents a little under the pointer, so the hover is a movement
   rather than only a change of background. */
.mp-list a {
  position: relative;
  display: block;
  min-block-size: 0;
  padding: .46rem .6rem .46rem 1.35rem;
  margin-inline-start: -.6rem;
  border-radius: var(--r, 2px);
  text-decoration: none;
  color: var(--ink, #2a2a2a);
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.35;
  transition: background .14s var(--ease, ease),
              color .14s ease,
              padding-inline-start .14s var(--ease, ease);
}

.mp-list a::before {
  content: "";
  position: absolute;
  inset-inline-start: .58rem;
  inset-block-start: .95em;
  inline-size: 6px;
  block-size: 1px;
  background: var(--acme-orange, #f49200);
  opacity: .42;
  transition: inline-size .16s var(--ease, ease), opacity .16s ease;
}

.mp-list a:hover,
.mp-list a:focus-visible {
  background: var(--off-white, #f1efea);
  color: var(--brand-black, #0d0d0d);
  padding-inline-start: 1.55rem;
}

.mp-list a:hover::before,
.mp-list a:focus-visible::before {
  inline-size: 11px;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .mp-list a,
  .mp-list a::before {
    transition: none;
  }
  .mp-list a:hover,
  .mp-list a:focus-visible {
    padding-inline-start: 1.35rem;
  }
}

.mp-all {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--mono, monospace);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #8b6914;
  text-decoration: none;
  padding-block: .35rem;
}

.mp-all:hover {
  color: var(--brand-black, #0d0d0d);
}

.mp-all svg {
  transition: transform .16s var(--ease, ease);
}

.mp-all:hover svg {
  transform: translateX(3px);
}

/* ---- foot --------------------------------------------------------------- */

/* The foot spans the panel, but its contents line up with .mega-in above it,
   so the prompt starts on the same vertical as the service rail. The previous
   version put max-inline-size and padding on the children instead, which left
   them unaligned and pushed "All services" off the right edge. */
.mega-foot {
  border-block-start: 1px solid var(--hair, #ece9e4);
  background: var(--off-white, #f1efea);
  display: grid;
  gap: 0;
  max-inline-size: 1180px;
  margin-inline: auto;
  padding-inline: clamp(16px, 2vw, 24px);
}

@media (min-width: 768px) {
  .mega-foot {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: clamp(16px, 2vw, 32px);
  }
}

.mega-foot > * {
  text-decoration: none;
  min-inline-size: 0;
}

.mega-foot .mega-help {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-block: .9rem;
}

.mega-help-k {
  font-family: var(--mono, monospace);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b6914;
}

.mega-help-v {
  font-size: .88rem;
  color: var(--ink, #2a2a2a);
}

.mega-foot .mega-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding-block: .9rem;
  padding-inline: clamp(14px, 1.6vw, 22px);
  font-family: var(--mono, monospace);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brand-black, #0d0d0d);
  white-space: nowrap;
  background: var(--cream, #fdf3e0);
  border-radius: var(--r, 2px);
  align-self: center;
}

.mega-foot .mega-help:hover {
  color: var(--brand-black, #0d0d0d);
}

.mega-foot .mega-all:hover {
  background: var(--acme-orange, #f49200);
}

.mega-foot .mega-all svg {
  transition: transform .16s var(--ease, ease);
}

.mega-foot .mega-all:hover svg {
  transform: translateX(3px);
}

/* ---- the panel version, for phones -------------------------------------- */

.dnav-group {
  display: block;
}

.acc-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  inline-size: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding-block: .55rem;
  text-align: start;
}

.acc-btn svg {
  transition: transform .18s var(--ease, ease);
  opacity: .7;
}

.acc-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.acc-body[hidden] {
  display: none;
}

.acc-body {
  display: flex;
  flex-direction: column;
  padding-block-end: .6rem;
}

.acc-line {
  display: flex;
  align-items: center;
  gap: .75rem;
  inline-size: 100%;
  min-block-size: 44px;
  padding: .5rem 0 .5rem 1rem;
  background: none;
  border: 0;
  border-inline-start: 1px solid rgba(255, 255, 255, .16);
  cursor: pointer;
  text-align: start;
  color: inherit;
  font: inherit;
  font-size: .94rem;
  opacity: .88;
}

.acc-line > span {
  flex: 1;
}

.acc-line svg {
  transition: transform .18s ease;
  opacity: .7;
  flex: none;
}

.acc-line[aria-expanded="true"] {
  opacity: 1;
  border-inline-start-color: var(--acme-orange, #f49200);
}

.acc-line[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.acc-subs {
  display: flex;
  flex-direction: column;
}

.acc-help {
  display: block;
  margin-block-start: .75rem;
  padding: .55rem 0 .55rem 1rem;
  font-family: var(--mono, monospace);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--acme-orange, #f49200);
  text-decoration: none;
}

.acme-si-line-all {
  font-family: var(--mono, monospace);
  font-size: .64rem !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .62 !important;
}

.acc-line em {
  font-family: var(--mono, monospace);
  font-style: normal;
  font-size: .68rem;
  opacity: .6;
  font-variant-numeric: tabular-nums;
}

.acc-all {
  margin-block-start: .5rem;
  padding: .5rem 0 .5rem 1rem;
  font-family: var(--mono, monospace);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--acme-orange, #f49200);
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
   Pane heading and column count

   Two things the first version got wrong.

   Once the eye moves to the right-hand pane, the only thing saying which of
   nine lines you are reading was the highlight back on the rail — out of
   foveal vision by then. The line's name now heads its own pane.

   And the list was always two columns: six services split across two is three
   short rows against a lot of empty width, which reads as an unfinished
   layout rather than a short list. The template counts the items and asks for
   one column below seven.
   --------------------------------------------------------------------------- */
.mp-head {
  display: inline-flex;
  align-items: baseline;
  gap: .6rem;
  margin: 0 0 .3rem;
  padding: .2rem .5rem .2rem 0;
  text-decoration: none;
  border-radius: var(--r, 2px);
}

.mp-head .mp-name {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color .14s ease;
}

.mp-head:hover .mp-name,
.mp-head:focus-visible .mp-name {
  text-decoration-color: currentColor;
}

.mp-go {
  display: inline-flex;
  align-items: center;
  color: #8b6914;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .16s ease, transform .16s var(--ease, ease);
}

.mp-head:hover .mp-go,
.mp-head:focus-visible .mp-go {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .mp-go { transition: none; transform: none; }
}

.mp-code {
  font-family: var(--mono, monospace);
  font-size: .58rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8b6914;
  padding: .16rem .4rem;
  border: 1px solid color-mix(in srgb, var(--acme-orange, #f49200) 38%, transparent);
  border-radius: var(--r, 2px);
  flex: none;
}

.mp-name {
  font-family: var(--display, system-ui);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--brand-black, #0d0d0d);
  line-height: 1.2;
}

.mp-list[data-cols="1"] {
  grid-template-columns: minmax(0, 1fr);
  max-inline-size: 46ch;
}

@media (min-width: 1180px) {
  .mp-list[data-cols="2"] {
    grid-template-columns: 1fr 1fr;
  }
}

/* The focus ring. Keyboard users move through nine triggers and a list of
   links; the browser default is a thin outline that disappears against the
   cream active row. */
.mega-line:focus-visible,
.mp-list a:focus-visible,
.mega-foot a:focus-visible,
.mp-all:focus-visible {
  outline: 2px solid var(--acme-orange, #f49200);
  outline-offset: 2px;
  border-radius: var(--r, 2px);
}

/* The active row points into its pane, so the two halves read as one object
   rather than two lists side by side. */
@media (min-width: 992px) {
  .mega-line.is-on {
    position: relative;
  }

  .mega-line.is-on::after {
    content: "";
    position: absolute;
    inset-inline-end: calc(clamp(12px, 1.4vw, 20px) * -1 - 5px);
    inset-block-start: 50%;
    inline-size: 9px;
    block-size: 9px;
    background: var(--paper, #faf9f7);
    border-inline-start: 1px solid var(--hair, #ece9e4);
    border-block-end: 1px solid var(--hair, #ece9e4);
    transform: translateY(-50%) rotate(45deg);
  }
}
