/* 手机/平板适配补丁（加载在 site.css 之后）。
 * 线上原站没有 viewport，手机上只是缩小的桌面版；加上 viewport 后需要这里修正页头语言切换器、表单等在窄屏的溢出。
 * 中文动态页（header.php）与 14 种语言静态页（build/enhancers.py）共用。 */

/* ---------- 页头：语言切换器 ---------- */
.trp-language-switcher { max-width: 100%; }

/* 平板：导航 + 切换器放不下时收紧间距，避免撑出屏幕 */
@media (min-width: 768px) and (max-width: 1023.98px) {
  #navbar > .container > a img { height: 2.5rem; }
  #pc-menu > :not([hidden]) ~ :not([hidden]) { margin-left: 1rem !important; margin-right: 0 !important; }
  #pc-menu { font-size: .9rem; }
  .trp-language-switcher { width: 150px !important; }
  .trp-language-switcher .trp-ls-shortcode-current-language,
  .trp-language-switcher .trp-ls-shortcode-language { width: 150px !important; }
  .trp-language-switcher > div > a { font-size: 14px; padding: 7px 6px; }
}

/* 手机：切换器只显示当前语言的国旗，下拉列表向页面内侧展开 */
@media (max-width: 767.98px) {
  #navbar > .container { gap: .5rem; }
  #navbar > .container > a { min-width: 0; flex: 0 1 auto; }
  #navbar > .container > a img { height: 2.25rem; width: auto; max-width: 100%; }
  .trp_language_switcher_shortcode { margin-left: auto; margin-right: .25rem; flex: none; }
  .trp-language-switcher { width: auto !important; min-width: 0; height: 38px; }
  .trp-language-switcher > div { padding: 3px 8px; }
  .trp-language-switcher .trp-ls-shortcode-current-language { width: auto !important; }
  .trp-language-switcher .trp-ls-shortcode-current-language > a { font-size: 0; padding: 6px 4px; }
  .trp-language-switcher .trp-ls-shortcode-current-language > a > img { margin: 0; width: 22px; height: 15px; }
  .trp-language-switcher:focus .trp-ls-shortcode-language,
  .trp-language-switcher:hover .trp-ls-shortcode-language,
  .trp-language-switcher:focus-within .trp-ls-shortcode-language {
    width: auto !important; min-width: 190px; left: auto; right: 0; top: 0;
    visibility: visible; display: inline-block !important; position: absolute; height: auto; max-height: 70vh; overflow-y: auto; z-index: 60;
  }
  .trp-language-switcher:focus-within .trp-ls-shortcode-current-language { visibility: hidden; }
  html[dir="rtl"] .trp-language-switcher:focus .trp-ls-shortcode-language,
  html[dir="rtl"] .trp-language-switcher:hover .trp-ls-shortcode-language,
  html[dir="rtl"] .trp-language-switcher:focus-within .trp-ls-shortcode-language { left: 0; right: auto; }
  html[dir="rtl"] .trp_language_switcher_shortcode { margin-left: .25rem; margin-right: auto; }
}

/* ---------- 通用防溢出 ---------- */
/* 首页轮播：Swiper 10 只给 .swiper 加 overflow:hidden，模板用的是 .swiper-container，
 * 未命中，后面的幻灯片会把手机端页面撑宽（视口被放大，页头右侧元素被推出屏幕） */
.swiper-container { overflow: hidden; position: relative; }
html, body { max-width: 100%; overflow-x: clip; }
img, video, iframe, embed, table { max-width: 100%; }
.prose { overflow-wrap: anywhere; }
.prose img { height: auto; }
.prose table { display: block; overflow-x: auto; }
.wpforms-container, .wpforms-form, .wpforms-field input, .wpforms-field textarea, .wpforms-field select { max-width: 100% !important; box-sizing: border-box; }
.wpforms-field textarea { width: 100% !important; min-width: 0; }
/* 网格子项默认 min-width:auto，textarea 的固有宽度会把单列网格撑宽 */
.wpforms-field-container { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .wpforms-field-container { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wpforms-field-container > * { min-width: 0; }
/* 原模板脚本给"需求描述"字段写死 style.width=206%（桌面两列时撑满两列的取巧写法），单列的手机端会溢出 */
@media (max-width: 767.98px) { .wpforms-field-container > .wpforms-field { width: 100% !important; } }
/* 手机端：首页"四个优势"、联系页"服务时间/热线"这类并排块在长文案语言（德/俄/越…）下放不下，改为单列 */
@media (max-width: 767.98px) {
  .grid.grid-cols-2.gap-6.mb-8 { grid-template-columns: minmax(0, 1fr); }
  .bg-white\/10.inline-block { display: block; }
  .bg-white\/10 > .space-x-12 { flex-direction: column; gap: 1.25rem; }
  .bg-white\/10 > .space-x-12 > * { margin-left: 0 !important; margin-right: 0 !important; }
  .bg-white\/10 > .space-x-12 > .w-px { width: 60%; height: 1px; }
}
@media (max-width: 1023.98px) {
  .grid > *, .grid-cols-2 > * { min-width: 0; overflow-wrap: break-word; }
  .flex.items-start > div:last-child { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
}
/* 页脚链接行在德语等长文案下放不下：允许换行 */
@media (max-width: 1023.98px) {
  footer .space-x-6 { flex-wrap: wrap; gap: .5rem 1.5rem; }
  footer .space-x-6 > * { margin-left: 0 !important; margin-right: 0 !important; }
}
