/* ==========================================================================
   Legal500 Masthead — collapsible panel, triggered from the LB site-header
   ========================================================================== */

/* ---- Reset / Scope ---- */
.legal500-masthead,
.legal500-masthead *,
.legal500-masthead *::before,
.legal500-masthead *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ---- Outer wrapper — collapses to zero once JS moves the nav out ---- */
.legal500-masthead {
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Collapsible panel ---- */
.legal500-masthead__nav {
    max-height: 0;
    overflow: hidden;
    background: #ffffff;
    border-bottom: 2px solid #001e41;
    box-shadow: 0 4px 12px rgba(0, 30, 65, 0.1);
    transition: max-height 0.4s ease;
    position: relative;
    z-index: 999;
}

.legal500-masthead__nav[aria-hidden="false"] {
    max-height: 600px;
}

.legal500-masthead__nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* ---- Panel header: logo + search ---- */
.legal500-masthead__panel-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-bottom: 16px;
}

.legal500-masthead__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.legal500-masthead__logo:hover,
.legal500-masthead__logo:focus {
    opacity: 0.75;
}

.legal500-masthead__logo-svg {
    display: block;
    width: 170px;
    height: 37px;
}

/* ---- Search (light panel) ---- */
.legal500-masthead__search {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    max-width: 380px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s ease;
}

.legal500-masthead__search:focus-within {
    border-color: #001e41;
}

.legal500-masthead__search-input {
    flex: 1 1 auto;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    background: transparent !important;
    color: #1f2937;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.legal500-masthead__search-input::placeholder {
    color: #9ca3af;
}

.legal500-masthead__search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.15s ease;
}

.legal500-masthead__search-btn:hover,
.legal500-masthead__search-btn:focus {
    color: #001e41;
}

/* ---- Divider ---- */
.legal500-masthead__divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0 0 20px;
}

/* ==========================================================================
   Navigation menu — 6-column grid
   Columns 1–5 : top-level <li> items with sub-menus
   Column 6    : a single wrapper <li> containing a flex-column <ul> of
                 standalone links — keeps them flush from the top with no
                 row-height gaps inherited from the taller columns 1–5.
   ========================================================================== */

