/* =========================================
   Section 2: Gallery — Desktop First
   Desktop (>1024): 横向滚动轮播
   Tablet (769-1024): 横向滚动，小卡片
   Mobile (<=768): 纵向滚动列表
   ========================================= */

/* --- Base / Desktop --- */
.gallery-section {
    position: absolute; top: 100vh; left: 0; width: 100%; height: 100vh;
    background-color: var(--gallery-bg); z-index: 30;
    display: flex; flex-direction: column; justify-content: center;
    /* clip-path: inset(100% 0 0 0); 移除可能有兼容性问题的 clip-path，改用真实的物理 top 位移 */
    transform: translateZ(0);
    overflow: hidden;
    box-shadow: inset 0 20px 100px rgba(0,0,0,0.5);
    background-image: radial-gradient(circle at 50% 50%, rgba(20,20,20,0) 0%, rgba(0,0,0,0.4) 100%);
}

#dither-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; opacity: 0.6; mix-blend-mode: overlay;
}

/* Header */
.gallery-header-fixed {
    position: relative; z-index: 40;
    width: 100%; text-align: center;
    padding: 0 4vw; margin-bottom: 40px;
    color: var(--gallery-text);
    opacity: 0; transform: translateY(40px);
}
.gallery-header-fixed h2 {
    font-size: 64px; font-weight: 900; letter-spacing: -2.5px;
    margin-bottom: 16px; line-height: 1.1;
    background: linear-gradient(180deg, #FFF 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.gallery-header-fixed .gallery-sub {
    font-size: 16px; color: rgba(245,239,230,0.6);
    font-family: 'Space Mono', monospace; letter-spacing: 0.5px; margin-bottom: 8px;
}
.gallery-header-fixed .gallery-powered {
    font-size: 14px; color: rgba(245,239,230,0.4);
    font-family: 'Inter', sans-serif;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* CTA Button */
.gallery-cta {
    display: inline-flex; align-items: center; justify-content: center;
    height: 48px; padding: 0 36px; margin-top: 28px;
    font-size: 15px; font-weight: 600; font-family: inherit;
    color: #fff; background: linear-gradient(135deg, var(--accent-orange), #C44C00);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
    cursor: pointer; transition: all 0.3s cubic-bezier(0.25,1,0.5,1);
    box-shadow: 0 4px 15px rgba(232,93,4,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
.gallery-cta:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(232,93,4,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
    background: linear-gradient(135deg, #FF6B1A, #D65503);
}

/* 横向轮播轨道 */
.carousel-container {
    width: 100%; overflow: visible; position: relative; z-index: 1;
    mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}
.carousel-track {
    display: flex; flex-direction: row; gap: 40px;
    padding: 20px calc(50vw - 220px); /* 动态 padding 保证最后一张完美居中 */
    width: max-content; align-items: center;
}

/* 优化卡片样式 */
.card {
    width: 440px; flex-shrink: 0;
    background: linear-gradient(145deg, rgba(30,30,35,0.7), rgba(15,15,18,0.8));
    border: 1px solid rgba(255,255,255,0.06);
    border-top: 1px solid rgba(255,255,255,0.18);
    border-left: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-radius: 20px; padding: 24px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
    opacity: 0; cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.6s ease, background 0.6s ease;
}
.card:hover {
    transform: translateY(-20px) scale(1.04);
    background: linear-gradient(145deg, rgba(40,40,45,0.85), rgba(20,20,24,0.95));
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 50px 100px rgba(0,0,0,0.8), 0 0 0 1px rgba(232,93,4,0.6), 0 0 60px rgba(232,93,4,0.2);
}

/* Thumbnail */
.card-thumb {
    height: 270px; border-radius: 14px; background: #000;
    margin-bottom: 28px; position: relative; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 8px 30px rgba(0,0,0,0.8), 0 10px 30px rgba(0,0,0,0.3);
    transform: translateZ(0);
}
.card-thumb::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 36px;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.15); z-index: 2;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.card-thumb::after {
    content: ''; position: absolute; top: 15px; left: 18px;
    width: 7px; height: 7px; background: #FF5F56; border-radius: 50%;
    box-shadow: 16px 0 0 #FFBD2E, 32px 0 0 #27C93F, inset 0 1px 2px rgba(255,255,255,0.5); z-index: 3; opacity: 0.9;
}

/* iframe wrapper & iframe */
.thumb-iframe-wrap {
    position: absolute; top: 36px; left: 0;
    width: 100%; height: calc(100% - 36px);
    overflow: hidden; border-radius: 0 0 13px 13px;
}
.thumb-iframe {
    position: absolute; top: 0; left: 0;
    width: 1440px; height: 900px; border: none;
    transform: scale(0.29); transform-origin: top left;
    pointer-events: none; opacity: 0.55;
    transition: opacity 0.8s ease, filter 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    filter: saturate(0.5) contrast(1.1) brightness(0.8);
}
.card:hover .thumb-iframe {
    opacity: 1; transform: scale(0.30);
    filter: saturate(1.2) contrast(1.15) brightness(1.05);
}

/* Card info */
.card-info { padding: 0 6px; }
.card-title {
    font-size: 26px; font-weight: 900; color: #FFF;
    margin-bottom: 12px; letter-spacing: -0.8px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.6), 0 1px 1px rgba(0,0,0,0.8);
}
.card-desc {
    font-size: 16px; color: rgba(245,239,230,0.75);
    line-height: 1.65; margin-bottom: 24px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.card-tag {
    display: inline-flex; align-items: center;
    font-size: 13px; color: #FFB380;
    background: linear-gradient(90deg, rgba(232,93,4,0.15), rgba(232,93,4,0.05));
    padding: 8px 18px; border-radius: 30px;
    border: 1px solid rgba(232,93,4,0.3);
    font-family: 'Space Mono', monospace; font-weight: 700; letter-spacing: 1px;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
.card:hover .card-tag {
    background: linear-gradient(90deg, rgba(232,93,4,0.25), rgba(232,93,4,0.1));
    border-color: rgba(232,93,4,0.5);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.15), 0 4px 8px rgba(232,93,4,0.1);
}

/* ========== Tablet (769px - 1024px) ========== */
@media (max-width: 1024px) and (min-width: 769px) {
    .gallery-header-fixed h2 { font-size: 48px; letter-spacing: -1.5px; }
    .gallery-header-fixed .gallery-sub { font-size: 14px; }
    .gallery-header-fixed { margin-bottom: 28px; }
    .gallery-cta { height: 42px; padding: 0 28px; font-size: 14px; }
    .carousel-track { gap: 28px; padding: 16px 8vw; }
    .card { width: 340px; padding: 18px; border-radius: 16px; }
    .card-thumb { height: 200px; border-radius: 12px; margin-bottom: 18px; }
    .card-thumb::before { height: 28px; }
    .card-thumb::after { top: 11px; left: 14px; width: 6px; height: 6px; box-shadow: 12px 0 0 #FFBD2E, 24px 0 0 #27C93F; }
    .thumb-iframe-wrap { top: 28px; height: calc(100% - 28px); border-radius: 0 0 11px 11px; }
    .thumb-iframe { transform: scale(0.22); }
    .card:hover .thumb-iframe { transform: scale(0.23); }
    .card-title { font-size: 18px; margin-bottom: 8px; }
    .card-desc { font-size: 13px; margin-bottom: 14px; }
    .card-tag { font-size: 11px; padding: 5px 12px; }
}

/* ========== Mobile (<=768px) ========== */
@media (max-width: 768px) {
    .gallery-section {
        flex-direction: column; justify-content: flex-start;
        padding-top: 10vh;
    }
    .gallery-header-fixed {
        width: 100%; margin-bottom: 16px; padding: 0 6vw;
        transform: translateY(0) !important;
    }
    .gallery-header-fixed h2 { font-size: 32px; letter-spacing: -1px; margin-bottom: 8px; }
    .gallery-header-fixed .gallery-sub { font-size: 13px; margin-bottom: 6px; }
    .gallery-header-fixed .gallery-powered { font-size: 12px; }
    .gallery-cta { height: 36px; padding: 0 20px; font-size: 13px; margin-top: 12px; border-radius: 6px; }

    .carousel-container {
        width: 100%; flex: 1 1 auto;
        overflow-y: auto !important; overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        mask-image: linear-gradient(to bottom, transparent 0%, black 4%, black 92%, transparent);
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 4%, black 92%, transparent);
    }
    .carousel-container::-webkit-scrollbar { display: none; }

    .carousel-track {
        flex-direction: column; gap: 20px;
        padding: 16px 5vw 60px; width: 100%; align-items: center;
        transform: none !important;
    }

    .card {
        width: 100%; max-width: 360px; margin: 0 auto;
        padding: 16px; border-radius: 16px;
        transform: none !important; opacity: 1 !important;
    }
    .card:hover { transform: none !important; }
    .card-thumb { height: 180px; border-radius: 10px; margin-bottom: 14px; }
    .card-thumb::before { height: 26px; }
    .card-thumb::after { top: 10px; left: 12px; width: 5px; height: 5px; box-shadow: 10px 0 0 #FFBD2E, 20px 0 0 #27C93F; }
    .thumb-iframe-wrap { top: 26px; height: calc(100% - 26px); border-radius: 0 0 9px 9px; }
    .thumb-iframe { transform: scale(0.22); opacity: 0.7; filter: saturate(0.6) contrast(1.05) brightness(0.85); }
    .card:hover .thumb-iframe { transform: scale(0.22); opacity: 0.7; }
    .card-title { font-size: 17px; margin-bottom: 6px; }
    .card-desc { font-size: 12px; line-height: 1.5; margin-bottom: 12px; }
    .card-tag { font-size: 10px; padding: 4px 10px; border-radius: 16px; }
}
