/* ==========================================================================
   esgri-nav.css — the site header, our own                     (2026-10-02)
   ==========================================================================
   Replaces Phlox's Elementor header + Premium Addons' menu widget (Chase:
   "直接做个新的吧…"), then — "你完全复刻吧，现在还有很大差距" — set to the old
   bar's own numbers, read off the live old header the same afternoon:

     bar        120px, white, drop-shadow 0 8px 20px rgba(0,0,0,.18) on the
                whole thing (dropdowns included — it is a filter, not a box
                shadow); the menu row from y=30 to 96
     top item   Noto Sans 16/600 #14171F, 20px padding, FA angle-down;
                hover/current gold; a 1px line, the item's full width, 12px up
                from its foot, drawn left→right in .35s, ink then gold
     dropdown   flush under the item, 220px, white, 2.5px 0 2.5px 12.5px;
                rows 15.52px/400, 7px 10px, 12px apart; hover gold with a 1px
                line under the WORDS (4px below), same ink-then-gold draw;
                Research Fund opens a second 220px panel to its right
     phone      72px bar; burger FA bars 22px #494C4F; a 300px drawer from the
                LEFT, #F7F7F7, over a rgba(0,0,0,.6) scrim, with Phlox's
                circled close at its top right; items 16/600, 10px padding,
                16px apart, FA angle-down 14px at the right; children 12.42px;
                the page you are on gold with a 1px gold line under the words

   One deliberate difference: the logo file has its white margins cropped
   (esgri-logo-nav.webp), so the artwork starts on the page edge — the old one
   began 17px inside it, which is half of what Chase saw as "不齐".
   The row is var(--esgri-measure), the same box as every page's content.
   ========================================================================== */

/* the site measure, defined here as well as in esgri-chrome.css because
   /home-2/ loads this file but not that one */
html:root { --esgri-measure: max(72vw, min(1200px, calc(100vw - 70px))); }
@media (max-width: 720px) { html:root { --esgri-measure: calc(100vw - 32px); } }

/* the old header is gone everywhere this file loads */
#site-elementor-header,
.aux-elementor-header { display: none !important; }

.enav {
  --enav-ink: #14171F;
  --enav-gold: #B89642;
  /* 20px per side as the old bar; shrinks to 6 when the measure is narrow */
  --enav-pad: clamp(6px, calc((var(--esgri-measure, 1200px) - 827px) / 14), 20px);
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 120px;
  z-index: 1500;
  background: #fff;
  font-family: 'Noto Sans', sans-serif;
  color: var(--enav-ink);
  line-height: 1.5;
}
@media (min-width: 1025px) {
  /* the old bar's shadow: a filter, so the dropdowns cast it too. Desktop
     only — a filter makes the header the containing block of anything
     position:fixed inside it, which would trap the phone drawer in 72px. */
  .enav { filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .18)); }
}
body.admin-bar .enav { top: 32px; }
@media (max-width: 782px) { body.admin-bar .enav { top: 46px; } }

