* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #fafafa;
    transition: background-color 0.3s ease, color 0.3s ease;
}

@keyframes goldFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== 导航栏 ===== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #d4a017, #f5d76e, #d4a017, #f5d76e);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldFlow 4s ease infinite;
    cursor: default;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
}

.theme-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.theme-btn .icon-sun,
.theme-btn .icon-moon {
    position: absolute;
    transition: all 0.3s ease;
}

.theme-btn .icon-moon {
    opacity: 0;
    transform: scale(0.5);
}

.dark-mode .theme-btn .icon-sun {
    opacity: 0;
    transform: scale(0.5);
}

.dark-mode .theme-btn .icon-moon {
    opacity: 1;
    transform: scale(1);
}

.dark-mode .theme-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ===== Hero 区域 ===== */
#hero {
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 40px;
    background: linear-gradient(180deg, #fefcf5 0%, #fafafa 100%);
    transition: background 0.3s ease;
}

#hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #d4a017, #f5d76e, #d4a017);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldFlow 4s ease infinite;
    margin-bottom: 12px;
}

#hero .subtitle {
    font-size: 1.1rem;
    color: #999;
    font-weight: 400;
}

#hero .tagline {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #bbb;
}

/* ===== 搜索栏 ===== */
.search-section {
    padding: 0 24px;
    display: flex;
    justify-content: center;
}

.search-wrapper {
    width: 100%;
    max-width: 560px;
}

.search-box {
    display: flex;
    align-items: center;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e8e0d0;
    border-radius: 50px;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: #d4a017;
    box-shadow: 0 4px 20px rgba(212, 160, 23, 0.12);
}

.search-icon {
    color: #ccc;
    font-size: 1.1rem;
    margin-right: 10px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    padding: 14px 0;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: #333;
    outline: none;
    min-width: 0;
}

.search-input::placeholder {
    color: #ccc;
}

.search-clear {
    display: none;
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 4px 4px 8px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.search-clear:hover {
    color: #999;
}

.search-clear.show {
    display: block;
}

/* ===== 分类筛选按钮 ===== */
.categories-section {
    padding: 28px 24px 20px;
    display: flex;
    justify-content: center;
}

.categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.cat-btn {
    padding: 8px 20px;
    border: 1px solid #e8e0d0;
    border-radius: 50px;
    background: #ffffff;
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.cat-btn:hover {
    color: #d4a017;
    border-color: #f5d76e;
    background: rgba(212, 160, 23, 0.05);
}

.cat-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #d4a017, #f5d76e);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.25);
}

/* ===== 卡片区域 ===== */
.cards-section {
    padding: 10px 24px 60px;
    display: flex;
    justify-content: center;
}

.cards-container {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== 公众号风格卡片 ===== */
.project-card {
    display: flex;
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.4s ease both;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 160, 23, 0.12);
    border-color: #f5d76e;
}

.project-card.hidden {
    display: none;
}

.card-thumb {
    width: 140px;
    min-height: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    position: relative;
    overflow: hidden;
}

.card-thumb-img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    display: block;
}

.card-thumb::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background: linear-gradient(180deg, #f5d76e, #d4a017);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .card-thumb::after {
    opacity: 1;
}

.card-body {
    flex: 1;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
    transition: color 0.3s ease;
}

.project-card:hover .card-title {
    color: #d4a017;
}

.card-desc {
    font-size: 0.88rem;
    color: #888;
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0;
}

.card-tags {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}

.card-tags::-webkit-scrollbar {
    display: none;
}

.card-tag {
    flex-shrink: 0;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(212, 160, 23, 0.1);
    color: #d4a017;
    white-space: nowrap;
}

.card-date {
    font-size: 0.78rem;
    color: #bbb;
    margin-left: auto;
    flex-shrink: 0;
}

