/* ==========================================================================
 * OrchShop 官网公共样式文件
 * 内容：移动端汉堡导航抽屉、导航遮罩等公共组件的样式
 * 引入方式：放在各页面内嵌 <style> 之后（确保可以覆盖内嵌样式）
 * ========================================================================== */

/* ---------- 导航栏毛玻璃修复 ----------
 * 背景与 backdrop-filter 必须移到 ::before 伪元素上：
 * 后代元素上的 backdrop-filter 会创建新的包含块(containing block)，
 * 导致抽屉菜单的 position: fixed 相对导航栏而非视口定位（高度塌陷、背景丢失）。
 * 统一在此处定义全站导航栏外观，保证 6 个页面完全一致。
 * -------------------------------------------------------------------------- */
.navbar {
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: rgba(10, 14, 26, 0.82);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    backdrop-filter: blur(24px) saturate(1.2);
    transition: background 0.3s ease;
}

/* 滚动后的加深状态（主页等页面通过 .scrolled 类切换） */
.navbar.scrolled {
    background: transparent;
}

.navbar.scrolled::before {
    background: rgba(10, 14, 26, 0.95);
}

/* ---------- 移动端汉堡按钮（桌面端默认隐藏） ---------- */
.nav-toggle { display: none; }

/* ---------- 导航遮罩（抽屉打开时的半透明背景） ---------- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 990;
    background: rgba(4, 8, 18, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* 抽屉打开时锁定背景滚动 */
body.menu-open { overflow: hidden; }

/* ---------- 导航栏下载按钮（统一全站各页面样式） ---------- */
.navbar .nav-links .nav-btn {
    padding: 9px 22px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f8fff, #7c3aed);
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(79, 143, 255, 0.2);
}

.navbar .nav-links .nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(79, 143, 255, 0.4);
    color: #ffffff;
}

/* ---------- 移动端媒体查询（860px 以下启用抽屉导航） ---------- */
@media (max-width: 860px) {

    /* 汉堡按钮样式 */
    .navbar .nav-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 42px;
        height: 42px;
        padding: 0;
        border: 1px solid rgba(79, 143, 255, 0.25);
        border-radius: 10px;
        background: rgba(79, 143, 255, 0.06);
        cursor: pointer;
        position: relative;
        z-index: 1300;
        transition: background 0.3s ease, border-color 0.3s ease;
    }

    .navbar .nav-toggle span {
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: #e2e8f0;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    .navbar .nav-toggle:hover {
        background: rgba(79, 143, 255, 0.15);
        border-color: #4f8fff;
    }

    /* 按钮变叉的动画 */
    .navbar .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .navbar .nav-toggle.open span:nth-child(2) { opacity: 0; }
    .navbar .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* 抽屉菜单本体 */
    .navbar .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1250;
        width: min(78vw, 320px);
        margin: 0;
        padding: 96px 26px 32px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        background: linear-gradient(180deg, rgba(10, 14, 26, 0.985), rgba(13, 19, 36, 0.985));
        border-left: 1px solid rgba(79, 143, 255, 0.16);
        box-shadow: -24px 0 64px rgba(0, 0, 0, 0.55);
        transform: translateX(105%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .navbar .nav-links.open { transform: translateX(0); }

    .navbar .nav-links a {
        font-size: 15px;
        padding: 14px 6px;
        border-bottom: 1px solid rgba(79, 143, 255, 0.08);
    }

    .navbar .nav-links a::after { display: none; }
    .navbar .nav-links a.active { color: #00d4ff; }

    /* 抽屉里的下载按钮 */
    .navbar .nav-links a.nav-btn {
        margin-top: 20px;
        border-bottom: none;
        border-radius: 10px;
        text-align: center;
        padding: 14px 22px;
        color: #ffffff;
    }
}

/* ==========================================================================
 * 全站通用组件（桌面端与移动端共用）
 * ========================================================================== */

/* ---------- 回到顶部按钮 ---------- */
.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 960;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid rgba(79, 143, 255, 0.32);
    border-radius: 50%;
    background: rgba(10, 14, 26, 0.86);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #cfd8ea;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s ease,
                background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.back-to-top svg { width: 20px; height: 20px; }

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: rgba(79, 143, 255, 0.18);
    border-color: #4f8fff;
    color: #ffffff;
    box-shadow: 0 6px 24px rgba(79, 143, 255, 0.32);
    transform: translateY(-2px);
}

/* 移动端：避让 api-docs 页面的侧栏悬浮按钮（bottom: 20px） */
@media (max-width: 900px) {
    .back-to-top { right: 20px; bottom: 84px; }
}

/* ---------- 卡片鼠标跟随光斑（光标处柔光） ---------- */
.feature-card,
.download-card,
.tutorial-card,
.video-card,
.module-tag,
.step-content {
    position: relative;
}

.feature-card::after,
.download-card::after,
.tutorial-card::after,
.video-card::after,
.module-tag::after,
.step-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    border-radius: inherit;
    background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
                rgba(79, 143, 255, 0.14), rgba(0, 212, 255, 0.06) 45%, transparent 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.feature-card:hover::after,
.download-card:hover::after,
.tutorial-card:hover::after,
.video-card:hover::after,
.module-tag:hover::after,
.step-content:hover::after {
    opacity: 1;
}
