/* ═══════════════════════════════════════════════════════════════════
 * Services Mega-Menu
 * ═══════════════════════════════════════════════════════════════════
 *
 * Lives inside the existing UICore Simple Megamenu container:
 *
 *   <li class="menu-item-870 uicore-simple-megamenu uicore-full">
 *     Services
 *     <ul class="sub-menu">  ← we replace this <ul>'s children
 *       <li class="ado-mega-wrapper">
 *         <nav class="ado-mega-content">…rich grid…</nav>
 *       </li>
 *     </ul>
 *   </li>
 *
 * The first block of rules below RESETS what UICore (or the previously
 * shipped Customizer "Custom CSS" polish) painted on the flat list, so
 * the rich nav can render cleanly on top.
 * ═══════════════════════════════════════════════════════════════════ */

/* ─── Reset UICore / Customizer polish on the sub-menu container ───
 *
 * Visual reset only — positioning is handled in mega-menu.js via inline
 * styles applied AFTER UICore's keyframe animation is cancelled. We do
 * NOT touch transform/left/right/width here because UICore's running
 * animation wins the cascade against `!important` declarations. */
@media (min-width: 1025px) {
  /* Desktop only: force the sub-menu container to render the rich nav.
     On mobile we let UICore toggle show/hide naturally in its drawer. */
  .uicore-simple-megamenu.uicore-simple-megamenu > .sub-menu:has(.ado-mega-wrapper),
  .menu-item-870.uicore-simple-megamenu.uicore-simple-megamenu > .sub-menu {
      display: block !important;
      grid-template-columns: none !important;
      grid-template-rows: none !important;
      gap: 0 !important;
      padding: 0 !important;
      background: transparent !important;
      box-shadow: none !important;
      border-radius: 0 !important;
      max-width: none !important;
  }
}
.uicore-simple-megamenu.uicore-simple-megamenu > .sub-menu > li.ado-mega-wrapper,
.menu-item-870.uicore-simple-megamenu.uicore-simple-megamenu > .sub-menu > li.ado-mega-wrapper {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
    background: transparent !important;
}
/* Hide the bare anchor (none here, but the Customizer flat-list polish
   still styles `> li > a` — kill any direct anchor inside the wrapper) */
.uicore-simple-megamenu > .sub-menu > li.ado-mega-wrapper > a {
    display: none !important;
}

/* ─── Rich content scope ─── */
.ado-mega-content,
nav.ado-mega-content {
    --m-primary: #8956FF;
    --m-primary-light: #A87FFF;
    --m-primary-dark: #5A2BC9;
    --m-primary-soft: #F4ECFF;
    --m-text: #1B1238;
    --m-text-soft: #5A4D7A;
    --m-text-muted: #8B7FB2;
    --m-border: rgba(91, 43, 201, 0.08);
    --m-radius-sm: 12px;
    --m-radius: 20px;

    font-family: 'Avantique', 'Outfit', 'Inter', system-ui, sans-serif;
    color: var(--m-text);
    padding: 36px 40px !important;
    background:
      radial-gradient(ellipse at top right, rgba(168, 127, 255, 0.06) 0%, transparent 50%),
      #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 24px 60px rgba(91, 43, 201, 0.18) !important;
    position: relative !important;
    max-width: 1280px !important;
    width: calc(100% - 32px) !important;
    margin: 0 auto !important;
    /* The theme styles `nav` as `display: flex; flex-direction: row` —
       reset to block so our <header> and <div.grid> stack vertically. */
    display: block !important;
    flex-direction: initial !important;
    box-sizing: border-box !important;
}

/* ─── Header tagline ─── */
.ado-mega-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--m-border);
}
.ado-mega-header__eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--m-primary);
    margin: 0;
}
.ado-mega-header__sub {
    font-size: 13px;
    color: var(--m-text-muted);
    margin: 0;
    margin-left: auto;
}
.ado-mega-header__sub em {
    font-style: italic;
    color: var(--m-primary);
    font-weight: 500;
}

