/* ============================================
   nav-mega.css (v3) — Services mega menu + Portfolio dropdown.
   Desktop: opens on hover (and keyboard focus).
   Touch / mobile: opens with the arrow button.
   Also holds small shared styles for the services/portfolio pages.
   ============================================ */

.nm-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
}

.nm-toggle {
    background: none;
    border: none;
    padding: 6px;
    margin: 0;
    cursor: pointer;
    color: var(--muted, #5b6783);
    display: inline-flex;
    align-items: center;
    font: inherit;
}

.nm-item:hover .nm-toggle,
.nm-item.nm-open .nm-toggle {
    color: #f0682c;
}

.nm-caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -3px;
    transition: transform .18s ease;
}

.nm-item.nm-open .nm-caret {
    transform: rotate(-135deg);
    margin-top: 2px;
}

.nm-panel {
    position: absolute;
    top: calc(100% + 18px);
    left: 50%;
    transform: translateX(-53%);
    width: min(1000px, 92vw);
    background: #ffffff;
    border: 1px solid #e7e9ef;
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(15, 27, 53, 0.14);
    padding: 28px;
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    z-index: 60;
}

/* invisible bridge so the panel doesn't close while the mouse crosses the gap */
.nm-panel::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -22px;
    height: 22px;
}

.nm-item.nm-open .nm-panel {
    display: grid;
}

/* Desktop hover / keyboard */
@media (hover: hover) and (min-width: 961px) {

    .nm-item:hover .nm-panel,
    .nm-item:has(:focus-visible) .nm-panel {
        display: grid;
    }

    .nm-item:hover .nm-link,
    .nm-item:hover .nm-caret {
        color: #f0682c;
    }

    .nm-item:hover .nm-caret {
        transform: rotate(-135deg);
        margin-top: 2px;
    }
}

.nm-col h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #f0682c;
    text-transform: uppercase;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e7e9ef;
}

.nm-col h4 a {
    color: #f0682c;
    font-size: 13px;
    font-weight: 700;
}

.nm-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.nm-col a {
    display: block;
    font-size: 14px;
    color: #0f1b35;
    text-decoration: none;
    line-height: 1.7;
}

.nm-col a:hover {
    color: #f0682c;
}

.nm-col.nm-more {
    display: flex;
    flex-direction: column;
}

.nm-cta {
    margin-top: auto;
    display: inline-block;
    background: #f0682c;
    color: #fff !important;
    font-weight: 700;
    font-size: 13.5px;
    text-align: center;
    padding: 10px 14px;
    border-radius: 5px;
}

.nm-cta:hover {
    color: #fff !important;
    opacity: .92;
}

/* ---------- Portfolio dropdown (single column) ---------- */
.nm-panel.nm-drop {
    width: 240px;
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 0;
}

.nm-drop ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
}

.nm-drop a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: #0f1b35;
    text-decoration: none;
}

.nm-drop a:hover {
    background: #fff4ee;
    color: #f0682c;
}

.nm-drop .nm-all {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #e7e9ef;
}

.nm-drop .nm-all a {
    font-weight: 700;
    color: #f0682c;
}

/* ---------- Responsive behaviour ---------- */

/* keep the CTA button from touching the last link */
.nm-col.nm-more ul {
    margin-bottom: 16px;
}

/* the per-column arrow only exists for the mobile accordion */
.nm-sub-toggle {
    display: none;
}

/* Small laptops / tablets in landscape: keep the whole bar on one line */
@media (min-width: 961px) and (max-width: 1200px) {
    nav ul {
        gap: 16px;
    }

    nav ul a {
        font-size: 14px;
    }

    nav .btn {
        padding: 9px 14px;
        font-size: 14px;
    }

    .nm-panel {
        width: min(700px, calc(100vw - 32px));
        padding: 22px;
        gap: 18px;
    }
}

