/* ============================================================
 * 人民网中日对译语料库 · 站点菜单样式
 * 毛玻璃黑白质感：半透明面板 + backdrop-filter 模糊，跟随明暗主题
 * ============================================================ */

/* ---------- 遮罩 ---------- */
.site-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;
    background: rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

body.site-menu-open .site-menu-overlay {
    opacity: 1;
    visibility: visible;
}

body.site-menu-open {
    overflow: hidden;
}

/* ---------- 面板本体（毛玻璃） ---------- */
.site-menu {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 220;
    width: min(400px, 92vw);
    display: flex;
    flex-direction: column;
    padding: 20px 18px calc(16px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.62);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    backdrop-filter: blur(30px) saturate(180%);
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 18px 0 60px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
    transform: translateX(-102%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

[data-theme="dark"] .site-menu {
    background: rgba(12, 12, 12, 0.66);
    border-right-color: rgba(255, 255, 255, 0.12);
    box-shadow: 18px 0 60px rgba(0, 0, 0, 0.5);
}

body.site-menu-open .site-menu {
    transform: translateX(0);
}

/* ---------- 关闭按钮 ---------- */
.site-menu-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

[data-theme="dark"] .site-menu-close {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
}

.site-menu-close:hover {
    background: var(--text-primary);
    color: var(--bg);
}

/* ---------- 品牌 ---------- */
.site-menu-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 34px 5px 4px;
    margin: 2px 0 0;
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
}

.site-menu-brand:hover {
    background: rgba(0, 0, 0, 0.05);
    text-decoration: none;
    color: var(--text-primary);
}

[data-theme="dark"] .site-menu-brand:hover {
    background: rgba(255, 255, 255, 0.08);
}

.site-menu-logo {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.10);
}

[data-theme="dark"] .site-menu-logo {
    border-color: rgba(255, 255, 255, 0.16);
}

.site-menu-brand-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.site-menu-brand-name {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-menu-brand-sub {
    margin-top: 2px;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---------- 操作区 ---------- */
.site-menu-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 14px;
}

.site-menu-theme {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .site-menu-theme {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.08);
}

.site-menu-theme:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg);
}

.site-menu-theme svg {
    width: 18px;
    height: 18px;
    display: block;
}

.site-menu-theme .site-menu-theme-sun {
    display: none;
}

html[data-theme="dark"] .site-menu-theme .site-menu-theme-moon {
    display: none;
}

html[data-theme="dark"] .site-menu-theme .site-menu-theme-sun {
    display: block;
}

.site-menu-actions-tip {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ---------- 信息区 ---------- */
.site-menu-info {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 2px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.site-menu-info::-webkit-scrollbar {
    width: 4px;
}

.site-menu-info::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ---------- 玻璃卡片 ---------- */
.site-menu-block {
    padding: 13px 13px 12px;
    margin: 0 0 10px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.50);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .site-menu-block {
    border-color: rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.055);
    box-shadow: none;
}

.site-menu-block h3 {
    margin: 0 0 8px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.site-menu-h3-with-icon {
    display: flex;
    align-items: center;
    gap: 5px;
}

.site-menu-h3-with-icon svg {
    width: 14px;
    height: 14px;
    display: block;
    color: var(--text-secondary);
}

.site-menu-block p {
    margin: 0 0 8px;
    font-size: 0.74rem;
    line-height: 1.72;
    color: var(--text-muted);
}

.site-menu-block p:last-child {
    margin-bottom: 0;
}

.site-menu-block strong {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.site-menu-block a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    opacity: 0.9;
}

[data-theme="dark"] .site-menu-block a {
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.site-menu-block a:hover {
    opacity: 1;
    color: var(--text-primary);
}

.site-menu-inline-icon {
    width: 14px;
    height: 14px;
    margin-right: 5px;
    vertical-align: -2px;
}

.site-menu-author-line {
    margin-bottom: 6px !important;
}

.site-menu-author-line a {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    border-bottom: none !important;
}

.site-menu-author-platform {
    margin-left: 7px;
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.site-menu-author-platform::before {
    content: "· ";
}

/* ---------- 语料下载 ---------- */
.site-menu-downloads {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 2px;
}

.site-menu-download {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 9px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text-primary) !important;
    text-decoration: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

[data-theme="dark"] .site-menu-download {
    border-color: rgba(255, 255, 255, 0.10) !important;
    background: rgba(255, 255, 255, 0.055);
}

.site-menu-download:hover {
    background: var(--text-primary);
    color: var(--bg) !important;
    border-color: var(--text-primary) !important;
    transform: translateY(-1px);
}

.site-menu-download:hover .site-menu-download-desc {
    color: var(--bg);
    opacity: 0.75;
}

.site-menu-download-fmt {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.3;
}

.site-menu-download-desc {
    font-size: 0.62rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- 其他项目 ---------- */
.site-menu-projects {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.site-menu-project {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.45);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--text-primary) !important;
    text-decoration: none !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    transition: background 0.18s ease, border-color 0.18s ease;
}

[data-theme="dark"] .site-menu-project {
    border-color: rgba(255, 255, 255, 0.10) !important;
    background: rgba(255, 255, 255, 0.055);
}

.site-menu-project:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.22) !important;
}

[data-theme="dark"] .site-menu-project:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.26) !important;
}

.site-menu-project-logo {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2px;
}

[data-theme="dark"] .site-menu-project-logo {
    border-color: rgba(255, 255, 255, 0.14);
}

.site-menu-project-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.35;
}

.site-menu-project-copy strong {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-menu-project-copy small {
    font-size: 0.66rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-menu-project-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.site-menu-repo {
    font-weight: 600;
}

.site-menu-foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-muted);
}

[data-theme="dark"] .site-menu-foot {
    border-top-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 480px) {
    .site-menu {
        width: min(360px, 94vw);
        padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
    }

    .site-menu-brand-name {
        font-size: 0.92rem;
    }

    .site-menu-downloads {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
}