/* ─── Grid (3 service cols + 1 featured CTA col) ─── */
.ado-mega-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 1.3fr;
    gap: 32px;
    /* default stretch — featured card uses justify-content: space-between
       so its content distributes top/bottom across the row height */
}
.ado-mega-col {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.ado-mega-cat {
    display: flex;
    flex-direction: column;
}

/* Category head — <button> for a11y / mobile accordion */
.ado-mega-cat__head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    cursor: default;
    color: inherit;
    font-family: inherit;
    width: 100%;
}
.ado-mega-cat__num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--m-primary), var(--m-primary-light));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(137, 86, 255, 0.30);
}
.ado-mega-cat__info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ado-mega-cat__name {
    font-size: 14px;
    font-weight: 700;
    color: var(--m-text);
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.ado-mega-cat__count {
    font-size: 11px;
    color: var(--m-text-muted);
    font-weight: 500;
}

/* List reset — beats UICore / theme default <ul> styles */
.ado-mega-content ul,
.ado-mega-content .ado-mega-cat__list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ado-mega-content li,
.ado-mega-content .ado-mega-cat__list li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style-image: none !important;
    display: block !important;
}
.ado-mega-content li::marker { content: none !important; }
.ado-mega-content .ado-mega-cat__list > li::before {
    content: none !important;
    display: none !important;
}

.ado-mega-cat__list a {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 7px 8px 7px 14px !important;
    margin-left: -8px;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--m-text-soft) !important;
    text-decoration: none !important;
    border-radius: 8px !important;
    position: relative;
    transition: color 0.15s, background 0.15s, padding-left 0.2s !important;
    background: transparent !important;
}
.ado-mega-cat__list a::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--m-primary);
    opacity: 0.30;
    transition: all 0.2s;
}
.ado-mega-cat__list a::after {
    content: '→';
    margin-left: auto;
    color: var(--m-primary);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s, transform 0.2s;
    font-weight: 700;
}
.ado-mega-cat__list a:hover {
    background: var(--m-primary-soft) !important;
    color: var(--m-primary-dark) !important;
    padding-left: 18px !important;
}
.ado-mega-cat__list a:hover::before {
    width: 2px;
    height: 14px;
    border-radius: 2px;
    opacity: 1;
    background: var(--m-primary);
}
.ado-mega-cat__list a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

/* ═════════════════════════════════════════════════════════════════
   FEATURED CTA CARD — with always-on subtle animations
   ═════════════════════════════════════════════════════════════════ */
.ado-mega-featured {
    position: relative;
    background:
      radial-gradient(ellipse at top right, rgba(168, 127, 255, 0.35), transparent 60%),
      radial-gradient(ellipse at bottom left, rgba(168, 127, 255, 0.20), transparent 50%),
      linear-gradient(135deg, #1B1238 0%, #5A2BC9 100%);
    border-radius: var(--m-radius);
    padding: 32px 28px;
    color: #fff;
    display: flex;
    flex-direction: column;
    /* Card stretches to the tallest column's height (default grid stretch).
       space-between pins the badge/title/sub block at the top and the
       button/signature block at the bottom; spotlight + circles fill the
       breathing space in the visual middle. */
    justify-content: space-between;
    gap: 20px;
    overflow: hidden;
}

/* Spotlight sweep */
.ado-mega-featured::after {
    content: '';
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at center, rgba(168, 127, 255, 0.28), transparent 40%);
    pointer-events: none;
    animation: adoMegaSweep 14s ease-in-out infinite;
    z-index: 0;
}
@keyframes adoMegaSweep {
    0%, 100% { transform: translate(-18%, -8%); }
    25%      { transform: translate(18%, -12%); }
    50%      { transform: translate(14%, 14%); }
    75%      { transform: translate(-14%, 10%); }
}

/* Decorative circles — slow rotation */
.ado-mega-featured__shape {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}
.ado-mega-featured__shape--1 {
    top: -40px; right: -40px;
    width: 200px; height: 200px;
    border: 1px solid rgba(168, 127, 255, 0.25);
    border-radius: 50%;
    animation: adoMegaRotate 40s linear infinite;
}
.ado-mega-featured__shape--2 {
    top: -20px; right: -20px;
    width: 140px; height: 140px;
    border: 1px solid rgba(168, 127, 255, 0.18);
    border-radius: 50%;
    animation: adoMegaRotate 60s linear infinite reverse;
}
.ado-mega-featured__shape--3 {
    bottom: -60px; left: -30px;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(168, 127, 255, 0.18), transparent 70%);
    border-radius: 50%;
    animation: adoMegaFloat 9s ease-in-out infinite;
}
@keyframes adoMegaRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes adoMegaFloat {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(8px, -14px); }
}

/* Featured CONTENT sits above the animated layers.
   ⚠ MUST exclude .ado-mega-featured__shape — same specificity (0,1,0)
   as the universal-child selector. Without :not(), the shapes would lose
   their `position: absolute` and drop into the flex flow, creating a
   ~500px empty band at the top of the card. */
