/*
Theme Name: Bestintro
Theme URI: https://net158.com/
Author: 粹介网络
Author URI: https://net158.com/
Description: Bestintro 是 Astra 的子主题，功能与 hello-theme-child-cj 2.7.5 保持一致：本地字体（Poppins + DM Sans，含 Inter / Plus Jakarta Sans 备选）、中文排版与流动字号刻度、按设备控制高度的区块工具类（.cj-pg-header / .cj-hero）、instant.page 预加载、图片尺寸策略、面包屑中文标题。两个子主题的 functions.php 与 style.css 刻意保持同构，便于后续同步维护。
Template: astra
Version: 2.7.5
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: bestintro
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: flexible-header, custom-colors, custom-menu, custom-logo, featured-images, threaded-comments, translation-ready
*/

/* ==========================================================================
   1. @font-face 声明（四种字体全重 100-900）
      - 默认启用：Poppins（标题）+ DM Sans（正文）
      - 备选（当前注释）：Plus Jakarta Sans（标题）+ Inter（正文）
      切换方法：注释/取消注释对应区块即可
   ========================================================================== */

/* ---- 字体组 A（备选）：Plus Jakarta Sans + Inter ---- */
/* Plus Jakarta Sans v12 — 标题字体 */
/* 注：缺少 100/900 重量，如有需要请自行补充文件 */
/*
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-200.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-300.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url('assets/fonts/plus-jakarta-sans-v12-latin-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }

@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-100.woff2') format('woff2'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-200.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-300.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('assets/fonts/inter-v20-latin-900.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }
*/

