/* <hb-topbar>: the one top bar for every page. This file is loaded twice on purpose:
   inside the element's shadow root (the :host / .tb-* rules) and on the page itself (the hb-topbar …
   rules at the bottom, which style buttons a page drops into the actions slot). Tokens: /shared/theme.css. */

:host {
  display: block;
  position: sticky;
  top: 0;
  z-index: 40;
  font-family: var(--hb-font);
  font-size: var(--hb-text-md);
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--hb-focus); outline-offset: 2px; border-radius: var(--hb-r-sm); }

/* ---------- the bar ---------- */
.tb {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "brand nav search actions user";
  align-items: center;
  column-gap: var(--hb-s-3);
  min-height: var(--hb-bar-h);
  padding: 0 var(--hb-s-4) 0 var(--hb-s-3);
  background: var(--hb-bar);
  color: var(--hb-bar-ink);
  border-bottom: 1px solid var(--hb-bar-divider);
  position: relative;
}
.tb[data-variant="portal"], .tb[data-variant="minimal"] {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand . actions";
}

/* ---------- brand plate: real emblem + product ---------- */
.tb-brand { grid-area: brand; display: flex; align-items: center; gap: 2px; min-width: 0; position: relative; }
.tb-home {
  display: inline-flex; align-items: center; justify-content: center;
  height: 52px; padding: 0 8px; border-radius: var(--hb-r-md);
}
.tb-home:hover { background: var(--hb-bar-hover); }

/* Full Holland lockup, including its wordmark. Tint uses the artwork alpha in dark bars. */
.emblem { position: relative; display: block; height: var(--hb-emblem-h); width: calc(var(--hb-emblem-h) * 178 / 124); flex: none; }
.emblem i { position: absolute; inset: 0; }
.emblem .tinted {
  display: var(--hb-emblem-tinted, block);
  background: var(--hb-logo);
  -webkit-mask: url("../assets/holland-logo.png") center / contain no-repeat;
  mask: url("../assets/holland-logo.png") center / contain no-repeat;
}
.emblem .original {
  display: var(--hb-emblem-original, none);
  background: url("../assets/holland-logo.png") center / contain no-repeat;
}

.tb-rule { width: 1px; height: 26px; background: var(--hb-bar-line); margin: 0 6px 0 4px; flex: none; }
.tb-switch {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 10px 0 8px; border-radius: var(--hb-r-md); text-align: left; min-width: 0;
}
.tb-switch:hover, .tb-switch[aria-expanded="true"] { background: var(--hb-bar-hover); }
.tb-names { display: flex; flex-direction: column; min-width: 0; }
.tb-prod {
  font-family: var(--hb-font-display); font-size: var(--hb-text-lg); font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--hb-bar-ink);
}
.tb-chev { color: var(--hb-bar-ink-2); transition: transform .16s var(--hb-ease); }
.tb-switch[aria-expanded="true"] .tb-chev { transform: rotate(180deg); }
.tb-static { padding: 0 8px; }

/* ---------- product sub-navigation ---------- */
/* The wrap holds the scroll cues: a chevron on the side with more sections, over an edge shadow in the
   bar's ink colour so it stands out against the bar in every theme. */
.tb-navwrap { grid-area: nav; position: relative; min-width: 0; display: flex; align-items: center; }
.tb-navwrap::before, .tb-navwrap::after {
  content: ""; position: absolute; top: 4px; bottom: 4px; width: 14px; pointer-events: none; opacity: 0; transition: opacity .12s;
}
.tb-navwrap::before { left: 0; box-shadow: inset 12px 0 10px -8px color-mix(in srgb, var(--hb-bar-ink) 45%, transparent); }
.tb-navwrap::after { right: 0; box-shadow: inset -12px 0 10px -8px color-mix(in srgb, var(--hb-bar-ink) 45%, transparent); }
.tb-navwrap[data-more-before]::before, .tb-navwrap[data-more-after]::after { opacity: 1; }
.tb-more {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--hb-bar-ink); color: var(--hb-bar); box-shadow: 0 0 0 3px var(--hb-bar);
}
.tb-more[data-dir="-1"] { left: 2px; }
.tb-more[data-dir="1"] { right: 2px; }
.tb-more:hover { background: var(--hb-logo); }
.tb-nav { flex: 1; display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tb-nav::-webkit-scrollbar { display: none; }
.tb-nav a {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 32px; padding: 0 11px; border-radius: var(--hb-r-sm);
  color: var(--hb-bar-ink-2); font-size: var(--hb-text-sm); font-weight: 500; white-space: nowrap;
}
.tb-nav a:hover { color: var(--hb-bar-ink); background: var(--hb-bar-hover); }
.tb-nav a[aria-current="page"] { color: var(--hb-bar-ink); background: var(--hb-bar-active); font-weight: 600; }
.tb-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--hb-r-pill);
  background: var(--hb-logo); color: var(--hb-bar); font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}