.ado-mega-featured > *:not(.ado-mega-featured__shape) {
    position: relative;
    z-index: 2;
}

.ado-mega-featured__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.20);
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    align-self: flex-start;
    margin-bottom: 18px;
}
.ado-mega-featured__badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #B5FF6E;
    border-radius: 50%;
    animation: adoMegaGlow 2.4s ease-in-out infinite;
}
@keyframes adoMegaGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(181, 255, 110, 0.55); }
    50%      { box-shadow: 0 0 20px rgba(181, 255, 110, 0.95); }
}

.ado-mega-featured__h,
.ado-mega-content h3.ado-mega-featured__h {
    font-size: 24px !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    margin: 0 0 12px !important;
    letter-spacing: -0.015em;
    color: #fff !important;
}
.ado-mega-featured__h em,
.ado-mega-content h3.ado-mega-featured__h em {
    font-style: italic;
    font-weight: 400;
    color: #A87FFF !important;
}
.ado-mega-featured__sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.78);
    margin: 0 0 24px;
    line-height: 1.55;
    max-width: 280px;
}

/* CTA pill — hardcoded hex with maximal specificity.
 * Why so aggressive: previous selector at (0,3,1) + !important was being
 * beat at runtime — likely a higher-specificity UICore rule we couldn't
 * see in cssRules iteration (theme inline scope or animation-derived).
 * `html body` prefix lifts us to (0,3,3) which beats anything UICore
 * realistically ships in their default a-tag rules. */
html body .ado-mega-content .ado-mega-featured a.ado-mega-featured__cta,
html body .ado-mega-featured a.ado-mega-featured__cta,
html body nav.ado-mega-content a.ado-mega-featured__cta {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #5A2BC9 !important;
    padding: 13px 22px !important;
    border-radius: 100px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    align-self: flex-start;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    width: fit-content;
    border: none !important;
}
html body .ado-mega-content .ado-mega-featured a.ado-mega-featured__cta:hover,
html body .ado-mega-featured a.ado-mega-featured__cta:hover,
html body nav.ado-mega-content a.ado-mega-featured__cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25) !important;
    background: #F4ECFF !important;
    background-color: #F4ECFF !important;
    color: #5A2BC9 !important;
    text-decoration: none !important;
}
/* arrow inherits the violet — defensive override */
.ado-mega-featured a.ado-mega-featured__cta .ado-mega-featured__cta-arrow {
    color: #5A2BC9 !important;
}
.ado-mega-featured__cta-arrow { transition: transform 0.2s; font-weight: 700; }
.ado-mega-featured__cta:hover .ado-mega-featured__cta-arrow { transform: translateX(4px); }

.ado-mega-featured__signature {
    margin-top: 18px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.58);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ado-mega-featured__signature-line {
    width: 24px;
    height: 1px;
    background: rgba(255, 255, 255, 0.30);
}

@media (prefers-reduced-motion: reduce) {
    .ado-mega-featured::after,
    .ado-mega-featured__shape,
    .ado-mega-featured__badge::before {
        animation: none !important;
    }
}


/* ─── Tablet (≤ 1240px) — slightly tighter ─── */
@media (max-width: 1240px) {
    .ado-mega-content { padding: 28px 24px !important; }
    .ado-mega-grid { gap: 24px; }
}