/* ======================================================================
   字体组 B（默认）：Poppins（标题）+ DM Sans（正文）
   如需切换，请取消本区块注释，并将上方"字体组 A"整体注释
   ====================================================================== */
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-100.woff2') format('woff2'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-200.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-300.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Poppins'; src: url('assets/fonts/poppins-v24-latin-900.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }

@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-100.woff2') format('woff2'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-200.woff2') format('woff2'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-300.woff2') format('woff2'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('assets/fonts/dm-sans-v17-latin-900.woff2') format('woff2'); font-weight: 900; font-style: normal; font-display: swap; }

/* ==========================================================================
   2. 响应式流体字号 + 核心字体定义 (390px -> 1440px)
      - 默认启用：Poppins（标题）+ DM Sans（正文）
      - 备选方案注释在下方，取消注释即可切换
   ========================================================================== */
:root {
    /* ---- A 类：小字与正文（12–18）：两端同值，不随视口缩小 ----
       汉字笔画密度高于拉丁字母，小字号下明显更"糊"；而中文在移动端的可读下限
       本来就是正文 16px、小字 14px。桌面值恰好已等于这两个下限，
       所以这几档"不流动"是必然结果，不是妥协。 */
    --fluid-12: 0.75rem;
    --fluid-14: 0.875rem;
    --fluid-15: 0.9375rem;
    --fluid-16: 1rem;
    --fluid-17: 1.0625rem;
    --fluid-18: 1.125rem;

    /* ---- B 类：标题（20–64）：保持流动，390px → 1440px 线性插值 ----------------
       clamp 的 min / max 就是手机端 / 桌面端取值。
       手机端取值保证：22 档两两不同（无塌缩），且一律不低于改版前的数值。 */
    --fluid-20: clamp(1.1875rem, 0.0952vw + 1.1643rem, 1.25rem);
    --fluid-22: clamp(1.25rem, 0.1905vw + 1.2036rem, 1.375rem);
    --fluid-24: clamp(1.3125rem, 0.2857vw + 1.2429rem, 1.5rem);
    --fluid-26: clamp(1.375rem, 0.381vw + 1.2821rem, 1.625rem);
    --fluid-28: clamp(1.4375rem, 0.4762vw + 1.3214rem, 1.75rem);
    --fluid-30: clamp(1.5rem, 0.5714vw + 1.3607rem, 1.875rem);
    --fluid-32: clamp(1.5625rem, 0.6667vw + 1.4rem, 2rem);
    --fluid-36: clamp(1.75rem, 0.7619vw + 1.5643rem, 2.25rem);
    --fluid-38: clamp(1.8125rem, 0.8571vw + 1.6036rem, 2.375rem);
    --fluid-40: clamp(1.9375rem, 0.8571vw + 1.7286rem, 2.5rem);
    --fluid-42: clamp(2rem, 0.9524vw + 1.7679rem, 2.625rem);
    --fluid-48: clamp(2.1875rem, 1.2381vw + 1.8857rem, 3rem);
    --fluid-50: clamp(2.3125rem, 1.2381vw + 2.0107rem, 3.125rem);
    --fluid-56: clamp(2.375rem, 1.7143vw + 1.9571rem, 3.5rem);
    --fluid-60: clamp(2.4375rem, 2vw + 1.95rem, 3.75rem);
    --fluid-64: clamp(2.5625rem, 2.1905vw + 2.0286rem, 4rem);

    /* 语义化映射 */
    --fs-h1: var(--fluid-36); --fs-h2: var(--fluid-32); --fs-h3: var(--fluid-28);
    --fs-h4: var(--fluid-24); --fs-h5: var(--fluid-20); --fs-h6: var(--fluid-18);
    --fs-body: var(--fluid-16); --fs-small: var(--fluid-14);

    --fluid-py: clamp(2.5rem, 4vw + 1.5rem, 5rem);
    --fluid-px: 1.25rem;

    /* 默认字体组 B：Poppins（标题）+ DM Sans（正文） */
    --font-main: 'DM Sans', -apple-system, system-ui, sans-serif;
    --font-heading: 'Poppins', sans-serif;
}

/* ---- 备选字体组 A（Plus Jakarta Sans + Inter），取消注释并注释上方 :root 中 --font-* 两行以启用 ---- */
/*
:root {
    --font-main: 'Inter', -apple-system, system-ui, sans-serif;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
}
*/

/* ==========================================================================
   3. 中文站字体覆盖（自动感应 :lang(zh)）
   ========================================================================== */

/* ---- 默认配置（字体组 B：Poppins + DM Sans） ---- */
:root:lang(zh) {
    --font-main: 'DM Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-heading: 'Poppins', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* ---- 备选配置（字体组 A），与上方英文站同步切换 ---- */
/*
:root:lang(zh) {
    --font-main: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-heading: 'Plus Jakarta Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
*/

/* ==========================================================================
   4. 底层渲染分配（锁定字体族）
   ========================================================================== */
*, *::before, *::after {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, .elementor-heading-title, .elementor-button, .elementor-nav-menu a {
    font-family: var(--font-heading) !important;
}
body, p, .elementor-text-editor, .elementor-widget-text-editor {
    font-family: var(--font-main) !important;
}

/* ==========================================================================
   5. 中文排版精修（制造业质感）
   ========================================================================== */
:root:lang(zh) body { line-height: 1.8; }
:root:lang(zh) :is(h1, h2, h3, h4, h5, h6, .elementor-heading-title) { line-height: 1.4; letter-spacing: 0; }

:root:lang(zh) :is(p, .elementor-widget-text-editor, body) {
    font-weight: 400 !important;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   6. 布局类
   ========================================================================== */
.site-section {
    padding: var(--fluid-py) var(--fluid-px);
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   7. 强制全局取消链接下划线
   ========================================================================== */
a,
a:hover,
a:focus,
.elementor-widget-text-editor a,
.elementor-button {
    text-decoration: none !important;
}

/* ==========================================================================
   8. 面包屑全局容器样式
   ========================================================================== */
.mianbaoxie {
    font-size: 14px !important;
    color: #555555 !important;
    line-height: 1.5;
}

.mianbaoxie a {
    color: #555555;
    text-decoration: none;
    transition: color 0.3s;
}

.mianbaoxie a:hover {
    color: #000000;
}

.mianbaoxie span {
    color: #555555;
}

.mianbaoxie .sep {
    margin: 0 8px;
}

/* ==========================================================================
   9. 通用首屏头部区块：cj-pg-header
       PC 35vh / 平板 30vh / 手机 25vh

   用法：Elementor 里选中该「容器」或「Section」→ 高级 → CSS 类，填 cj-pg-header
        下面两段分别对应两种结构，同一元素只会有其中一个命中，不会重复生效。

   断点与 Elementor 默认值一致（平板 ≤1024px、手机 ≤767px）。
   若在「Elementor → 站点设置 → 布局 → 断点」改过断点，这里要同步改像素值。

   两点注意：
   1) 用 min-height 而不是 height：内容多时允许自动变高，手机上不会裁掉文字。
   2) 不要在 Elementor 里同时设「最小高度」，两边都设时以谁为准是不同的：
      - 容器：这里会赢。Elementor 只在元素级选择器上写 --min-height 变量，
        真正声明 min-height 的是低特异性的 .e-con，会被这里覆盖。
      - 旧版 Section：Elementor 会赢。它生成的是
        .elementor-{id} .elementor-element.elementor-element-{id} > .elementor-container
        （特异性 0,4,0），高于这里的 0,3,0。
        若发现高度没生效，请把 Elementor 布局里的「最小高度」清空。
   ========================================================================== */

/* 容器（新站默认结构）：min-height 直接作用在 .e-con 上 */
.cj-pg-header.e-con {
    min-height: 35vh;
    min-height: 35svh; /* 支持 svh 的浏览器用它：不随手机地址栏收放而跳动 */
}

/* 旧版 Section：与 Elementor 自身行为一致，min-height 加在内层 .elementor-container 上 */
.cj-pg-header.elementor-section > .elementor-container {
    min-height: 35vh;
    min-height: 35svh;
}

@media (max-width: 1024px) {
    .cj-pg-header.e-con,
    .cj-pg-header.elementor-section > .elementor-container {
        min-height: 30vh;
        min-height: 30svh;
    }
}

/* 手机：写在后面即可覆盖平板档 —— 与 Elementor「平板样式会继承到手机」的逻辑一致 */
@media (max-width: 767px) {
    .cj-pg-header.e-con,
    .cj-pg-header.elementor-section > .elementor-container {
        min-height: 25vh;
        min-height: 25svh;
    }
}

/* ==========================================================================
   10. 首页首屏 banner：cj-hero
       PC ≈72svh / 平板 ≈65svh / 手机 ≈60svh，并用 px 上下限夹住

   用法：Elementor 里选中该「容器」或「Section」→ 高级 → CSS 类，填 cj-hero
        （与第 9 节 cj-pg-header 相同的双结构写法，同一元素只命中其中一个）

   为什么不用 100svh、也不用裸 vh：
   1) 第一屏被撑满会让用户看不出下面还有内容，留 250–300px 露头有利于滚动；
   2) 1366×768 这类短屏笔记本可视高只有约 640px，裸 vh 会让中文标题两行就顶满，
      所以给 px 下限（580 / 500 / 440）；
   3) 1440p、4K 上裸 vh 会变成一大片空白，所以给 px 上限（820 / 700 / 600）。
   用 svh 而不是 vh/dvh：svh 是"手机地址栏展开时"的真实可视高度，CTA 不会被地址栏
   挡住；dvh 会随地址栏收放实时重排，造成抖动。

   另外：Section 的「垂直对齐」记得设为「中间」，否则内容会顶在 banner 上边。
   ========================================================================== */

/* 静态 header（随页面滚走）时改成它的实际高度，如 80px；透明覆盖式 header 保持 0px */
:root {
    --cj-header-h: 0px;
}

.cj-hero.e-con,
.cj-hero.elementor-section > .elementor-container {
    min-height: clamp(580px, calc(72vh - var(--cj-header-h)), 820px); /* 不支持 svh 时的回退 */
    min-height: clamp(580px, calc(72svh - var(--cj-header-h)), 820px);
}

@media (max-width: 1024px) {
    .cj-hero.e-con,
    .cj-hero.elementor-section > .elementor-container {
        min-height: clamp(500px, calc(65vh - var(--cj-header-h)), 700px);
        min-height: clamp(500px, calc(65svh - var(--cj-header-h)), 700px);
    }
}

@media (max-width: 767px) {
    .cj-hero.e-con,
    .cj-hero.elementor-section > .elementor-container {
        min-height: clamp(440px, calc(60vh - var(--cj-header-h)), 600px);
        min-height: clamp(440px, calc(60svh - var(--cj-header-h)), 600px);
    }
}
