/* ==========================================================================
   Estastra Mega-Dropdown Navigation
   Desktop: multi-column mega panel with Slack-style spotlight card
   Mobile: Drill-down panel navigation (no accordion, no border lines)
   No em dashes anywhere in this file.
   ========================================================================== */

/* ── Desktop mega list item (position: static so dropdown can go fixed) ──── */

.nav-mega {
    position: static;
    display: flex;
    align-items: center;
    height: 100%;
}

/* ── Trigger button ───────────────────────────────────────────────────────── */

.nav-mega-trigger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0;
    height: 100%;
    font-family: inherit;
    transition: color 0.2s, font-weight 0.1s;
    line-height: 1;
    outline: none;
    white-space: nowrap;
}

.nav-mega-trigger:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 0;
}

/* Active/hover trigger: bright white on the dark header, never dimmed */
.nav-mega-trigger:hover,
.nav-mega-trigger.active,
.nav-mega:hover .nav-mega-trigger,
.nav-mega.open .nav-mega-trigger,
.nav-mega-trigger[aria-expanded="true"] {
    color: #ffffff;
    font-weight: 700;
}

/* Ensure the dark header theme does not override back to a dim color */
.main-header.over-dark .nav-mega-trigger:hover,
.main-header.over-dark .nav-mega-trigger.active,
.main-header.over-dark .nav-mega:hover .nav-mega-trigger,
.main-header.over-dark .nav-mega.open .nav-mega-trigger,
.main-header.over-dark .nav-mega-trigger[aria-expanded="true"] {
    color: #ffffff;
}

/* Chevron */
.nav-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-mega:hover .nav-chevron,
.nav-mega.open .nav-chevron,
.nav-mega-trigger[aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

/* ── Mega dropdown panel ──────────────────────────────────────────────────── */

/*
   Use fixed positioning so the panel breaks out of any overflow:hidden parent.
   The panel is centred on the viewport. box-sizing: border-box ensures
   proper bounding box sizing.
*/
.mega-dropdown {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: 0;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.13), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 24px;
    overflow: hidden;
    white-space: normal;
    /* Locked uniform dimensions across all dropdown menus */
    width: min(880px, 92vw);
    height: 390px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 270px;
    gap: 0 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.17s ease, visibility 0.17s;
    z-index: 1200;
}

/* Invisible hover bridge spanning from top: -28px to 0 across the full width */
.mega-dropdown::before {
    content: '';
    position: absolute;
    top: -28px;
    left: 0;
    right: 0;
    width: 100%;
    height: 28px;
}

.nav-mega:hover .mega-dropdown,
.nav-mega.open .mega-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Column section label ─────────────────────────────────────────────────── */

.mega-col-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ba3af;
    margin: 0 0 10px 0;
    padding-left: 4px;
    white-space: normal;
}

/* ── Mega link items ──────────────────────────────────────────────────────── */

.mega-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mega-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 0;
    text-decoration: none;
    transition: background 0.13s ease;
    min-width: 0;
    white-space: normal;
}

.mega-item:hover {
    background: #f5f8f6;
}

.mega-item:hover .mega-item-title {
    color: var(--primary-color);
}

/* Icon container */
.mega-item-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 0;
    background: #f0f7f4;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    transition: background 0.13s ease;
}

.mega-item:hover .mega-item-icon {
    background: #d6ede5;
}

/* Text group */
.mega-item-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
    white-space: normal;
}

.mega-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    transition: color 0.12s;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
    flex-wrap: wrap;
    white-space: normal;
}

/* "New" badge */
.mega-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #dcfce7;
    color: #15803d;
    border-radius: 0;
    padding: 2px 6px;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

