.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    max-width: 100%;
    text-decoration: none;
    color: inherit;
}

.brand-lockup--linked {
    transition: transform 0.2s ease;
}

.brand-lockup--linked:hover {
    transform: scale(1.02);
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    max-width: 100%;
}

.brand-logo__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
}

/* 新 Logo 内容填充约 90%，用 max-height 控制视觉尺寸且不撑破容器 */
.brand-logo--xs .brand-logo__image { max-height: 1.75rem; }
.brand-logo--sm .brand-logo__image { max-height: 2rem; }
.brand-logo--md .brand-logo__image { max-height: 2.5rem; }
.brand-logo--lg .brand-logo__image { max-height: 3rem; }
.brand-logo--xl .brand-logo__image { max-height: 3.5rem; }
.brand-logo--2xl .brand-logo__image { max-height: 4.5rem; }

.rail .rail-logo .brand-logo__image {
    transition: none;
}

/* 折叠：紧凑方形，与 42px 侧栏图标区对齐 */
.rail:not(.expanded) a.rail-logo {
    width: 2.625rem;
    height: 2.625rem;
    padding: 0.125rem;
    justify-content: center;
    overflow: hidden;
}

.rail:not(.expanded) .rail-logo .brand-logo {
    width: 100%;
    height: 100%;
}

.rail:not(.expanded) .rail-logo .brand-logo__image {
    max-height: 100%;
    max-width: 100%;
}

/* 展开：固定最大高度、水平居中，不做尺寸过渡避免闪动 */
.rail.expanded a.rail-logo {
    justify-content: center;
    overflow: hidden;
}

.rail.expanded .rail-logo .brand-logo {
    width: auto;
    max-width: 100%;
    display: flex;
    justify-content: center;
}

.rail.expanded .rail-logo .brand-logo__image {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(100% - 0.5rem);
    max-height: 6.5rem;
    margin-inline: auto;
    object-fit: contain;
    object-position: center center;
}

.rail-logo:hover .brand-logo__image {
    opacity: 0.92;
}

.brand-lockup--centered {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#header-panel .brand-lockup {
    max-width: min(46vw, 11.5rem);
    overflow: hidden;
}

.invite-topbar .brand-lockup {
    max-height: 3rem;
    max-width: min(52vw, 11rem);
    overflow: hidden;
}

.invite-topbar .brand-logo__image {
    max-height: 2.75rem;
}

@media (max-width: 767px) {
    .brand-logo--xl .brand-logo__image { max-height: 3rem; }
    .brand-logo--2xl .brand-logo__image { max-height: 3.75rem; }
}
