/* 
 * 项目详情弹窗样式层 (Project Modal Layer) - v3.8
 * -------------------------------------------
 * 用途：负责“精选项目”点击后的全屏/浮层详情展示，包含图库、参数列表和描述。
 * 设计：支持深色/浅色模式切换，移动端自动转为全屏覆盖模式以优化阅读体验。
 * 
 * 主要内容：
 * 1. 弹窗外层容器 & 毛玻璃背景 (.project-modal)
 * 2. 内容主体及深色模式适配 (.modal-content)
 * 3. 媒体展示区 (图片/视频容器)
 * 4. 项目参数网格 (Meta Grid: 类别、地点、日期等)
 * 5. 移动端全屏覆盖逻辑 (@media max-width: 768px)
 * 6. 扩展图库网格 (.modal-gallery-section)
 */

.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    /* Topmost */
    opacity: 0;
    pointer-events: none;
    /* Click-through when hidden */
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.6);
    /* Backdrop */
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-modal.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Content Container */
.project-modal .modal-content {
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 20px;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Dark Mode Support */
body:not(.light-mode) .project-modal .modal-content {
    background: #1e1e1e;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Image Section */
.project-modal .modal-image-container {
    width: 100%;
    height: 300px;
    overflow: hidden;
    position: relative;
}

.project-modal .modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Details Section */
.project-modal .modal-details {
    padding: 30px;
}

.project-modal .modal-tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent-color, #d4af37);
    color: #fff;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.project-modal .modal-title {
    font-size: 2rem;
    font-family: 'Playfair Display', serif;
    margin-bottom: 15px;
    line-height: 1.2;
}

.project-modal .modal-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 30px;
}

body:not(.light-mode) .project-modal .modal-description {
    color: #ccc;
}

/* Meta Grid */
.project-modal .modal-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body:not(.light-mode) .project-modal .modal-meta-grid {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.project-modal .modal-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #444;
}

body:not(.light-mode) .project-modal .modal-meta-item {
    color: #ddd;
}

/* Close Button */
.project-modal .modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    color: #000;
}

body:not(.light-mode) .project-modal .modal-close-btn {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.project-modal .modal-close-btn:hover {
    transform: scale(1.1);
}

/* =========================================
   MOBILE FULL SCREEN OVERRIDE (For User)
   ========================================= */
@media (max-width: 768px) {

    /* V45: Full Screen Opaque Overlay */
    .project-modal {
        background: #000;
        z-index: 999999;
    }

    .project-modal .modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .project-modal .modal-image-container {
        height: 40vh;
        /* Larger image on mobile */
        flex-shrink: 0;
    }

    .project-modal .modal-details {
        padding: 24px;
        flex: 1;
        overflow-y: auto;
    }

    .project-modal .modal-title {
        font-size: 1.8rem;
    }

    .project-modal .modal-close-btn {
        top: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.5);
        /* Always dark bg on mobile over image */
        color: #fff;
    }
}

/* --- GALLERY EXTENSION (V55) --- */
.modal-gallery-section {
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
}

body:not(.light-mode) .modal-gallery-section {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .modal-gallery-section {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.gallery-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-weight: 500;
    opacity: 0.8;
}

.modal-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.gallery-item {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

/* Mobile specific for gallery */
@media (max-width: 768px) {
    .modal-gallery-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeInImg {
    from {
        opacity: 0.5;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeInImg 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}