.mega-item-desc {
    font-size: 0.775rem;
    color: #6b7280;
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ── Spotlight / sidebar card (rightmost column) ──────────────────────────── */

.mega-sidebar {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 100%;
    background: #f0f7f4;
    border-radius: 0;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mega-sidebar-img {
    width: 100%;
    height: 105px;
    object-fit: cover;
    border-radius: 0;
    margin-bottom: 2px;
    flex-shrink: 0;
    display: block;
}

.mega-sidebar-eyebrow {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #15803d;
    white-space: normal;
    display: block;
    flex-shrink: 0;
}

.mega-sidebar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.35;
    margin: 0;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-overflow: clip;
    flex-shrink: 0;
}

.mega-sidebar-desc {
    font-size: 0.775rem;
    color: #374151;
    line-height: 1.5;
    flex: 1;
    margin: 0;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-overflow: clip;
}

/* Action link: high contrast dark emerald (#065f46), aligned at bottom */
.mega-sidebar-link,
.main-header .nav-links a.mega-sidebar-link,
.main-header.over-dark .nav-links a.mega-sidebar-link,
.main-header.over-light .nav-links a.mega-sidebar-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600 !important;
    color: #065f46 !important;
    opacity: 1 !important;
    text-decoration: none;
    transition: color 0.14s, gap 0.14s ease;
    flex-shrink: 0;
    white-space: normal;
    margin-top: auto;
    padding-top: 6px;
}

.mega-sidebar-link:hover,
.main-header .nav-links a.mega-sidebar-link:hover,
.main-header.over-dark .nav-links a.mega-sidebar-link:hover,
.main-header.over-light .nav-links a.mega-sidebar-link:hover {
    color: #044e3a !important;
    gap: 9px;
}

.mega-sidebar-link svg path {
    stroke: #065f46 !important;
}

.mega-sidebar-link:hover svg path {
    stroke: #044e3a !important;
}

/* ── Learn dropdown: uniform width, height, and spotlight proportions ─────── */

.mega-dropdown.mega-learn {
    height: 390px;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 0 40px;
}

.mega-dropdown.mega-learn .mega-links {
    gap: 12px;
}

.mega-dropdown.mega-learn .mega-item {
    padding: 14px 14px;
    gap: 14px;
}

.mega-dropdown.mega-learn .mega-item-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 20px;
}

.mega-dropdown.mega-learn .mega-item-title {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.mega-dropdown.mega-learn .mega-item-desc {
    font-size: 0.825rem;
    line-height: 1.5;
}

/* ── Responsive: hide desktop mega on mobile ──────────────────────────────── */

@media (max-width: 1024px) {
    .mega-dropdown {
        display: none !important;
    }

    .nav-mega-trigger {
        display: none !important;
    }
}

/* ==========================================================================
   Mobile drill-down navigation
   ========================================================================== */

/* Full-screen overlay */
.mobile-nav-new {
    position: fixed;
    top: 72px;
    left: 0;
    width: 100%;
    height: calc(100vh - 72px);
    background: #fff;
    z-index: 1100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.22s ease, visibility 0.22s, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-new.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Slide track: 3 panels side by side. Track is 300% wide so each
   panel is calc(100%/3) = exactly one viewport width. JS slides by
   multiples of 33.333% to show the correct panel. */
.mobile-nav-track {
    display: flex;
    flex-wrap: nowrap;
    width: 300%;
    flex: 1;
    min-height: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* Each panel = 1/3 of track width = 100vw */
.mobile-nav-panel {
    width: calc(100% / 3);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 8px 0 32px;
}

/* Back button */
.mobile-nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px 12px;
    background: none;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    text-align: left;
    margin-bottom: 8px;
}

.mobile-nav-back svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Top-level items */
.mobile-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 24px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.1s;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    background: #f9fafb;
}

.mobile-nav-item-chevron {
    color: #9ca3af;
    flex-shrink: 0;
}

/* Sub-panel section label */
.mobile-sub-heading {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ba3af;
    padding: 10px 24px 6px;
    margin-top: 8px;
}

/* Sub-panel links */
.mobile-sub-item {
    display: block;
    padding: 14px 24px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    transition: color 0.12s, background 0.1s;
}

.mobile-sub-item:hover {
    color: var(--primary-color);
    background: #f5f8f6;
}

/* CTA row pinned to the bottom of the root panel */
.mobile-nav-cta {
    padding: 20px 24px 0;
    margin-top: auto;
    border-top: 1px solid #f3f4f6;
}

.mobile-nav-cta .btn {
    width: 100%;
    justify-content: center;
    border-radius: 8px;
}

/* ── Hide mobile nav on desktop ───────────────────────────────────────────── */

@media (min-width: 1025px) {
    .mobile-nav-new,
    .mobile-nav-track,
    .mobile-nav-panel {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
}
