/* Mega menu panels (Boyd site part, T51; site-parts/mega-menu.md). From 1000 px; below that the drawer is used.
   Each section with links has a plain link (no script) and a disclosure button (script) followed by its panel.
   Panel colours come from the section theme classes (css/base/themes.css): theme-acoustic, -presentation, -display,
   -custom; Master sections use the white surface, as in the design. Tokens only. */

/* The panels hang under the glass pill, as wide as the pill. */
.site-nav__pill { position: relative; }

/* With script the section is a button; without script it stays a plain link to the section page. */
.js .mega-item__link,
.no-js .mega-item__button { display: none; }

.site-nav .mega-item__button {
  margin: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
.site-nav .mega-item__button[aria-expanded="true"] { background: var(--c-ink-a10); }
/* Current section: an underline, not colour alone (the plain link uses aria-current, see header.css). */
.site-nav .mega-item__button.is-current {
  text-decoration: underline;
  text-decoration-thickness: var(--border-width-heavy);
  text-underline-offset: 4px;
}

/* ── Panel ─────────────────────────────────────────────────────────────────────── */
.mega {
  position: absolute;
  top: calc(100% + 10px);
  right: calc(-1 * var(--border-width));
  left: calc(-1 * var(--border-width));
  max-height: calc(100vh - 120px);
  max-height: calc(100svh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: var(--border-width) solid var(--c-deep-blue);
  border-radius: var(--radius-menu);
  box-shadow: var(--shadow-panel);
  text-align: left;
  animation: mega-in var(--duration-base) var(--ease-brand);
}
.mega[hidden] { display: none; }
.mega.surface-white,
.mega.theme-presentation { border-color: var(--c-white-a72); }

@keyframes mega-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mega { animation: none; }
}

.mega__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-7) clamp(24px, 3vw, 48px);
  padding: clamp(24px, 3vw, 38px) clamp(24px, 3.5vw, 44px);
}
/* No image: the links take the rest of the width, in 2 columns when there are more than 4. */
.mega__grid--no-image { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.mega__grid--two-columns .mega__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  column-gap: clamp(24px, 3vw, 48px);
}

.mega__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
}
.mega__logo {
  display: block;
  width: auto;
  max-width: 180px;
  height: auto;
  max-height: 72px;
  margin-bottom: var(--space-2);
}
.mega p { margin: 0; }
.mega .mega__kicker {
  margin-bottom: var(--space-2);
  color: var(--color-eyebrow);
  font-size: 14px;
  font-weight: var(--fw-bold);
  line-height: var(--lh-label);
}
.mega .mega__title {
  color: var(--color-heading);
  font-size: 36px;
  font-weight: var(--fw-light);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  overflow-wrap: anywhere;
}
.mega .mega__text {
  max-width: 34ch;
  color: var(--color-text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
/* Master (white) and Presentation (pale) panels: intro in the muted ink, as designed. */
.mega.surface-white .mega__text,
.mega.theme-presentation .mega__text { color: var(--color-muted); }

.site-header .mega .mega__links { min-width: 0; }
.site-header .mega .mega__link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap-min);
  padding: 13px 0;
  border-bottom: var(--border-width) solid var(--color-hairline);
  color: var(--color-heading);
  font-size: var(--fs-body-md);
  font-weight: var(--fw-regular);
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: var(--transition-control);
}
.site-header .mega .mega__link:hover { color: var(--color-eyebrow); text-decoration: underline; }
.site-header .mega .mega__link--all { font-weight: var(--fw-semibold); }
.site-header .mega .mega__link[aria-current] {
  text-decoration: underline;
  text-decoration-thickness: var(--border-width-heavy);
  text-underline-offset: 4px;
}
.mega__label { min-width: 0; }
.mega__arrow {
  flex: none;
  color: var(--color-eyebrow);
}
/* Display: the eyebrow is white, so hover keeps the white text and relies on the underline. */
.site-header .mega.theme-display .mega__link:hover { color: var(--color-heading); }
/* Light Blue on navy is the design's hover and arrow colour (acoustic, custom). */
.site-header .mega.theme-acoustic .mega__link:hover,
.site-header .mega.theme-custom .mega__link:hover { color: var(--c-light-blue); }

.mega__media {
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--radius-media);
  background: var(--c-ink-a10);
}
.mega__media picture { display: block; height: 100%; }
.mega__media .mega__img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: cover;
}
