/* ==========================================================================
   layout.css — 站点布局骨架：导航、页头、页脚、浮动按钮
   依赖顺序：base.css → layout.css（需使用 base.css 中的 CSS 变量）
   ========================================================================== */

/* ===== 导航栏内容 ===== */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.5rem;
    background: rgba(11, 15, 20, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.nav-brand-link {
    text-decoration: none;
}

.nav-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

/* 主导航菜单 */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin: 0 auto; /* 居中 */
}

.nav-menu-item {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-menu-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.nav-menu-item.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(53, 208, 127, 0.12);
}

/* ===== 一级标题之上的导航卡片（页眉之下） ===== */
.nav-card {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 auto 1.8rem;
    max-width: 760px;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius);
}

.nav-card-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.32rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

.nav-card-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.nav-card-item.active {
    color: var(--primary);
    background: rgba(53, 208, 127, 0.14);
}

.nav-card-icon {
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

@media (max-width: 640px) {
    .nav-card {
        gap: 0.3rem;
        padding: 0.45rem 0.6rem;
    }
    .nav-card-item {
        padding: 0.3rem 0.6rem;
        font-size: 0.82rem;
    }
}

/* 右侧外部链接按钮 */
.nav-external {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.1s ease;
}

.nav-btn:hover {
    border-color: #fb7299;
    background: rgba(251, 114, 153, 0.12);
    transform: translateY(-1px);
}

.nav-btn:active {
    transform: scale(0.97);
}

.nav-btn-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.nav-btn-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.nav-btn .fa-bilibili {
    color: #fb7299;
    font-size: 1.05rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .topnav {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        padding: 0.6rem 1rem;
    }
    /* 菜单换行到第二行，横向可滚动 */
    .nav-menu {
        order: 3;
        width: 100%;
        margin: 0;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        -webkit-overflow-scrolling: touch;
    }
    .nav-external {
        gap: 0.4rem;
    }
    .nav-btn {
        padding: 0.4rem 0.6rem;
    }
}

/* ===== 头部 ===== */
.hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff, #c4d0db);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 子页面大标题 */
.page-title {
    font-size: 3rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-top: 0.4rem;
    background: linear-gradient(135deg, #fff, #c4d0db);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 子页面占位卡片 */
.placeholder-card {
    max-width: 640px;
    margin: 1rem auto 2rem;
    padding: 2.5rem 2rem;
    text-align: center;
    border-radius: var(--radius);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
    color: var(--primary);
}

.placeholder-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--text);
}

.placeholder-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.placeholder-hint {
    margin-top: 0.8rem;
    font-size: 0.85rem;
    color: var(--primary);
}

/* ===== 页头组件：标语、服主、徽章 ===== */
.tagline {
    margin-top: 0.8rem;
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.95;
}

.tagline i {
    margin-right: 0.35em;
}

/* 服主信息（Minecraft 皮肤头像） */
.owner-block {
    margin-top: 1.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.owner-avatar {
    width: 96px;
    height: 96px;
    border: 3px solid var(--primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 14px rgba(53, 208, 127, 0.25);
    image-rendering: pixelated; /* 保留 MC 皮肤像素质感 */
    background: rgba(24, 32, 44, 0.6);
}

/* 方形框头像 */
.owner-avatar.square {
    border-radius: 0;
}

.owner-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.owner-mcname {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.owner-mcname i {
    color: var(--primary);
    margin-right: 0.3em;
}

.subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.badges {
    margin-top: 1.2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.badge {
    background: rgba(53, 208, 127, 0.12);
    border: 1px solid rgba(53, 208, 127, 0.3);
    color: var(--primary);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge i {
    margin-right: 0.35em;
}

/* ===== 子页面页脚占位 + 返回主页按钮 ===== */
/* 子页面内占位页脚（配合吸底 footer 预留空间） */
.footer-holder {
    height: 7.5rem;
}

/* 底部返回主页按钮（不固定，位于文档流中） */
.back-home-wrap {
    display: flex;
    justify-content: center;
    margin: 0 auto 2.2rem;
}

.back-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.7rem;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.back-home-btn:hover {
    border-color: var(--primary);
    background: rgba(53, 208, 127, 0.12);
    color: var(--primary);
    transform: translateY(-1px);
}

.back-home-btn i {
    color: var(--primary);
}

/* ===== 页脚：吸底常驻，两行内容 ===== */
.footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    background: rgba(11, 15, 20, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 0.85rem 1rem;
    line-height: 1.5;
    max-height: 22vh; /* 防止极端内容溢出 */
    overflow: auto;
}

.footer p {
    margin: 0;
}

.footer-main {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 第二行：Powered by + 搭建信息 */
.footer-sub {
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.9;
}

.footer-sub .powered {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.footer-sub .fa-github {
    color: #d0d7de;
    font-size: 0.95rem;
}

.footer-sub .fa-cloudflare {
    color: #f6821f;
    font-size: 0.95rem;
}

.footer-sep {
    color: var(--border);
}

/* ===== 返回顶部按钮 ===== */
.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 134px; /* 位于音乐按钮之上 */
    width: 48px;
    height: 48px;
    border: 2px solid rgba(53, 208, 127, 0.5);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(53, 208, 127, 0.85), rgba(28, 156, 92, 0.9));
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(53, 208, 127, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background 0.2s ease, box-shadow 0.2s ease;
    z-index: 90;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: linear-gradient(145deg, rgba(53, 208, 127, 1), rgba(28, 156, 92, 1));
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 22px rgba(53, 208, 127, 0.5);
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .back-to-top {
        right: 14px;
        bottom: 124px;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
}

/* ===== 自动向下翻页按钮（仅服主的话页，左下角） ===== */
.auto-read {
    position: fixed;
    left: 20px;
    bottom: 78px; /* 避开吸底页脚 */
    width: 48px;
    height: 48px;
    border: 2px solid rgba(53, 208, 127, 0.5);
    border-radius: 50%;
    background: rgba(24, 32, 44, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    z-index: 90;
}

.auto-read:hover {
    background: rgba(53, 208, 127, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}

/* 开启自动翻页时：高亮 + 向下浮动动效 */
.auto-read.active {
    background: rgba(53, 208, 127, 0.3);
    border-color: var(--primary);
    animation: autoReadPulse 1.6s ease-in-out infinite;
}

@keyframes autoReadPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

@media (max-width: 640px) {
    .auto-read {
        left: 14px;
        bottom: 70px;
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.6rem;
    }
}
