/* ========================================
   Lightbox 全屏查看器
   ======================================== */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
}

.lightbox-overlay.show {
    opacity: 1;
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-content iframe,
.lightbox-content video {
    width: 90vw;
    max-width: 1000px;
    aspect-ratio: 16/9;
    border: none;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}

/* 视频加载动画 */
.lightbox-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90vw;
    max-width: 1000px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    gap: 16px;
}

.lightbox-loading p {
    font-size: 15px;
    margin: 0;
}

.lightbox-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: lightbox-spin 0.8s linear infinite;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}

.lightbox-close {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: none;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-counter {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-weight: 600;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 18px;
    border-radius: 50px;
}

.lightbox-dots {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10001;
}

.lightbox-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-dot.active {
    background: #fff;
    transform: scale(1.3);
}

.lightbox-dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

.lightbox-caption {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    max-width: 600px;
    text-align: center;
    z-index: 10001;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* ========================================
   爱好模块 - 多图轮播
   ======================================== */
.hobby-carousel {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 8px;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.carousel-slide {
    flex: 0 0 100%;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.carousel-fallback {
    width: 100%;
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    color: var(--text-primary);
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
}

.hobby-carousel:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-md);
}

.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }

.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}

.carousel-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* ========================================
   作品集 - 详情按钮
   ======================================== */
.portfolio-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.portfolio-detail-btn,
.portfolio-ext-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.portfolio-detail-btn {
    background: var(--grad-primary);
    color: #fff;
    border: none;
}

.portfolio-detail-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.portfolio-ext-btn {
    background: var(--bg-tertiary);
    color: var(--c-purple);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.portfolio-ext-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--c-purple);
}

/* ========================================
   作品集详情页
   ======================================== */
.project-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 16px 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.project-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
}

.project-back:hover {
    color: var(--c-purple);
    gap: 12px;
}

.back-arrow {
    font-size: 20px;
}

.project-home-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

/* 项目 Hero */
.project-hero {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: flex-end;
    padding: 180px 0 80px;
    overflow: hidden;
}

.project-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.4);
}

.project-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 30%, rgba(0, 0, 0, 0.5) 100%);
}

.project-hero-content {
    position: relative;
    z-index: 2;
    color: #fff;
    max-width: 800px;
    width: 100%;
}

.project-hero-cat {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    padding: 6px 18px;
    border-radius: 50px;
    margin-bottom: 20px;
}

.project-hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.project-hero-desc {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 24px;
    line-height: 1.8;
}

.project-hero-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.project-hero-tech span {
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.project-hero-btn {
    font-size: 16px;
}

/* 项目详情内容 */
.project-body {
    padding: 80px 0;
}

.project-section {
    margin-bottom: 64px;
}

.project-section-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 24px;
    position: relative;
    padding-left: 20px;
}

.project-section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 28px;
    background: var(--grad-primary);
    border-radius: 3px;
}

.project-detail-desc p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
    margin-bottom: 16px;
}

