/* PLD Page Mega Menu 1.1 – image navigation inside Flatsome's own desktop dropdown.
   Only the selected nav dropdown is widened; the mobile/off-canvas menu is untouched. */
.pld-mega-panel,
.pld-mega-panel * { box-sizing: border-box; }

.pld-mega-panel {
    --pld-columns: 4;
    --pld-width: 80vw;
    --pld-max-width: 1600px;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    display: block;
    background: #fff;
    color: #505050;
    text-align: center;
    text-transform: none;
    letter-spacing: normal;
}
.pld-mega-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--pld-columns), minmax(0, 1fr));
    gap: 0 !important;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.pld-mega-cell {
    display: block !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.pld-mega-panel .pld-mega-card {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    text-decoration: none !important;
    text-align: center !important;
    text-transform: none !important;
    color: inherit !important;
    background: #fff;
}
.pld-mega-panel .pld-mega-image {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    flex-shrink: 0;
    aspect-ratio: 2.55 / 1;
    background: #edf0f0;
}
.pld-mega-panel .pld-mega-img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    object-fit: cover;
    object-position: center;
}
.pld-mega-panel .pld-mega-image-mark {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #c0cacc;
    font-size: 28px;
}
.pld-mega-panel .pld-mega-copy { display: block; width: 100%; }
.pld-mega-panel .pld-mega-title {
    display: block;
    margin: 0;
    color: #525252;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.28;
    letter-spacing: 0;
    text-transform: none;
}
.pld-mega-panel .pld-mega-subtitle {
    display: block;
    margin-top: 6px;
    color: #727272;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 400;
    text-transform: none;
}

/* Default: reproduce the original Avada layout — one continuous white grid,
   hairline separators, centred landscape images and plain text titles. */
.pld-mega-panel--original .pld-mega-grid {
    border-top: 1px solid #dddddd;
    border-left: 1px solid #dddddd;
}
.pld-mega-panel--original .pld-mega-cell {
    border-right: 1px solid #dddddd;
    border-bottom: 1px solid #dddddd;
}
.pld-mega-panel--original .pld-mega-card {
    padding: 28px 16px 22px !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: background-color .16s ease;
}
.pld-mega-panel--original .pld-mega-image {
    width: 78%;
    max-width: 390px;
    margin: 0 auto 11px;
}
.pld-mega-panel--original .pld-mega-card:hover,
.pld-mega-panel--original .pld-mega-card:focus-visible {
    background: #fafafa;
}
.pld-mega-panel--original .pld-mega-card:hover .pld-mega-title,
.pld-mega-panel--original .pld-mega-card:focus-visible .pld-mega-title {
    color: #159ee5;
}
.pld-mega-panel .pld-mega-card:focus-visible {
    outline: 2px solid #159ee5;
    outline-offset: -4px;
}

