/* ============================================================================
   rtl.css — 阿拉伯语（RTL）镜像覆盖层
   ----------------------------------------------------------------------------
   作用域：只对 <html dir="rtl"> 生效。
     · dir 由 layouts/_default/baseof.html 依 .Site.Language.Direction 输出；
     · hugo.toml 的 [languages.ar].direction = "rtl"；
     · head.html 仅在 RTL 语言下引入本文件（LTR 语言根本不下载它）。
   口径（2026-10-17 用户选定「完整镜像」）：不改 LTR 基线，只做方向性镜像——
     文字对齐 / inline 间距 / 弹层对齐 / 分隔线 / 浮动按钮 / 列表圆点。
   LTR 语言零影响：文件不加载，即便加载也没有 [dir="rtl"] 命中。
   ============================================================================ */

/* ---------------------------------------------------------------------------
   0. 字体：Inter / Space Grotesk 不含阿拉伯字形。
      Google Fonts 的 @font-face 带 unicode-range —— 把 Noto Kufi Arabic 放在
      栈最前，阿拉伯字符命中它，拉丁字符（品牌名、CNC、型号）仍落到 Inter /
      Space Grotesk，互不干扰。
   --------------------------------------------------------------------------- */
[dir="rtl"] {
  --font-body: 'Noto Kufi Arabic', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Noto Kufi Arabic', 'Space Grotesk', 'Segoe UI', sans-serif;
}

/* ---------------------------------------------------------------------------
   1. 文字对齐
   （.section-header.center / .stat / .section-center p 是居中，无需镜像）
   --------------------------------------------------------------------------- */
[dir="rtl"] .hero-trust-item { text-align: right; }
[dir="rtl"] .equipment-table th { text-align: right; }
[dir="rtl"] .equipment-table td { text-align: right; }

/* ---------------------------------------------------------------------------
   2. inline 间距与列表圆点（原为 left 定位的项要翻到右侧）
   --------------------------------------------------------------------------- */
[dir="rtl"] .skip-link { left: auto; right: 16px; }
[dir="rtl"] .lang-switch { margin-left: 0; margin-right: 8px; }
[dir="rtl"] .footer .footer-prod-child { padding-left: 0; padding-right: 20px; }
[dir="rtl"] .footer .footer-prod-child::before { left: auto; right: 7px; }
[dir="rtl"] .dropdown-has-groups .dropdown-child::before { left: auto; right: 13px; }

/* ---------------------------------------------------------------------------
   3. 弹层 / 下拉：靠父项左边对齐的改靠右，反之亦然
   --------------------------------------------------------------------------- */
[dir="rtl"] .dropdown { left: auto; right: 0; }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .lang-more::after { right: auto; left: 0; }

/* ---------------------------------------------------------------------------
   4. 分隔线：.stat 的竖线在 RTL 下应落在单元格左侧
   --------------------------------------------------------------------------- */
[dir="rtl"] .stat { border-right: none; border-left: 1px solid var(--color-gray-100); }
[dir="rtl"] .stat:last-child { border-left: none; }

/* ---------------------------------------------------------------------------
   5. 固定浮动按钮：右下角 → 左下角
   （responsive.css 的两档 bottom/right 取值同源，这里按断点给出镜像）
   --------------------------------------------------------------------------- */
[dir="rtl"] .float-inquiry { right: auto; left: 24px; }
@media (max-width: 768px) {
  [dir="rtl"] .back-to-top { right: auto; left: 20px; }
}
@media (min-width: 769px) {
  [dir="rtl"] .back-to-top { right: auto; left: 24px; }
}

/* ---------------------------------------------------------------------------
   6. 方向性符号
   按钮文本里的箭头（&rarr; / &larr;）属**内容**，由内容层镜像 ——
   见 tools/mirror-arrows.mjs（&rarr;↔&larr;、→↔←），不在 CSS 里处理。
   --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   7. 表单：数字/电话/邮箱输入保持 LTR 内部顺序（RTL 页面里输入拉丁串时
      光标与数字顺序才正确；说明性文本仍随页面 RTL）
   --------------------------------------------------------------------------- */
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="number"] {
  direction: ltr;
  text-align: right;
}
/* ---------------------------------------------------------------------------
   8. 品牌标识：不随页面方向反转
   品牌名是拉丁串（XiangYing Metal）。在 RTL 段落里，两个相邻的 LTR run 的
   **先后顺序会被反转**（"XiangYing" 与 "Metal" 互换位置），因此必须显式固定 LTR。
   （2026-10-17：配合 i18n/ar.toml 的 logoTextSpan 还原为 "Metal" —— 品牌名不本地化）
   --------------------------------------------------------------------------- */
[dir="rtl"] .logo-text {
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------------------------------------------------------------------------
   9. 统计数值：数字 + 符号/单位 需作为一个整体参与 bidi，避免 "+50" 变成 "50 +"、
      "±0.005mm" 被拆开。isolate 只隔离、不改内部方向 —— 含阿拉伯语词的项
      （如「5 أيام」）仍按 RTL 正常排布。
   --------------------------------------------------------------------------- */
[dir="rtl"] .hero-trust-value,
[dir="rtl"] .stat-number {
  unicode-bidi: isolate;
}

/* ---------------------------------------------------------------------------
   10. 表单占位符（原第 7 节的分支，2026-10-17 编辑时被误删，此处补回）
   输入框正文保持 LTR 内部顺序（拉丁串输入才正确），占位符提示文案随页面 RTL。
   --------------------------------------------------------------------------- */
[dir="rtl"] input[type="email"]::placeholder,
[dir="rtl"] input[type="tel"]::placeholder,
[dir="rtl"] input[type="url"]::placeholder {
  direction: rtl;
  text-align: right;
}

