<?php
/**
 * 用 :where() 中和宿主（hello-elementor / Elementor）多出来的装饰。
 *
 * 原则（铁律 55 / 57）：
 *  - 只中和「宿主加了、源站没有」的东西 —— 按钮内边距、表单焦点白圈、表格边框等
 *  - 用 :where() 包作用域（特异性 0），不压掉源站自己的模块规则
 *  - 不碰 font-size / color / background 这类源站会自己给值的属性
 *
 * 源站 reset 见 assets/css/style.mytf.css 顶部的 `*,:after,:before` 与 body 规则，
 * 那些已经在原 CSS 里，此处不再重复。
 */

/* ---------- 宿主按钮装饰（复位为源站的“无装饰”） ---------- */
:where(body) button,
:where(body) .g-btn1,
:where(body) .btn {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background-image: none;
	box-shadow: none;
	font-family: inherit;
}

/* ---------- 表单控件焦点环（host 会加 4px 白圈 + outline） ---------- */
:where(body) input:focus,
:where(body) input:focus-visible,
:where(body) textarea:focus,
:where(body) textarea:focus-visible,
:where(body) select:focus,
:where(body) select:focus-visible {
	outline: none !important;
	box-shadow: none !important;
}

/* ---------- 表格：宿主会加斑马纹与单元格内边距 ---------- */
:where(body) table td,
:where(body) table th {
	border: 0;
}

/* ---------- 页脚链接颜色：源站是 a{color:#333;text-decoration:none} ---------- */
:where(body) .footer a {
	text-decoration: none;
}

/* ---------- Elementor 容器默认 gap 会累积偏移（铁律 54） ----------
   本插件区块自身是紧贴的，靠模板层设置 gap=no 解决；这里只兜底一次性
   给「明阳薄膜组件」外面那层不留额外下边距。 */
.elementor-widget[class*="elementor-widget-mytf-"] {
	margin-block-end: 0;
}

/* ---------- Elementor 图标库字体缺省时的保底 ---------- */
.mytf-no-print {
	display: none !important;
}

/* ---------- 询盘表单反馈 ---------- */
.mytf-form-msg{font-size:.14rem;line-height:1.5;margin-top:.1rem;min-height:.2rem}
.mytf-form-msg.ok{color:#1a7f37}
.mytf-form-msg.err{color:#d93026}
.mytf-inquiry button[type=submit][disabled]{opacity:.6;cursor:default}

/* ---------- Elementor 4.x 新容器默认 10px padding ----------
   源站区块的间距全靠自己 CSS 的 padding/margin，容器多出 10px 会让
   每个区块整体下移、块间多出空隙。只中和本插件加的 .mytf-block。 */
body .mytf-block.e-con,
body .mytf-block.e-con > .e-con-inner {
	padding: 0;
	margin: 0;
}
/* 容器自身仍要整宽、且不做 flex gap */
body .mytf-block.e-con {
	gap: 0;
}

/* ============================================================
   Elementor 原生模块化：容器 + 单元 widget
   ------------------------------------------------------------
   目标：页面 = 容器树，容器内 = mytf-unit。
   难点：Elementor 容器自带 flex 布局与 10px padding，
        而源站的布局由它自己的 class 决定（.m-list4{display:flex} 等）。
   解法：用 :where() 把我们的规则权重压到 (0,1,0)，与源站同权，
        靠「加载顺序在后」让源站的 display/gap/padding 生效。
   ============================================================ */

/* 单元 widget 的宿主也不生成盒子 */
.elementor-widget-mytf-unit,
.elementor-widget-mytf-unit > .elementor-widget-container {
	display: contents !important;
}

/* 注：容器的 display/width/padding 不在这里强行改写。
   那样会与源站的 .wp{width:1280px} / .m-list4{display:flex} 抢同一个元素而互相打脸。
   改为靠加载顺序：style.mytf.css 依赖 elementor-frontend，源站规则自然排在后面胜出。 */

/* 单元内容的外壳：不加任何默认样式，尺寸完全由源站 class 决定 */
.mytf-s-box {
	display: contents;
}

/* 叶子元素 widget（纯文本 / 纯图片） */
.elementor-widget-mytf-el,
.elementor-widget-mytf-el > .elementor-widget-container {
	display: contents !important;
}

/* ---------- 源站 flex 容器方向还原（自动生成） ----------
   源站用 display:flex 排版但多数没写方向（默认 row），
   而 Elementor 容器的 --flex-direction 是 column，会把它变成竖排
   （products 页产品网格因此从 776 涨到 2327）。
   只在 ≥1200px 强制横排：窄屏源站自己会在 @media 里改成 column，
   若用无条件的 !important 会把那套响应式压掉（首页 390 实测矮 220px）。 */
@media (min-width: 1200px) {
  .ban-opts, .fd-nv, .fd-share, .fd-top, .g-t1, .g-t3, .g-tabtop, .hg-swpArrow1, .hg-swpBtns1, .hg-swpFraction1, .jl-info1, .jl-info3, .jl-info4, .jl-info5, .jl-ls1, .jl-ls2, .jl-ls3, .jl-ls4, .jl-ls5, .jl-ls6, .jl-ls7, .jl-ls8, .m-about2, .m-about4, .m-arrow, .m-contab3, .m-emp3, .m-fuwu, .m-list1, .m-list10, .m-list2, .m-list3, .m-list4, .m-list5, .m-list6, .m-list7, .m-list8, .m-list9, .m-tab2, .m-tab3, .m-tech3, .nav, .ul-emp2, .ul-emp4, .ul-emp6, .ul-listab2, .ul-listab4_1, .ul-news, .ul-pk1_1, .ul-pk3, .ul-tech1, .ul-tech2, .ul-tech3 { flex-direction: row !important; }
}