/* ─── Mobile (≤ 1024px) — accordion stacked ─── */
@media (max-width: 1024px) {
    .ado-mega-content { padding: 20px 16px !important; }
    .ado-mega-header {
        margin-bottom: 18px;
        padding-bottom: 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .ado-mega-header__sub { margin-left: 0 !important; }
    .ado-mega-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .ado-mega-col { gap: 0; }
    .ado-mega-cat__head {
        cursor: pointer;
        padding: 14px 4px;
        margin: 0;
        position: relative;
        border-bottom: 1px solid var(--m-border);
        transition: background 0.15s;
    }
    .ado-mega-cat__head::after {
        content: '+';
        margin-left: auto;
        font-size: 22px;
        color: var(--m-primary);
        transition: transform 0.2s;
        font-weight: 400;
    }
    .ado-mega-cat__head[aria-expanded="true"]::after { content: '−'; }
    .ado-mega-cat__head + .ado-mega-cat__list {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s, padding 0.3s;
    }
    .ado-mega-cat__head[aria-expanded="true"] + .ado-mega-cat__list {
        max-height: 600px;
        padding: 8px 0 14px;
    }

    .ado-mega-featured {
        padding: 24px 20px;
        min-height: auto;
        margin-top: 16px;
    }
    .ado-mega-featured__h,
    .ado-mega-content h3.ado-mega-featured__h { font-size: 20px !important; }
}

@media (min-width: 1025px) {

/* ═══════════════════════════════════════════════════════════════════
 * OPEN/CLOSE ANIMATIONS
 * ═══════════════════════════════════════════════════════════════════
 * The sub-menu container itself can't be animated (UICore's animation
 * is canceled by mega-menu.js to avoid breaking the viewport pinning).
 * Instead we animate the INNER `.ado-mega-content` nav and stagger the
 * children — gives the menu a polished reveal without fighting UICore.
 * ═══════════════════════════════════════════════════════════════════ */

@keyframes adoMegaContentIn {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes adoMegaItemIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hidden default — when sub-menu opens, :hover triggers the fade-in */
.uicore-simple-megamenu .ado-mega-content {
    opacity: 0;
    transform: translateY(-14px);
    transition:
        opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
}

/* Visible state — covers all the ways UICore can mark the menu as open */
.uicore-simple-megamenu:hover .ado-mega-content,
.uicore-simple-megamenu:focus-within .ado-mega-content,
.uicore-simple-megamenu .sub-menu:hover .ado-mega-content,
.uicore-simple-megamenu.uicore-active .ado-mega-content,
.uicore-simple-megamenu.is-active .ado-mega-content,
.uicore-simple-megamenu.is-open .ado-mega-content {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered reveal — header → col 1 → col 2 → col 3 → CTA card */
.uicore-simple-megamenu:hover .ado-mega-header,
.uicore-simple-megamenu:focus-within .ado-mega-header,
.uicore-simple-megamenu .sub-menu:hover .ado-mega-header,
.uicore-simple-megamenu.uicore-active .ado-mega-header {
    animation: adoMegaItemIn 0.32s cubic-bezier(0.4, 0, 0.2, 1) 0.05s both;
}
.uicore-simple-megamenu:hover .ado-mega-col:nth-child(1),
.uicore-simple-megamenu:focus-within .ado-mega-col:nth-child(1),
.uicore-simple-megamenu .sub-menu:hover .ado-mega-col:nth-child(1),
.uicore-simple-megamenu.uicore-active .ado-mega-col:nth-child(1) {
    animation: adoMegaItemIn 0.36s cubic-bezier(0.4, 0, 0.2, 1) 0.10s both;
}
.uicore-simple-megamenu:hover .ado-mega-col:nth-child(2),
.uicore-simple-megamenu:focus-within .ado-mega-col:nth-child(2),
.uicore-simple-megamenu .sub-menu:hover .ado-mega-col:nth-child(2),
.uicore-simple-megamenu.uicore-active .ado-mega-col:nth-child(2) {
    animation: adoMegaItemIn 0.36s cubic-bezier(0.4, 0, 0.2, 1) 0.16s both;
}
.uicore-simple-megamenu:hover .ado-mega-col:nth-child(3),
.uicore-simple-megamenu:focus-within .ado-mega-col:nth-child(3),
.uicore-simple-megamenu .sub-menu:hover .ado-mega-col:nth-child(3),
.uicore-simple-megamenu.uicore-active .ado-mega-col:nth-child(3) {
    animation: adoMegaItemIn 0.36s cubic-bezier(0.4, 0, 0.2, 1) 0.22s both;
}
.uicore-simple-megamenu:hover .ado-mega-featured,
.uicore-simple-megamenu:focus-within .ado-mega-featured,
.uicore-simple-megamenu .sub-menu:hover .ado-mega-featured,
.uicore-simple-megamenu.uicore-active .ado-mega-featured {
    animation: adoMegaItemIn 0.40s cubic-bezier(0.4, 0, 0.2, 1) 0.28s both;
}

/* Respect prefers-reduced-motion — accessibility */
@media (prefers-reduced-motion: reduce) {
    .uicore-simple-megamenu .ado-mega-content {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .uicore-simple-megamenu:hover .ado-mega-header,
    .uicore-simple-megamenu:hover .ado-mega-col,
    .uicore-simple-megamenu:hover .ado-mega-featured {
        animation: none !important;
    }
}

} /* end desktop-only animations */