/* ---------- search ---------- */
.tb-search {
  grid-area: search; display: inline-flex; align-items: center; gap: 8px;
  width: clamp(170px, 18vw, 300px); height: 34px; padding: 0 8px 0 10px;
  border-radius: var(--hb-r-md); border: 1px solid var(--hb-bar-line); background: var(--hb-bar-field);
  color: var(--hb-bar-ink-2); font-size: var(--hb-text-sm);
}
.tb-search:hover { color: var(--hb-bar-ink); border-color: var(--hb-bar-ink-2); }
.tb-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd {
  font-family: var(--hb-font); font-size: 11px; line-height: 1; padding: 3px 5px; border-radius: 4px;
  border: 1px solid var(--hb-bar-line); color: var(--hb-bar-ink-2); white-space: nowrap;
}

/* ---------- actions + user ---------- */
.tb-actions { grid-area: actions; display: flex; align-items: center; gap: 6px; }
.tb-user { grid-area: user; position: relative; }
.tb-me {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border-radius: var(--hb-r-pill);
}
.tb-me:hover, .tb-me[aria-expanded="true"] { background: var(--hb-bar-hover); }
.tb-me-name { font-size: var(--hb-text-sm); font-weight: 500; white-space: nowrap; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--hb-logo); color: var(--hb-bar); font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.avatar.lg { width: 38px; height: 38px; font-size: 13px; background: var(--hb-tint); color: var(--hb-primary-ink); }
.tb-tag { font-size: var(--hb-text-sm); color: var(--hb-bar-ink-2); white-space: nowrap; }

