/**
 * 插画详情页专用样式
 * 瀑布流布局 + 分类筛选 + 灯箱组件
 */

/* ========== 页面头部 ========== */
.page-header {
    padding: 100px 0 0;
    background: linear-gradient(180deg, #FDFBF7 0%, #F8FAFC 100%);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
    position: relative;
}

.back-link {
    position: absolute;
    left: 24px;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* ========== 分类筛选栏 ========== */
.filter-section {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
}

.filter-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-tag:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-tag.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.filter-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========== 瀑布流画廊 ========== */
.gallery-section {
    padding: 0 0 80px;
    background: #F8FAFC;
    min-height: 60vh;
}

.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 默认网格 - 职业头像 3:4 规格 */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    padding-top: 24px;
}

/* 手机壁纸规格网格 */
.masonry-grid--wallpaper {
    grid-template-columns: repeat(6, 1fr);
}

/* 方形头像规格网格 - 1:1 卡片，与职业头像统一 */
.masonry-grid--square {
    grid-template-columns: repeat(6, 1fr);
}

/* ========== 卡片样式 ========== */
.illustration-card {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    cursor: pointer;
}

/* 图片容器 - 默认 3:4 竖版（职业头像），圆角卡片 */
.illustration-image-wrapper {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    border-radius: 12px;
}

/* 手机壁纸规格 1170:2532 */
.illustration-image-wrapper--wallpaper {
    aspect-ratio: 1170 / 2532;
}

/* 方形头像规格 1200:1200 */
.illustration-image-wrapper--square {
    aspect-ratio: 1 / 1;
}

.illustration-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 400ms ease;
}

.illustration-card:hover .illustration-image {
    transform: scale(1.08);
}

/* 占位图样式 */
.illustration-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.8rem;
    gap: 8px;
}

.illustration-placeholder svg {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

/* 卡片信息覆盖层 - 悬停时显示 */
.illustration-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    transition: opacity 300ms ease;
}

.illustration-card:hover .illustration-info {
    opacity: 1;
}

.illustration-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    flex: 1;
    min-width: 0;
}

.illustration-category-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    padding: 4px 10px;
    color: white;
    border-radius: 6px;
    font-weight: 500;
    flex-shrink: 0;
}

/* ========== 加载更多按钮 ========== */
.load-more-container {
    text-align: center;
    margin-top: 48px;
}

.load-more-btn {
    padding: 14px 48px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.load-more-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.load-more-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* ========== 灯箱组件 ========== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 300ms ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
    position: relative;
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: var(--radius);
    overflow: visible;
    animation: lightboxIn 300ms ease;
}

@keyframes lightboxIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* 图片容器 - 3:4 比例，自适应高度 */
.lightbox-image-container {
    position: relative;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 90vw;
    transition: opacity 150ms ease;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
}

.lightbox-image-container.loading {
    opacity: 0;
}

.lightbox-image {
    display: block;
    max-height: 80vh;
    max-width: 90vw;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* 灯箱占位图 - 3:4 比例 */
.lightbox-placeholder {
    width: 540px;
    height: 720px;
    max-width: 90vw;
    max-height: 80vh;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    gap: 16px;
}

.lightbox-placeholder svg {
    width: 80px;
    height: 80px;
    opacity: 0.4;
}

.lightbox-placeholder span {
    font-size: 1.3rem;
    font-weight: 500;
}

.lightbox-info {
    padding: 14px 24px;
    background: white;
    border-radius: 0 0 var(--radius) var(--radius);
}

.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.lightbox-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.lightbox-category {
    display: inline-flex;
    align-items: center;
    font-size: 0.9rem;
    padding: 4px 10px;
    color: white;
    border-radius: 6px;
    font-weight: 500;
    flex-shrink: 0;
}

.lightbox-description {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.7;
}

/* 翻页按钮 - 放在弹窗两侧外部 */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background 200ms ease, box-shadow 200ms ease;
}

.lightbox-prev {
    left: -76px;
}

.lightbox-next {
    right: -76px;
}

.lightbox-prev svg,
.lightbox-next svg {
    width: 24px;
    height: 24px;
    color: #334155;
    transition: color 200ms ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: white;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.lightbox-prev:hover svg,
.lightbox-next:hover svg {
    color: var(--primary);
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ========== 响应式布局 ========== */

/* 平板端 (max-width: 1023px) */
@media (max-width: 1023px) {
    .page-header {
        padding-top: 90px;
        padding-bottom: 32px;
    }

    .header-container,
    .filter-container,
    .gallery-container {
        padding-left: 24px;
        padding-right: 24px;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .page-subtitle {
        font-size: 1.1rem;
    }

    .masonry-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    /* 手机壁纸规格 - 平板端 */
    .masonry-grid--wallpaper {
        grid-template-columns: repeat(3, 1fr);
    }

    /* 方形头像规格 - 平板端 */
    .masonry-grid--square {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 手机端 (max-width: 767px) */
@media (max-width: 767px) {
    .page-header {
        padding-top: 80px;
        padding-bottom: 24px;
    }

    .header-container,
    .filter-container,
    .gallery-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .filter-section {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .back-link {
        left: 16px;
        font-size: 0.9rem;
    }

    .back-link svg {
        width: 18px;
        height: 18px;
    }

    .page-title {
        font-size: 1.2rem;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    .filter-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-tags {
        flex-wrap: wrap;
    }

    .filter-tag {
        padding: 6px 16px;
        font-size: 0.85rem;
    }

    .filter-count {
        display: none;
    }

    .gallery-section {
        padding-bottom: 60px;
    }

    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* 手机壁纸规格 - 手机端 */
    .masonry-grid--wallpaper {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 方形头像规格 - 手机端 */
    .masonry-grid--square {
        grid-template-columns: repeat(2, 1fr);
    }

    .load-more-container {
        margin-top: 32px;
    }

    .load-more-btn {
        width: 100%;
        max-width: 300px;
    }

    /* 卡片信息区 */
    .illustration-info {
        padding: 12px;
    }

    .illustration-name {
        font-size: 0.8rem;
    }

    .illustration-category-tag {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    /* 灯箱响应式 */
    .lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
        animation: none;
    }

    .lightbox-image {
        max-height: 70vh;
        max-width: 95vw;
    }

    .lightbox-placeholder {
        width: 285px;
        height: 380px;
        max-width: 95vw;
        max-height: 70vh;
    }

    .lightbox-placeholder svg {
        width: 60px;
        height: 60px;
    }

    .lightbox-placeholder span {
        font-size: 1rem;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 44px;
        height: 44px;
        position: fixed;
        transition: none;
    }

    .lightbox-prev svg,
    .lightbox-next svg {
        width: 20px;
        height: 20px;
    }

    .lightbox-prev {
        left: 12px;
    }

    .lightbox-next {
        right: 12px;
    }

    .lightbox-info {
        padding: 10px 16px;
    }

    .lightbox-header {
        margin-bottom: 0;
    }

    .lightbox-title {
        font-size: 1.1rem;
    }

    .lightbox-category {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .lightbox-description {
        font-size: 0.85rem;
    }
}

/* 超小屏幕 (max-width: 375px) */
@media (max-width: 375px) {
    .page-title {
        font-size: 1.2rem;
    }

    .filter-tag {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
}
