/* Faculty desktop navigation. Mobile navigation and project headers are separate. */

/* Submenus stay closed at every width even before jQuery adds .stellarnav/.desktop/.km-ready.
   Outside the media query on purpose: without it the whole menu tree renders expanded until
   DOM ready. jQuery show()/hide() writes inline styles, which still win over this. */
#header .menu nav ul ul { display: none; }

@media (min-width: 1001px) {
    #header { padding: 16px 0; background: #ffffffed; border-bottom: 1px solid #e8eef4; }
    #header > .content-size { width: calc(100% - 64px); max-width: 1440px; padding: 0; }
    #header .simple-tbl { display: flex; align-items: center; gap: 22px; }
    #header .simple-tbl > .logo { display: block; flex: 0 0 104px; width: auto; }
    #header .logo img { display: block; width: 94px; height: auto; }
    #header .simple-tbl > .menu { display: block; flex: 1; min-width: 0; }
    #header .simple-tbl > .search.desktop { display: block; flex: 0 0 44px; width: 44px; }
    #header .search.desktop > a { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #dfe8f0; border-radius: 50%; font-size: 18px; color: #094e96; background: #f8fafc; }
    #header .search.desktop > a:hover { background: #eaf2fa; border-color: #b5ccdf; }
    #header .stellarnav > ul { display: flex !important; align-items: center; justify-content: space-between; gap: 3px; }
    #header .stellarnav li.has-sub { margin-right: 0; }
    #header .stellarnav > ul > li { flex-shrink: 0; }
    #header .stellarnav li > a:not(.dd-toggle) {
        color: #20394f; font-weight: 500; font-size: 16px; line-height: 1.4;
        transition: color .15s, background-color .15s, box-shadow .15s;
    }
    #header .stellarnav > ul > li > a:not(.dd-toggle) {
        display: flex; align-items: center; gap: 9px; padding: 12px 11px;
        border-radius: 9px; white-space: nowrap; font-size: clamp(13px, 1.15vw, 16px); font-weight: 600;
    }
    #header .stellarnav > ul > li > a:has(.fa-home) { padding: 12px; font-size: 19px; }
    #header .stellarnav > ul > li.lang-item > a { min-width: 42px; justify-content: center; border: 1px solid #e4ebf2; margin-left: 5px; }
    #header .stellarnav li > a:focus-visible { outline: 2px solid #4490bf; outline-offset: 2px; }
    #header .stellarnav li:hover > a:not(.dd-toggle),
    #header .stellarnav li > a:focus-visible { background: #edf4fb; color: #094e96; }
    #header .stellarnav > ul > li.current-menu-ancestor > a,
    #header .stellarnav > ul > li.current-menu-item > a { color: #094e96; background: #f0f5fa; box-shadow: inset 0 -2px #4490bf; }

    /* Replace the old filled triangles with fine chevrons. */
    #header .stellarnav li.has-sub > a:not(.dd-toggle)::before { content: none; }
    #header .stellarnav li.has-sub > a:not(.dd-toggle)::after {
        content: ''; display: block; position: static; float: none; flex-shrink: 0;
        width: 5px; height: 5px; margin: -3px 0 0; border: solid currentColor;
        border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: .65;
    }
    #header .stellarnav ul ul li.has-sub > a:not(.dd-toggle)::after {
        position: absolute; top: 50%; right: 15px; margin: -3px 0 0;
        transform: rotate(-45deg);
    }
    #header .stellarnav ul ul li.kd-left > a:not(.dd-toggle)::after { transform: rotate(135deg); }

    #header .stellarnav ul ul {
        box-sizing: border-box; width: 300px; padding: 10px; margin: 0;
        border: 1px solid #dde7f0; border-radius: 15px; background: #fff;
        box-shadow: 0 18px 48px -12px #12395a30, 0 3px 10px #12395a08;
        z-index: 100; text-align: left;
    }
    #header .stellarnav > ul > li > ul { top: calc(100% + 12px); left: var(--kd-offset, 0px); right: auto; }
    #header .stellarnav ul ul::before { content: ''; position: absolute; top: -13px; left: 0; width: 100%; height: 13px; }
    #header .stellarnav ul ul > li { margin: 0; break-inside: avoid; }
    #header .stellarnav ul ul > li + li { margin-top: 2px; }
    #header .stellarnav ul ul li > a:not(.dd-toggle) {
        position: relative; display: block; padding: 11px 32px 11px 14px;
        min-height: 44px; border-radius: 8px; font-size: 16px; font-weight: 500; overflow-wrap: break-word;
    }
    #header .stellarnav ul ul li.current-menu-item > a:not(.dd-toggle) {
        color: #094e96; background: #edf4fb; box-shadow: inset 3px 0 #4490bf; font-weight: 600;
    }
    #header .stellarnav ul ul ul { left: calc(100% + 10px); right: auto; top: -11px; }
    #header .stellarnav ul ul li:hover > ul { top: -11px; }
    #header .stellarnav ul ul ul::before { top: 0; left: -12px; width: 12px; height: 100%; }
    #header .stellarnav ul ul li.kd-left > ul { left: auto; right: calc(100% + 10px); }
    #header .stellarnav ul ul li.kd-left > ul::before { left: auto; right: -12px; }
    #header .stellarnav > ul > li > ul.kd-wide { width: 580px; columns: 2; column-gap: 16px; column-rule: 1px solid #edf1f5; padding: 14px; }
}
@media (min-width: 1001px) and (max-width: 1200px) {
    #header > .content-size { width: calc(100% - 40px); }
    #header .simple-tbl { gap: 12px; }
    #header .simple-tbl > .logo { flex-basis: 76px; }
    #header .logo img { width: 72px; }
    #header .stellarnav > ul { gap: 0; }
    #header .stellarnav > ul > li > a:not(.dd-toggle) { padding-inline: 6px; gap: 6px; font-size: 13px; }
    #header .stellarnav > ul > li.lang-item > a { min-width: 30px; margin-left: 2px; }
}
@media (prefers-reduced-motion: reduce) { #header .stellarnav li > a { transition: none; } }

/* Desktop search shares the navigation palette and card treatment. */
.ks-panel[hidden] { display: none !important; }
.ks-trigger, .ks-panel button { font-family: inherit; cursor: pointer; }
.ks-trigger { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #dfe8f0; border-radius: 50%; color: #094e96; background: #f8fafc; transition: background .15s, border-color .15s; }
.ks-trigger:hover, .ks-trigger[aria-expanded=true] { color: white; background: #094e96; border-color: #094e96; }
.ks-trigger:focus-visible, .ks-panel button:focus-visible { outline: 2px solid #4490bf; outline-offset: 3px; }
.ks-panel, .ks-panel * { box-sizing: border-box; }
.ks-panel {
    position: absolute; top: calc(100% + 20px); right: 0; z-index: 11000;
    width: min(620px, calc(100vw - 48px)); margin: 0; padding: 32px;
    color: #20394f; background: #fff; border: 1px solid #dce6ef; border-radius: 20px;
    box-shadow: 0 24px 70px -20px #12395a40, 0 4px 14px #12395a08;
}
.ks-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.ks-eyebrow { display: block; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #094e96; }
#header .ks-panel h2 { margin: 9px 0 0; padding: 0; font-size: 32px; line-height: 1.2; font-weight: 500; letter-spacing: -.02em; color: #18364f; }
.ks-close { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; flex-shrink: 0; border: 1px solid #e1e9f0; border-radius: 50%; color: #647b8e; background: #f8fafc; }
.ks-close:hover { background: #eaf2fa; color: #094e96; }
.ks-description { margin: 15px 0 25px; color: #60758a; font-size: 16px; line-height: 1.5; }
.ks-field { display: flex; align-items: center; gap: 12px; padding: 7px 7px 7px 18px; border: 1px solid #ccdce9; border-radius: 13px; background: #f5f8fb; transition: border-color .15s, box-shadow .15s; }
.ks-field:focus-within { border-color: #4490bf; box-shadow: 0 0 0 3px #4490bf1a; background: #fff; }
.ks-field > svg { flex-shrink: 0; color: #708ba1; }
#header .ks-field input { min-width: 0; width: 100%; padding: 9px 0; border: 0; outline: none; box-shadow: none; background: transparent; font: inherit; font-size: 18px; line-height: 1.5; color: #18364f; }
.ks-field input::placeholder { color: #7d8f9e; opacity: 1; }
.ks-submit { display: inline-flex; align-items: center; justify-content: center; gap: 15px; flex-shrink: 0; min-height: 48px; padding: 0 19px; border: 0; border-radius: 9px; background: #094e96; color: #fff; font-size: 16px; font-weight: 500; }
.ks-submit:hover { background: #073d77; }
.ks-hints { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; color: #748696; font-size: 12px; }
.ks-hints > span { display: inline-flex; align-items: center; gap: 7px; }
.ks-hints kbd { padding: 2px 5px; border: 1px solid #e0e7ed; border-radius: 4px; font-family: inherit; font-size: 11px; color: #50697d; background: #f8fafc; }
.ks-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 1001px) { #header .search.desktop { position: relative; } }
@media (max-width: 1000px) { .ks-panel { display: none; } }
@media (prefers-reduced-motion: reduce) { .ks-panel { animation: none; } .ks-field, .ks-trigger { transition: none; } }