/* ---------- popovers (product family, account, jump) ---------- */
.pop {
  position: absolute; top: calc(100% + 6px); z-index: 60;
  background: var(--hb-surface); color: var(--hb-ink);
  border: 1px solid var(--hb-line); border-radius: var(--hb-r-lg); box-shadow: var(--hb-shadow-pop);
  animation: pop-in .14s var(--hb-ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .pop, .jump-box { animation: none; } .tb-chev, .tb-navwrap::before, .tb-navwrap::after { transition: none; } }

.family { left: 0; width: min(540px, calc(100vw - 16px)); padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.family a { display: grid; grid-template-columns: 34px 1fr; column-gap: 11px; align-items: center; padding: 9px 10px; border-radius: var(--hb-r-md); }
.family a:hover, .family a:focus-visible { background: var(--hb-paper-2); outline-offset: -2px; }
.family a[aria-current="page"] { background: var(--hb-tint); }
.fam-ico { grid-row: span 2; width: 34px; height: 34px; border-radius: var(--hb-r-md); display: inline-flex; align-items: center; justify-content: center; background: var(--hb-paper-2); color: var(--hb-primary-ink); }
.family a[aria-current="page"] .fam-ico { background: var(--hb-surface); }
.fam-name { font-weight: 600; font-size: var(--hb-text-md); color: var(--hb-ink); }
.fam-desc { font-size: var(--hb-text-xs); color: var(--hb-ink-3); }

.account { right: 0; width: 292px; padding: 6px; }
.acc-h { display: flex; align-items: center; gap: 11px; padding: 10px 10px 12px; }
.acc-h b { display: block; font-weight: 600; font-size: var(--hb-text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-h small { display: block; font-size: var(--hb-text-xs); color: var(--hb-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-h > div { min-width: 0; flex: 1; }
.role { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--hb-r-pill); background: var(--hb-paper-2); color: var(--hb-ink-2); text-transform: capitalize; }
.sep { height: 1px; background: var(--hb-line); margin: 6px 4px; }
.acc-k { font-size: var(--hb-text-xs); font-weight: 600; color: var(--hb-ink-3); padding: 6px 10px 6px; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 6px 6px; }
.theme-opt {
  display: flex; flex-direction: column; gap: 6px; padding: 5px; border-radius: var(--hb-r-md);
  border: 1px solid var(--hb-line); font-size: 11.5px; color: var(--hb-ink-2); text-align: left;
}
/* each preview carries data-theme, so it resolves that theme's own tokens; the label keeps the page's */
.theme-opt .preview { display: flex; flex-direction: column; gap: 0; }
.theme-opt .mini { height: 26px; border-radius: 5px 5px 0 0; background: var(--hb-bar); border: 1px solid var(--hb-bar-divider); display: flex; align-items: center; padding: 0 6px; --hb-emblem-h: 12px; }
.theme-opt .mini-page { height: 10px; border-radius: 0 0 5px 5px; background: var(--hb-paper); border: 1px solid var(--hb-line); border-top: 0; }
.theme-opt .opt-l { padding: 0 2px 1px; }
.theme-opt:hover { border-color: var(--hb-line-2); }
.theme-opt[aria-checked="true"] { border-color: var(--hb-primary); box-shadow: 0 0 0 1px var(--hb-primary); color: var(--hb-ink); font-weight: 600; }
.theme-opt { background: transparent; }
.acc-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: var(--hb-r-sm);
  font-size: var(--hb-text-md); color: var(--hb-ink); text-align: left;
}
.acc-item svg { color: var(--hb-ink-3); }
.acc-item:hover, .acc-item:focus-visible { background: var(--hb-paper-2); outline-offset: -2px; }
.acc-item kbd { margin-left: auto; border-color: var(--hb-line); color: var(--hb-ink-3); }

/* built-in jump list for pages without their own command palette */
.jump { position: fixed; inset: 0; z-index: 80; background: rgba(10, 16, 12, .38); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 12px 0; }
.jump-box { width: min(560px, 100%); background: var(--hb-surface); color: var(--hb-ink); border: 1px solid var(--hb-line); border-radius: var(--hb-r-lg); box-shadow: var(--hb-shadow-pop); overflow: hidden; animation: pop-in .14s var(--hb-ease); }
.jump-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--hb-line); color: var(--hb-ink-3); }
.jump-in input { flex: 1; height: 50px; border: 0; background: transparent; color: var(--hb-ink); font: inherit; font-size: var(--hb-text-lg); outline: none; }
.jump-in input::placeholder { color: var(--hb-ink-3); }
.jump-list { max-height: 52vh; overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.jump-list [role="option"] { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--hb-r-sm); cursor: pointer; }
.jump-list [role="option"] small { margin-left: auto; color: var(--hb-ink-3); font-size: var(--hb-text-xs); }
.jump-list [aria-selected="true"] { background: var(--hb-tint); color: var(--hb-primary-ink); }
.jump-list [aria-selected="true"] small { color: var(--hb-primary-ink); }
.jump-empty { padding: 18px 14px; color: var(--hb-ink-3); }

/* ---------- narrow screens ---------- */
/* the product's sections win the space before the search label does */
@media (max-width: 1320px) {
  .tb-search { width: auto; }
  .tb-search span { display: none; }
}
@media (max-width: 980px) {
    .tb-search { width: auto; }
  .tb-search span, .tb-search kbd { display: none; }
  .tb-me-name { display: none; }
}
@media (max-width: 760px) {
  .tb { grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "brand search actions user" "nav nav nav nav"; column-gap: 6px; padding: 0 8px 0 4px; }
  .tb[data-variant="portal"], .tb[data-variant="minimal"] { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand actions"; }
  .tb-brand { height: var(--hb-bar-h); }
  .tb-navwrap { height: var(--hb-subnav-h); border-top: 1px solid var(--hb-bar-line); margin: 0 -8px 0 -4px; }
  .tb-nav { height: 100%; padding: 0 8px; }
  .tb-more[data-dir="-1"] { left: 6px; }
  .tb-more[data-dir="1"] { right: 6px; }
  .tb-rule { margin: 0 2px; }
  .tb-home { padding: 0 6px; }
  .tb-switch { padding: 0 6px; }
  .family { position: fixed; top: calc(var(--hb-bar-h) + 4px); left: 8px; right: 8px; width: auto; grid-template-columns: 1fr; }
  .account { position: fixed; top: calc(var(--hb-bar-h) + 4px); right: 8px; left: auto; }
  .tb-tag { display: none; }
}
@media (max-width: 400px) { .tb-switch { gap: 4px; } .tb-prod { font-size: 13px; } }

/* ---------- page side: buttons a page places in slot="actions" ---------- */
hb-topbar .hb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; position: relative;
  height: 34px; padding: 0 12px; border-radius: var(--hb-r-md); border: 1px solid transparent;
  background: transparent; color: var(--hb-bar-ink); font: 500 var(--hb-text-sm)/1 var(--hb-font);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
hb-topbar .hb-btn:hover { background: var(--hb-bar-hover); }
hb-topbar .hb-btn--icon { width: 34px; padding: 0; }
hb-topbar .hb-btn--primary { background: var(--hb-primary); color: var(--hb-on-primary); }
hb-topbar .hb-btn--primary:hover { background: var(--hb-primary-hover); }
hb-topbar .hb-btn svg { width: 16px; height: 16px; flex: none; }
hb-topbar .hb-btn kbd { font: 11px/1 var(--hb-font); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--hb-bar-line); color: var(--hb-bar-ink-2); }
hb-topbar .hb-btn--primary kbd { border-color: rgba(255, 255, 255, .35); color: inherit; }
hb-topbar .hb-badge {
  position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--hb-logo); color: var(--hb-bar); font: 700 10px/16px var(--hb-font); text-align: center;
  box-shadow: 0 0 0 2px var(--hb-bar);
}
hb-topbar :focus-visible { outline: 2px solid var(--hb-focus); outline-offset: 2px; }
@media (max-width: 980px) { hb-topbar [data-hb-label], hb-topbar .hb-btn kbd { display: none; } hb-topbar .hb-btn:has(svg):not(.hb-btn--icon) { width: 34px; padding: 0; } }
