/* =============================================
   Factory Template Styles - Wheelox
   优化版本：桌面端限制宽度 + 移动端居中吸附
============================================= */

:root {
    --black: #000000;
    --red: #e63946;
}

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

/* ---------- 工厂 Hero 通屏区域 ---------- */
.factory-hero-fullwidth {
    width: 100%;
    background-color: #f8f8f8;
    min-height: 580px;
    display: flex;
    align-items: center;
}
.factory-hero-inner {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}
.factory-hero-text {
    width: 42%;
    padding: 60px 5% 60px 8%;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.factory-hero-text h2 {
    font-size: 2.5rem;
    color: var(--red);
    margin-bottom: 20px;
}
.factory-hero-text p {
    font-size: 1rem;
    line-height: 1.6;
    color: #222;
    margin-bottom: 25px;
}
.video-play-btn {
    background: var(--black);
    color: white;
    border: none;
    padding: 12px 28px;
    font-weight: 600;
    border-radius: 40px;
    cursor: pointer;
    width: fit-content;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.video-play-btn:hover {
    background: var(--red);
    transform: scale(1.02);
}
.factory-hero-image {
    width: 58%;
}
.factory-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---------- 流程卡片区域 ---------- */
.process-section {
    padding: 70px 0;
}
.section-title {
    text-align: center;
    margin-bottom: 50px;
    font-size: 2.2rem;
    font-weight: 700;
}
.process-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}
.process-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}
.process-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 35px rgba(0,0,0,0.1);
}
.process-card-img img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}
.process-card-content {
    padding: 20px;
}
.process-card-content h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}
.process-card-content p {
    color: #555;
    margin-bottom: 15px;
}
.view-photos-link {
    color: var(--red);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: 0.2s;
}
.view-photos-link:hover {
    border-bottom-color: var(--red);
}

/* ---------- 地图横幅 ---------- */
.fullwidth-map-banner {
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: 100px 20px;
    text-align: center;
    color: white;
}
.banner-overlay h3 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    color: white;
}
.banner-overlay p {
    font-size: 1.1rem;
    margin-bottom: 30px;
}
.map-btn {
    background: var(--red);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: 0.2s;
}
.map-btn:hover {
    background: #b91c2c;
    transform: scale(1.02);
}

/* ========== 画廊和证书滚动通用样式 ========== */
/* 桌面端：滚动容器限制最大宽度 1400px，居中显示，内容可超出滚动 */
.gallery-scroll-container,
.certificates-scroll-container {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 24px;
    padding: 20px 0 30px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    /* ----- 新增桌面端限制 ----- */
    max-width: 1400px;
    margin: 0 auto;
    /* 注意：padding 左右为 0，让卡片可以滚动到边缘时紧贴边界 */
}

/* 单独调整证书滚动容器的间距 */
.certificates-scroll-container {
    gap: 30px;
}

/* 卡片基础样式 */
.gallery-card,
.certificate-card {
    flex-shrink: 0;
    transition: transform 0.2s;
    cursor: pointer;
}
.gallery-card {
    flex: 0 0 320px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.gallery-card:hover {
    transform: translateY(-6px);
}
.certificate-card {
    flex: 0 0 320px;
    background: white;
    border-radius: 20px;
    text-align: center;
}
.certificate-card:hover {
    transform: translateY(-6px);
}

/* 画廊卡片图片区域 */
.gallery-card-img {
    width: 100%;
    height: 320px;
    background-size: contain;
    background-position: center;
}
.gallery-card-info {
    padding: 18px;
}
.gallery-card-info h4 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}
.gallery-date {
    font-size: 0.85rem;
    color: #888;
}

/* 证书卡片图片区域（A4 比例） */
.certificate-img {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}
.certificate-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #222;
    padding: 0 5px;
}

/* ---------- 头部区域（标题+箭头）样式 ---------- */
.gallery-scroll-header,
.certificates-header {
    max-width: 1400px;
    margin: 0 auto 30px;
    padding: 0 0;  /* 移除左右内边距，使标题与滚动区域对齐 */
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
}
.gallery-scroll-header h2,
.certificates-header h2 {
    font-size: 1.8rem;
    margin: 0;
}
.scroll-arrows button,
.cert-scroll-arrows button {
    background: #ddd;
    border: none;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 12px;
    transition: 0.2s;
}
.scroll-arrows button:hover,
.cert-scroll-arrows button:hover {
    background: var(--red);
    color: white;
}

