/* The shared topic row stays in normal document flow below the primary header. */
.br-topic-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 1140px;
    margin: 12px auto 0;
    padding: 4px 12px;
    border: 1px solid var(--br-line);
    border-radius: 8px;
    background: var(--br-surface-secondary);
    scroll-margin-top: 100px;
}
.br-topic-label { flex-shrink: 0; font-size: 13px; color: var(--br-muted); font-weight: 600; }
.br-topic-desktop { flex: 1; min-width: 0; }
.br-section-head.br-feed-heading { flex-direction: row; align-items: center; }
.br-feed-heading h1 { font-size: 22px; }
.br-topic-links { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.br-topic-links a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--br-muted); font-size: 14px; white-space: nowrap; }
.br-topic-links a:hover { color: var(--br-accent); background: var(--br-accent-soft); }
.br-topic-links a.active { color: var(--br-accent); background: var(--br-accent-soft); font-weight: 700; }
.br-topic-picker { display: none; }
.br-topic-links a:focus-visible, .br-topic-picker summary:focus-visible, .br-feed-views a:focus-visible { outline: 2px solid var(--br-accent); outline-offset: 3px; }
.br-topic-empty { padding: 8px 10px; color: var(--br-muted); }
.br-feed-views { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.br-feed-views a { padding: 5px 12px; border-radius: 6px; font-size: 14px; color: var(--br-muted); }
.br-feed-views a[aria-current="page"] { color: var(--br-accent); background: var(--br-accent-soft); font-weight: 700; }
@media (max-width: 1180px) { .br-topic-bar { margin-left: 20px; margin-right: 20px; } }
@media (max-width: 1000px) {
    .br-topic-bar { display: none; }
    .br-topic-label { display: none; }
    .br-topic-desktop { display: none; }
    .br-topic-picker { display: block; position: static; }
    .br-topic-page-header .br-global-nav-rail, .br-topic-page-header .br-nav,
    .br-nav-stack.is-compact .br-topic-page-header .br-nav { overflow: visible; }
    .br-topic-page-header .br-nav-content { position: relative; width: 100%; justify-content: space-between; gap: 4px; }
    .br-topic-page-header .br-topbar-inner { min-width: 0; }
    .br-topic-picker > nav { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; max-height: min(60vh, 420px, calc(100dvh - 110px)); overscroll-behavior: contain; overflow-y: auto; background: var(--br-surface-primary); border: 1px solid var(--br-line); border-radius: 8px; box-shadow: 0 8px 20px rgba(31,35,40,.12); }
    .br-topic-page-header .br-global-nav-rail .br-topic-picker nav a { height: auto; min-height: 36px; white-space: normal; }
    .br-topic-picker summary { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 10px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
    .br-topic-picker summary::-webkit-details-marker { display: none; }
    .br-topic-indicator { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin: -4px 2px 0 0; }
    .br-topic-picker[open] .br-topic-indicator { transform: rotate(225deg); margin-top: 4px; }
    .br-topic-picker .br-topic-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px 8px 10px; border-top: 1px solid var(--br-line); }
    .br-topic-picker .br-topic-links a { white-space: normal; }
}
@media (max-width: 680px) {
    .br-feed-views a { padding: 5px 8px; }
}

/* These reading entry pages share a two-row mobile header. Account controls
   occupy the spare space beside the brand instead of creating a third row. */
@media (max-width: 680px) {
    .br-topic-page-header .br-topbar-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
    }
    .br-topic-page-header .br-brand { grid-column: 1; grid-row: 1; min-width: 0; }
    .br-topic-page-header .br-brand-mark { flex-shrink: 0; }
    .br-topic-page-header .br-brand-title { overflow: hidden; text-overflow: ellipsis; }
    .br-topic-page-header .br-nav-tools { grid-column: 2; grid-row: 1; min-width: 0; max-width: 96px; }
    .br-topic-page-header .br-user-menu, .br-topic-page-header .br-user-trigger { min-width: 0; max-width: 100%; }
    .br-topic-page-header .br-user-avatar { flex-shrink: 0; }
    .br-topic-page-header .br-user-name { display: block; max-width: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .br-topic-page-header .br-global-nav-rail { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
    .br-topic-page-header .br-nav { padding-bottom: 2px; }
    .br-topic-page-header .br-nav-content { width: 100%; gap: 0; justify-content: space-between; }
    .br-nav-stack.is-compact .br-topic-page-header .br-topbar-inner { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .br-nav-stack.is-compact .br-topic-page-header .br-global-nav-rail { grid-row: 1; }
}
