#masthead {
    top: 0;
    z-index: 10;
}

.header-nav {
    font-family: var(--font-primary) !important;
}

/* If menu is on the left and CTA on the right: left: -24px aligns the nav (and its Max Mega Menu dropdowns) flush with .container-xl's true left edge. */
.header-inner > *:first-child {
    position: absolute;
    left: -24px;
}

.header-inner > *:last-child {
    position: absolute;
    right: 4px;
}

.header-inner {
    height: 56px;
    padding: 4px;
    justify-content: center;
}

.header-inner .header-nav .collapse-item:focus {
    outline: none;
}

.header-inner .header-nav .dropdown-items {
    margin-left: -24px;
    margin-top: 16px;
    width: 407px;
    padding: 24px 40px 24px 24px;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
}

.header-inner .header-nav .dropdown-items a +a {
    margin-top: 12px;
}

.header-inner .header-cta {
    border-radius: 2px;
}

.header-cta .btn {
    padding: 12px 32px;
}

/* ── Unified desktop header layout (EN and ES) ──────────────────────────── */

/* Container-xl: replicates Bootstrap behaviour in case CDN fails to load; constrains each header row's content only, not its full-width background. */
#masthead .container-xl {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (min-width: 1400px) {
    #masthead .container-xl {
        max-width: 1320px;
    }
}

/* Header height: 80px per production design */
.header-inner {
    height: 80px;
}

/* CTA button: fills the full height of header-inner, flush to the edge */
.header-inner > *:last-child {
    top: 0;
    bottom: 0;
    right: 0;      /* override right: 4px from base CSS */
    height: auto;  /* top + bottom determine the height */
}

/* CTA: relative positioning for the teal background pseudo-element */
.header-inner .header-cta {
    position: relative;
    z-index: 1;
}

/* CTA teal background that extends the button to the viewport edge */
.header-inner .header-cta::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    right: 0 !important;
    background: var(--bs-secondary-500);
    z-index: -1;
}

@media (min-width: 992px) {
    .header-inner .header-cta::after {
        left: 0;
        right: 0;
    }
}

/* header-cta stretches on its own (global-en stays centered) */
.header-cta {
    align-self: stretch;
    display: flex !important;
    align-items: stretch;
    border-radius: 0 !important;
}

.header-cta > a.btn {
    height: 100%;
    border-radius: 0;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Mega menu arrows: vertical indicator adjustment only */
.mega-menu-item > a.mega-menu-link .mega-indicator {
    vertical-align: middle;
    display: inline-block;
    line-height: 1;
    margin-top: -2px;
}

#mega-menu-wrap-main_header #mega-menu-main_header li.mega-menu-item-has-children > a.mega-menu-link > span.mega-indicator {
    content: "";
    font-family: dashicons;
    font-weight: normal;
    display: inline-block;
    margin: 0;
    vertical-align: top;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transform: rotate(0);
    color: inherit;
    position: relative;
    background: transparent;
    height: auto;
    width: auto;
    right: auto;
    line-height: inherit;
}

/* Mega menu color scheme, applied identically to EN and ES: the plugin's own generated stylesheet (wp-content/uploads/maxmegamenu/) is gitignored and gets silently regenerated, so these overrides keep the intended colors durable and versioned. */

/* Top-level nav items: font-weight is forced constant here too, since the plugin's Menu Theme renders the active page's item at a lighter weight by default. */
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-item > a.mega-menu-link,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-item > a.mega-menu-link {
    color: var(--bs-black) !important;
    font-weight: 500 !important;
}

#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-item > a.mega-menu-link:active,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-item > a.mega-menu-link:active {
    color: var(--bs-main-700) !important;
    font-weight: 500 !important;
}

/* "Second level" subitems: category headers in the Practice Areas grid dropdown plus the flyout dropdowns' direct items (same hierarchy, one DOM level shallower), forced to the same black/teal behavior and 16px size as the top-level items. */
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link,
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-flyout > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-flyout > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link {
    color: var(--bs-black) !important;
    font-size: 16px !important;
}

#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:active,
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-flyout > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-flyout > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:active,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:active,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-flyout > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-flyout > ul.mega-sub-menu > li.mega-menu-item > a.mega-menu-link:active {
    color: var(--bs-main-700) !important;
}

/* "Third level" leaf subitems, nested one level deeper than the featured column-header items above. */
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item li.mega-menu-item > a.mega-menu-link,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item li.mega-menu-item > a.mega-menu-link {
    color: var(--bs-darkness) !important;
}

/* Same leaf subitems, on hover — EN's plugin Menu Theme sets hover color equal to the normal color, so this guarantees visible feedback on both languages. */
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item li.mega-menu-item > a.mega-menu-link:hover,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-megamenu > ul.mega-sub-menu li.mega-menu-column > ul.mega-sub-menu > li.mega-menu-item li.mega-menu-item > a.mega-menu-link:hover {
    color: var(--bs-black) !important;
}

/* Scoped to the outermost flyout only — a plain `.mega-sub-menu` selector also matches nested levels and margin-top would stack; ES needs 29px instead of EN's 20px since it has an extra topbar row above its nav. */
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-item > ul.mega-sub-menu {
    margin-top: 20px !important;
}

#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-item > ul.mega-sub-menu {
    margin-top: 29px !important;
}

