/* ===== The dashboard's identity header (#drawerHeader, site_header.js) =====
   One sheet for the one header (PT5 one header): the dashboard (index.html) and every standalone
   page that wears the dashboard frame (site_frame.js: the Bike Shop, profiles, club pages) link
   this, after tokens.css and level.css (the XP bar). Only the header itself lives here; where it
   sits is the host's (portal-shell.css's #portalContainer column, or site_frame.css, which fixes
   it across the top). The rules were portal-shell.css's until PT5, values unchanged. */
#drawerHeader {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 24px;
  background: var(--dash-chrome);
  border-bottom: 1px solid var(--dash-border);
  flex-shrink: 0;
  /* What the header would otherwise inherit from its page, pinned so it renders the same on every
     page (the dashboard's base.css values). */
  color: var(--dash-text);
  font-family: var(--kalam);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: normal;
  text-align: left;
  /* level.css's XP bar on paper (the dashboard's #portalContainer values). */
  --xp-track: var(--paper-warm);
  --xp-fill: #e0a800;
  --xp-text: var(--ink);
  --xp-muted: #66625a;
}
#drawerHeader,
#drawerHeader * {
  box-sizing: border-box;
}
#drawerHeader [class*='xp-bar--'] {
  --rank-text: color-mix(in srgb, var(--rank-color, #666) 62%, var(--ink));
}
#drawerHeader .xp-bar__track {
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}
.drawer-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
#drawerHeader img#userPhoto {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--dash-border-strong);
  flex-shrink: 0;
}
.drawer-identity-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.drawer-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#userDisplayName {
  font-family: var(--arch);
  font-size: 1rem;
  color: var(--dash-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#drawerUserFlag {
  font-size: 1.25rem;
  line-height: 1;
}
.drawer-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 16px;
}
#drawerXpBar {
  width: 240px;
  max-width: 100%;
}
#drawerXpBar[hidden] {
  display: none;
}
.drawer-distance {
  font-family: var(--arch);
  font-size: 0.8125rem;
  color: var(--dash-text-soft);
  white-space: nowrap;
}
#drawerTotalDistance {
  color: var(--dash-text);
  font-variant-numeric: tabular-nums;
}
#drawerCloseBtn {
  background: none;
  border: 1px solid var(--dash-border-strong);
  color: var(--dash-text-soft);
  font-family: var(--arch);
  font-size: 0.8125rem;
  line-height: 1;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
#drawerCloseBtn .drawer-close-x {
  font-size: 1.25rem;
}
#drawerCloseBtn:hover {
  border-color: var(--dash-border-strong);
  color: var(--dash-text);
}
/* A signed-out visitor reading About / Careers in the dashboard (landing_page.js's
   setDrawerVisitorMode shows it; portal-shell.css). A framed page draws no header for a visitor. */
#drawerVisitorLoginBtn {
  display: none;
  margin-left: auto;
}
/* Guest Mode conversion: the persistent header indicator — a compact chip next to the XP bar,
   shown only while the viewer is a guest. */
#guestUpsellBar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  background: var(--dash-warn-bg);
  border: 1px solid var(--dash-warn-border);
  border-radius: 8px;
  font-size: 0.85em;
}
#guestUpsellBar[hidden] {
  display: none;
}
#guestUpsellBar span {
  color: var(--dash-warn-text);
  flex: 1;
}
/* Overrides #drawerHeader img's generic circular-avatar-photo styling above (size,
   round clip, ring border) — this is a square floppy-disk glyph, not a photo. */
#guestUpsellBar .ui-icon-img.guest-upsell-bar-icon {
  display: inline-block;
  width: 38px;
  height: 38px;
  border-radius: 0;
  border: none;
  flex-shrink: 0;
}
/* portal-shell.css's .btn-secondary, so the button reads the same on a page without that sheet. */
#guestUpsellBarSaveBtn {
  background: var(--dash-surface-2);
  color: var(--dash-text);
  border: 1px solid var(--dash-border-strong);
  border-radius: 6px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 0.9em;
  cursor: pointer;
}
#guestUpsellBarSaveBtn:hover {
  background: var(--dash-control);
}

/* Club [TAG] colors on paper inside the header (portal-shell.css's #portalContainer values, so a
   framed page without that sheet matches). */
#drawerHeader .club-tag--group {
  color: #8a4a1d;
}
#drawerHeader .club-tag--club {
  color: #5b6b78;
  text-shadow: 0 0 6px rgba(91, 107, 120, 0.35);
}
#drawerHeader .club-tag--clan {
  color: #a8790a;
}
#drawerHeader .club-tag--guild {
  color: #0b7a45;
}

/* Narrow viewports (a phone, or a narrow desktop window): a tighter header over the nav strip. */
@media (max-width: 760px) {
  #drawerHeader {
    padding: 8px 14px;
  }
  #drawerHeader img#userPhoto {
    width: 36px;
    height: 36px;
  }
  #drawerXpBar {
    width: 150px;
  }
  #drawerCloseBtn .drawer-close-label {
    display: none;
  }
  #drawerCloseBtn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}

/* A phone held sideways (short touch screen, too wide for the strip above): a slimmer header (and
   nav column, site_nav_panel.css) so the page keeps most of the screen. */
@media (hover: none) and (pointer: coarse) and (max-height: 500px) and (min-width: 761px) {
  #drawerHeader {
    padding: 6px 16px;
  }
  #drawerHeader img#userPhoto {
    width: 34px;
    height: 34px;
  }
  #drawerCloseBtn .drawer-close-label {
    display: none;
  }
  #drawerCloseBtn {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}
