/* /browse: each section band opens and closes its drill-down (click only; founder-decided 2026-11-11, in session).
   Everything here is keyed on `html.bacc`, a class the page sets before the first band paints (no open-then-collapse shift). The script
   at the foot wires the buttons; if it throws it removes the class and what it added, and if it never ran the head's
   DOMContentLoaded check removes the class, so a reader with no script, or a failed one, sees every band open as the page always was.
   Main host only (the phone host's browse screens are left alone). Manifest: "/browse — Browse hospital outpatient, and each band opens and closes". */
html.bacc .browse-band[data-bacc] { position: relative; padding-right: 56px; }
html.bacc .bacc-toggle {
  position: absolute; inset: 0; width: 100%; background: transparent; border: 0; padding: 0; margin: 0;
  cursor: pointer; border-radius: inherit; font: inherit; color: inherit;
}
html.bacc .bacc-toggle:focus-visible { outline: 3px solid var(--accent, #7B2E93); outline-offset: -5px; }
html.bacc .browse-band[data-bacc]:hover { filter: brightness(1.08); }
html.bacc .bacc-toggle .bacc-chev {
  position: absolute; right: 22px; top: 50%; width: 12px; height: 12px; margin-top: -9px;
  border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg); transition: transform .45s ease; opacity: .85;
}
html.bacc .browse-band[data-bacc="open"] .bacc-toggle .bacc-chev { transform: rotate(-135deg); margin-top: -3px; }
.bacc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the body: its height eases between 0 and its own, nothing is measured in script */
html.bacc .bacc-body {
  display: grid; grid-template-rows: 1fr; visibility: visible;
  transition: grid-template-rows .7s cubic-bezier(.22, .8, .24, 1), visibility 0s;
}
html.bacc .browse-band[data-bacc="closed"] ~ .bacc-body {
  grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows .7s cubic-bezier(.22, .8, .24, 1), visibility 0s .7s;
}
html.bacc .bacc-inner { overflow: hidden; min-height: 0; }
html.bacc .bacc-body .browse-drill-row,
html.bacc .bacc-body .browse-catcard { transition: opacity .5s ease, transform .5s ease; }
html.bacc .browse-band[data-bacc="closed"] ~ .bacc-body .browse-drill-row,
html.bacc .browse-band[data-bacc="closed"] ~ .bacc-body .browse-catcard { opacity: 0; transform: translateY(-6px); }

/* what a closed band leaves under its header: the first few names inside */
html.bacc .bacc-peek {
  margin: 8px 4px 0; display: flex; flex-wrap: nowrap; gap: 6px 8px; align-items: center;
  font-size: var(--fs-caption, 12.5px); color: var(--n500, #57534e); max-height: 64px; overflow: hidden;
  transition: max-height .5s ease, opacity .4s ease, margin .5s ease;
}
.bacc-peek i { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; border: 1px solid var(--n300, #e7e5e4); background: var(--n0, #fff); border-radius: 999px; padding: 1px 10px; }
.bacc-peek > :last-child { flex: none; white-space: nowrap; }
html.bacc .browse-band[data-bacc="open"] ~ .bacc-peek { max-height: 0; opacity: 0; margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  html.bacc .bacc-body, html.bacc .bacc-body .browse-drill-row, html.bacc .bacc-body .browse-catcard,
  html.bacc .bacc-toggle .bacc-chev, html.bacc .bacc-peek { transition: none !important; }
}
@media print {
  html.bacc .bacc-body { grid-template-rows: 1fr !important; visibility: visible !important; }
  html.bacc .bacc-body .browse-drill-row, html.bacc .bacc-body .browse-catcard { opacity: 1 !important; transform: none !important; }
  html.bacc .bacc-peek, html.bacc .bacc-toggle { display: none !important; }
}