/* Only the "Practice Areas" grid-type dropdown needs a taller fixed height to fit its 8 items; the simple flyout dropdowns have far fewer items and keep their own auto-fitted height. */
#mega-menu-wrap-main_header #mega-menu-main_header > li.mega-menu-megamenu > ul.mega-sub-menu,
#mega-menu-wrap-menu-1 #mega-menu-menu-1 > li.mega-menu-megamenu > ul.mega-sub-menu {
    height: 310px !important;
}

/* Reset the nested .mega-sub-menu levels back to 0 — they must not inherit the 20px meant only for the outermost flyout's alignment against the nav. */
#mega-menu-wrap-main_header .mega-sub-menu .mega-sub-menu,
#mega-menu-wrap-menu-1 .mega-sub-menu .mega-sub-menu {
    margin-top: 0 !important;
}

/* The banner's default 300px height fell short of the 8 practice-area items, misaligning their bottoms — raise both to the same taller height so they end at the same point. */
#mega-menu-wrap-main_header .mega-acf-banner,
#mega-menu-wrap-menu-1 .mega-acf-banner {
    height: 310px !important;
}

/* Neutral scrollbar for the mega menu's scrollable sub-menu columns: scrollbar-color covers Firefox/standard, the ::-webkit- rules cover Chrome/Safari (which also need an explicit width or the thumb rules are ignored). */
#mega-menu-wrap-main_header .mega-sub-menu,
#mega-menu-wrap-menu-1 .mega-sub-menu {
    scrollbar-width: thin;
    scrollbar-color: var(--bs-dark) var(--bs-lighter);
}

#mega-menu-wrap-main_header .mega-sub-menu::-webkit-scrollbar,
#mega-menu-wrap-menu-1 .mega-sub-menu::-webkit-scrollbar {
    width: 0.25rem;
}

#mega-menu-wrap-main_header .mega-sub-menu::-webkit-scrollbar-track,
#mega-menu-wrap-menu-1 .mega-sub-menu::-webkit-scrollbar-track {
    background: var(--bs-lighter);
    border-radius: 0;
}

#mega-menu-wrap-main_header .mega-sub-menu::-webkit-scrollbar-thumb,
#mega-menu-wrap-menu-1 .mega-sub-menu::-webkit-scrollbar-thumb {
    background: var(--bs-dark);
    border-radius: 0;
}

.header-en-banner {
    padding: 6px 0;
    font-size: 18px;
    font-style: italic;
    font-weight: 600;
    line-height: 20px;
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-skip-ink: auto;
    text-decoration-thickness: 10%;
    text-underline-offset: auto;
    text-underline-position: from-font;
    color: var(--bs-black) !important;
}

/* Overrides a border-radius rule injected via ACF Options "Custom CSS" (wp_head priority 1000, not in version control) — this compound selector is more specific and beats it regardless of injection order. */
.header-en-banner.en-banner-link {
    /* Distinct from .bg-main-500 so this banner doesn't blend in with the page below it. */
    background-color: var(--bs-main-700) !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.header-en-banner a {
    color: var(--bs-black);
}

.collapsing {
  transition: height 0.9s ease-in-out !important;
  overflow: hidden;
}

.dropdown-items.collapse.show {
  transition: height 0.9s ease-in-out !important;
}

.header-phone-text {
    position: relative;
    display: inline-block;
    overflow: hidden;
    line-height: 1.2;
}

.header-phone-text span {
    display: block;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.header-phone-text span:last-child {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
}

.btn:hover .header-phone-text span:first-child {
    transform: translateY(-100%);
}

.btn:hover .header-phone-text span:last-child {
    transform: translateY(-100%);
}

li.mega-menu-item > a.mega-menu-link:active,
li.mega-menu-item > a.mega-menu-link:focus {
    color: var(--bs-black) !important;
}

.global-en .global-link:visited {
    color: var(--bs-secondary-500);
}

.global-en .global-link {
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    color: var(--bs-secondary-500);
}

.global-en .global-link svg {
    width: 20px;
    height: 20px;
}

.global-en .global-link:hover {
    color: var(--bs-main-500)
}

.global-en .lang-label {
    font-size: 18px;
    line-height: 20px;
}


@media screen and (max-width: 1400px) and (min-width: 992px) {
    .menu-wrapper {
        gap: 8px !important;
    }

    .hero-title {
        font-size: 64px !important;
        line-height: 72px !important;
    }

    .hero-character {
        width: 360px !important;
    }

    .hero-logos {
        gap: 4px !important;
    }

    .dropdown a {
        gap: 0 !important;
    }
}


.logo-desktop {
    /* Same fix as .logo-mobile in headermobile.css. */
    height: 45px;
    width: auto;
    max-width: 100%;
}

/* Topbar: top strip of the header-card, above the main nav row — shared by EN and ES, each populated from its own "Header Topbar" menu */
.header-topbar {
    background-color: var(--bs-white);
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.header-topbar-link {
    color: var(--bs-text-muted);
    text-decoration: none;
    font-weight: 600;
}

.header-topbar-link:hover {
    color: var(--bs-main-500);
}

.mobile-header-wrapper {
    z-index: 1050;
}

@media (max-width: 992px) {
    .header-en-banner {
        font-size: 15px;
    }
}
