/*
 * Services mega menu of the header (partials/services-mega-menu.blade.php, js/mega-menu.js): category tabs on the
 * start side, the services of the tab under the pointer, and a call to action. Logical properties keep one file for
 * both directions; arrows are drawn for right-to-left and turned for left-to-right.
 */
.mega-menu {
    --mega-green: var(--theme-color1, #33a457);
    --mega-lime: #67f60c;
    --mega-ink: #0d130f;
    --mega-text: #e4ebe6;
    --mega-muted: #a3b2a8;
    --mega-line: rgba(255, 255, 255, .08);
    --mega-shift: 0px;
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 300;
    width: min(1100px, calc(100vw - 40px));
    padding-top: 6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(calc(-50% + var(--mega-shift)), 16px);
    transition: opacity .28s ease, transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .28s;
}

/* The plain list is for the mobile menu only. */
.main-menu .navigation > li.has-mega > ul.mega-fallback,
.main-menu .navigation > li.has-mega:hover > ul.mega-fallback {
    display: none !important;
}

.main-menu .navigation > li.has-mega:hover > .mega-menu,
.main-menu .navigation > li.has-mega:focus-within > .mega-menu,
.main-menu .navigation > li.has-mega.is-open > .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(calc(-50% + var(--mega-shift)), 0);
    transition: opacity .28s ease, transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s;
}

.main-menu .navigation > li.has-mega.is-closed > .mega-menu {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.mega-menu__inner {
    position: relative;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr) 240px;
    overflow: hidden;
    border: 1px solid rgba(103, 246, 12, .18);
    border-radius: 24px;
    background:
        radial-gradient(600px 260px at 85% -10%, rgba(103, 246, 12, .16), transparent 60%),
        radial-gradient(420px 300px at 0% 110%, rgba(51, 164, 87, .22), transparent 65%),
        var(--mega-ink);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .06);
    text-align: start;
}

/* A faint grid behind everything. */
.mega-menu__inner::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

/* Category tabs */
.mega-menu__tabs {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px 16px;
    border-inline-end: 1px solid var(--mega-line);
    background: rgba(255, 255, 255, .02);
}

.mega-menu__eyebrow {
    display: block;
    margin: 0 10px 8px;
    color: var(--mega-lime);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.mega-menu__tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 16px;
    background: transparent;
    color: var(--mega-text);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: background .25s ease, border-color .25s ease, color .25s ease;
}

.mega-menu__tab::before {
    content: "";
    position: absolute;
    inset-block: 14px;
    inset-inline-start: -16px;
    width: 3px;
    border-radius: 3px;
    background: var(--mega-lime);
    box-shadow: 0 0 12px var(--mega-lime);
    opacity: 0;
    transform: scaleY(.3);
    transition: opacity .25s ease, transform .25s ease;
}

.mega-menu__tab:hover,
.mega-menu__tab:focus-visible {
    background: rgba(255, 255, 255, .04);
    color: #fff;
    outline: none;
}

.mega-menu__tab.is-active {
    border-color: rgba(103, 246, 12, .25);
    background: linear-gradient(135deg, rgba(51, 164, 87, .28), rgba(103, 246, 12, .06));
    color: #fff;
}

.mega-menu__tab.is-active::before {
    opacity: 1;
    transform: scaleY(1);
}

.mega-menu__tab-icon {
    display: inline-flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .06);
    color: var(--mega-lime);
    font-size: 18px;
    transition: background .25s ease, color .25s ease, transform .25s ease;
}

.mega-menu__tab.is-active .mega-menu__tab-icon {
    background: var(--mega-lime);
    color: var(--mega-ink);
    transform: rotate(-6deg);
}

.mega-menu__tab-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.mega-menu__tab-text strong {
    overflow: hidden;
    color: inherit;
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mega-menu__tab-text small {
    color: var(--mega-muted) !important;
    font-size: 12px;
}

.mega-menu__tab-arrow {
    font-size: 11px;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity .25s ease, transform .25s ease;
}

.mega-menu__tab.is-active .mega-menu__tab-arrow {
    opacity: .8;
    transform: none;
}

.mega-menu__all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: auto 12px 0;
    padding-top: 14px;
    color: var(--mega-lime) !important;
    font-size: 14px;
    font-weight: 700;
}

.mega-menu__all i {
    transition: transform .25s ease;
}

.mega-menu__all:hover i {
    transform: translateX(-4px);
}

/* Services of the active tab */
.mega-menu__panes {
    position: relative;
    padding: 26px 28px;
}

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

.mega-menu__pane {
    animation: mega-pane-in .35s cubic-bezier(.2, .8, .2, 1);
}

