/* One balanced header across Home, Explore and Memories. Existing visibility,
   safe-area top positioning and panel behavior remain owned by each view. */
html body main.app-shell section.map-stage #appTopbar.topbar {
  --topbar-rail-width: 96px;
  --topbar-edge: clamp(16px, 2.5vw, 28px);
  left: 0 !important;
  right: 0 !important;
  padding-inline: max(var(--topbar-edge), env(safe-area-inset-left)) max(var(--topbar-edge), env(safe-area-inset-right)) !important;
  grid-template-columns: minmax(var(--topbar-rail-width), 1fr) auto minmax(var(--topbar-rail-width), 1fr) !important;
  column-gap: 8px !important;
  min-height: 48px !important;
  align-items: center !important;
}

html body main.app-shell #appTopbar.topbar > :is(.topbar-left, .topbar-actions, #brandHomeButton) {
  box-sizing: border-box !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  border-radius: 16px !important;
  border: 1px solid #36586e !important;
  background: var(--mymappi-action-navy, #00243f) !important;
  box-shadow: 0 8px 20px rgba(0, 24, 43, .16), inset 0 1px 0 rgba(255, 255, 255, .06) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html body main.app-shell #appTopbar.topbar > :is(.topbar-left, .topbar-actions) {
  width: var(--topbar-rail-width) !important;
  min-width: var(--topbar-rail-width) !important;
  max-width: var(--topbar-rail-width) !important;
  grid-template-columns: repeat(2, 44px) !important;
  gap: 2px !important;
  padding: 0 !important;
  align-items: center !important;
  justify-content: center !important;
}

html body main.app-shell #appTopbar.topbar :is(#categoryMenuButton, #logoHomeButton, #pinSearchButton, #notificationButton) {
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  border-radius: 13px !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  color: #fff !important;
}
html body main.app-shell #appTopbar.topbar :is(#categoryMenuButton, #logoHomeButton, #pinSearchButton, #notificationButton):is(:hover, [aria-expanded="true"]) {
  background: #163b52 !important;
}
html body main.app-shell #appTopbar.topbar :is(button, a):focus-visible {
  outline: 2px solid #a1f1dd !important;
  outline-offset: 2px !important;
}
html body main.app-shell #appTopbar.topbar :is(#pinSearchButton, #notificationButton) svg {
  width: 19px !important;
  height: 19px !important;
  stroke-width: 2.1 !important;
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  html body main.app-shell section.map-stage #appTopbar.topbar {
    --topbar-rail-width: 92px;
    --topbar-edge: 12px;
  }
}
@media (max-width: 720px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  html body main.app-shell #appTopbar.topbar #brandHomeButton {
    width: clamp(96px, calc(100vw - 224px), 127px) !important;
    min-width: 0 !important;
    max-width: 127px !important;
    padding-inline: 6px !important;
  }
}
@media (max-width: 350px) {
  html body main.app-shell #appTopbar.topbar #brandHomeButton h1 { font-size: 20px !important; }
}

/* This is fixed-size brand artwork, not reading text. Keep the wordmark and
   its red dot inside their capsule when accessibility text is enlarged. */
@media (orientation: portrait) {
  html body main.app-shell section.map-stage #appTopbar.topbar #brandHomeButton h1.mymappi-wordmark {
    font-size: min(1.48rem, 6.25vw, 24px) !important;
  }
}

/* Use the existing MM-and-pin artwork, framed tightly without altering it.
   Keep the button's existing Home/OM action and 44px minimum touch target. */
html body main.app-shell section.map-stage header.topbar #logoHomeButton {
  display: grid !important;
  place-items: center !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
}

html body main.app-shell section.map-stage header.topbar #logoHomeButton .topbar-logo-frame {
  position: relative;
  display: block;
  width: 40px;
  height: 36px;
  overflow: hidden;
  border-radius: 7px;
  background: #00243f;
  pointer-events: none;
}

/* Override the old mascot's optical offset and shadow in every map scope. */
html body main.app-shell section.map-stage header.topbar #logoHomeButton .topbar-logo-frame #topbarLogoImage {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 47px !important;
  height: 47px !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  transform: translate(-50%, -50%) !important;
  filter: none !important;
  box-shadow: none !important;
  animation: none !important;
  transition: none !important;
}
