/* Brachial plexus app: the shared regional app shell (plan §4), loaded last so it wins over couture-app.css.
   One sticky bar (home · block · copy link · level); the site header scrolls away. DESIGN.md: paper, ink, one wine
   accent, square edges, hairlines, nothing under 12px, 44px targets. */
:root:has(body.ra-app) { --ra-bar: 56px; }
html:has(body.ra-app) { scroll-padding-top: calc(var(--ra-bar, 56px) + 8px); }
body.ra-app .ntf-header { position: relative; z-index: 60; } /* scrolls away; its phone menu stays above the bar and the page */
body.ra-app {
  --bp-paper: #f7f5ef; --bp-ink: #272722; --bp-muted: #55534d; --bp-line: #d7d2c8; --bp-line-strong: #b8ad9e;
  --bp-control: #827b6d; --bp-wine: #633d3c; --bp-hover: #e9e5dc; --bp-blush: #ece3dc; --bp-ivory: #fffaf0;
}
.ra-app main [id], .ra-app .panel { scroll-margin-top: calc(var(--ra-bar, 56px) + 8px); }

/* ------------------------------------------------------------ the one sticky bar */
.bp-bar { position: sticky; top: 0; z-index: 50; background: var(--bp-paper); border-bottom: 1px solid var(--bp-line); }
.bp-bar-inner { position: relative; display: flex; align-items: center; gap: 8px; min-height: 55px; padding-top: 5px; padding-bottom: 5px; }
.bp-home, .bp-tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 0 12px 0 10px;
  border: 1px solid var(--bp-line-strong); border-radius: 0; background: var(--bp-paper); color: var(--bp-ink); font: 500 15px/1 var(--font); text-decoration: none; cursor: pointer; }
.bp-home:hover, .bp-tool:hover { border-color: var(--bp-wine); background: var(--bp-hover); color: var(--bp-ink); }
.bp-home svg, .bp-tool svg, .bp-blockmenu-act svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bp-level { flex-shrink: 0; display: flex; position: relative; }

/* Block chips (wide screens) */
.ra-app #block-chips { flex: 1; min-width: 0; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px; margin: -2px 0; }
.ra-app #block-chips::-webkit-scrollbar { display: none; }
.ra-app #block-chips .chip { min-height: 44px; padding: 3px 11px; flex-shrink: 0; }
.ra-app #block-chips .chip-main { font-size: 15px; }
.ra-app #block-chips .chip-sub { font-size: 12px; }
.ra-app .chip[aria-pressed="true"] { background: var(--bp-wine); border-color: var(--bp-wine); color: var(--bp-ivory); }
.ra-app .chip-group-label { min-height: 32px; }

/* Block menu (phones and narrow windows) */
.bp-blockmenu { position: relative; flex: 1; min-width: 0; display: none; }
.bp-blockmenu-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--bp-control); border-radius: 0;
  background: var(--bp-paper); color: var(--bp-ink); font: 16px/1.2 var(--font); text-align: left; cursor: pointer; }
