/* ===== 首页样式 ===== */
.xh-home-wrapper {
    display: block !important;
    width: 100%;
    max-width: 100%;
    padding: 0;
}
.xh-hero { width: 100%; overflow: hidden; }
.xh-hero-slider { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.xh-hero-slide { flex: 0 0 100%; scroll-snap-align: start; }
.xh-hero-slide img { width: 100%; height: auto; display: block; }
.xh-categories-section { max-width: 1200px; margin: 0 auto; padding: 60px 20px; }
.xh-categories-header { text-align: center; margin-bottom: 40px; }
.xh-title { font-size: 2rem; margin-bottom: 16px; color: #1a1a2e; }
.xh-subtitle { max-width: 900px; margin: 0 auto; font-size: 1rem; line-height: 1.8; color: #444; }
.xh-product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.xh-product-card { border-radius: 8px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: transform 0.3s; }
.xh-product-card:hover { transform: translateY(-4px); }
.xh-product-card img { width: 100%; height: 240px; object-fit: cover; display: block; }

/* ===== 产品详情页容器 ===== */
/* 覆盖 Astra 默认容器宽度，产品页使用更宽布局 */
.single-post .ast-container,
.single .ast-container {
    max-width: 100% !important;
    padding: 0;
}
.xh-product-single {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 24px;
    box-sizing: border-box;
}

/* ===== 上半部分：图库 + 摘要（双栏） ===== */
.xh-product-top {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-bottom: 40px;
}
.xh-product-gallery {
    flex: 0 0 58%;
    max-width: 58%;
    position: sticky;
    top: 20px;
}
.xh-product-summary {
    flex: 1;
    min-width: 0;
}

/* 主图区 */
.xh-gallery-main {
    position: relative;
    width: 100%;
    background: #f8f8f8;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}
.xh-gallery-slide { display: none; width: 100%; }
.xh-gallery-slide.active { display: block; }
.xh-gallery-slide img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 600px;
    object-fit: contain;
}

/* 左右箭头 */
.xh-gallery-prev, .xh-gallery-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.9); border: none; border-radius: 50%;
    width: 44px; height: 44px; font-size: 26px; cursor: pointer;
    color: #333; line-height: 44px; text-align: center;
    opacity: 0; transition: opacity 0.3s; z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.xh-gallery-main:hover .xh-gallery-prev,
.xh-gallery-main:hover .xh-gallery-next { opacity: 1; }
.xh-gallery-prev { left: 12px; }
.xh-gallery-next { right: 12px; }

/* 缩略图 */
.xh-gallery-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.xh-gallery-thumb {
    flex: 0 0 72px;
    height: 72px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s;
}
.xh-gallery-thumb.active { border-color: #2563eb; opacity: 1; }
.xh-gallery-thumb:hover { opacity: 0.85; }
.xh-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 产品摘要区 */
.xh-product-title {
    font-size: 1.8rem;
    line-height: 1.3;
    color: #1a1a2e;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}
.xh-product-summary-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #444;
}
.xh-product-summary-text p { margin: 0 0 14px; }
.xh-product-summary-text p:last-child { margin-bottom: 0; }

/* ===== 下半部分：完整产品详情（全宽） ===== */
.xh-product-detail {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 0 0;
    border-top: 1px solid #eee;
}
.xh-product-detail h2 {
    font-size: 1.5rem;
    margin: 36px 0 16px;
    color: #1a1a2e;
}
.xh-product-detail h3 {
    font-size: 1.2rem;
    margin: 28px 0 12px;
    color: #1a1a2e;
}
.xh-product-detail p {
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
    margin: 0 0 16px;
}
.xh-product-detail table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
}
.xh-product-detail th, .xh-product-detail td {
    border: 1px solid #ddd;
    padding: 12px 14px;
    text-align: left;
}
.xh-product-detail th {
    background: #f5f5f5;
    font-weight: 600;
    width: 25%;
}
.xh-product-detail ul, .xh-product-detail ol {
    padding-left: 1.5em;
    margin: 14px 0;
}
.xh-product-detail li { margin-bottom: 8px; line-height: 1.7; }

/* ===== 无图库的旧布局 ===== */
.xh-product-hero { width: 100%; max-width: 1200px; margin: 0 auto 40px; }
.xh-product-hero-img { width: 100%; height: auto; display: block; border-radius: 8px; }
.xh-product-content { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.xh-product-header { margin-bottom: 32px; }
.xh-product-body { font-size: 1rem; line-height: 1.75; color: #333; }
.xh-product-body h2 { font-size: 1.35rem; margin: 32px 0 14px; color: #1a1a2e; }
.xh-product-body h3 { font-size: 1.15rem; margin: 24px 0 10px; }
.xh-product-body table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 0.95rem; }
.xh-product-body th, .xh-product-body td { border: 1px solid #ddd; padding: 10px 12px; text-align: left; }
.xh-product-body th { background: #f5f5f5; font-weight: 600; }
.xh-product-body ul, .xh-product-body ol { padding-left: 1.5em; margin: 14px 0; }
.xh-product-body li { margin-bottom: 6px; }

/* 上下篇导航 */
.xh-product-nav {
    max-width: 1400px;
    margin: 50px auto 0;
    padding: 24px 24px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #eee;
    gap: 20px;
}
.xh-product-nav a { color: #2563eb; text-decoration: none; font-size: 0.95rem; max-width: 45%; }
.xh-product-nav a:hover { text-decoration: underline; }
.xh-prev-link { text-align: left; }
.xh-next-link { text-align: right; }

/* 隐藏 Astra 默认 meta */
.ast-post-meta-container, .entry-meta, .posted-on, .byline { display: none !important; }

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
    .xh-product-single { padding: 24px 20px; }
    .xh-product-top { gap: 30px; }
    .xh-product-gallery { flex: 0 0 55%; max-width: 55%; }
}

@media (max-width: 1024px) {
    .xh-product-top { flex-direction: column; gap: 24px; }
    .xh-product-gallery {
        flex: 0 0 100%;
        max-width: 100%;
        position: static;
    }
    .xh-product-summary { flex: 1; }
    .xh-gallery-slide img { max-height: 450px; }
    .xh-product-title { font-size: 1.5rem; }
    .xh-product-detail { padding-top: 30px; }
}

@media (max-width: 768px) {
    .xh-product-grid { grid-template-columns: repeat(2, 1fr); }
    .xh-categories-section { padding: 40px 16px; }
    .xh-product-single { padding: 16px 12px; }
    .xh-product-title { font-size: 1.35rem; }
    .xh-product-summary-text { font-size: 0.95rem; }
    .xh-gallery-slide img { max-height: 350px; }
    .xh-gallery-thumb { flex: 0 0 56px; height: 56px; }
    .xh-gallery-prev, .xh-gallery-next { width: 36px; height: 36px; font-size: 20px; line-height: 36px; }
    .xh-product-content { padding: 0 16px; }
    .xh-product-nav { flex-direction: column; padding: 20px 16px; }
    .xh-product-nav a { max-width: 100%; }
    .xh-product-detail { font-size: 0.95rem; }
    .xh-product-detail table { font-size: 0.85rem; }
    .xh-product-detail th, .xh-product-detail td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .xh-product-grid { grid-template-columns: 1fr; }
    .xh-product-single { padding: 12px 8px; }
    .xh-product-top { gap: 16px; }
    .xh-product-title { font-size: 1.2rem; }
    .xh-product-summary-text { font-size: 0.9rem; line-height: 1.6; }
    .xh-gallery-slide img { max-height: 280px; }
    .xh-gallery-thumb { flex: 0 0 48px; height: 48px; }
    .xh-gallery-prev, .xh-gallery-next { width: 30px; height: 30px; font-size: 16px; line-height: 30px; }
    .xh-product-detail { padding-top: 20px; }
    .xh-product-detail h2 { font-size: 1.25rem; }
    .xh-product-detail table { font-size: 0.8rem; }
}

/* ===== 产品分类列表页 ===== */
.xh-products-archive { max-width: 1400px; margin: 0 auto; padding: 40px 20px; box-sizing: border-box; }
.xh-archive-header { text-align: center; margin-bottom: 40px; }
.xh-archive-title { font-size: 2.2rem; color: #1a1a2e; margin: 0 0 8px; }
.xh-archive-desc { color: #666; font-size: 1.05rem; margin: 0; }

.xh-products-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.xh-product-card-archive { border-radius: 8px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: transform 0.3s, box-shadow 0.3s; background: #fff; }
.xh-product-card-archive:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.xh-card-link { text-decoration: none; color: inherit; display: block; }
.xh-card-img-wrap { width: 100%; aspect-ratio: 1; overflow: hidden; background: #f5f5f5; }
.xh-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s; }
.xh-product-card-archive:hover .xh-card-img-wrap img { transform: scale(1.05); }
.xh-card-info { padding: 14px 16px; }
.xh-card-title { font-size: 0.95rem; line-height: 1.4; color: #333; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 1024px) {
    .xh-products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .xh-products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .xh-archive-title { font-size: 1.6rem; }
    .xh-card-title { font-size: 0.85rem; }
    .xh-card-info { padding: 10px 12px; }
}
@media (max-width: 480px) {
    .xh-products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .xh-products-archive { padding: 20px 10px; }
    .xh-card-title { font-size: 0.8rem; }
}