.legal500-masthead__menu {
    display: grid;
    grid-template-columns: repeat(5, 1fr) 180px;
    column-gap: 32px;
    align-items: start;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Columns 1–5 */
.legal500-masthead__menu > li:nth-child(1) { grid-column: 1; }
.legal500-masthead__menu > li:nth-child(2) { grid-column: 2; }
.legal500-masthead__menu > li:nth-child(3) { grid-column: 3; }
.legal500-masthead__menu > li:nth-child(4) { grid-column: 4; }
.legal500-masthead__menu > li:nth-child(5) { grid-column: 5; }

/* Column 6 wrapper — single grid cell, aligned to the top */
.legal500-masthead__menu > li.legal500-masthead__col6-wrapper {
    grid-column: 6;
    grid-row: 1;
    align-self: start;
    border-left: 1px solid #e5e7eb;
    padding-left: 24px;
    margin-left: -8px; /* aligns the border with the column gap */
}

/* ---- Section headings (columns 1–5 top-level links) ---- */
.legal500-masthead__menu > li > a {
    display: block;
    padding: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #001e41;
    text-decoration: none;
    border-bottom: 2px solid #001e41;
    margin-bottom: 10px;
    white-space: nowrap;
}

.legal500-masthead__menu > li > a:hover,
.legal500-masthead__menu > li > a:focus {
    color: #1a56a0;
    border-bottom-color: #1a56a0;
}

/* ---- Sub-menu — flush under heading, no indentation ---- */
.legal500-masthead__menu .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.legal500-masthead__menu .sub-menu li {
    padding: 0;
    margin: 0;
}

.legal500-masthead__menu .sub-menu a {
    display: block;
    padding: 5px 0;
    font-size: 13px;
    font-weight: 400;
    color: #374151;
    text-decoration: none;
    border-radius: 0;
    white-space: normal;
}

.legal500-masthead__menu .sub-menu a:hover,
.legal500-masthead__menu .sub-menu a:focus {
    color: #001e41;
    text-decoration: underline;
    background: transparent;
}

/* ==========================================================================
   Column 6 — standalone links (Comparative Guides, Events, Legal 500 TV,
   Deutschland, Paris) rendered as a flex-column <ul> inside the wrapper <li>
   ========================================================================== */

.legal500-masthead__col6 {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Each standalone link — bold uppercase, no decorative underline */
.legal500-masthead__col6 > li > a {
    display: block;
    padding: 5px 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #001e41;
    text-decoration: none;
    white-space: nowrap;
}

.legal500-masthead__col6 > li > a:hover,
.legal500-masthead__col6 > li > a:focus {
    color: #1a56a0;
    text-decoration: underline;
}

/* Search form at the top of column 6 */
.legal500-masthead__col6-search {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
    transition: border-color 0.15s ease;
}

.legal500-masthead__col6-search:focus-within {
    border-color: #001e41;
}

.legal500-masthead__col6-search .legal500-masthead__search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 8px;
    border: 0;
    background: transparent !important;
    color: #1f2937;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.legal500-masthead__col6-search .legal500-masthead__search-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.legal500-masthead__col6-search .legal500-masthead__search-btn:hover,
.legal500-masthead__col6-search .legal500-masthead__search-btn:focus {
    color: #001e41;
}

/* ---- Locale edition badges (Deutschland, Paris) ---- */
.legal500-masthead__col6 > li.locale-de > a::after,
.legal500-masthead__col6 > li.locale-fr > a::after {
    display: inline-block;
    background: #374151;
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.legal500-masthead__col6 > li.locale-de > a::after { content: 'DE'; }
.legal500-masthead__col6 > li.locale-fr > a::after { content: 'FR'; }

/* ==========================================================================
   Legal 500 toggle button — L mark + label + arrow in the LB site-header
   ========================================================================== */

.legal500-toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.legal500-toggle-mark {
    display: block;
    flex-shrink: 0;
}

.legal500-toggle-arrow {
    display: inline-block;
    font-size: 10px;
    line-height: 1;
    margin-left: 4px;
    transition: transform 0.25s ease;
    vertical-align: middle;
}

[data-legal500-toggle][aria-expanded="true"] .legal500-toggle-arrow {
    transform: rotate(180deg);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    .legal500-masthead__menu {
        grid-template-columns: repeat(5, 1fr) 160px;
        column-gap: 20px;
    }
}

@media (max-width: 900px) {
    .legal500-masthead__nav[aria-hidden="false"] {
        max-height: 1200px;
    }

    .legal500-masthead__menu {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 20px;
    }

    .legal500-masthead__menu > li:nth-child(1) { grid-column: 1; grid-row: 1; }
    .legal500-masthead__menu > li:nth-child(2) { grid-column: 2; grid-row: 1; }
    .legal500-masthead__menu > li:nth-child(3) { grid-column: 1; grid-row: 2; }
    .legal500-masthead__menu > li:nth-child(4) { grid-column: 2; grid-row: 2; }
    .legal500-masthead__menu > li:nth-child(5) { grid-column: 1; grid-row: 3; }

    .legal500-masthead__menu > li.legal500-masthead__col6-wrapper {
        grid-column: 2;
        grid-row: 3;
        border-left: none;
        padding-left: 0;
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .legal500-masthead__panel-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .legal500-masthead__logo-svg {
        width: 140px;
        height: 30px;
    }

    .legal500-masthead__search {
        flex-basis: 100%;
        max-width: none;
    }

    .legal500-masthead__menu {
        grid-template-columns: 1fr;
        row-gap: 16px;
    }

    .legal500-masthead__menu > li:nth-child(n) {
        grid-column: 1;
        grid-row: auto;
    }

    .legal500-masthead__menu > li.legal500-masthead__col6-wrapper {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
    }
}

/* ---- Screen-reader text ---- */
.legal500-masthead .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
