/* ==========================================================
   首页改版 + 顶部导航
   ========================================================== */

:root {
    --home-accent: #c1531f;
    --home-accent-soft: #f3e4d8;
    --home-bg: #faf7f2;
    --home-card: #ffffff;
    --home-border: #efe9e1;
    --home-text: #1f1c19;
    --home-muted: #8a8178;
}

/* ---------- 顶部导航 ---------- */

@media screen and (min-width: 1081px) {
    html {
        scroll-padding-top: 90px;
    }
}

#header.header {
    display: block;
    max-width: none;
    margin: 0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--home-border);
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    height: 72px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.header-inner .logo-wrapper .logo {
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--home-accent);
    white-space: nowrap;
}

.header-inner .site-navbar {
    position: absolute;
    top: 0;
    left: 50%;
    height: 100%;
    margin-left: 0;
    transform: translateX(-50%);
}

.header-inner .menu {
    height: 100%;
    font-family: inherit;
}

.header-inner .menu-item {
    margin: 0 1.05rem;
    border-bottom: 2px solid transparent;
}

.header-inner .menu-item:hover,
.header-inner .menu-item.active {
    border-bottom-color: var(--home-accent);
}

.header-inner .menu-item .menu-item-link {
    font-size: 1rem;
    color: var(--home-text);
    white-space: nowrap;
}

.header-inner .menu-item:hover .menu-item-link,
.header-inner .menu-item.active .menu-item-link {
    color: var(--home-accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-left: auto;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #5c554d;
    transition: background 0.2s, color 0.2s;
}

.header-icon-btn:hover {
    background: var(--home-accent-soft);
    color: var(--home-accent);
}

.header-icon-btn .iconfont svg {
    width: 20px;
    height: 20px;
}

.header-about-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
    background: var(--home-accent);
    color: #fff;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    transition: opacity 0.2s, transform 0.2s;
}

.header-about-btn:hover {
    color: #fff;
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ---------- 搜索弹窗 ---------- */

.search-dialog {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(31, 26, 21, 0.42);
}

.search-dialog,
.search-dialog *,
.search-dialog *::before,
.search-dialog *::after {
    box-sizing: border-box;
}

.search-dialog-content {
    position: absolute;
    top: clamp(64px, 16vh, 170px);
    left: 50%;
    width: min(620px, calc(100vw - 2rem));
    max-height: min(70vh, 640px);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transform: translateX(-50%);
    background: var(--home-card);
    border: 1px solid var(--home-border);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(90, 50, 20, 0.22);
}

.search-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-dialog-head h3 {
    margin: 0 0 0.3rem;
    font-size: 1.35rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--home-text);
}

.search-dialog-head p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--home-muted);
}

.search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #f6f0e9;
    color: #7a7168;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.search-close:hover {
    background: var(--home-accent-soft);
    color: var(--home-accent);
}

.search-input {
    width: 100%;
    height: 52px;
    padding: 0 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--home-text);
    background: #fdfbf8;
    border: 1px solid #e7ddd2;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-input::placeholder {
    color: #b3aaa1;
}

.search-input:focus {
    background: #fff;
    border-color: var(--home-accent);
    box-shadow: 0 0 0 3px rgba(193, 83, 31, 0.12);
}

.search-results {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    overflow-y: auto;
    max-height: 46vh;
}

.search-results li {
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    color: var(--home-muted);
}

.search-results li a {
    display: block;
    margin: -0.7rem -0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--home-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.search-results li a:hover {
    background: var(--home-accent-soft);
    color: var(--home-accent);
}

.search-results li a.search-more {
    color: var(--home-accent);
    font-weight: 600;
}

/* ---------- 首页整体 ---------- */

main:has(> .home-page) {
    padding: 0;
    background: var(--home-bg);
}

.home-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
    color: var(--home-text);
    box-sizing: border-box;
}

.home-page *,
.home-page *::before,
.home-page *::after {
    box-sizing: border-box;
}

/* ---------- 左侧个人卡 ---------- */

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 2rem;
}

.home-profile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    background: var(--home-card);
    border: 1px solid var(--home-border);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(60, 40, 20, 0.04);
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-avatar {
    flex: 0 0 auto;
    width: 128px;
    height: 128px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--home-accent-soft);
    border: 4px solid #fff;
    box-shadow: 0 6px 18px rgba(120, 70, 30, 0.12);
}

