/* ============================================================
   首页专属样式
   加载于：index.html
   ============================================================ */

/* ============================================
   Hero
   ============================================ */
.hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.5rem 0 2rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.75rem;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    border: 2px solid var(--border-subtle);
    transition: transform 0.3s var(--ease-out), border-color 0.2s;
}
.avatar:hover {
    transform: scale(1.04);
    border-color: var(--accent);
}

.hero-text {
    flex: 1;
    min-width: 0;
}

.hero-name {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.4rem;
    line-height: 1.2;
}

.hero-bio {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.hero-social {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}
.hero-social a {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    font-size: 1.15rem;
    text-decoration: none;
    transition: all 0.2s var(--ease-out);
}
.hero-social a:hover {
    color: var(--accent);
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ============================================
   通用区块
   ============================================ */
.section {
    margin-top: 2.25rem;
}
.section:first-of-type {
    margin-top: 0;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}
.section-label i {
    color: var(--accent);
    font-size: 0.95em;
}

.section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-strong), transparent);
}

.section-more {
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.02em;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    transition:
        background 0.2s ease,
        transform 0.2s var(--ease-out);
}
.section-more:hover {
    background: var(--accent-soft);
    transform: translateX(2px);
}
.section-more i {
    font-size: 0.85em;
    transition: transform 0.2s var(--ease-out);
}
.section-more:hover i {
    transform: translateX(2px);
}

.section-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-size: 0.92rem;
}

/* ============================================
   文章列表
   ============================================ */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.article-item {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    color: inherit;
    min-width: 0;
    position: relative;
    transition:
        transform 0.24s var(--ease-out),
        border-color 0.24s ease,
        background 0.24s ease,
        box-shadow 0.24s ease;
    animation: articleIn 0.5s var(--ease-out) backwards;
    animation-delay: min(calc(var(--i, 0) * 50ms), 500ms);
}

@keyframes articleIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.article-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 10px 28px -16px var(--accent-soft);
}
.article-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.article-item-cover {
    width: 152px;
    height: 96px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    transition: transform 0.32s var(--ease-out);
}
.article-item:hover .article-item-cover {
    transform: scale(1.02);
}

/* 无封面时左侧装饰条 */
.article-item:not(.has-cover)::before {
    content: '';
    width: 3px;
    align-self: stretch;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--accent), transparent);
    opacity: 0.5;
    margin-right: -0.35rem;
    transition: opacity 0.24s ease;
}
.article-item:not(.has-cover):hover::before {
    opacity: 1;
}

.article-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.article-item-title {
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-item-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.article-item-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.1rem;
}
.article-item-meta i {
    color: var(--accent);
    font-size: 0.85em;
    opacity: 0.85;
}

.article-item-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    font-size: 0.85rem;
    opacity: 0.5;
    transform: translateX(-4px);
    transition:
        opacity 0.24s ease,
        transform 0.24s var(--ease-out),
        color 0.24s ease,
        background 0.24s ease;
}
.article-item:hover .article-item-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--accent);
    background: var(--accent-soft);
}

/* 封面异步加载淡入 */
.article-item-cover.cover-loaded {
    animation: coverIn 0.5s var(--ease-out) backwards;
}
@keyframes coverIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

/* ============================================
   瀑布流（Pinterest 风格）
   ============================================ */
.masonry {
    column-count: 2;
    column-gap: 0.9rem;
}
@media (min-width: 640px) {
    .masonry { column-count: 3; }
}
@media (min-width: 1024px) {
    .masonry { column-count: 4; }
}
@media (min-width: 1400px) {
    .masonry { column-count: 5; }
}

/* ------------------------------------------------------------
   .masonry-item
   - border-radius + overflow: hidden 做圆角
   - transform: translateZ(0) 强制 GPU 光栅化，消除半屏小数列宽
     下的子像素抗锯齿"裂缝"
   - isolation: isolate 独立层叠上下文
   ------------------------------------------------------------ */
.masonry-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;

    margin: 0 0 0.9rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    display: block;
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: left;

    position: relative;

    /* 圆角：border-radius + overflow: hidden */
    border-radius: 12px;
    overflow: hidden;

    /* 强制 GPU 光栅化 */
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    isolation: isolate;

    transition:
        transform 0.32s var(--ease-out),
        box-shadow 0.32s ease;

    animation: masonryIn 0.55s var(--ease-out) backwards;
    animation-delay: min(calc(var(--i, 0) * 30ms), 500ms);
}

@keyframes masonryIn {
    from { opacity: 0; transform: translateZ(0) translateY(10px) scale(0.985); }
    to   { opacity: 1; transform: translateZ(0) translateY(0) scale(1); }
}

/* 内衬：盖住圆角边缘 1px 抗锯齿缝隙，颜色与页面主背景一致 */
.masonry-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px var(--bg-secondary);
    z-index: 1;
}

.masonry-item:hover {
    transform: translateZ(0) translateY(-3px);
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .masonry-item:hover {
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16);
}
.masonry-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.masonry-item img {
    display: block;
    width: 100%;
    height: auto;
    background: var(--bg-tertiary);
    opacity: 0;
    transition: opacity 0.45s ease;
}
.masonry-item img.loaded { opacity: 1; }

