/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏样式 */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.nav-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.nav-logo h1 {
    color: #8b4513;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0;
}

.nav-subtitle {
    color: #a0522d;
    font-size: 1.1rem;
    font-weight: 400;
    margin: 8px 0 0;
    opacity: 0.9;
    text-align: left;
}

/* 轮播图样式 */
.hero-slider {
    margin-top: 80px;
    height: 70vh;
    position: relative;
    overflow: hidden;
}

.slider-container {
    position: relative;
    height: 100%;
    width: 100%;
}

.slider-wrapper {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease;
}

/* 图片加载优化 */
.slide img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.slide img.loaded {
    opacity: 1;
}

.slider-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.slider-prev, .slider-next {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-prev:hover, .slider-next:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-dot.active {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

/* 分类展示样式 */
.categories {
    padding: 4rem 0;
}

.categories h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: #8b4513;
    font-weight: 600;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.category-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.category-image {
    width: 100%;
    height: 280px;
    overflow: hidden;
    position: relative;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-image img {
    transform: scale(1.1);
}

.category-card h3 {
    padding: 1.5rem;
    text-align: center;
    font-size: 1.3rem;
    color: #8b4513;
    font-weight: 600;
}

/* 画廊模态框样式 */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-modal.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.gallery-container {
    width: 95%;
    height: 95%;
    background: #000;
    border-radius: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 电脑端关闭按钮样式 */
.gallery-close.desktop-only {
    position: absolute;
    right: 30px;
    top: -5px;
    width: 45px;
    height: 45px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.gallery-close.desktop-only:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* 平板和手机设备隐藏关闭按钮 */
@media (max-width: 1024px) {
    .gallery-close.desktop-only {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
}

/* 电脑设备显示关闭按钮 */
@media (min-width: 1025px) {
    .gallery-close.desktop-only {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

/* 手机端优化 */
@media (max-width: 767px) {
    .gallery-close.desktop-only {
        display: none !important;
    }
    
    /* 手机端添加手势提示 */
    .gallery-modal::after {
        content: '左右滑动切换图片';
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.8rem;
        background: rgba(0, 0, 0, 0.5);
        padding: 4px 8px;
        border-radius: 12px;
        animation: fadeInOut 3s infinite;
    }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .gallery-container {
        -webkit-overflow-scrolling: touch;
    }
    
    .thumbnail {
        touch-action: manipulation;
    }
    
    /* 触摸设备隐藏关闭按钮 */
    .gallery-close.desktop-only {
        display: none !important;
    }
}

.gallery-header {
    padding: 2px;
    text-align: center;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-counter {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: block;
}

.gallery-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.gallery-prev, .gallery-next {
    display: none;
}

.gallery-image-container {
    width: 100%;
    height: calc(100vh - 130px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.gallery-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.3s ease;
    display: block;
}

.gallery-image:hover {
    transform: scale(1.05);
}

/* 电脑端和平板端智能填充模式 */
@media (min-width: 769px) {
    body .gallery-modal .gallery-image-container {
        height: calc(100vh - 120px) !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
    }
    
    body .gallery-modal .gallery-image {
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        transition: all 0.3s ease !important;
    }
    

}

@media (min-width: 769px) and (max-width: 1024px) {
    body .gallery-modal .gallery-image {
        max-width: 96% !important;
        max-height: 96% !important;
    }
    

}

@media (min-width: 1025px) and (max-width: 1199px) {
    body .gallery-modal .gallery-image {
        max-width: 98% !important;
        max-height: 98% !important;
    }
    

}

@media (min-width: 1200px) {
    body .gallery-modal .gallery-image {
        max-width: 98% !important;
        max-height: 98% !important;
    }
    
    body .gallery-modal .gallery-image[data-orientation="landscape"] {
        width: auto !important;
        height: 98% !important;
        max-width: 98% !important;
    }
    
    body .gallery-modal .gallery-image[data-orientation="portrait"] {
        height: 98% !important;
        width: auto !important;
        max-width: 85% !important;
    }
    

}

.gallery-thumbnails {
    height: 70px;
    padding: 5px;
    border-top: 1px solid #333;
    overflow-x: auto;
    flex-shrink: 0;
}

.thumbnails-container {
    display: flex;
    gap: 10px;
    height: 100%;
}

.thumbnail {
    width: 100px;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.thumbnail.active {
    opacity: 1;
    border: 2px solid #fff;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 页脚样式 */
.footer {
    background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: center;
}

.footer-info h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-info p {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.footer-qrcode {
    text-align: center;
}

.footer-qrcode img {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 3px solid white;
}

.footer-copyright {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .nav-logo h1 {
        font-size: 2rem;
    }
    
    .nav-subtitle {
        font-size: 1rem;
    }
    
    .hero-slider {
        height: 50vh;
        margin-top: 60px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
    }
    
    .category-image {
        height: 220px;
    }
    
    .gallery-prev, .gallery-next {
        display: none;
    }
    

    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .slider-controls {
        padding: 0 10px;
    }
    
    .slider-prev, .slider-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .gallery-image-container {
        height: calc(100vh - 160px);
    }
    
    .gallery-image {
        max-width: 98%;
        max-height: 98%;
    }
    
    /* 移动端页脚优化 - 进一步减少与上方内容的间距 */
    .footer {
        margin-top: 0.5rem; /* 进一步减少上边距 */
        padding: 1rem 0 0.5rem; /* 减少内边距 */
    }
    
    /* 移动端页脚内容紧凑排列 */
    .footer-info h3 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    .footer-info p {
        margin-bottom: 0.3rem;
        font-size: 1rem;
    }
    
    .footer-qrcode img {
        width: 100px;
        height: 100px;
        margin-bottom: 8px;
    }
    
    .footer-copyright {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .beian-info {
        margin-top: 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .category-image {
        height: 180px;
    }
    
    .gallery-thumbnails {
        height: 100px;
    }
    
    .thumbnail {
        width: 80px;
    }
    
    /* 手机端页脚进一步优化 */
    .footer {
        margin-top: 0; /* 完全移除上边距 */
        padding: 0.5rem 0 0.2rem; /* 进一步减少内边距 */
    }
    
    .footer-info h3 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .footer-info p {
        font-size: 0.9rem;
        margin-bottom: 0.2rem;
    }
    
    .footer-qrcode img {
        width: 80px;
        height: 80px;
        margin-bottom: 5px;
    }
    
    .footer-copyright {
        margin-top: 0.8rem;
        padding-top: 0.8rem;
    }
    
    .beian-info {
        margin-top: 5px;
        font-size: 11px;
    }
}

/* 图片加载优化样式 */
.img-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 渐进式图片加载 */
.progressive-image {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.progressive-image.loaded {
    opacity: 1;
}

/* 触摸设备优化 */
@media (hover: none) {
    .gallery-prev, .gallery-next {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .category-card:hover {
        transform: none;
    }
}

/* 滑动返回功能 */
.gallery-modal {
    touch-action: pan-y;
}

/* 手机端和平板端边缘滑动返回提示 */
@media (max-width: 1024px) {
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 15px;
        height: 100%;
        background: linear-gradient(90deg, rgba(139, 69, 19, 0.3), transparent);
        z-index: 9999;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    body::after {
        content: '';
        position: fixed;
        top: 0;
        right: 0;
        width: 15px;
        height: 100%;
        background: linear-gradient(270deg, rgba(139, 69, 19, 0.3), transparent);
        z-index: 9999;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    body.edge-swipe-active::before,
    body.edge-swipe-active::after {
        opacity: 1;
    }
    
    /* 边缘滑动返回动画 */
    .edge-swipe-indicator {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(139, 69, 19, 0.9);
        color: white;
        padding: 12px 24px;
        border-radius: 25px;
        font-size: 14px;
        font-weight: 500;
        z-index: 10000;
        opacity: 0;
        transition: all 0.3s ease;
        pointer-events: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .edge-swipe-indicator.show {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* 平板端特殊优化 */
@media (min-width: 768px) and (max-width: 1024px) {
    /* 增强边缘检测区域 */
    body::before, body::after {
        width: 25px;
    }
    
    /* 平板端隐藏轮播图翻页按钮 */
    .slider-prev, .slider-next {
        display: none !important;
    }
    
    /* 平板端手势提示 - 只保留左右滑动提示 */
    .gallery-modal::after {
        content: '左右滑动切换图片';
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.8);
        font-size: 0.9rem;
        background: rgba(0, 0, 0, 0.6);
        padding: 8px 16px;
        border-radius: 20px;
        animation: fadeInOut 4s infinite;
        white-space: nowrap;
    }
}

/* 手机端特殊优化 */
@media (max-width: 767px) {
    /* 手机端边缘检测区域 */
    body::before, body::after {
        width: 20px;
    }
    
    /* 手机端隐藏轮播图翻页按钮 */
    .slider-prev, .slider-next {
        display: none !important;
    }
    
    /* 手机端移除手势提示文字 */
    .gallery-modal::after {
        content: '';
        display: none;
    }
    

}

/* 单页应用路由动画 */
.page-transition {
    animation: pageSlideIn 0.3s ease-out;
}

@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 返回首页动画 */
.return-home-animation {
    animation: returnHome 0.4s ease-out;
}

@keyframes returnHome {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 触摸设备滚动优化 */
@media (hover: none) {
    html {
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        overscroll-behavior-y: contain;
    }
}

/* 防止页面滚动时的弹性效果干扰边缘滑动 */
@media (max-width: 1024px) {
    html {
        overscroll-behavior-x: none;
    }
}

/* 电脑端缩略图优化 */
@media (min-width: 1025px) {
    .gallery-thumbnails {
        height: 150px !important; /* 增大缩略图区域高度 */
        overflow-x: hidden !important; /* 隐藏水平滚动条 */
        padding: 15px !important; /* 增加内边距 */
    }
    
    .thumbnails-container {
        height: 100% !important;
        overflow-x: hidden !important; /* 隐藏容器滚动条 */
        gap: 20px !important; /* 增加缩略图间距 */
    }
    
    .thumbnail {
        width: 180px !important; /* 增大缩略图宽度 */
        height: 100% !important; /* 使用容器全部高度 */
        border-radius: 12px !important; /* 增加圆角 */
        transition: all 0.3s ease !important;
    }
    
    .thumbnail:hover {
        transform: scale(1.05) !important; /* 悬停放大效果 */
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    }
    
    .thumbnail.active {
        border: 3px solid #fff !important; /* 加粗选中边框 */
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.5) !important;
    }
}