/* 富文本正文（Markdown 渲染后） */
.project-rich-content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
}
.project-rich-content > *:first-child { margin-top: 0; }
.project-rich-content > *:last-child { margin-bottom: 0; }
.project-rich-content h1,
.project-rich-content h2,
.project-rich-content h3,
.project-rich-content h4,
.project-rich-content h5,
.project-rich-content h6 {
    color: var(--text-primary);
    font-weight: 800;
    line-height: 1.3;
    margin: 1.8em 0 0.6em;
}
.project-rich-content h1 { font-size: 2rem; }
.project-rich-content h2 { font-size: 1.6rem; padding-left: 14px; border-left: 5px solid var(--c-purple); }
.project-rich-content h3 { font-size: 1.3rem; }
.project-rich-content h4 { font-size: 1.15rem; }
.project-rich-content h5 { font-size: 1rem; }
.project-rich-content h6 { font-size: 0.9rem; color: var(--text-muted); }
.project-rich-content p {
    margin: 0 0 1.1em;
    color: var(--text-secondary);
}
.project-rich-content strong { color: var(--text-primary); font-weight: 700; }
.project-rich-content em { font-style: italic; color: var(--text-primary); }
.project-rich-content a {
    color: var(--c-purple);
    text-decoration: none;
    border-bottom: 1px solid rgba(102, 126, 234, 0.4);
    transition: var(--transition);
}
.project-rich-content a:hover {
    color: var(--c-pink, #ec4899);
    border-bottom-color: currentColor;
}
.project-rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 1.4em 0;
    box-shadow: var(--shadow-md);
    display: block;
}
.project-rich-content ul,
.project-rich-content ol {
    margin: 0 0 1.1em;
    padding-left: 1.8em;
}
.project-rich-content li {
    margin: 0.4em 0;
    line-height: 1.8;
}
.project-rich-content li::marker {
    color: var(--c-purple);
    font-weight: 700;
}
.project-rich-content blockquote {
    margin: 1.4em 0;
    padding: 14px 22px;
    background: rgba(102, 126, 234, 0.08);
    border-left: 4px solid var(--c-purple);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
    font-style: italic;
}
.project-rich-content blockquote p { margin: 0.4em 0; }
.project-rich-content code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: rgba(102, 126, 234, 0.12);
    color: var(--c-purple);
    padding: 2px 8px;
    border-radius: 4px;
    word-break: break-word;
}
.project-rich-content pre {
    background: var(--bg-tertiary, #1e1e38);
    color: #e4e4e7;
    padding: 18px 22px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.4em 0;
    line-height: 1.65;
    font-size: 0.92rem;
}
.project-rich-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}
.project-rich-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
    margin: 2.2em 0;
}
.project-rich-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
    font-size: 0.95rem;
}
.project-rich-content th,
.project-rich-content td {
    border: 1px solid var(--border-color, rgba(102, 126, 234, 0.2));
    padding: 10px 14px;
    text-align: left;
}
.project-rich-content th {
    background: rgba(102, 126, 234, 0.08);
    color: var(--text-primary);
    font-weight: 700;
}
[data-theme="dark"] .project-rich-content blockquote {
    background: rgba(102, 126, 234, 0.12);
}
[data-theme="dark"] .project-rich-content pre {
    background: #0a0e1a;
    color: #e4e4e7;
}

.project-section-image {
    margin: 24px 0;
}

.project-section-image img {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* 作品展示画廊 */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.gallery-figure {
    margin: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    background: #fff;
}

.gallery-figure:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.gallery-figure img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: var(--transition);
}

.gallery-figure:hover img {
    transform: scale(1.03);
}

.gallery-figure figcaption {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 单张大封面 */
.project-cover-large {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.project-cover-large:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* 未找到 */
.project-not-found {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 80px;
}

.not-found-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.project-not-found h2 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.project-not-found p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* 相关作品 */
.related-projects {
    padding: 80px 0;
    background: var(--bg-secondary);
}

.related-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 40px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.related-card {
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.related-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.related-cover {
    aspect-ratio: 16/10;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.related-emoji {
    font-size: 48px;
}

.related-info {
    padding: 20px;
}

.related-cat {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--c-purple);
    background: rgba(102, 126, 234, 0.1);
    padding: 3px 10px;
    border-radius: 50px;
    margin-bottom: 8px;
}

.related-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================================
   暗黑模式适配
   ======================================== */
[data-theme="dark"] .project-navbar {
    background: rgba(15, 15, 30, 0.9);
}

[data-theme="dark"] .gallery-figure,
[data-theme="dark"] .related-card {
    background: #1e1e38;
}

[data-theme="dark"] .project-cover-large {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
    .lightbox-container {
        padding: 40px 16px;
    }

    .lightbox-nav {
        width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }

    .project-gallery {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .project-hero {
        min-height: 50vh;
        padding: 100px 0 60px;
    }

    .project-body {
        padding: 50px 0;
    }

    .project-section {
        margin-bottom: 40px;
    }

    .project-section-title {
        font-size: 1.4rem;
    }
}