.mega-menu__pane-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 16px;
}

.mega-menu__pane-index {
    background: linear-gradient(135deg, var(--mega-lime), var(--mega-green));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
}

.mega-menu__pane-title {
    margin: 0;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.mega-menu__services {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 340px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    scrollbar-width: thin;
}

.main-menu .navigation .mega-menu__services > li {
    float: none;
    margin: 0;
    padding: 0;
    border: 0;
}

.main-menu .navigation .mega-menu__services > li::before {
    display: none;
}

.mega-menu__service {
    position: relative;
    display: flex !important;
    align-items: flex-start;
    gap: 12px;
    padding: 12px !important;
    border: 1px solid transparent;
    border-radius: 16px;
    color: var(--mega-text) !important;
    text-align: start !important;
    animation: mega-item-in .4s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: var(--mega-delay, 0ms);
    transition: background .25s ease, border-color .25s ease, transform .25s ease;
}

.mega-menu__service:hover,
.mega-menu__service:focus-visible {
    border-color: rgba(103, 246, 12, .22);
    background: rgba(255, 255, 255, .045);
    outline: none;
    transform: translateY(-2px);
}

.mega-menu__service-icon {
    display: inline-flex;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(103, 246, 12, .2);
    border-radius: 12px;
    background: rgba(51, 164, 87, .12);
    color: var(--mega-lime);
    font-size: 16px;
    transition: background .25s ease, color .25s ease;
}

.mega-menu__service:hover .mega-menu__service-icon {
    background: var(--mega-lime);
    color: var(--mega-ink);
}

.mega-menu__service-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    line-height: 1.45;
}

.mega-menu__service-text strong {
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
}

.mega-menu__service-text small {
    color: var(--mega-muted) !important;
    font-size: 12.5px;
    font-weight: 400;
}

.mega-menu__service-arrow {
    align-self: center;
    color: var(--mega-lime);
    font-size: 12px;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity .25s ease, transform .25s ease;
}

.mega-menu__service:hover .mega-menu__service-arrow {
    opacity: 1;
    transform: none;
}

/* Call to action */
.mega-menu__cta {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 10px;
    margin: 16px;
    padding: 22px;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(160deg, #1f8a12 0%, var(--mega-green) 45%, #0f3d1a 100%);
    color: #eaf7ea;
    isolation: isolate;
}

.mega-menu__cta-orb {
    position: absolute;
    inset-block-start: -60px;
    inset-inline-end: -60px;
    z-index: -1;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(103, 246, 12, .7), transparent 70%);
    filter: blur(6px);
    animation: mega-orb 6s ease-in-out infinite alternate;
}

.mega-menu__cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: auto;
    border-radius: 14px;
    background: rgba(13, 19, 15, .35);
    color: var(--mega-lime);
    font-size: 20px;
    backdrop-filter: blur(4px);
}

.mega-menu__cta h4 {
    margin: 0;
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.4;
}

.mega-menu__cta p {
    margin: 0;
    color: rgba(234, 247, 234, .85);
    font-size: 13.5px;
    line-height: 1.7;
}

.mega-menu__cta-button {
    display: inline-flex !important;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    margin-top: 6px;
    padding: 9px 18px !important;
    border-radius: 999px;
    background: var(--mega-lime);
    color: var(--mega-ink) !important;
    font-size: 14px;
    font-weight: 800;
    transition: transform .25s ease, box-shadow .25s ease;
}

.mega-menu__cta-button:hover {
    box-shadow: 0 10px 24px -8px rgba(103, 246, 12, .8);
    transform: translateY(-2px);
}

/* Arrows are drawn pointing left (right to left); left to right turns them. */
[dir="ltr"] .mega-menu__tab-arrow,
[dir="ltr"] .mega-menu__service-arrow,
[dir="ltr"] .mega-menu__all i,
[dir="ltr"] .mega-menu__cta-button i {
    scale: -1 1;
}

[dir="ltr"] .mega-menu__all:hover i {
    transform: translateX(4px);
}

/* Narrower desktops: the call to action steps aside. */
@media (max-width: 1299.98px) {
    .mega-menu__inner {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .mega-menu__cta {
        display: none;
    }
}

/* The mobile menu shows the plain list. */
.mobile-menu .mega-menu {
    display: none !important;
}

@keyframes mega-pane-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes mega-item-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@keyframes mega-orb {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(-20px, 24px) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
    .mega-menu,
    .mega-menu__pane,
    .mega-menu__service,
    .mega-menu__cta-orb {
        animation: none !important;
        transition: none !important;
    }
}
