/* HxH v1.6.11 — responsive header, sharp brand surfaces and refined motion. */

/* Keep the real hidden attribute authoritative. Some previous theme rules used
   display:flex!important and accidentally resurrected hidden header elements. */
.topbar .top-brand[hidden],
.topbar [hidden] {
  display: none !important;
}

.topbar .top-brand {
  display: flex !important;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-width: 100px;
  color: var(--text, #27223a);
  text-decoration: none;
}
.topbar .top-brand img { width: 42px; height: 42px; object-fit: cover; flex: 0 0 auto; }
.topbar .top-brand span { display: flex; flex-direction: column; min-width: 0; line-height: 1; }
.topbar .top-brand strong { font: 800 17px/1 'SpaceGrotesk', 'Segoe UI', sans-serif; letter-spacing: -.7px; }
.topbar .top-brand small { margin-top: 4px; font: 800 9px/1 'Manrope', 'Segoe UI', sans-serif; letter-spacing: .14em; color: var(--muted, #747087); }

/* Prevent flex children from forcing the header wider than the viewport. */
.topbar,
.topbar > *,
.topbar .top-nav,
.topbar .header-search,
.topbar .top-actions {
  min-width: 0;
}
.topbar {
  width: 100%;
  box-sizing: border-box;
  gap: clamp(6px, .9vw, 14px);
}
.topbar .top-nav {
  flex: 0 1 auto;
  margin-left: 0;
  overflow: hidden;
  white-space: nowrap;
}
.topbar .top-nav .top-link {
  flex: 0 0 auto;
  padding-inline: clamp(5px, .65vw, 10px);
  font-size: clamp(10px, .88vw, 12.5px);
}
.topbar .header-search {
  flex: 0 1 clamp(160px, 19vw, 270px) !important;
  width: clamp(160px, 19vw, 270px) !important;
  min-width: 130px !important;
  max-width: 100%;
  margin-left: auto !important;
}
.topbar .header-search input {
  min-width: 0 !important;
  text-overflow: ellipsis;
}
.topbar .top-actions {
  flex: 0 0 auto;
  gap: clamp(2px, .45vw, 7px) !important;
  white-space: nowrap;
}
.topbar .top-actions .top-wallet {
  min-width: 0;
  max-width: clamp(92px, 10vw, 148px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .top-actions .icon-btn {
  flex: 0 0 auto;
}

/* At laptop widths the breadcrumb is redundant and competes with the useful
   controls. Hide it, progressively simplify navigation and preserve the search. */
@media (max-width: 1280px) and (min-width: 761px) {
  .topbar .breadcrumb { display: none !important; }
  .topbar { padding-inline: clamp(12px, 2vw, 24px) !important; }
  .topbar .header-search {
    flex-basis: clamp(150px, 18vw, 220px) !important;
    width: clamp(150px, 18vw, 220px) !important;
  }
}
@media (max-width: 1120px) and (min-width: 761px) {
  .topbar .top-nav a:nth-last-child(-n+3) { display: none !important; }
  .topbar .header-search {
    flex-basis: clamp(138px, 17vw, 185px) !important;
    width: clamp(138px, 17vw, 185px) !important;
    min-width: 125px !important;
    padding-inline: 10px !important;
  }
  .topbar .top-actions .icon-btn { width: 34px !important; height: 36px !important; }
  .topbar .top-actions .top-wallet { max-width: 96px; padding-inline: 9px !important; }
  .topbar .top-actions .top-avatar img { width: 32px; height: 32px; }
}
@media (max-width: 920px) and (min-width: 761px) {
  .topbar .top-nav a:nth-last-child(-n+4) { display: none !important; }
  .topbar { gap: 6px !important; }
  .topbar .top-nav .top-link { padding-inline: 7px; }
  .topbar .header-search {
    flex-basis: 145px !important;
    width: 145px !important;
    min-width: 115px !important;
  }
  .topbar .top-actions .top-wallet { max-width: 42px; width: 42px; justify-content: center; padding-inline: 0 !important; }
  .topbar .top-actions .top-wallet > :not(svg) { display: none !important; }
}

/* Mobile header gets two deliberate rows rather than a cramped single row. */
@media (max-width: 760px) {
  .topbar .top-brand[hidden] { display: none !important; }
  .topbar .top-brand { min-width: 75px; gap: 6px; }
  .topbar .top-brand img { width: 34px; height: 34px; border-radius: 10px !important; }
  .topbar .top-brand strong { font-size: 15px; }
  .topbar .top-brand small { font-size: 8px; }
  .topbar .breadcrumb,
  .topbar .top-nav { display: none !important; }
  .topbar {
    width: 100%;
    max-width: 100%;
    gap: 8px !important;
    padding-inline: 12px !important;
    overflow: visible;
    flex-wrap: wrap;
  }
  .topbar .top-actions {
    max-width: calc(100vw - 100px);
    overflow: visible;
  }
  .topbar .top-actions .top-wallet {
    max-width: 44px;
    width: 40px;
    justify-content: center;
    padding-inline: 0 !important;
  }
  .topbar .top-actions .top-wallet > :not(svg) { display: none !important; }
  .topbar .header-search {
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 1 100% !important;
    max-width: none;
    margin-left: 0 !important;
    order: 6;
  }
}

/* Crown mark: clean, high-contrast and consistent across app and auth panels. */
.top-brand img,
.sidebar .brand img,
.auth-brand-emblem img,
.top-avatar img {
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.top-brand img,
.sidebar .brand img,
.auth-brand-emblem img {
  filter: drop-shadow(0 3px 7px rgba(82, 37, 160, .14));
}
.top-brand img { border-radius: 12px !important; }
.sidebar .brand img { border-radius: 12px !important; }
.auth-brand-emblem img { border-radius: 15px !important; }

/* Premium page typography using bundled local fonts only. */
html[data-theme] .page-heading h1,
html[data-theme] .section-title h2,
html[data-theme] .admin-welcome h2,
html[data-theme] .auth-panel h2 {
  font-family: var(--font-display, 'M1 Display', 'Segoe UI', sans-serif);
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}
html[data-theme] .page-heading h1 { letter-spacing: -.7px; }
html[data-theme] .page-heading p,
html[data-theme] .section-title p { text-wrap: pretty; }

/* The opening screen shows the same crisp crown artwork as the header. */
#app > .boot .boot-orbit img {
  object-fit: cover;
  background: #4c168f;
  box-shadow: 0 9px 30px rgba(110, 52, 211, .23), inset 0 0 0 1px rgba(255,255,255,.24);
}
#app > .boot .boot-orbit::after {
  border-color: rgba(164, 119, 255, .38) !important;
  box-shadow: 0 0 24px rgba(128, 72, 220, .11);
}
#app > .boot .boot-progress i { will-change: transform; }

/* Small transitions that remain compositor-friendly. */
.topbar .top-link,
.admin-tabs .tab,
.catalog-toolbar .tab,
.topbar .icon-btn,
.topbar .top-wallet,
.topbar .top-avatar {
  transition: color .18s ease, background-color .18s ease, border-color .18s ease,
    box-shadow .2s ease, transform .2s cubic-bezier(.2,.75,.25,1);
}
.admin-tabs .tab { transform: translateY(0); }
.admin-tabs .tab:active { transform: translateY(1px) scale(.985); }
.admin-tabs .tab.active { box-shadow: inset 0 0 0 1px rgba(128, 77, 219, .08); }
.admin-context-bar { transition: opacity .2s ease, transform .2s ease; }

/* Scroll reveals are enabled by hxh-motion.js only when motion is permitted. */
.hx-reveal {
  opacity: 0;
  transform: translate3d(0, 15px, 0) scale(.995);
  transition: opacity .44s cubic-bezier(.22,.75,.25,1),
    transform .5s cubic-bezier(.22,.75,.25,1);
  transition-delay: var(--hx-reveal-delay, 0ms);
  will-change: opacity, transform;
}
.hx-reveal.hx-reveal-visible { opacity: 1; transform: none; }
.hx-swap-enter { animation: hxSwapEnter .24s cubic-bezier(.2,.75,.25,1) both; }
@keyframes hxSwapEnter {
  from { opacity: .68; transform: translate3d(0, 7px, 0); }
  to { opacity: 1; transform: none; }
}
.content { scroll-margin-top: 16px; }
.content [id] { scroll-margin-top: 84px; }

/* Native View Transitions give browser-backed, smooth tab/page changes. */
.content { view-transition-name: hxh-page; }
.admin-workspace { view-transition-name: hxh-admin; }
::view-transition-old(hxh-page),
::view-transition-new(hxh-page),
::view-transition-old(hxh-admin),
::view-transition-new(hxh-admin) {
  animation-duration: 190ms;
  animation-timing-function: cubic-bezier(.22,.75,.25,1);
}
::view-transition-old(hxh-page),
::view-transition-old(hxh-admin) { animation-name: hxViewOut; }
::view-transition-new(hxh-page),
::view-transition-new(hxh-admin) { animation-name: hxViewIn; }
@keyframes hxViewOut { to { opacity: 0; transform: translate3d(0, -4px, 0); } }
@keyframes hxViewIn { from { opacity: 0; transform: translate3d(0, 5px, 0); } to { opacity: 1; transform: none; } }

html.hx-lowfx .hx-reveal,
html.hx-lowfx .hx-swap-enter { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .hx-reveal { opacity: 1 !important; transform: none !important; transition: none !important; will-change: auto; }
  .hx-swap-enter { animation: none !important; }
  ::view-transition-old(hxh-page), ::view-transition-new(hxh-page),
  ::view-transition-old(hxh-admin), ::view-transition-new(hxh-admin) { animation: none !important; }
  .topbar .top-link, .admin-tabs .tab, .catalog-toolbar .tab,
  .topbar .icon-btn, .topbar .top-wallet, .topbar .top-avatar { transition: none !important; }
}
