/* ==========================================================================
   "Our Services" mega menu  (component: ServicesMegaMenu.tsx)
   Desktop >= 992px : floating 3-column panel (tabs | links | promo card)
   Mobile  <  992px : accordion inside the navbar's collapse drawer
   Brand colours are CSS variables on .mm-item so they are one-line changes.
   ========================================================================== */

.mm-item {
  --brand-primary: #cd400d; /* accent / hover / active  */
  --brand-dark: #0e3052; /* headings                 */
  --text-muted: #5b6472; /* secondary text           */
  --bg-hover: #fff3ee; /* hover / active background */
  --mm-line: #ece8e4; /* dividers                 */
  --mm-radius: 22px;
  --mm-font: inherit; /* set to 'Inter', sans-serif to switch the font */
  position: static; /* so the panel anchors to the whole navbar, not this <li> */
  font-family: var(--mm-font);
}

/* ------------------------------------------------------------- trigger */
.mm-trigger {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mm-chevron {
  border: 0;
  background: transparent;
  padding: 8px 6px;
  line-height: 1;
  font-size: 11px;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}
.mm-chevron i {
  display: block;
  transition: transform 0.22s ease;
}
.mm-item.is-open .mm-chevron i,
.mm-item.is-m-open .mm-chevron i {
  transform: rotate(180deg);
}
.mm-chevron:focus-visible,
.mm-tab:focus-visible,
.mm-link:focus-visible,
.mm-links-title:focus-visible,
.mm-card-cta:focus-visible,
.mm-m-btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------- desktop-only parts */
.mm-panel,
.mm-overlay {
  display: none;
}

@media (min-width: 992px) {
  /* dim the page behind the panel; z-index:-1 keeps the white header bright */
  .mm-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(10, 12, 20, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
  }
  .mm-item.is-open .mm-overlay {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }

  .mm-panel {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 14px);
    z-index: 1002;
    background: #fff;
    border-radius: var(--mm-radius);
    box-shadow: 0 24px 60px rgba(14, 48, 82, 0.18), 0 2px 8px rgba(14, 48, 82, 0.06);
    /* closed state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
  }
  /* invisible bridge over the gap, so the cursor can travel from item to panel */
  .mm-panel::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -16px;
    height: 16px;
  }
  .mm-item.is-open .mm-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .mm-inner {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr; /* ~25% / 50% / 25% */
    padding: 36px;
  }
  .mm-col {
    min-width: 0;
  }
  /* a category without a promo card gives the space to the links */
  .mm-inner.no-promo {
    grid-template-columns: 1fr 3fr;
  }
  .mm-inner.no-promo .mm-links {
    border-right: 0;
    padding-right: 0;
  }

  /* ---- left: category tabs ---- */
  .mm-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 28px;
  }
  .mm-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    border: 0;
    border-left: 3px solid transparent;
    border-radius: 12px;
    background: transparent;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    color: var(--brand-dark);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  }
  .mm-tab-ico {
    flex: none;
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.18s ease;
  }
  .mm-tab-arrow {
    margin-left: auto;
    font-size: 12px;
    color: var(--brand-primary);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .mm-tab:hover,
  .mm-tab.is-active {
    background: var(--bg-hover);
  }
  .mm-tab.is-active {
    border-left-color: var(--brand-primary);
    font-weight: 700;
  }
  .mm-tab.is-active .mm-tab-ico {
    color: var(--brand-primary);
  }
  .mm-tab.is-active .mm-tab-arrow {
    opacity: 1;
    transform: none;
  }

  /* ---- middle: links ---- */
  .mm-links {
    padding: 0 32px;
    border-left: 1px solid var(--mm-line);
    border-right: 1px solid var(--mm-line);
    animation: mm-fade 0.22s ease both;
  }
  .mm-links-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--mm-line);
    text-decoration: none;
  }
  .mm-links-title h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--brand-dark);
  }
  .mm-links-title span {
    flex: none;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-primary);
  }
  .mm-links-title span i {
    font-size: 11px;
    margin-left: 2px;
    transition: transform 0.18s ease;
  }
  .mm-links-title:hover span i {
    transform: translateX(3px);
  }
  .mm-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 18px;
  }
  .mm-grid li {
    margin: 0;
    padding: 0;
  }
  .mm-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.35;
    color: #1f2937;
    text-decoration: none;
    transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
  }
  .mm-link i {
    flex: none;
    font-size: 11px;
    color: var(--brand-primary);
    opacity: 0.65;
  }
  .mm-link:hover,
  .mm-link:focus-visible {
    color: var(--brand-primary);
    background: var(--bg-hover);
    transform: translateX(4px);
  }

  /* ---- right: promo card ---- */
  .mm-promo {
    padding-left: 28px;
  }
  .mm-card {
    position: relative;
    overflow: hidden;
    height: 100%;
    min-height: 250px;
    padding: 26px 24px;
    border-radius: 18px;
    background: linear-gradient(150deg, #fff3ee 0%, #ffddcc 100%);
    animation: mm-fade 0.22s ease both;
  }
  .mm-card::after {
    content: '';
    position: absolute;
    right: -50px;
    bottom: -60px;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: rgba(205, 64, 13, 0.1);
  }
  .mm-card > * {
    position: relative;
    z-index: 1;
  }
  .mm-card-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--brand-primary);
  }
  .mm-card-stat {
    display: block;
    margin: 18px 0 6px;
    font-size: 56px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--brand-dark);
    background: linear-gradient(90deg, #000 10%, var(--brand-primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .mm-card-text {
    margin: 0 0 22px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-muted);
  }
  .mm-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, #000 20%, var(--brand-primary) 100%);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .mm-card-cta i {
    font-size: 11px;
  }
  .mm-card-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(205, 64, 13, 0.3);
    color: #fff;
  }

  .mm-mobile {
    display: none !important;
  }
}

@keyframes mm-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------- tablet / mobile drawer */
@media (max-width: 991px) {
  .mm-trigger {
    justify-content: space-between;
  }
  .mm-chevron {
    padding: 10px 12px;
    font-size: 12px;
  }

  .mm-mobile {
    display: none;
    padding: 2px 0 8px;
  }
  .mm-mobile.is-open {
    display: block;
  }
  .mm-m-cat {
    border-bottom: 1px solid var(--mm-line);
  }
  .mm-m-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 12px 6px 12px 14px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    color: var(--brand-dark);
    cursor: pointer;
  }
  .mm-m-direct {
    text-decoration: none;
  }
  .mm-m-ico {
    flex: none;
    width: 20px;
    text-align: center;
    color: var(--brand-primary);
  }
  .mm-m-chev {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.22s ease;
  }
  .mm-m-btn[aria-expanded='true'] .mm-m-chev {
    transform: rotate(180deg);
  }
  .mm-m-links {
    list-style: none;
    margin: 0;
    padding: 0 0 12px 44px;
  }
  .mm-m-links a {
    display: block;
    padding: 8px 0;
    font-size: 14.5px;
    color: var(--text-muted);
    text-decoration: none;
  }
  .mm-m-links a:hover,
  .mm-m-links a:focus-visible {
    color: var(--brand-primary);
  }
  .mm-m-links .mm-m-all {
    font-weight: 700;
    color: var(--brand-primary);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-panel,
  .mm-overlay,
  .mm-links,
  .mm-card,
  .mm-chevron i,
  .mm-tab,
  .mm-link,
  .mm-m-chev {
    transition: none !important;
    animation: none !important;
  }
}
