/* ============================================
   ZHUOJU IP 自定义样式 - 全宽 + 完整响应式 v4
   目标: PC 全宽 + 平板/手机 responsive 无溢出
   ============================================ */

/* ---- 1. 强制解除主题宽度限制 (覆盖 :root 变量) ---- */
:root {
    --wp--style--global--content-size: 1200px !important;
    --wp--style--global--wide-size: 1400px !important;
}

/* 解除 constrained 子元素 645px 限制 */
.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)),
.is-layout-constrained,
.wp-block-post-content.is-layout-constrained > *,
.wp-block-group.is-layout-constrained > *,
.alignfull {
    max-width: 100% !important;
}

/* 修复全局内边距: 主题用 margin:-50px 负边距 + padding:50px 撑出全宽
   之前设 padding:0 导致负 margin 让内容左移出视口
   改为保留足够 padding 抵消负 margin 并留出安全边距 */
.entry-content.has-global-padding,
.wp-block-post-content.has-global-padding,
.wp-block-group.has-global-padding,
.has-global-padding {
    padding-left: 50px !important;
    padding-right: 50px !important;
}

/* 内容容器额外安全边距, 防止贴边 */
.entry-content {
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* 防止任何元素横向溢出 (关键: 修复手机溢出) */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
img, video, canvas, svg, table, pre {
    max-width: 100% !important;
    height: auto;
}

/* ---- 2. 内容排版容器 - PC 1200px 居中 ---- */
.entry-content > p,
.entry-content > h1, .entry-content > h2, .entry-content > h3,
.entry-content > ul, .entry-content > ol,
.entry-content > table,
.entry-content > blockquote,
.entry-content > div {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}

/* 文字类元素内边距, 避免贴边 */
.entry-content > p,
.entry-content > h1, .entry-content > h2, .entry-content > h3,
.entry-content > ul, .entry-content > ol {
    padding-left: 24px;
    padding-right: 24px;
}

/* 全宽背景区块 (hero/stats/cta) 铺满 */
.hero-section, .stats-section, .cta-section,
div[style*="background:linear-gradient"],
div[style*="background:#1e3a5f"] {
    width: 100% !important;
    max-width: none !important;
}

/* 网格/flex 容器撑满 1200px */
div[style*="display:grid"],
div[style*="display:flex"],
.hero-section > *,
.stats-section > *,
.cta-section > *,
.wp-block-columns,
.wp-block-columns > .wp-block-column {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* ---- 3. 统计数据深色背景白字 ---- */
.stats-section {
    background: #1e3a5f !important;
    color: white !important;
    padding: 60px 20px;
}
.stats-section .stat-number {
    color: #f59e0b !important;
    font-size: 3em;
    font-weight: 700;
}

/* ---- 4. 图片自适应 ---- */
img {
    max-width: 100% !important;
    height: auto;
    display: block;
}

/* ============================================
   响应式断点
   ============================================ */

/* ---- 平板 (≤1200px, ≥782px): 网格 2 列 ---- */
@media (max-width: 1200px) {
    .entry-content > p,
    .entry-content > h1, .entry-content > h2, .entry-content > h3,
    .entry-content > ul, .entry-content > ol,
    .entry-content > div {
        max-width: 100% !important;
    }
    div[style*="grid-template-columns:repeat(4,1fr)"],
    .office-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ---- 手机 (≤782px): 单列, 字号缩小, 无溢出 ---- */
@media (max-width: 782px) {
    :root {
        --wp--style--global--content-size: 100% !important;
    }

    /* 所有网格/flex 变单列 */
    div[style*="display:grid"] {
        grid-template-columns: 1fr !important;
    }
    div[style*="display:flex"] {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
    }
    /* flex 子项占满 */
    div[style*="flex:1 1 25%"],
    div[style*="flex:1 1 33%"],
    div[style*="flex:1 1 50%"] {
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }
    /* wp-block-columns 堆叠 */
    .wp-block-columns {
        flex-direction: column !important;
    }
    .wp-block-columns > .wp-block-column {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }

    /* 内容全宽, 减少内边距 (手机覆盖所有层级的 50px padding) */
    .entry-content,
    .entry-content.has-global-padding,
    .wp-block-post-content.has-global-padding,
    .wp-block-group.has-global-padding,
    main.has-global-padding,
    .has-global-padding {
        padding-left: 14px !important;
        padding-right: 14px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    /* 归零主题负 margin, 避免内容左移出视口 */
    .alignfull,
    .alignfull > .alignfull,
    .entry-content.alignfull {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    /* root padding 手机上也缩小 */
    :root {
        --wp--style--root--padding-left: 14px !important;
        --wp--style--root--padding-right: 14px !important;
    }
    .entry-content > p,
    .entry-content > h1, .entry-content > h2, .entry-content > h3,
    .entry-content > ul, .entry-content > ol,
    .entry-content > div {
        max-width: 100% !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* 字号缩小 */
    .entry-content h1, .hero-section h1 { font-size: 2em !important; }
    .entry-content h2 { font-size: 1.6em !important; }
    .entry-content h3 { font-size: 1.3em !important; }
    .stats-section .stat-number { font-size: 2.2em !important; }

    /* 网格间距缩小 */
    div[style*="display:grid"] {
        gap: 16px !important;
    }
}

/* ---- 小手机 (≤480px): 进一步缩小 ---- */
@media (max-width: 480px) {
    .entry-content h1, .hero-section h1 { font-size: 1.7em !important; }
    .entry-content h2 { font-size: 1.4em !important; }
    .hero-section {
        padding: 50px 16px !important;
    }
    .stats-section {
        padding: 40px 12px !important;
    }
}
