/* ============================================================
   EM Snow topbar — split out of em.css (V1c, 2026-09-17)
   The .em-topbar header em-shell.js injects, its search/location controls,
   and their <=720px mobile rules. Moved here VERBATIM so the resort page
   (public/resortinfo.html) can style the ONE shell header WITHOUT loading
   the whole em.css (em.css restyles *, html, body and redefines --line, which
   would clobber the resort page's own base styles). Needs em-tokens.css for
   the --scrim / --line / --ink-* / --s* / --r* / --font-* tokens it consumes.
   Every em.css consumer also loads this file (immediately before em.css); on
   those pages it is identical CSS to what used to live in em.css.
   ============================================================ */

/* ---------- top bar ---------- */
.em-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: var(--s5);
  padding: calc(env(safe-area-inset-top, 0px) + var(--s3)) var(--s5) var(--s3);
  background: var(--scrim);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.em-brand {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.05rem;
  color: var(--ink-1); text-decoration: none !important;
  display: inline-flex; align-items: center; gap: 10px;
}
.em-brand svg { display: block; }
.em-nav { display: flex; gap: var(--s4); margin-left: auto; align-items: center; position: relative; }
.em-nav-links { display: flex; gap: var(--s4); align-items: center; }
.em-nav a { color: var(--ink-2); font-size: var(--text-small); font-weight: 500; }
.em-nav a:hover { color: var(--ink-1); text-decoration: none; }
.em-nav-burger {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: var(--surface-mid);
  color: var(--ink-1); font-size: 1.05rem; line-height: 1;
  cursor: pointer;
}
.em-nav-burger:hover { border-color: var(--accent-ice); }
.em-theme-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 36px; padding: 0 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: var(--surface-mid);
  color: var(--ink-1);
  font: 600 var(--text-micro) var(--font-data);
  letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer;
}
.em-theme-btn:hover { border-color: var(--accent-ice); }

/* ---------- topbar resort search + location actions (shell v2) ---------- */
.em-search { position: relative; flex: 1; max-width: 520px; min-width: 140px; }
.em-search input {
  width: 100%; height: 38px; padding: 0 38px 0 16px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: var(--surface-mid);
  color: var(--ink-1);
  font: 500 var(--text-small) var(--font-text);
}
.em-search input::placeholder { color: var(--ink-3); }
.em-search input:focus { outline: none; border-color: var(--accent-ice); }
.em-search-clear {
  position: absolute; top: 50%; right: 7px; transform: translateY(-50%);
  display: none; width: 24px; height: 24px; padding: 0; line-height: 1;
  border: 0; border-radius: var(--r-full); cursor: pointer;
  background: transparent; color: var(--ink-3); font-size: 18px;
  align-items: center; justify-content: center;
}
.em-search-clear.show { display: inline-flex; }
.em-search-clear:hover { color: var(--ink-1); background: var(--surface-mid); }
.em-search-drop {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-raise);
  border: 1px solid var(--line-strong);
  border-radius: var(--r2); overflow: hidden;
  box-shadow: var(--shadow-2);
  z-index: 120;
}
.em-search-drop.open { display: block; }
.em-search-drop a {
  display: flex; justify-content: space-between; gap: var(--s3);
  padding: 10px 14px;
  color: var(--ink-1); text-decoration: none; font-size: var(--text-small);
}
.em-search-drop a:hover, .em-search-drop a.sel { background: var(--surface-mid); }
.em-search-drop .where { color: var(--ink-3); white-space: nowrap; }
.em-act {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: var(--surface-mid);
  color: var(--ink-1);
  font: 600 var(--text-small) var(--font-text);
  cursor: pointer; white-space: nowrap;
}
.em-act:hover { border-color: var(--accent-ice); }

@media (max-width: 720px) {
  .em-topbar { flex-wrap: wrap; gap: var(--s2) var(--s3); }
  /* Page links hide on phones and live in the burger — Flyby 3D included (Lee's iPhone test,
     2026-09-11: it read as the same link twice, once in the strip and again in the menu).
     ONE HOME PER LINK: the burger is where cross-site links live, the strip is for this page's
     own lenses and tools. The burger entry keeps the resort deep link, which is what the old
     exemption was protecting. */
  .em-nav-links a.em-nav-page { display: none; }
  .em-brand span { display: none; }        /* glyph-only brand, room for the search box */
  .em-search { flex: 1 1 160px; }          /* mobile: let the search box shrink/grow (V1c: header-scoped, belongs here) */

  /* mobile menu: burger reveals the hidden page links as a dropdown.
     Only .open gets the absolute panel treatment - the closed state is untouched (still
     a normal inline row with the theme button always visible), so nothing that already
     lived in .em-nav-links (theme toggle etc) loses visibility by default.
     Review fix (2026-07-27): NOTE this .open ruleset styles the WHOLE .em-nav-links
     wrapper (no selector-level scoping) - the guard is DOM POSITION, the mirror of the
     .fl-nav-links fix in em-resort-skin.css. Any control that must stay put whether the menu is open or
     closed (e.g. resortinfo's Story/Stats toggle) belongs OUTSIDE .em-nav-links, as a
     sibling in .em-nav - never nested inside it, or it gets swept into the dropdown. */
  .em-nav-burger { display: inline-flex; }
  .em-nav-links.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; top: calc(100% + var(--s2)); right: 0; min-width: 200px;
    background: var(--bg-raise);
    border: 1px solid var(--line-strong);
    border-radius: var(--r2);
    box-shadow: var(--shadow-2);
    padding: var(--s2);
    z-index: 130;
  }
  .em-nav-links.open a.em-nav-page { display: block; padding: 10px 12px; border-radius: var(--r1); }
  .em-nav-links.open a:hover { background: var(--surface-mid); }
  .em-nav-links.open .em-theme-btn { align-self: stretch; justify-content: flex-start; }
}