.masonry-item .masonry-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.8rem 0.9rem 0.75rem;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
    color: #fff;
    opacity: 0;
    transform: translateY(6px);
    transition:
        opacity 0.28s ease,
        transform 0.32s var(--ease-out);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 2;
}
.masonry-item:hover .masonry-overlay,
.masonry-item:focus-visible .masonry-overlay {
    opacity: 1;
    transform: translateY(0);
}

.masonry-overlay-title {
    font-size: 0.92rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.masonry-overlay-meta {
    font-size: 0.76rem;
    opacity: 0.8;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

/* ============================================
   灯箱
   ============================================ */
body.lightbox-lock { overflow: hidden; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
}
.lightbox[hidden] { display: none; }
.lightbox.lightbox-open { display: block; }

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 6, 14, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.lightbox.lightbox-visible .lightbox-backdrop { opacity: 1; }

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.15rem;
    cursor: pointer;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    transition:
        opacity 0.3s ease 0.1s,
        transform 0.35s var(--ease-out) 0.1s,
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}
.lightbox.lightbox-visible .lightbox-close {
    opacity: 1;
    transform: scale(1);
}
.lightbox-close:hover {
    color: #fff;
    border-color: var(--accent);
    background: rgba(111, 203, 214, 0.18);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition:
        opacity 0.3s ease 0.1s,
        transform 0.35s var(--ease-out) 0.1s,
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}
.lightbox.lightbox-visible .lightbox-nav {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-nav:hover {
    color: #fff;
    border-color: var(--accent);
    background: rgba(111, 203, 214, 0.18);
}
.lightbox-prev:hover { transform: translateY(-50%) translateX(-2px) scale(1); }
.lightbox-next:hover { transform: translateY(-50%) translateX(2px) scale(1); }

.lightbox-nav[disabled] {
    opacity: 0.25 !important;
    pointer-events: none;
}

.lightbox-stage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 70px 90px 40px;
    gap: 1rem;
    pointer-events: none;
    z-index: 2;
}

.lightbox-image-wrap {
    max-width: 100%;
    max-height: calc(100vh - 220px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 220px);
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
    display: block;
    opacity: 0;
    transform: scale(0.82);
    transition:
        opacity 0.36s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.46s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}
.lightbox-image.lb-in {
    opacity: 1;
    transform: scale(1);
}

.lightbox-caption {
    max-width: 720px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.4s ease 0.15s,
        transform 0.48s var(--ease-out) 0.15s;
}
.lightbox.lightbox-visible .lightbox-caption {
    opacity: 1;
    transform: translateY(0);
}

.lightbox-caption-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.lightbox-title {
    font-size: 1.05rem;
    font-weight: 500;
    color: #fff;
}

.lightbox-date {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    font-variant-numeric: tabular-nums;
}

.lightbox-counter {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 780px) {
    .hero {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.25rem 0 1.5rem;
        margin-bottom: 1.5rem;
    }
    .avatar { width: 72px; height: 72px; }
    .hero-name { font-size: 1.5rem; }
    .hero-bio { font-size: 0.95rem; }
    .hero-social { width: 100%; gap: 0.5rem; }
    .hero-social a {
        width: 42px;
        height: 42px;
        font-size: 1.05rem;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
    .lightbox-close {
        top: 14px;
        right: 14px;
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    .lightbox-stage { padding: 60px 60px 40px; }
    .lightbox-image,
    .lightbox-image-wrap {
        max-height: calc(100vh - 200px);
    }
    .lightbox-title { font-size: 0.98rem; }
    .lightbox-date { font-size: 0.8rem; }
}

@media (max-width: 640px) {
    .article-item {
        padding: 0.85rem 0.9rem;
        gap: 0.85rem;
    }
    .article-item-cover {
        width: 100px;
        height: 68px;
    }
    .article-item-desc { display: none; }
    .article-item-title {
        font-size: 1rem;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

@media (max-width: 460px) {
    .hero-name { font-size: 1.35rem; }
    .hero-bio { font-size: 0.9rem; }
    .article-item-meta { display: none; }

    .masonry { column-gap: 0.6rem; }
    .masonry-item { margin-bottom: 0.6rem; }

    .lightbox-stage { padding: 60px 12px 100px; }
    .lightbox-image,
    .lightbox-image-wrap {
        max-height: calc(100vh - 220px);
    }
}

/* ============================================
   减少动画
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .article-item,
    .article-item-cover,
    .article-item-arrow,
    .masonry-item,
    .masonry-item img,
    .masonry-overlay,
    .lightbox-backdrop,
    .lightbox-image,
    .lightbox-caption,
    .lightbox-close,
    .lightbox-nav {
        animation: none !important;
        transition: none !important;
    }
    .lightbox-image { opacity: 1 !important; transform: none !important; }
    .lightbox-close,
    .lightbox-nav { opacity: 1 !important; }
}