/* ============ MEGA MENU ============ */
.mega-trigger {
  position: relative;
  cursor: pointer;
}

/* Keep the header nav visible + crisp above the mega backdrop while the
   menu is open. The base .nav is z-index:40 with mix-blend-mode:difference,
   so the mega's full-screen dark/blur backdrop (z-index ~120) would otherwise
   cover it and the blend mode washes the text out. Lift it above the backdrop
   and neutralise the blend so it reads plainly over the dimmed page. */
body.mega-is-open .nav {
  z-index: 121;
  mix-blend-mode: normal;
}
.mega-trigger[aria-expanded="true"]::after {
  width: 100% !important;
}

.mega {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 120;
  padding-top: 78px; /* below nav */
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .35s var(--ease-out), transform .45s var(--ease-out);
}
.mega.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mega__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .35s var(--ease-out);
  pointer-events: none;
  z-index: -1;
}
.mega.is-open .mega__backdrop {
  opacity: 1;
  pointer-events: auto;
}

.mega__panel {
  margin: 0 var(--gutter);
  background: var(--ink-0);
  border: 1px solid var(--line);
  border-top: 2px solid var(--lime);
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 480px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  position: relative;
}

.mega__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--bone-2);
  cursor: pointer;
  z-index: 5;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.mega__close:hover {
  color: var(--bone);
  border-color: var(--bone-3);
  background: var(--ink-1);
}

/* LEFT: category rail */
.mega__cats {
  background: var(--ink-1);
  padding: 24px 0;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.mega__cat {
  width: 100%;
  text-align: left;
  padding: 16px 28px;
  background: transparent;
  border: 0;
  color: var(--bone-2);
  font-family: var(--f-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  transition: color .25s var(--ease-out), background .25s var(--ease-out);
  border-left: 2px solid transparent;
}
.mega__cat:hover { color: var(--bone); background: rgba(212,255,58,0.04); }
.mega__cat.is-active {
  color: var(--bone);
  border-left-color: var(--lime);
  background: rgba(212,255,58,0.06);
}
.mega__cat .mega__cat-num {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--bone-3);
  letter-spacing: .14em;
}
.mega__cat .mega__cat-arrow {
  font-family: var(--f-mono);
  color: var(--lime);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .25s, transform .25s;
}
.mega__cat.is-active .mega__cat-arrow,
.mega__cat:hover .mega__cat-arrow {
  opacity: 1; transform: translateX(0);
}

/* RIGHT: panel content */
.mega__content {
  padding: 32px 40px 32px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow-y: auto;
  position: relative;
}
.mega__pane {
  display: none;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  animation: megaFadeIn .4s var(--ease-out) both;
}
.mega__pane.is-active { display: grid; }
@keyframes megaFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mega__head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.mega__head-left .eyebrow { margin-bottom: 10px; }
.mega__head h3 {
  font-family: var(--f-display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(32px, 2.8vw, 44px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  color: var(--bone);
}
.mega__head p {
  max-width: 42ch;
  color: var(--bone-3);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  text-align: right;
}

/* Tile grid */
.mega__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 4px 0;
  box-shadow: 0 0 0 1px var(--line);
}
.mega__tile {
  padding: 18px 18px;
  display: flex; align-items: center; gap: 14px;
  background: var(--ink-0);
  color: var(--bone-2);
  box-shadow: 1px 0 0 0 var(--line), 0 1px 0 0 var(--line);
  transition: background .3s var(--ease-out), color .3s var(--ease-out), transform .4s var(--ease-out);
  min-height: 72px;
  position: relative;
  cursor: pointer;
}
.mega__tile:hover {
  background: var(--ink-1);
  color: var(--bone);
}
.mega__tile:hover .mega__logo svg { filter: none; opacity: 1; }
.mega__tile:hover .mega__tile-arrow { opacity: 1; transform: translate(0,0); }

.mega__logo {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.mega__logo svg {
  width: 22px; height: 22px;
  fill: currentColor;
  color: var(--bone-2);
  opacity: .75;
  transition: opacity .3s, color .3s;
}
.mega__tile:hover .mega__logo svg { color: var(--lime); }

.mega__tile-name {
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
  line-height: 1.1;
  flex: 1;
}
.mega__tile-sub {
  display: block;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 10px;
  color: var(--bone-3);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 4px;
}
.mega__tile-arrow {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--lime);
  opacity: 0;
  transform: translate(-4px, 0);
  transition: opacity .3s, transform .3s;
}

/* Footer CTA */
.mega__footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
.mega__footer-note {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--bone-3);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.mega__footer-cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  background: var(--lime); color: var(--ink-0);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: transform .3s var(--ease-out);
}
.mega__footer-cta:hover { transform: translateY(-2px); }

/* Responsive */
@media (max-width: 1100px) {
  .mega__grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .mega__panel { grid-template-columns: 1fr; min-height: 0; max-height: calc(100vh - 100px); }
  .mega__cats { display: flex; overflow-x: auto; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .mega__cat { white-space: nowrap; padding: 10px 16px; border-left: 0; border-bottom: 2px solid transparent; }
  .mega__cat.is-active { border-left-color: transparent; border-bottom-color: var(--lime); }
  .mega__grid { grid-template-columns: repeat(2, 1fr); }
  .mega__content { padding: 24px; }
  .mega__head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mega__head p { text-align: left; }
}

/* Keep custom cursor above the mega menu */
#cursor, .cursor, #cursor-ring, .cursor-ring {
  z-index: 9999 !important;
}

/* Dropdown caret on Services link */
.nav__links a.has-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav__links a.has-dropdown::before {
  content: "";
  width: 0; height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.55;
  transform: translateY(1px);
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.nav__links a.has-dropdown[aria-expanded="true"]::before {
  transform: translateY(1px) rotate(180deg);
  opacity: 1;
  color: var(--lime);
}

/* Hit-test the panes ONLY when the menu is open. The closed menu is
   opacity:0 + pointer-events:none on .mega, but pointer-events:auto on a
   descendant overrides an ancestor's :none — so an unscoped rule here makes
   the invisible closed menu's position:fixed rectangle swallow every click on
   the page beneath it (sitewide, viewport-height dependent). Scope to .is-open
   so the closed menu inherits :none and the page underneath stays clickable. */
.mega.is-open .mega__content,
.mega.is-open .mega__pane { pointer-events: auto; }
.mega__panel, .mega__cats { cursor: default; }