.enav *, .enav *::before, .enav *::after { box-sizing: border-box; }
.enav ul { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.enav li { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.enav a { text-decoration: none !important; }
.enav button {
  font: inherit; color: inherit; background: none !important; border: 0 !important;
  border-radius: 0 !important; padding: 0; margin: 0; cursor: pointer;
  box-shadow: none !important; text-transform: none !important; letter-spacing: inherit;
  -webkit-appearance: none; appearance: none; min-height: 0 !important; line-height: inherit;
}
.enav svg { display: block; flex: none; }

.enav__bar {
  width: var(--esgri-measure, min(1200px, calc(100% - 70px)));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-top: 30px;
}
/* ink of the old 260x52 logo began 7.4px below its box, which sat at y=31 */
.enav__logo { display: block; flex: none; line-height: 0; margin-top: 8.4px; }
.enav__logo img { display: block; width: 224px; height: 37px; max-width: none; }
.enav__logo .enav__logo-w { display: none; }

/* ---------- desktop ---------- */
.enav__nav { display: block; }
.enav__close { display: none; }
.enav__menu { display: flex; align-items: flex-start; }
.enav__item { position: relative; display: flex; align-items: center; height: 66px; }
.enav .enav__top {
  display: inline-flex; align-items: center;
  padding: 20px var(--enav-pad) !important;
  font-size: 16px; font-weight: 600; line-height: 24px;
  color: var(--enav-ink) !important;
  white-space: nowrap;
  transition: color .35s ease;
}
.enav .enav__top .enav__chev { width: 10px; height: 16px; margin: 1px 0 0 10px; }
/* a top item that is also a page (Insights, News, About): the words are the
   link and the chevron is its own button, together the old item's width */
.enav .enav__item--has-sub > a.enav__top { padding-right: 0 !important; }
.enav .enav__toggle--icon {
  display: inline-flex; align-items: center; height: 64px;
  padding: 0 var(--enav-pad) 0 10px !important; color: var(--enav-ink) !important;
  transition: color .35s ease;
}
.enav .enav__toggle--icon .enav__chev { width: 10px; height: 16px; margin-top: 1px; }

/* the line, on the item: full width, 12px up from the foot */
.enav__item::after {
  content: ""; position: absolute; left: 0; bottom: 12px;
  width: 0; height: 1px; background: var(--enav-ink);
  transition: width .35s ease, background-color .2s ease;
  pointer-events: none;
}
/* lit while the pointer is on the item itself, not while it is down in the
   dropdown — exactly as the old bar behaved */
.enav__item:has(> .enav__top:hover)::after, .enav__item:has(> .enav__toggle--icon:hover)::after,
.enav__item.is-open::after {
  width: 100%; background: var(--enav-gold);
  transition: width .35s ease, background-color .3s ease .35s;
}
/* no "you are here" on a desktop: the old bar had none (the phone drawer does) */
.enav__item:has(> .enav__top:hover) > .enav__top, .enav__item:has(> .enav__toggle--icon:hover) > .enav__top,
.enav__item.is-open > .enav__top,
.enav__item:has(> .enav__top:hover) > .enav__toggle--icon, .enav__item:has(> .enav__toggle--icon:hover) > .enav__toggle--icon,
.enav__item.is-open > .enav__toggle--icon { color: var(--enav-gold) !important; }

.enav__top:focus-visible, .enav__toggle:focus-visible, .enav__link:focus-visible,
.enav__flytoggle:focus-visible, .enav__logo:focus-visible, .enav__burger:focus-visible, .enav__close:focus-visible {
  outline: 2px solid var(--enav-gold); outline-offset: 2px;
}

.enav__sub {
  position: absolute; top: 100%; left: 0;
  width: 220px;
  background: #fff;
  padding: 2.5px 0 2.5px 12.5px;
  font-size: 15.52px;
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
  z-index: 2;
}
.enav__item.is-open > .enav__sub { opacity: 1; visibility: visible; transition: opacity .2s ease, visibility 0s; }
@media (hover: hover) and (min-width: 1025px) {
  .enav__item:hover > .enav__sub { opacity: 1; visibility: visible; transition: opacity .2s ease, visibility 0s; }
}
.enav__sub > ul > li { margin: 0 0 12.4px !important; }
.enav__sub > ul > li:first-child { margin-top: 0.5px !important; }

.enav .enav__link,
.enav .enav__flytoggle {
  display: flex; align-items: center;
  padding: 7px 10px !important;
  /* px, not em: the theme scales a link's font by .97, which put these at 15.05 */
  font-size: 15.52px !important; font-weight: 400; line-height: 1.25;
  color: var(--enav-ink) !important;
  text-align: left;
  transition: color .25s ease;
}
.enav .enav__link:hover, .enav .enav__flytoggle:hover, .enav .enav__fly:hover > .enav__flytoggle,
.enav .enav__fly.is-open > .enav__flytoggle { color: var(--enav-gold) !important; }
/* the line under the words */
.enav__sub .enav__txt { position: relative; display: inline-block; }
.enav__sub .enav__txt::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
  background: var(--enav-ink); transform: scaleX(0); transform-origin: left;
  transition: transform .35s ease, background-color .2s ease; pointer-events: none;
}
.enav__link:not(.enav__flytoggle):hover .enav__txt::after {
  transform: scaleX(1); background: var(--enav-gold);
  transition: transform .35s ease, background-color .3s ease .35s;
}
.enav .enav__flytoggle { padding-top: 10.5px !important; padding-bottom: 10.5px !important; }
.enav__chev--r { width: 8px; height: 15px; margin-left: 6px; }

/* Research › Research Fund › : the second panel, to the right of its row */
.enav__fly { position: relative; }
.enav__sub--fly { top: 0; left: auto; right: -220px; font-size: 15.06px; }
.enav__sub--fly .enav__link { font-size: 15.06px !important; }
.enav__sub--fly > ul > li:first-child { margin-top: 0 !important; }
.enav__fly.is-open > .enav__sub--fly { opacity: 1; visibility: visible; transition: opacity .2s ease, visibility 0s; }
@media (hover: hover) and (min-width: 1025px) {
  .enav__fly:hover > .enav__sub--fly { opacity: 1; visibility: visible; transition: opacity .2s ease, visibility 0s; }
}

.enav__burger { display: none; }

/* ---------- tablet and phone: the drawer ---------- */
@media (max-width: 1024px) {
  .enav__bar { align-items: center; padding-top: 0; }
  .enav__logo { margin-top: 0; }
  .enav .enav__burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-right: -7px !important; color: #494C4F;
  }
  .enav__burger svg { width: 19px; height: 22px; }

  .enav__nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 300px; max-width: 100%;
    background: #F7F7F7;
    padding: 60px 10px 10px;
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-100%); visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
    z-index: 2;
  }
  body.admin-bar .enav__nav { top: 46px; }
  html.enav-open .enav__nav { transform: none; visibility: visible; transition: transform .3s ease, visibility 0s; }
  html.enav-open, html.enav-open body { overflow: hidden; }
  .enav::before {                    /* the scrim */
    content: ""; position: fixed; inset: 0;
    background: rgba(0, 0, 0, .6); opacity: 0; visibility: hidden;
    transition: opacity .3s ease, visibility 0s linear .3s; z-index: 1;
  }
  html.enav-open .enav::before { opacity: 1; visibility: visible; transition: opacity .3s ease, visibility 0s; }

  .enav .enav__close {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; top: 18px; right: 5px; width: 44px; height: 44px; color: #494C4F;
  }
  .enav__close svg { width: 22px; height: 22px; }

  .enav__menu { display: block; }
  .enav .enav__item { display: flex; flex-wrap: wrap; align-items: center; height: auto; margin: 0 0 16px !important; }
  .enav__item::after { display: none; }
  .enav .enav__top { flex: 0 1 auto; padding: 10px !important; font-size: 16px; line-height: 24px; min-height: 45px; }
  /* a top item that is also a page: the chevron is its own tap target at the right */
  .enav .enav__toggle--icon { margin-left: auto !important; height: 44px; width: 32px; padding: 0 !important; justify-content: center; }
  .enav .enav__toggle--icon .enav__chev { width: 9px; height: 14px; margin: 0; }
  /* a heading with no page (Research, Programs, Events): the whole row opens it */
  .enav .enav__top.enav__toggle { flex: 1 1 100%; justify-content: space-between; padding-right: 0 !important; }
  .enav .enav__top.enav__toggle .enav__chev { width: 9px; height: 14px; margin: 0 11.5px 0 0; }
  .enav__item.is-open > .enav__toggle .enav__chev { transform: rotate(180deg); }
  .enav .enav__item:hover > .enav__top, .enav .enav__item.is-open > .enav__top { color: var(--enav-ink) !important; }
  .enav .enav__item.is-current > .enav__top, .enav .enav__item.is-current > .enav__toggle .enav__chev,
  .enav .enav__link.is-current { color: var(--enav-gold) !important; }

  /* the page you are on: gold, and a 1px gold line 5px under the words */
  .enav__item.is-current > .enav__top .enav__txt,
  .enav__link.is-current .enav__txt {
    display: inline-block; padding-bottom: 5px; margin-bottom: -5px;
    background: linear-gradient(var(--enav-gold), var(--enav-gold)) left bottom / 100% 1px no-repeat;
  }

  .enav__sub {
    position: static; flex: 0 0 100%; width: auto;
    padding: 3px 0 3px 13px; font-size: 12.42px; background: none;
    opacity: 1; visibility: visible; transition: none;
    display: none;
  }
  .enav__item.is-open > .enav__sub { display: block; }
  .enav__sub > ul > li { margin: 0 0 12px !important; }
  .enav__sub > ul > li:first-child { margin-top: 0 !important; }
  .enav .enav__link, .enav .enav__flytoggle { padding: 10px !important; line-height: 11px; font-size: 12.42px !important; }
  .enav .enav__sub--fly .enav__link { font-size: 12.04px !important; }
  .enav .enav__flytoggle { padding-top: 13px !important; padding-bottom: 13px !important; }
  .enav__sub .enav__txt::after { display: none; }
  .enav__chev--r { width: 6px; height: 11px; }
  .enav__sub--fly { position: static; display: none; padding: 6px 0 0 13px; font-size: 12.04px; right: auto; }
  .enav__fly.is-open > .enav__sub--fly { display: block; }
}
@media (max-width: 720px) {
  .enav { height: 72px; }
  .enav__logo { margin-top: -9.8px; }   /* the old logo's ink sat at y=19 in the 72px bar */
  .enav__logo img { width: 148px; height: 24.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .enav *, .enav::before, .enav__item::after, .enav__txt::after { transition: none !important; }
}

/* ==========================================================================
   /home-2/: the bar over the video (state A), then white once you scroll
   ==========================================================================
   The front page's own header did this (frontpage.css, "Rounded floating site
   header"); esgri-nav.js adds .enav--over there and .is-solid past 60px of
   scroll — the same threshold. State A, as it was: no ground and no shadow,
   the white logo, white items and chevrons, a white line that warms to gold;
   hovering opens a rgba(0,0,0,.6) scrim that grows down to the deepest open
   dropdown + 20px (--enav-mega-h, set by the script), the dropdowns themselves
   transparent on it with white .88 links and a white line. Chase, 2026-08-28,
   on the line: "一开始是黑色，然后hover上去变金色" — white over the video. */
.enav--over { transition: background-color .35s ease, filter .35s ease; }
.enav--over:not(.is-solid) { background: transparent; filter: none; }
.enav--over:not(.is-solid) .enav__logo-c { display: none; }
.enav--over:not(.is-solid) .enav__logo-w { display: block; }
@media (min-width: 1025px) {
  .enav--over:not(.is-solid)::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 100%;
    background: transparent; z-index: -1; pointer-events: none;
    transition: background .35s ease, height .35s ease;
  }
  .enav--over:not(.is-solid):hover::before {
    background: rgba(0, 0, 0, .6); height: var(--enav-mega-h, 100%); pointer-events: auto;
  }
  .enav--over:not(.is-solid) .enav__top,
  .enav--over:not(.is-solid) .enav__toggle--icon { color: #fff !important; }
  .enav--over:not(.is-solid) .enav__item::after { background: #fff; }
  /* the words stay white while hovered here, as they did over the video */
  .enav--over:not(.is-solid) .enav__item:has(> .enav__top:hover) > .enav__top,
  .enav--over:not(.is-solid) .enav__item:has(> .enav__toggle--icon:hover) > .enav__top,
  .enav--over:not(.is-solid) .enav__item:has(> .enav__top:hover) > .enav__toggle--icon,
  .enav--over:not(.is-solid) .enav__item:has(> .enav__toggle--icon:hover) > .enav__toggle--icon,
  .enav--over:not(.is-solid) .enav__item.is-open > .enav__top,
  .enav--over:not(.is-solid) .enav__item.is-open > .enav__toggle--icon { color: #fff !important; }
  .enav--over:not(.is-solid) .enav__item:has(> .enav__top:hover)::after,
  .enav--over:not(.is-solid) .enav__item:has(> .enav__toggle--icon:hover)::after,
  .enav--over:not(.is-solid) .enav__item.is-open::after { background: var(--enav-gold); }
  .enav--over:not(.is-solid) .enav__sub { background: transparent; }
  .enav--over:not(.is-solid) .enav__link,
  .enav--over:not(.is-solid) .enav__flytoggle { color: rgba(255, 255, 255, .88) !important; }
  .enav--over:not(.is-solid) .enav__link:hover,
  .enav--over:not(.is-solid) .enav__flytoggle:hover,
  .enav--over:not(.is-solid) .enav__fly:hover > .enav__flytoggle { color: #fff !important; }
  .enav--over:not(.is-solid) .enav__sub .enav__txt::after,
  .enav--over:not(.is-solid) .enav__link:not(.enav__flytoggle):hover .enav__txt::after { background: #fff; }
}
