@import url("/fonts.css");
/* The shared Strata header — ONE stylesheet for every screen.
 *
 * geoai pages get it through styles.css (`@import url("/header.css")`, first
 * line); the server-rendered pages (Esri directory, Admin Console) link it
 * directly from `strata-core/templates/partials/strata_header.html`, which
 * also loads the same `_header.js`. The palette and font are restated here so
 * the header renders identically on a page that does not load styles.css.
 * The vendored font faces and the --font token live in fonts.css, imported
 * above, so every page that reaches header.css gets them too.
 */
:root {
  --teal:        #1ba7a6;
  --teal-deep:   #004d5d;
  --orange:      #f9971c;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1e293b;
}

/* Filled by _header.js on every page that includes the shared header —
   including the server-rendered Settings shell, whose `.mgr-fallbar` is hidden
   by CSS the moment this element stops being `:empty`. Keep the 56px height:
   styles.css hard-codes it (`top: 56px` on the drawer, `calc(100vh - 56px)`
   on the map shell). The retired `.settings-rail` used to depend on it too. */
#app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  height: 56px;
  font-family: var(--font);
  color: var(--text);
  box-sizing: border-box;
}
#app-header * { box-sizing: border-box; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* `.brand` is shared with the map drawer's logo. */
.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--teal-deep); text-decoration: none;
}
.brand .logo { height: 32px; width: auto; }
.brand .title { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }

.hbtn {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  background: var(--teal); color: #fff; border: 1px solid var(--teal);
}
.hbtn:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.hbtn.ghost { background: transparent; color: var(--teal-deep); }
.hbtn.primary { background: var(--orange); border-color: var(--orange); }
.hbtn.primary:hover { background: #d6800d; border-color: #d6800d; }

.brand .name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; color: var(--teal-deep); }
.header-sep { opacity: 0.35; }
.header-title { font-weight: 600; font-size: 15px; white-space: nowrap; }
/* The nav never grows; the right block is pushed to the edge with an auto
   margin and can never leave the container (flex-shrink 0 + nowrap on every
   control). A grown nav + space-between let the right block spill past the
   viewport on a real Firefox render. */
.header-nav { display: flex; gap: 4px; margin-inline-start: 12px; flex: 0 1 auto; min-width: 0; }
.header-right { margin-inline-start: auto; flex: 0 0 auto; }
.header-right > * { flex: 0 0 auto; }
.hbtn, .header-lang-btn { white-space: nowrap; }
.header-nav a {
  font-size: 13px; text-decoration: none; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px;
  color: var(--teal-deep); border: 1px solid transparent;
}
.header-nav a:hover { background: #f1f5f9; }
.header-nav a.active { background: var(--teal-deep); color: #fff; }
.header-right .pill { font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.header-right .pill[hidden], #header-signout[hidden] { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-lang { display: flex; gap: 4px; }
.header-lang-btn {
  font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.header-lang-btn[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); }

@media (max-width: 800px) {
  .header-title, .header-sep { display: none; }
  /* Only the map page (index.html) has the slide-out #app-drawer that carries
     Home / Map / Settings and the user's name on a phone. header.css is also
     loaded by home.html, help.html and admin_help.html, which have no drawer
     (or any other mobile-nav fallback) — hiding the nav there would strand
     those pages' phone users with no way to reach Home/Map/Settings at all
     (review R-fix1). Scope the hide to a page that actually has the drawer,
     rather than the whole selector's audience. */
  body:has(#app-drawer) .header-nav, body:has(#app-drawer) .header-right .pill { display: none; }
  .header-lang-btn { padding: 4px 6px; }
}
