﻿/* Cloudmersive – Products hover mega menu
   Scope with `cm-` to avoid collisions with site CSS.
   Mobile: hide (tap still navigates to /products).
*/

.cm-megamenu {
    position: absolute;
    inset: 0 auto auto 0;
    z-index: 10000; /* above header & hero */
    background: #ffffff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 10px;
    box-shadow: 0 20px 45px rgba(0,0,0,.15);
    padding: 18px 18px 12px;
    width: clamp(720px, 72vw, 1100px);
    display: none; /* toggled by JS */
    animation: cm-fade-slide .12s ease-out;
}

    .cm-megamenu.cm-show {
        display: block;
    }

@keyframes cm-fade-slide {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cm-megamenu__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 24px;
}

/* Each column */
.cm-megamenu__col {
    max-height: none; /* was 60vh */
    overflow: visible; /* was auto (created vertical & horizontal bars) */
    padding-right: 0; /* no need for scrollbar gutter */
}

/* Column header */
.cm-megamenu__heading {
    margin: 2px 0 8px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #666;
}

/* List */
.cm-megamenu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cm-megamenu__item + .cm-megamenu__item {
    margin-top: 2px;
}

/* Item link row */
.cm-megamenu__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    text-decoration: none;
    color: #333;
    position: relative; /* for tooltip positioning */
    line-height: 1.25;
    transition: background .12s ease;
}

    .cm-megamenu__link:hover,
    .cm-megamenu__link:focus {
        background: #f7f7f7;
        outline: none;
    }

.cm-megamenu__icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.cm-megamenu__label {
    font-weight: 600;
    font-size: 14px;
    word-break: break-word;
}

/* HTML tooltip (pure CSS show/hide) */
.cm-tooltip {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%) translateX(4px);
    min-width: 240px;
    max-width: 320px;
    background: #111;
    color: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
    font-size: 12.5px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease, transform .12s ease;
    z-index: 10001;
}

    .cm-tooltip::before {
        content: "";
        position: absolute;
        top: 50%;
        right: 100%;
        transform: translateY(-50%);
        border: 7px solid transparent;
        border-right-color: #111;
    }

.cm-megamenu__link:hover .cm-tooltip,
.cm-megamenu__link:focus .cm-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Footer row (View all Products) – optional */
.cm-megamenu__footer {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(0,0,0,.06);
    margin-top: 12px;
    padding-top: 10px;
}

    .cm-megamenu__footer a {
        font-weight: 600;
        text-decoration: none;
    }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cm-megamenu {
        animation: none;
    }

    .cm-tooltip {
        transition: none;
    }
}

/* Hide mega menu on devices without hover (keep /products link normal) */
@media (hover: none), (pointer: coarse), (max-width: 992px) {
    .cm-megamenu {
        display: none !important;
    }
}


.cm-megamenu__grid {
    display: block; /* stop using grid */
    column-count: 3; /* same visual width as before */
    column-gap: 24px; /* small horizontal breathing room */
}

.cm-megamenu__col {
    break-inside: avoid; /* keep a category together */
    -webkit-column-break-inside: avoid; /* Safari */
    -moz-column-break-inside: avoid; /* Firefox */
    margin: 0 0 10px 0; /* tight vertical spacing between categories */
}

.cm-megamenu__list::after {
    content: "";
    display: block;
    height: 18px; /* tweak to taste */
}