/* ===== 无结果提示 ===== */
.no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.no-results.show {
    display: flex;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results-text {
    font-size: 1rem;
    color: #999;
    font-weight: 500;
}

.no-results-hint {
    font-size: 0.85rem;
    color: #ccc;
    margin-top: 6px;
}

/* ===== 底部结束标记 ===== */
.no-more {
    text-align: center;
    padding: 40px 24px 60px;
    color: #ccc;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

/* =============================================
   暗夜模式
   ============================================= */
body.dark-mode {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode #navbar {
    background: rgba(26, 26, 46, 0.92);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode #hero {
    background: linear-gradient(180deg, #1e1e3a 0%, #1a1a2e 100%);
}

body.dark-mode #hero .subtitle {
    color: #aaa;
}

body.dark-mode #hero .tagline {
    color: #666;
}

body.dark-mode .search-box {
    background: #252545;
    border-color: #3a3a5c;
}

body.dark-mode .search-box:focus-within {
    border-color: #f5d76e;
    box-shadow: 0 4px 20px rgba(245, 215, 110, 0.1);
}

body.dark-mode .search-icon {
    color: #555;
}

body.dark-mode .search-input {
    color: #e0e0e0;
}

body.dark-mode .search-input::placeholder {
    color: #555;
}

body.dark-mode .search-clear {
    color: #555;
}

body.dark-mode .search-clear:hover {
    color: #888;
}

body.dark-mode .cat-btn {
    background: #252545;
    border-color: #3a3a5c;
    color: #999;
}

body.dark-mode .cat-btn:hover {
    color: #f5d76e;
    border-color: #f5d76e;
    background: rgba(245, 215, 110, 0.08);
}

body.dark-mode .cat-btn.active {
    color: #fff;
    background: linear-gradient(135deg, #d4a017, #f5d76e);
    border-color: transparent;
}

body.dark-mode .project-card {
    background: #252545;
    border-color: #3a3a5c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark-mode .project-card:hover {
    border-color: #f5d76e;
    box-shadow: 0 8px 24px rgba(245, 215, 110, 0.08);
    background: linear-gradient(135deg, #2a2a50, #252545);
}

body.dark-mode .card-title {
    color: #e0e0e0;
}

body.dark-mode .project-card:hover .card-title {
    color: #f5d76e;
}

body.dark-mode .card-desc {
    color: #888;
}

body.dark-mode .card-tag {
    background: rgba(245, 215, 110, 0.12);
    color: #f5d76e;
}

body.dark-mode .card-date {
    color: #555;
}

body.dark-mode .no-results-text {
    color: #888;
}

body.dark-mode .no-results-hint {
    color: #555;
}

body.dark-mode .no-more {
    color: #444;
}

/* =============================================
   响应式
   ============================================= */
@media (max-width: 768px) {
    #hero {
        min-height: 35vh;
        padding: 100px 20px 32px;
    }

    #hero h1 {
        font-size: 2.5rem;
    }

    #hero .subtitle {
        font-size: 1rem;
    }

    .search-box {
        padding: 0 16px;
    }

    .search-input {
        padding: 12px 0;
        font-size: 0.9rem;
    }

    .categories {
        gap: 8px;
    }

    .cat-btn {
        padding: 6px 16px;
        font-size: 0.85rem;
    }

    .cards-section {
        padding: 6px 16px 40px;
    }

    .cards-container {
        gap: 12px;
    }

    .project-card {
        border-radius: 10px;
    }

    .card-thumb {
        width: 110px;
        min-height: 110px;
        font-size: 2.2rem;
    }

    .card-body {
        padding: 14px 14px 14px 12px;
    }

    .card-title {
        font-size: 0.95rem;
    }

    .card-desc {
        font-size: 0.82rem;
        -webkit-line-clamp: 2;
    }

    .no-more {
        padding: 30px 16px 40px;
    }
}

@media (max-width: 480px) {
    #hero h1 {
        font-size: 2rem;
    }

    .card-thumb {
        width: 90px;
        min-height: 100px;
        font-size: 1.8rem;
    }

    .card-body {
        padding: 12px 12px 12px 10px;
    }

    .card-title {
        font-size: 0.9rem;
    }

    .card-desc {
        font-size: 0.78rem;
        -webkit-line-clamp: 2;
        margin-bottom: 8px;
    }

    .card-tag {
        font-size: 0.7rem;
        padding: 1px 8px;
    }

    .card-date {
        font-size: 0.72rem;
    }
}
