/* Hangar-family topper — shared by Hangar showroom + Events board */

@import url("https://fonts.googleapis.com/css2?family=Exo+2:wght@500;600;700;800&display=swap");

:root,
[data-theme="dark"] {
  --hsr-top: #080808;
  --hsr-line: #2a2c31;
  --hsr-text: #f4f4f5;
  --hsr-text-strong: #ffffff;
  --hsr-muted: #9ca3af;
  --hsr-elevated: #16171a;
  --hsr-panel: #111214;
  --hsr-shadow: rgba(0, 0, 0, 0.45);
  --hsr-hover: rgba(255, 255, 255, 0.04);
  --hsr-accent: #e10600;
  --hsr-accent-hi: #ff2a1f;
  --hsr-glow: rgba(225, 6, 0, 0.35);
  --hsr-avatar-bg: linear-gradient(135deg, #333, #111);
  --hsr-soft: #e5e7eb;
}

[data-theme="light"] {
  --hsr-top: #ffffff;
  --hsr-line: #d5dae1;
  --hsr-text: #0f172a;
  --hsr-text-strong: #0a0a0a;
  --hsr-muted: #64748b;
  --hsr-elevated: #eef1f4;
  --hsr-panel: #ffffff;
  --hsr-shadow: rgba(15, 23, 42, 0.14);
  --hsr-hover: rgba(15, 23, 42, 0.04);
  --hsr-glow: rgba(225, 6, 0, 0.22);
  --hsr-avatar-bg: linear-gradient(135deg, #cbd5e1, #94a3b8);
  --hsr-soft: #334155;
}

header[data-rcs-hangar-topper]:empty {
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  display: block;
  background: var(--hsr-top);
  border-bottom: 1px solid var(--hsr-line);
}

.hsr-top {
  border-bottom: 1px solid var(--hsr-line);
  background: var(--hsr-top);
  position: sticky;
  top: 0;
  z-index: 40;
  pointer-events: none;
  font-family: "Exo 2", "Segoe UI", system-ui, sans-serif;
  box-sizing: border-box;
  width: 100%;
}

/* Inner row — same grid whether sticky (Hangar) or fixed (Events field page) */
.hsr-top-inner,
.hsr-top:not(:has(.hsr-top-inner)) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px 20px;
  padding: 10px 28px;
  box-sizing: border-box;
  width: 100%;
}

/* On field/events pages the header is also .rcs-pilot-topper → fixed + scene pad */
.rcs-pilot-chrome.rcs-pilot-topper.hsr-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  margin: 0;
  padding: 0 !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
  display: block;
}

.hsr-top .hsr-top-brand,
.hsr-top .rcs-pilot-nav-scroller,
.hsr-top .hsr-nav,
.hsr-top .hsr-top-tools,
.hsr-top .hsr-top-brand a,
.hsr-top .hsr-nav a,
.hsr-top .hsr-top-tools a,
.hsr-top .hsr-top-tools button,
.hsr-top .hsr-top-tools input {
  pointer-events: auto;
}

.hsr-top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}

.hsr-top .rcs-pilot-nav-scroller {
  position: relative;
  z-index: 2;
  grid-column: 2;
  justify-self: stretch;
  align-self: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: auto;
}

/* Fixed chevrons (Hangar may not load pilot-layout.css). */
.hsr-top .rcs-pilot-nav-scroller::before,
.hsr-top .rcs-pilot-nav-scroller::after {
  content: "";
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 9px;
  height: 9px;
  margin-top: -5px;
  border-top: 2.5px solid #fff;
  border-right: 2.5px solid #fff;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}

html[data-theme="light"] .hsr-top .rcs-pilot-nav-scroller::before,
html[data-theme="light"] .hsr-top .rcs-pilot-nav-scroller::after {
  border-top-color: #0f172a;
  border-right-color: #0f172a;
  filter: none;
}

.hsr-top .rcs-pilot-nav-scroller::before {
  left: 8px;
  transform: rotate(-135deg);
}

.hsr-top .rcs-pilot-nav-scroller::after {
  right: 8px;
  transform: rotate(45deg);
}

.hsr-top .rcs-pilot-nav-scroller.is-scrolled::before,
.hsr-top .rcs-pilot-nav-scroller.is-overflow:not(.is-at-end)::after {
  opacity: 0.85;
  animation: rcs-nav-chev-breathe 1.8s ease-in-out infinite;
}

@keyframes rcs-nav-chev-breathe {
  0%,
  100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hsr-top .rcs-pilot-nav-scroller.is-scrolled::before,
  .hsr-top .rcs-pilot-nav-scroller.is-overflow:not(.is-at-end)::after {
    animation: none;
    opacity: 0.85;
  }
}

.hsr-nav {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.hsr-top .rcs-pilot-nav-scroller:not(.is-overflow) .hsr-nav {
  justify-content: center;
}

.hsr-nav::-webkit-scrollbar {
  display: none;
}

.hsr-top-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  justify-self: end;
  min-width: 0;
  grid-column: 3;
}

.hsr-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.hsr-brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.hsr-brand-logo--light {
  display: none;
}

html[data-theme="light"] .hsr-brand-logo--dark {
  display: none;
}

html[data-theme="light"] .hsr-brand-logo--light {
  display: block;
}

.hsr-nav a {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--hsr-muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 6px;
  border-bottom: 2px solid transparent;
}

.hsr-nav a:hover {
  color: var(--hsr-text-strong);
  background: var(--hsr-hover);
}

.hsr-nav a.is-active {
  color: #fff;
  background: linear-gradient(180deg, var(--hsr-accent-hi), var(--hsr-accent));
  border-bottom-color: var(--hsr-accent-hi);
  box-shadow: 0 0 18px var(--hsr-glow);
}

/* Field layout sets border-box on everything, which shrinks Hangar chips. Keep Hangar size.
   The search pill stays border-box so its padding stays inside the slot and does not run under the bell. */
.hsr-top .hsr-donate,
.hsr-top .hsr-icon-btn,
.hsr-top .hsr-avatar {
  box-sizing: content-box;
}

/* Hangar → Events keeps .hsr-body and the original .hsr-top. Photo sits behind the app. */
body.hsr-body.hsr-route-events {
  background: transparent;
}

body.hsr-body.hsr-route-events .hsr-app {
  background: transparent;
  position: relative;
  z-index: 1;
}

body.hsr-body.hsr-route-events .rcs-pilot-backdrop,
body.hsr-body.hsr-route-events .rcs-pilot-atmosphere {
  z-index: 0;
}

@media (max-width: 800px) {
  .hsr-top-inner,
  .hsr-top:not(:has(.hsr-top-inner)) {
    grid-template-columns: max-content minmax(0, 1fr) max-content max-content max-content;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 6px;
    row-gap: 6px;
    padding: 8px 12px;
  }

  .hsr-top-tools {
    display: contents;
  }

  .hsr-top-brand {
    grid-column: 1;
    grid-row: 1;
    min-width: max-content;
  }

  .hsr-top .rcs-pt-donate,
  .hsr-top .hsr-donate {
    grid-column: 3;
    grid-row: 1;
  }

  .hsr-top .rcs-pt-bell-wrap,
  .hsr-top .hsr-bell-wrap {
    grid-column: 4;
    grid-row: 1;
  }

  .hsr-top .rcs-pt-avatar,
  .hsr-top .hsr-avatar {
    grid-column: 5;
    grid-row: 1;
  }

  .hsr-top .rcs-pt-search-wrap,
  .hsr-top .hsr-search-wrap {
    display: none;
  }

  .hsr-top .rcs-pilot-nav-scroller {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .hsr-nav {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
}
