/* 全站顶栏 · token 与 list-common.css / listening-home.css 同源 */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    padding: 0 20px;
    background: #FFF9F1;
    border-bottom: 1px solid #F3E3C8;
    transition: box-shadow .2s ease;
}

.topbar-scrolled {
    box-shadow: 0 1px 8px rgba(61, 52, 40, .06);
}

/* ---------- logo ---------- */

.topbar-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #3D3428;
    font-weight: 800;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
}

.topbar-logo:hover,
.topbar-logo:focus {
    color: #3D3428;
    text-decoration: none;
}

.topbar-logo-icon,
.topbar-logo-short {
    display: none;
}

/* ---------- 面包屑 ---------- */

.topbar-crumbs ol {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
}

.topbar-crumbs li {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.topbar-crumbs li + li::before {
    content: '›';
    margin: 0 8px;
    color: #A79375;
}

.topbar-crumbs a {
    color: #7A6A52;
    text-decoration: none;
}

.topbar-crumbs a:hover {
    color: #3D3428;
    text-decoration: underline;
}

.topbar-crumb-parent span,
.topbar-crumb-mid span {
    color: #7A6A52;
}

.topbar-crumb-current span {
    color: #3D3428;
}

.topbar-logo:focus-visible,
.topbar-crumbs a:focus-visible {
    outline: 3px solid #4A7CF0;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- 常用入口导航 ---------- */

/* 导航与用户区一起被推到最右；未登录时容器为空，宽度为 0，不影响用户区位置 */
.topbar-nav {
    margin-left: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 28px;
    white-space: nowrap;
}

.topbar-nav a {
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1;
    color: #7A6A52;
    text-decoration: none;
}

.topbar-nav a:hover,
.topbar-nav a:focus {
    color: #D97E00;
    text-decoration: none;
}

.topbar-nav a:focus-visible {
    outline: 3px solid #4A7CF0;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- 用户区 ---------- */

#user-info {
    margin-left: 20px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 991px) {
    .topbar-logo-full {
        display: none;
    }

    .topbar-logo-short {
        display: inline;
    }

    /* 窄屏放不下横向导航，入口回落到头像下拉菜单（见 user-info.css 的 .user-item-fallback）。
       容器保留 margin-left:auto，仍负责把用户区推到最右 */
    .topbar-nav {
        display: block;
        gap: 0;
    }

    .topbar-nav a {
        display: none;
    }
}

@media (max-width: 767px) {
    .topbar {
        height: 48px;
        padding: 0 12px;
        gap: 12px;
    }

    .topbar-logo-short {
        display: none;
    }

    .topbar-logo-icon {
        display: inline-block;
    }

    /* 中间级全部隐藏，只留「‹ 上一级」+ 当前项。
       必须写成两级类名：特异性 0,2,0 才压得过 .topbar-crumbs li 的 display:flex（0,1,1），
       媒体查询本身不提升特异性。 */
    .topbar-crumbs .topbar-crumb-mid {
        display: none;
    }

    /* 特异性 0,2,1 压过上面的 li + li::before（0,1,2），把分隔符换成返回箭头 */
    .topbar-crumbs .topbar-crumb-parent::before {
        content: '‹';
        margin: 0 4px 0 0;
        color: #A79375;
    }
}
