/* 隐藏滚动条但保留功能 (用于横向导航) */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* 瀑布流效果 */
.masonry-grid { column-count: 2; column-gap: 1rem; }
@media (min-width: 640px) { .masonry-grid { column-count: 2; } }
@media (min-width: 1024px) { .masonry-grid { column-count: 3; } }
@media (min-width: 1280px) { .masonry-grid { column-count: 4; } }

.masonry-item { break-inside: avoid; margin-bottom: 1rem; position: relative; }

/* 卡片悬停效果 */
.card-overlay { opacity: 0; transition: opacity 0.3s ease; }
.masonry-item:hover .card-overlay { opacity: 1; }

/* 图片缩放效果 */
.masonry-item img {transition: transform 0.3s ease; }
.masonry-item:hover img { transform: scale(1.05); }

.footer-copy,
.footer-copy p,
.footer-copy div {
    text-align: center !important;
}
.footer-copy a { color: inherit; text-decoration: underline; }
.footer-copy a:hover { opacity: .85; }

/* 首页全景背景 */
.home-pano-wrap {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: #111827;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
.home-pano-stage {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .8s ease;
}
.home-pano-wrap.is-ready .home-pano-stage {
    opacity: 1;
}
.home-pano-stage .krpano,
.home-pano-stage > div {
    width: 100%;
    height: 100%;
}
.home-pano-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity .8s ease;
}
.home-pano-wrap.is-ready .home-pano-cover {
    opacity: 0;
    pointer-events: none;
}
.home-pano-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .22);
    pointer-events: none;
}
.home-pano-ui {
    pointer-events: none;
}
.home-pano-ui a,
.home-pano-ui .swiper,
.home-pano-ui button,
.home-pano-ui .home-nav-scroll {
    pointer-events: auto;
}

/* 首页胶囊按钮：手机端可横向滑动，尺寸与电脑端一致 */
.home-nav-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    padding: 4px 16px 8px;
}
.home-nav-btns {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    justify-content: safe center;
    align-items: center;
    gap: 16px;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}
.home-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 16px 40px;
    border-radius: 9999px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.12);
    transition: background-color .2s ease, color .2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-x;
}
.home-nav-btn.is-primary {
    background: rgb(34 197 94 / 0.8);
    color: #fff;
}
.home-nav-btn.is-ghost {
    background: rgb(255 255 255 / 0.6);
    color: #374151;
}
.home-nav-btn.is-ghost:hover,
.home-nav-btn.is-ghost:active {
    background: rgb(34 197 94 / 0.8);
    color: #fff;
}

/* 移动端优化 */
@media (max-width: 640px) {
    /* 优化触摸交互 */
    button, a {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    .home-nav-scroll,
    .home-nav-scroll a,
    .home-nav-btn {
        touch-action: pan-x;
    }
    
    /* 优化图片加载 */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* 防止固定背景在移动端的问题 */
    .fixed {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* 优化滚动性能 */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* 触摸反馈优化 */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* 移动端按钮激活状态 */
@media (max-width: 768px) {
    button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* 图片懒加载样式 */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    background-color: #f0f0f0;
    background-image: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s ease-in-out infinite;
}

.lazy-loaded {
    opacity: 1;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes loading-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 首页图片轮播样式 - 无左右边距 */
.index-image-swiper {
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
}

.index-image-swiper .swiper-wrapper {
    padding-left: 0;
    padding-right: 0;
}

.index-image-swiper .swiper-slide {
    width: auto;
    height: auto;
}

/* 移动端：每张图片占屏幕宽度的 80% */
.index-image-swiper .swiper-slide {
    width: 80%;
    max-width: 300px;
}

/* 平板端：每张图片占屏幕宽度的 45% */
@media (min-width: 640px) {
    .index-image-swiper .swiper-slide {
        width: 45%;
        max-width: 400px;
    }
}

/* 桌面端：每张图片占屏幕宽度的 30% */
@media (min-width: 1024px) {
    .index-image-swiper .swiper-slide {
        width: 30%;
        max-width: 500px;
    }
}

/* 大屏幕：每张图片占屏幕宽度的 22% */
@media (min-width: 1280px) {
    .index-image-swiper .swiper-slide {
        width: 22%;
        max-width: 600px;
    }
}

/* 全景页二级分类：手机端保持左右滑动，电脑端折叠展开 */
.pano-child-toggle {
    display: none;
}
.pano-child-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.pano-child-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: max-content;
}
.pano-child-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    border-radius: 9999px;
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease;
}

@media (min-width: 768px) {
    .pano-child-nav {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    .pano-child-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1.15rem;
        font-size: 0.875rem;
        line-height: 1.25rem;
        border: 0;
        border-radius: 9999px;
        background: #e5e7eb;
        color: #374151;
        cursor: pointer;
        user-select: none;
        transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
    }
    .pano-child-toggle i {
        font-size: 10px;
        transition: transform .25s ease;
    }
    .pano-child-toggle:hover {
        background: #d1d5db;
    }
    .pano-child-toggle.is-active,
    .pano-child-nav.is-open .pano-child-toggle {
        background: #1a1a1a;
        color: #fff;
    }
    .pano-child-toggle.is-active:hover,
    .pano-child-nav.is-open .pano-child-toggle:hover {
        background: #111;
    }
    .pano-child-nav.is-open .pano-child-toggle i {
        transform: rotate(180deg);
    }
    .pano-child-scroll {
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        margin-top: 0;
        transition: max-height .32s ease, opacity .22s ease, margin-top .22s ease, visibility .22s ease;
    }
    .pano-child-nav.is-open .pano-child-scroll {
        max-height: 20rem;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        margin-top: 0.75rem;
    }
    .pano-child-inner {
        flex-wrap: wrap;
        min-width: 0;
        width: 100%;
        gap: 0.75rem 1rem;
    }
}