.profile-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    min-width: 0;
}

.profile-name {
    margin: 0 0 0.6rem;
    font-size: clamp(1.6rem, 1.15rem + 0.9vw, 2rem);
    font-weight: 700;
    line-height: 1.25;
    font-family: inherit;
    white-space: nowrap;
}

.profile-subtitle {
    margin: 0 0 1rem;
    font-size: 0.92rem;
    line-height: 1.7;
    color: #6f675f;
}

.profile-badge {
    display: inline-block;
    padding: 0.5rem 1.15rem;
    border-radius: 999px;
    background: var(--home-accent);
    color: #fff;
    font-size: 0.88rem;
    letter-spacing: 0.03em;
}

.profile-stats {
    display: flex;
    gap: 2.5rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--home-border);
}

.profile-stat strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--home-accent);
    line-height: 1.3;
}

.profile-stat span {
    font-size: 0.82rem;
    color: var(--home-muted);
}

/* ---------- 右侧分类卡 ---------- */

.home-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
}

.category-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 160px;
    padding: 1.75rem;
    background: var(--home-card);
    border: 1px solid var(--home-border);
    border-radius: 16px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: #e7d6c8;
    box-shadow: 0 12px 30px rgba(120, 70, 30, 0.08);
}

.category-card-text {
    min-width: 0;
}

.category-card-text h2 {
    margin: 0 0 0.4rem;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--home-text);
    overflow-wrap: break-word;
}

.category-card-text p {
    margin: 0 0 0.7rem;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--home-muted);
    overflow-wrap: break-word;
}

.category-count {
    font-size: 0.78rem;
    color: var(--home-accent);
}

.category-card-icon {
    flex: 0 0 auto;
    color: #d8c3b0;
    transition: color 0.2s;
}

.category-card:hover .category-card-icon {
    color: var(--home-accent);
}

.category-icon {
    width: 64px;
    height: 64px;
}

/* ---------- 最近更新 ---------- */

.home-recent {
    margin-top: 3.5rem;
}

.home-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.home-section-head h2 {
    margin: 0;
    font-size: 1.7rem;
    font-weight: 700;
    font-family: inherit;
}

.home-section-more {
    font-size: 0.82rem;
    letter-spacing: 0.05em;
    color: var(--home-muted);
    transition: color 0.2s;
}

.home-section-more:hover {
    color: var(--home-accent);
}

.home-post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}

.home-post-card {
    background: var(--home-card);
    border: 1px solid var(--home-border);
    border-radius: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.home-post-card:nth-child(2) {
    background: #fdf9f3;
}

.home-post-card:nth-child(3) {
    background: #fbf2e9;
}

.home-post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(120, 70, 30, 0.08);
}

.home-post-link {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 230px;
    height: 100%;
    padding: 1.75rem;
    color: inherit;
}

.home-post-text {
    min-width: 0;
}

.home-post-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--home-muted);
}

.home-post-section {
    color: var(--home-accent);
}

.home-post-title {
    margin: 0 0 0.75rem;
    font-size: 1.18rem;
    font-weight: 600;
    line-height: 1.55;
    font-family: inherit;
    color: var(--home-text);
    transition: color 0.2s;
    overflow-wrap: break-word;
}

.home-post-link:hover .home-post-title {
    color: var(--home-accent);
}

.home-post-summary {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.7;
    color: var(--home-muted);
    overflow-wrap: break-word;
}

.home-post-art {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
    color: #dcc7b3;
}

.home-post-icon {
    width: 46px;
    height: 46px;
}

/* ---------- 响应式 ---------- */

@media screen and (max-width: 1080px) {
    #header.header {
        position: static;
        padding: 50px 0 0;
        background: transparent;
        border-bottom: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .header-inner {
        display: none;
    }
}

@media screen and (max-width: 1180px) {
    .home-hero {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media screen and (max-width: 1024px) {
    .home-post-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 720px) {
    .home-page {
        padding: 2rem 1rem 3rem;
    }

    .home-categories,
    .home-post-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .home-post-card:nth-child(n) {
        background: var(--home-card);
    }

    .profile-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-avatar {
        width: 96px;
        height: 96px;
    }

    .profile-name {
        font-size: 1.6rem;
    }

    .profile-stats {
        gap: 2rem;
    }

    .home-post-link {
        min-height: 0;
    }
}