/* JoS QUANTUM — header nav dropdowns.
   Loaded last on every page so it wins over the per-page header rules. */

.header {
    position: relative;
    z-index: 50;
}

.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ---- Trigger: a <button> styled to match .header .links a.nav-link ---- */
.header .links .nav-dropdown__toggle {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: 0;
    margin: 0;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    color: var(--jos-white);
    font-family: var(--jos-font-body);
    font-weight: 600;
    font-size: 12px;
    line-height: inherit;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity var(--jos-transition);
}
.header .links .nav-dropdown__toggle:hover {
    opacity: 0.65;
}
.header .links .nav-dropdown__toggle:focus-visible {
    outline: 1px solid var(--jos-white);
    outline-offset: 4px;
}
.header .links .nav-dropdown__toggle--active {
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1.5px;
}

/* ---- Chevron, drawn in CSS so no icon font is required ---- */
.nav-dropdown__chevron {
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform var(--jos-transition);
}
.nav-dropdown:hover .nav-dropdown__chevron,
.nav-dropdown.is-open .nav-dropdown__chevron {
    transform: translateY(1px) rotate(-135deg);
}

/* ---- Panel ---- */
.nav-dropdown__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: -18px;
    right: auto;
    z-index: 60;
    width: 232px;
    max-width: calc(100vw - 40px);
    margin-top: 16px;
    padding: 8px 0;
    background-color: var(--jos-charcoal);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--jos-radius-sm);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

/* No-JS / no-script fallback: hover and keyboard focus open the panel. */
.nav-dropdown:hover > .nav-dropdown__menu,
.nav-dropdown:focus-within > .nav-dropdown__menu {
    display: block;
}

/* With JS present the open state is explicit; these rules come last so they
   override the fallback above at equal specificity. */
.nav--js .nav-dropdown > .nav-dropdown__menu {
    display: none;
}
.nav--js .nav-dropdown.is-open > .nav-dropdown__menu {
    display: block;
}

/* ---- Panel items ---- */
.header .links .nav-dropdown__item {
    display: block;
    width: 100%;
    padding: 9px 18px;
    color: var(--jos-white);
    font-family: var(--jos-font-body);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.03em;
    line-height: 1.4;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--jos-transition);
}
.header .links .nav-dropdown__item:hover,
.header .links .nav-dropdown__item:focus-visible {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
    outline: none;
}
.header .links .nav-dropdown__item--active {
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: inset 2px 0 0 var(--jos-white);
}
.nav-dropdown__ext {
    margin-left: 4px;
    font-size: 11px;
    color: var(--jos-slate);
}

@media (max-width: 1024px) {
    .header .links .nav-dropdown__toggle { font-size: 11px; }
}

/* Below this width the logo and the nav no longer fit on one line. */
@media (max-width: 760px) {
    .header { flex-wrap: wrap; row-gap: 12px; }
    .header .links { flex-wrap: wrap; justify-content: flex-end; gap: 16px; row-gap: 10px; }
    /* The nav is on its own line (often two), so a panel hung off the trigger
       would cover the row beneath it and could run past the right edge. Drop it
       below the whole header instead: position: static hands the panel's
       containing block to .header. */
    .nav-dropdown { position: static; }
    .nav-dropdown__menu {
        top: 100%;
        left: auto;
        right: 20px;
        margin-top: 0;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }
}