/* Tablets (portrait) and phones: slide-down menu with accordions */
@media (max-width: 960px) {

    nav ul {
        gap: 0;
        padding: 6px 20px 18px;
        box-shadow: 0 16px 28px rgba(15, 27, 53, 0.12);
    }

    nav ul.open {
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    /* style.css targets every "nav ul"; stop that leaking into the nested lists */
    nav ul ul {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        background: transparent;
        border: 0;
        box-shadow: none;
        max-height: none;
        overflow: visible;
        flex-direction: column;
        align-items: stretch;
    }

    #links>li {
        width: 100%;
        border-bottom: 1px solid #eef0f5;
    }

    #links>li>a:not(.btn),
    .nm-item .nm-link {
        display: block;
        padding: 14px 0;
        font-size: 16px;
    }

    #links>li:last-child {
        border-bottom: 0;
        padding-top: 14px;
    }

    #links>li>a.btn {
        display: block;
        text-align: center;
        padding: 13px 20px;
        font-size: 16px;
    }

    /* top level: Services / Portfolio row = link + arrow */
    .nm-item {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0;
    }

    .nm-item .nm-link {
        flex: 1;
    }

    .nm-toggle {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
    }

    /* panels */
    .nm-panel,
    .nm-panel.nm-drop {
        position: static;
        transform: none;
        width: 100%;
        max-width: none;
        flex: 0 0 100%;
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0 0 8px 12px;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .nm-panel::before {
        display: none;
    }

    /* column = accordion: heading link + arrow, list hidden until opened */
    .nm-col {
        border-top: 1px solid #f0f1f5;
    }

    .nm-col h4 {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0;
        padding: 0;
        border: 0;
    }

    .nm-col h4 a {
        flex: 1;
        padding: 12px 0;
    }

    .nm-sub-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        background: none;
        border: 0;
        color: #f0682c;
        cursor: pointer;
    }

    .nm-col ul {
        display: none;
        gap: 0;
        padding: 0 0 10px 10px;
    }

    .nm-col.nm-col-open ul {
        display: grid;
    }

    /* the parent's "open" state must not flip the column arrows */
    .nm-item.nm-open .nm-col .nm-caret {
        transform: rotate(45deg);
        margin-top: -3px;
    }

    .nm-item.nm-open .nm-col.nm-col-open .nm-caret {
        transform: rotate(-135deg);
        margin-top: 2px;
    }

    .nm-col li a {
        padding: 10px 0;
        font-size: 15px;
    }

    /* the bottom "Get Free Quote" button already exists in the main list */
    .nm-col .nm-cta {
        display: none;
    }

    /* portfolio dropdown is a short flat list: show it directly */
    .nm-drop ul {
        display: grid;
        padding: 0 0 6px;
    }

    .nm-drop a {
        padding: 11px 8px;
    }

    .nm-drop .nm-all {
        margin-top: 4px;
        padding-top: 4px;
    }
}

/* Small phones */
@media (max-width: 400px) {
    nav ul {
        padding-left: 16px;
        padding-right: 16px;
    }

    .logo {
        font-size: 20px;
    }

    .logo img {
        width: 38px;
        height: 38px;
    }
}

/* ---------- Shared styles for services / portfolio / related blocks ---------- */
.rl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.rl-card {
    display: block;
    background: #fff;
    border: 1px solid #e7e9ef;
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: #0f1b35;
    transition: border-color .18s, transform .18s, box-shadow .18s;
}

.rl-card b {
    display: block;
    font-size: 15.5px;
    margin-bottom: 6px;
}

.rl-card span {
    display: block;
    font-size: 13.5px;
    line-height: 1.55;
    color: #5b6783;
}

.rl-card:hover {
    border-color: #f0682c;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 27, 53, .08);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.chip {
    padding: 8px 16px;
    border: 1.5px solid #e7e9ef;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #0f1b35;
    background: #fff;
}

.chip:hover,
.chip.on {
    background: #f0682c;
    border-color: #f0682c;
    color: #fff;
}

.cat-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.cat-head h2 {
    margin: 0;
}

.cat-head a {
    font-size: 14.5px;
    font-weight: 600;
    color: #f0682c;
    text-decoration: none;
}

.cat-head a:hover {
    text-decoration: underline;
}
