/* ========== 移动端响应式优化 ========== */

/* 移动端按钮样式 */
.menu-toggle,
.search-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--slate-700);
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s ease;
}

.menu-toggle:hover,
.search-toggle:hover {
    color: var(--primary-600);
    transform: scale(1.1);
}

.search-toggle {
    margin-left: auto;
}

.menu-toggle {
    margin-left: 8px;
}

/* 平板及以下设备 (768px及以下) */
@media (max-width: 768px) {

    /* === 标题栏优化 - 左对齐布局 === */
    .top-bar {
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid rgba(6, 182, 212, 0.15) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    .header-inner {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 12px !important;
    }

    /* 左侧：Logo和标题 */
    .logo {
        flex: 1;
        min-width: 0;
        /* 允许文字截断 */
    }

    .site-branding {
        display: flex !important;
        align-items: baseline !important;
        gap: 8px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
    }

    .site-title {
        font-size: 16px !important;
        font-weight: 700 !important;
        margin: 0 !important;
        flex-shrink: 0;
    }

    .site-title a {
        color: var(--slate-800) !important;
    }

    /* 网站描述显示在标题后 */
    .site-description {
        display: inline-block !important;
        font-size: 12px !important;
        color: var(--slate-500) !important;
        font-weight: 400 !important;
        margin: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    /* 右侧：按钮组 */
    .search-toggle,
    .menu-toggle {
        display: block;
        flex-shrink: 0;
    }

    /* 隐藏桌面搜索框 */
    .search-container {
        display: none !important;
    }

    /* === 导航菜单优化 === */
    .nav-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }

    .nav-pills {
        display: none;
        flex-direction: column !important;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 999;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        padding: 12px !important;
        gap: 4px !important;
    }

    .nav-pills.active {
        display: flex !important;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start !important;
        padding: 14px 16px !important;
    }

    /* === 内容区优化 === */
    .container,
    .main-grid {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .top-bar {
        padding: 12px 0 !important;
    }

    /* === 文章卡片优化 === */
    .blog-posts {
        gap: 16px !important;
    }

    .card,
    .blog-post-card {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        padding: 16px 12px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Hero卡片优化 */
    .hero-card {
        border-radius: 0 !important;
        margin-bottom: 16px !important;
        padding: 24px 16px !important;
        height: auto !important;
        min-height: 160px !important;
    }

    .hero-title {
        font-size: 20px !important;
        max-width: 100% !important;
        margin-bottom: 8px !important;
    }

    .hero-desc {
        font-size: 14px !important;
        max-width: 100% !important;
        margin-bottom: 12px !important;
    }

    .hero-tag {
        font-size: 10px !important;
        padding: 3px 10px !important;
    }

    /* 缩略图优化 */
    .blog-post-thumbnail {
        height: 200px !important;
        border-radius: 0 !important;
        margin-left: -12px !important;
        margin-right: -12px !important;
        margin-bottom: 12px !important;
        width: calc(100% + 24px) !important;
    }

    /* 文章标题优化 */
    .blog-post-title {
        font-size: 18px !important;
        line-height: 1.4 !important;
    }

    /* 文章摘要优化 */
    .blog-post-excerpt {
        font-size: 14px !important;
        line-height: 1.6 !important;
    }

    /* 按钮优化 */
    .btn-read-more {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }

    /* 文章底部区域 */
    .blog-post-footer {
        margin-top: 12px !important;
    }

    /* 文章元信息 */
    .blog-post-meta {
        font-size: 12px !important;
        gap: 10px !important;
        flex-wrap: wrap;
    }

    /* === 分页优化 === */
    .pagination {
        margin-top: 24px !important;
        padding: 0 12px !important;
    }

    .page-numbers {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
}

/* 超小屏优化 (480px及以下) */
@media (max-width: 480px) {
    .site-title {
        font-size: 16px !important;
    }

    .hero-title {
        font-size: 18px !important;
    }

    .blog-post-title {
        font-size: 16px !important;
    }

    .blog-post-thumbnail {
        height: 180px !important;
    }

    .card,
    .blog-post-card {
        padding: 12px 10px !important;
    }

    .blog-post-thumbnail {
        margin-left: -10px !important;
        margin-right: -10px !important;
        width: calc(100% + 20px) !important;
    }
}

/* ========== 移动端搜索弹窗 ========== */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    padding-top: 80px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.mobile-search-content {
    background: white;
    margin: 0 16px;
    width: calc(100% - 32px);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mobile-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-200);
}

.mobile-search-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--slate-800);
}

.mobile-search-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--slate-500);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.mobile-search-close:hover {
    color: var(--slate-700);
}

.mobile-search-form {
    padding: 20px;
}

.mobile-search-form form {
    display: flex;
    gap: 8px;
}

.mobile-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--slate-200);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.mobile-search-input:focus {
    border-color: var(--primary-500);
}

.mobile-search-submit {
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-search-submit:hover {
    background: var(--primary-600);
}