/* Optional v1 card design is retained for websites that prefer it. */
.pld-mega-panel--modern { padding: 22px; text-align: left; }
.pld-mega-panel--modern .pld-mega-grid { gap: 18px !important; }
.pld-mega-panel--modern .pld-mega-card {
    overflow: hidden;
    align-items: stretch;
    border: 1px solid #e5e9ed !important;
    border-radius: 8px !important;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.pld-mega-panel--modern .pld-mega-card:hover,
.pld-mega-panel--modern .pld-mega-card:focus-visible {
    transform: translateY(-3px);
    border-color: #b8c4ce !important;
    box-shadow: 0 9px 25px rgba(16,30,45,.11);
}
.pld-mega-panel--modern .pld-mega-image { aspect-ratio: 16 / 10; }
.pld-mega-panel--modern .pld-mega-copy { padding: 14px; text-align: left; }
.pld-mega-panel--modern .pld-mega-title { color: #142b3c; font-size: 15px; font-weight: 700; }
.pld-mega-panel--modern .pld-mega-subtitle { font-size: 12px; }

/* Flatsome Classic keeps its own hover/click/focus dropdown behaviour.
   The plugin only controls size and centring of dropdowns containing PLD cards. */
@media (min-width: 850px) {
    .nav-dropdown.pld-mega-host {
        width: min(var(--pld-host-width, 80vw), var(--pld-host-max-width, 1600px), calc(100vw - 32px)) !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        right: auto !important;
        /* Avoid clipping more than two rows of cards on shorter screens. */
        max-height: calc(100vh - 100px);
        overflow-x: hidden;
        overflow-y: auto;
    }
    .nav-dropdown.pld-mega-host > li {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .nav-dropdown.pld-mega-host > .row,
    .nav-dropdown.pld-mega-host > .row > .col,
    .nav-dropdown.pld-mega-host .ux-block,
    .nav-dropdown.pld-mega-host .col-inner,
    .nav-dropdown.pld-mega-host .pld-mega-panel {
        max-width: none !important;
        width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* This visual grid is desktop ONLY. Flatsome's normal sidebar/mobile menu
   (with native submenu links) is used at 849px and below. */
@media (max-width: 849.98px) {
    .pld-mega-panel { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .pld-mega-card { transition: none !important; }
}

/* v1.2: replace selected legacy Flatsome mega dropdown automatically, but ONLY
   on desktop. The existing WP menu/submenu remains available on tablet/mobile. */
@media (min-width: 850px) {
    .pld-mega-enabled { position: relative !important; }
    .pld-mega-enabled > ul.nav-dropdown,
    .pld-mega-enabled > .nav-dropdown:not(.pld-mega-inline) {
        display: none !important;
    }
    .pld-mega-enabled > .pld-mega-inline {
        position: absolute !important;
        top: 100% !important;
        left: 0;
        right: auto !important;
        z-index: 10000;
        display: none;
        width: min(var(--pld-width, 80vw), var(--pld-max-width, 1600px), calc(100vw - 32px)) !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 1px solid #ddd;
        box-shadow: 0 15px 32px rgba(20, 30, 38, .15);
        max-height: calc(100vh - 125px);
        overflow-x: hidden;
        overflow-y: auto;
        cursor: default;
    }
    .pld-mega-enabled:hover > .pld-mega-inline,
    .pld-mega-enabled:focus-within > .pld-mega-inline {
        display: block !important;
    }
}
@media (max-width: 849.98px) {
    .pld-mega-enabled > .pld-mega-inline { display: none !important; }
}

/* v1.3: on narrower desktop widths, scale image-card typography and spacing.
   Keep the standard Flatsome mobile menu below 850px. */
@media (min-width: 850px) and (max-width: 1399px) {
    .pld-mega-enabled > .pld-mega-inline.pld-mega-panel--original .pld-mega-title {
        font-size: 15px !important;
        line-height: 1.2 !important;
    }
    .pld-mega-enabled > .pld-mega-inline.pld-mega-panel--original .pld-mega-card {
        padding: 9px 8px 6px !important;
    }
    .pld-mega-enabled > .pld-mega-inline.pld-mega-panel--original .pld-mega-image {
        margin-bottom: 5px !important;
    }
}

/* v1.3.1: semantically correct desktop-only dropdown buttons.
   A selected parent without a destination is a <button>, not an <a> missing
   href. Match Flatsome's nav-link presentation; keep the PLD cards untouched. */
@media (min-width: 850px) {
    .nav > li.pld-mega-enabled > button.pld-mega-trigger {
        -webkit-appearance: none;
        appearance: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        box-sizing: border-box;
        margin: 0;
        padding: 10px 0;
        min-width: 0;
        background: transparent !important;
        border: 0 !important;
        border-radius: 0;
        box-shadow: none;
        color: inherit;
        font-family: inherit;
        font-size: inherit;
        font-style: inherit;
        font-weight: inherit;
        line-height: inherit;
        letter-spacing: inherit;
        text-align: inherit;
        text-decoration: none;
        text-transform: inherit;
        vertical-align: middle;
        cursor: pointer;
    }
    .nav > li.pld-mega-enabled > button.pld-mega-trigger:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: -3px;
    }
    /* Retain Pennine's existing white-on-dark bottom-navigation appearance.
       Sites with different navigation colours can override this in their theme. */
    .header-bottom .nav > li.pld-mega-enabled > button.pld-mega-trigger {
        font-weight: 400 !important;
        color: #fff !important;
    }
    .header-bottom .nav > li.pld-mega-enabled:hover > button.pld-mega-trigger,
    .header-bottom .nav > li.pld-mega-enabled:focus-within > button.pld-mega-trigger {
        color: #fff !important;
        box-shadow: inset 0 -3px 0 #65b5d3 !important;
    }
}

/* v1.3.2: browser viewports can be fractional CSS pixels (e.g. 849.3px).
   At that width the 850px desktop rules are off but old max-width:849px
   mobile rules were also off, exposing the desktop card grid. Hide the
   bottom desktop-nav row only when it contains a PLD mega menu; the main
   mobile hamburger remains untouched. */
@media (max-width: 849.98px) {
    .header-bottom:has(.pld-mega-enabled) { display: none !important; }
}