/* ----- 调整画廊外层包装，去掉背景的左右内边距 ----- */
.gallery-scroll-wrapper {
    padding: 60px 0 80px;
    background: #f9f9f9;
}
.certificates-wrapper {
    width: 100%;
    background: #fff;
    padding: 60px 0 70px;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

/* ========== 移动端优化（卡片居中吸附） ========== */
@media (max-width: 768px) {
    /* 画廊滚动容器：启用 scroll-snap，卡片宽度为视口 80% 且居中 */
    .gallery-scroll-container,
    .certificates-scroll-container {
        scroll-snap-type: x mandatory;
        gap: 16px;
        padding-left: 10vw;   /* 左右留出空间，便于看到卡片两侧 */
        padding-right: 10vw;
        /* 确保滚动两端有空间 */
        scroll-padding: 0 10vw;
    }

    .gallery-card {
        flex: 0 0 80vw;        /* 宽度为视口宽度的 80%，手机上一张卡片占大部分屏幕 */
        scroll-snap-align: center;
        border-radius: 16px;
        margin: 0 auto;
    }
    .certificate-card {
        flex: 0 0 80vw;
        scroll-snap-align: center;
        border-radius: 16px;
        margin: 0 auto;
    }

    /* 调整卡片内部图片高度以适应移动端 */
    .certificate-img {
        margin-bottom: 10px;
    }

    /* 标题和箭头区域边距调整 */
    .gallery-scroll-header,
    .certificates-header {
        padding: 0 5vw;
        margin-bottom: 20px;
    }
    .gallery-scroll-header h2,
    .certificates-header h2 {
        font-size: 1.4rem;
    }
    .scroll-arrows button,
    .cert-scroll-arrows button {
        width: 36px;
        height: 36px;
        font-size: 22px;
        margin-left: 8px;
    }

    /* 其他已有移动端样式保留 */
    .process-grid {
        grid-template-columns: 1fr;
    }
    .factory-hero-text h2 {
        font-size: 1.8rem;
    }
    .section-title {
        font-size: 1.7rem;
    }
    .fullwidth-map-banner {
        padding: 60px 20px;
    }
    .gallery-thumb {
        width: 60px;
        height: 45px;
    }
    .gallery-nav-prev,
    .gallery-nav-next {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
    .certificate-name {
        font-size: 0.85rem;
    }
    .certificate-nav-prev,
    .certificate-nav-next {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }
    .certificate-nav-prev { left: -12px; }
    .certificate-nav-next { right: -12px; }
}

/* 平板设备过渡 (769px - 992px) 保持桌面滚动样式但不限制太死 */
@media (min-width: 769px) and (max-width: 992px) {
    .gallery-scroll-container,
    .certificates-scroll-container {
        max-width: 1400px;
        margin: 0 auto;
        gap: 20px;
    }
    .gallery-card {
        flex: 0 0 300px;
    }
    .certificate-card {
        flex: 0 0 200px;
    }
}

/* ========== 模态框样式（保持不变） ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: #fff;
    max-width: 90%;
    max-height: 90%;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}
.map-modal-content {
    width: 90%;
    max-width: 1100px;
}
.video-modal-content,
.gallery-modal-content {
    background: #000;
    width: auto;
}
.close-modal {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    background: rgba(0,0,0,0.5);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.close-modal:hover {
    background: var(--red);
}
.video-container iframe {
    width: 800px;
    max-width: 100%;
    height: 450px;
}

/* 图片画廊专用 */
.gallery-modal-content {
    max-width: 90%;
    width: 900px;
    background: #000;
    padding: 20px;
}
.gallery-main-container {
    position: relative;
    text-align: center;
}
#galleryMainImage {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}
.gallery-nav-prev,
.gallery-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
    border-radius: 50%;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
}
.gallery-nav-prev:hover,
.gallery-nav-next:hover {
    background: var(--red);
}
.gallery-nav-prev { left: 10px; }
.gallery-nav-next { right: 10px; }
.gallery-thumbnails {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 10px;
}
.gallery-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
    border-radius: 6px;
}
.gallery-thumb.active {
    border-color: var(--red);
    transform: scale(1.05);
}

/* 证书模态框专用 */
.certificate-modal-content {
    background: #fff;
    width: auto;
    max-width: 85%;
    max-height: 85%;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
}
.certificate-modal-main {
    position: relative;
    display: inline-block;
}
#certificateModalImage {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.certificate-nav-prev,
.certificate-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    transition: 0.2s;
}
.certificate-nav-prev:hover,
.certificate-nav-next:hover {
    background: var(--red);
}
.certificate-nav-prev { left: -20px; }
.certificate-nav-next { right: -20px; }
.certificate-modal-name {
    margin-top: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #111;
}
.close-certificate {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 32px;
    color: #333;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.close-certificate:hover {
    background: var(--red);
    color: white;
}