.bp-blockmenu-btn:hover { border-color: var(--bp-wine); background: var(--bp-hover); }
.bp-blockmenu-k { flex-shrink: 0; font: 400 12px/1 'NTF Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--bp-muted); }
.bp-blockmenu-cur { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bp-caret { flex-shrink: 0; width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.bp-blockmenu-btn[aria-expanded="true"] .bp-caret { transform: translateY(2px) rotate(-135deg); }
.bp-blockmenu-panel { position: absolute; left: 0; top: calc(100% + 4px); z-index: 60; width: max(100%, min(360px, calc(100vw - 32px))); max-width: calc(100vw - 16px);
  max-height: min(72vh, 600px); overflow-y: auto; overscroll-behavior: contain; background: var(--bp-paper); border: 1px solid var(--bp-line-strong);
  border-top: 2px solid var(--bp-wine); box-shadow: 0 12px 24px rgba(0, 0, 0, .14); }
.bp-blockmenu-panel[hidden] { display: none; }
.bp-blockmenu-list, .bp-blockmenu-extra { list-style: none; margin: 0; padding: 4px 0; }
.bp-blockmenu-list li, .bp-blockmenu-extra li { margin: 0; }
.bp-blockmenu-extra { border-top: 1px solid var(--bp-line); }
.bp-blockmenu-group { padding: 10px 14px 4px; border-top: 1px solid var(--bp-line); margin-top: 4px !important; font: 400 12px/1.4 'NTF Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: .06em; color: var(--bp-muted); }
.bp-blockmenu-item { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 8px 14px; border: 0; border-radius: 0;
  background: none; color: var(--bp-ink); font: 16px/1.3 var(--font); text-align: left; cursor: pointer; }
.bp-blockmenu-item:hover, .bp-blockmenu-item:focus-visible { background: var(--bp-hover); }
.bp-blockmenu-item:focus-visible, .bp-blockmenu-act:focus-visible { outline-offset: -3px; }
.bp-blockmenu-item[aria-pressed="true"] { background: var(--bp-blush); box-shadow: inset 3px 0 0 var(--bp-wine); font-weight: 600; }
.bp-blockmenu-sub { flex-shrink: 0; font-size: 14px; font-weight: 400; color: var(--bp-muted); }
.bp-blockmenu-main .adv-tag { margin-left: 6px; }
.bp-blockmenu-act { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 14px; border: 0; background: none; color: var(--bp-ink);
  font: 15px/1.35 var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.bp-blockmenu-act svg { stroke: var(--bp-wine); }
.bp-blockmenu-act:hover { background: var(--bp-hover); color: var(--bp-ink); }
.bp-share-li { display: none; }

/* Wide: chips in the bar. Below 1180px: the block menu. */
@media (max-width: 1179px) {
  .bp-blockmenu { display: block; }
  .ra-app #block-chips { display: none; }
}
@media (max-width: 1599px) {
  .bp-home span, .bp-tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .bp-home, .bp-tool { padding: 0; width: 44px; }
}
@media (max-width: 1399px) {
  .bp-level .ra-level-short { display: inline; }
  .bp-level .ra-level-full { display: none; }
}
/* phones: home (icon), block menu, level. Copy link moves into the block menu; the menu spans the bar. */
@media (max-width: 600px) {
  .bp-bar-inner { gap: 6px; }
  .bp-tool#btn-share { display: none; }
  .bp-share-li { display: block; }
  .bp-blockmenu { position: static; }
  .bp-blockmenu-panel { left: 16px; right: 16px; width: auto; max-width: none; }
  .bp-blockmenu-btn { padding: 0 10px; }
  .bp-level .ra-level-btn { padding: 0 6px; }
}
@media (max-width: 480px) { .bp-blockmenu-k { display: none; } }
/* Small phones (360–400 px): keep the longest name ("Supraclavicular") whole in the block menu. */
@media (max-width: 400px) {
  .bp-bar-inner { gap: 4px; }
  .bp-blockmenu-btn { gap: 6px; padding: 0 8px; }
  .bp-blockmenu-cur { font-size: 15px; letter-spacing: -.01em; }
}
/* "Back to MO" after a link raised the level: it hangs under the bar's right edge so the bar keeps its layout. */
.bp-level .ra-level-back { position: absolute; top: calc(100% + 6px); right: 0; z-index: 55; box-shadow: 0 6px 12px rgba(0, 0, 0, .08); }

/* Header: title only (tools live in the bar). */
.ra-app .top { border-bottom: 0; }
@media (max-width: 899px) {
  .ra-app .top-inner { padding-top: 14px; padding-bottom: 10px; }
}

/* Level picker sits above the intro. */
.ra-app #bp-picker:empty { display: none; }
.ra-app #guide-hint .ra-hidden-hint { margin-top: 0; }
.ra-app .guide .ra-tier-badge { display: block; width: max-content; margin: -2px 0 8px !important; }

/* Readable sizes (nothing under 12px) for the shared header and footer bits on this page */
.ra-app .org { font-size: 13px !important; }
body.ra-app .ntf-footer .ntf-copyright { font-size: 12px !important; }
.ra-app .foot p { line-height: 1.75; }
.ra-app .foot a { padding: 4px 0; }

/* Credit line */
.ra-app .foot .credit { color: var(--bp-ink); }

@media print { .bp-bar { display: none !important; } }

/* "If it goes wrong" guides (shared/regional/js/decide.js, styles in shared/regional/css/decide.css): this app's fonts. */
.ra-app .ra-dg-host { --tb-sans: var(--font); }
.ra-app .guide .bp-wrong-lead { font-size: 15px; line-height: 1.6; color: var(--bp-muted); max-width: 68ch; margin: 0 0 8px; }
.ra-app .guide .bp-wrong-more { font-size: 15px; margin: 12px 0 0; }
.ra-app .guide .bp-wrong-more a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--bp-wine); }

/* Settings (shared/regional/js/appnav.js): a bar button only while the chips replace the block menu. */
.bp-bar .ra-settings-btn { display: none; }
@media (min-width: 1180px) { .bp-bar .ra-settings-btn { display: inline-flex; width: 44px; padding: 0; } .bp-bar .ra-settings-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; } }
.bp-blockmenu-act.ra-settings-link svg { stroke: var(--bp-wine); }
