/*
 * 主题自己的少量样式（前端稿 style.css / style-new2.css 不改，方便以后整份替换）。
 */

/* 登录后的固定导航避开 WordPress 工具栏。 */
body.admin-bar {
	--mastars-admin-bar-height: 32px;
}

body.admin-bar .header .header-pc,
body.admin-bar .header .m_header_box {
	top: var(--mastars-admin-bar-height);
}

/* 大菜单和搜索层也采用固定定位，需要与导航同步下移。 */
body.admin-bar .header .header-pc .header-wrap .nav dd.nav-open,
body.admin-bar .header .search-pop {
	top: calc(var(--header-height) + var(--mastars-admin-bar-height));
}

@media screen and (max-width: 1024px) {
	body.admin-bar .header .search-pop {
		top: calc(50px + var(--mastars-admin-bar-height));
	}
}

@media screen and (max-width: 782px) {
	body.admin-bar {
		--mastars-admin-bar-height: 46px;
	}
}

/* 小屏工具栏也保持固定，滚动后不会在导航上方留下空隙。 */
@media screen and (max-width: 600px) {
	body.admin-bar #wpadminbar {
		position: fixed;
	}
}

/* 前端稿用 select:valid 隐藏浮动标签，默认下拉框都是必填。询盘弹窗里 Service 是选填
   （ebx_core_get_inquiry_form_config 决定），空值也算 valid，标签会一直不显示；
   选填下拉框改由 mastars.js 加的 .has-value 判断。 */
.field select:not([required]):not(.has-value):not(:focus) ~ .field-ph {
	opacity: 1;
}

/* 缩略图数量不足时保持每行五项的尺寸，不套用通用的均分放大规则。 */
.page-cnc-machining-materials .swiper-main .swiper-sync-master.swiper-no-enough > .swiper-wrapper > .swiper-slide {
	width: auto !important;
	flex: 0 0 calc((100% - 0.64rem) / 5);
}

@media screen and (max-width: 1023px) {
	.page-cnc-machining-materials .swiper-main .swiper-sync-master.swiper-no-enough > .swiper-wrapper > .swiper-slide {
		flex-basis: calc((100% - 24px) / 4);
	}
}

/* Resources 列表的分页只有一页时由 mastars.js 加 hidden，前端稿给分页设了 display:flex 会盖过 hidden。 */
.case-pager[hidden],
.tips-pager[hidden] {
	display: none !important;
}

/* 前端稿的 .swiper-no-enough 会把「内容不足一屏」的卡片撑满整行；推荐位刚开始录入时只有 1~2 篇，
   首页案例 / 资讯等卡片会变成整行巨图。桌面端让它保持正常卡片宽度、靠左排列（录满后不受影响）。 */
@media screen and (min-width: 769px) {
	.page-index-proof .swiper-no-enough .swiper-wrapper,
	.page-index-new .swiper-no-enough .swiper-wrapper {
		justify-content: flex-start;
	}
	.page-index-proof .swiper-main .swiper-no-enough .swiper-wrapper .swiper-slide {
		width: 25% !important;
	}
	.page-index-new .swiper-main .swiper-no-enough .swiper-wrapper .swiper-slide {
		width: 33.333% !important;
	}
}

/* 搜索结果列表（search.php）：每条一行，有缩略图才在右侧显示，没图就是纯文字行。 */
.search-list {
	border-top: 1px solid #e6e6e6;
}
.search-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .4rem;
	padding: .3rem 0;
	border-bottom: 1px solid #e6e6e6;
	color: inherit;
}
.search-body {
	flex: 1;
	min-width: 0;
}
.search-title {
	margin: .1rem 0 .08rem;
	color: #333;
}
a.search-item:hover .search-title {
	color: var(--color-primary, #0070c9);
}
.search-desc {
	margin: 0 0 .1rem;
	color: #666;
	line-height: 1.7;
}
.search-pic {
	flex: 0 0 2.2rem;
	width: 2.2rem;
	max-width: 35%;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	border-radius: .08rem;
}
.search-pic img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
@media screen and (max-width: 768px) {
	.search-item {
		align-items: flex-start;
		gap: .2rem;
		padding: .5rem 0;
	}
	.search-pic {
		flex-basis: 30%;
		width: 30%;
	}
}

/* 页脚原稿社交图标：账号待配置时使用静态占位。 */
.socials-wrap .social-placeholder { display: flex; align-items: center; justify-content: center; }
.socials-wrap .social-placeholder .icon { overflow: hidden; }
.socials-wrap .social-placeholder .icon img { width: auto; height: .24rem; min-height: 16px; }

/* Our Company：统计区上方保留一条横线（设计稿 show_company.html 统计条上方有线），
   下方直接接色块不显示；里程碑区上下均不显示，保留统计项之间的竖线。 */
.company-profile-page > .page-index-data {
	border-bottom: 0;
}
.company-profile-page > .page-about-company-milestones {
	border-top: 0;
	border-bottom: 0;
}

/* 验证码图片可点击换一个（见 mastars.js）。 */
.code-row .code-img[data-refresh] {
	cursor: pointer;
}

/* 活动列表各尺寸均显示前三篇，第 4 篇起由 View All 展开。 */
.page-about-events .events-list .event-card:nth-child(3):not(.is-more) {
	display: flex;
}

/* Partnership 行业筛选：对应 mastars.js 的筛选类及选中状态。 */
.page-rescources-partnership .partnership-card.is-hide {
	display: none;
}
.page-rescources-partnership .partnership-nav-item.is-active {
	color: var(--color-active);
}
.page-rescources-partnership .partnership-nav-item:focus-visible {
	outline: 2px solid var(--color-active);
	outline-offset: 2px;
}

/* 联系页与询盘弹窗的必填反馈，不依赖隐藏控件的浏览器气泡。 */
.inquiry-validation-list { padding: 8px 24px 8px 40px; margin: 12px 0; color: #b42318; line-height: 1.6; font-size: 14px; list-style: disc; }
.inquiry-validation-list li + li { margin-top: 8px; }
.contact-form-el [aria-invalid="true"],
.contact-form-el input[aria-invalid="true"] + .consent-box { border-color: #b42318; outline: 1px solid #b42318; }


/* Industries 原稿桌面案例箭头常驻；一屏放满时保留禁用箭头，手机沿用原稿隐藏规则。 */
@media (min-width: 1025px) {
  .page-index-proof.cases-navigation-always .swiper-main > .slide-btn {
    display: flex !important;
  }
  .page-index-proof.cases-navigation-always .swiper-main > .slide-btn.swiper-button-lock {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
  }
}


/* Certifications 资源区桌面箭头遵循原稿，三张卡一屏时保留禁用导航。 */
@media (min-width: 1025px) {
  .certifications-resources-navigation .swiper-main > .slide-btn {
    display: flex !important;
  }
  .certifications-resources-navigation .swiper-main > .slide-btn.swiper-button-lock {
    opacity: 0.35;
    pointer-events: none;
    cursor: default;
  }
}

/* FAQ 答案里的超链接（答案文本框写 [文字](链接)，见 mastars_link_text）。 */
.page-QA-down .text-body a,
.faq-a a {
	color: var(--color-primary, #0070c9);
	text-decoration: underline;
}

/* 404 页面（404.php）：大号 404 + 搜索 + 按钮 + 主菜单快捷入口。 */
.page-404 {
	padding: 1.2rem 0 1.6rem;
	text-align: center;
}
.page-404-code {
	margin-bottom: .2rem;
	font-size: 2.4rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .04em;
	color: var(--color-primary, #0070c9);
	opacity: .9;
}
.page-404 .page-title {
	margin-bottom: .4rem;
}
.page-404 .help-search {
	margin: 0 auto .5rem;
}
.page-404-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: .2rem;
	margin-bottom: .6rem;
}
.page-404-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .12rem .3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.page-404-links a {
	color: #666;
	text-decoration: underline;
}
.page-404-links a:hover {
	color: var(--color-primary, #0070c9);
}
@media screen and (max-width: 768px) {
	.page-404 {
		padding: .8rem 0 1rem;
	}
	.page-404-code {
		font-size: 1.6rem;
	}
}

/* 菜单项 CSS 类 nav-nolink：只是显示用的分组标题，<a> 不带 href，不可点（见 inc/menus.php）。 */
.header a:not([href]),
.foot-nav-box a:not([href]) {
	cursor: default;
	pointer-events: none;
}


.page-show-content .faq-item[id] { scroll-margin-top: 120px; }

/* Company 服务范围按钮统一蓝色询盘入口，悬停不变橙色。 */
.page-about-working .btn-container .company-inquiry-button.active,
.page-about-working .btn-container .company-inquiry-button.active:hover {
  background-color: var(--color-active);
  color: #fff;
}

/* Our Story 正文按后台原始大小写显示。 */
.page-about-story .page-main > .page-about-story2 .text-box .text-inner .text-body {
  text-transform: none;
}

/* 工厂实录说明按后台原文大小写显示。 */
.page-about-working .page-main .working-excellence .text-box .text-body {
  text-transform: none;
}

/* 服务范围介绍按后台原文大小写显示。 */
.page-about-working .page-main .working-intro .intro-left .text-body {
  text-transform: none;
}

/* Our Company 简介正文保持后台原文大小写。 */
.page-about-story .page-main > .page-about-story3 .text-box .text-inner .text-body {
  text-transform: none;
}

.faq-topic-reader .faq_nav button { background: transparent; border: 0; cursor: pointer; font-family: inherit; }
.faq-topic-reader .faq-topic-content { max-width: 1000px; margin: 40px auto 0; line-height: 1.8; }
.faq-topic-reader .faq-topic-content[hidden] { display: none; }
.faq-topic-reader .faq-topic-content h2 { margin: 30px 0 14px; font-size: 22px; line-height: 1.5; scroll-margin-top: 120px; }
.faq-topic-reader .faq-topic-content p { margin-bottom: 20px; }
@media(max-width:767px) { .faq-topic-reader .faq-topic-content h2 { font-size: 19px; } }


/* 三级服务详情：多条图文按后台顺序交替，移动端统一图上文下。 */
.services-detail-features .page-main .list > .item + .item {
  margin-top: clamp(40px, 5vw, 80px);
}
.services-detail-features .page-main .list > .item .item-box > .text-box {
  padding-right: 0;
}
@media (min-width: 991px) {
  .services-detail-features .page-main .list > .item:nth-child(even) > .item-box {
    flex-direction: row-reverse;
  }
}
@media (max-width: 990px) {
  .services-detail-features .page-main .list > .item .item-box > .public-img-box,
  .services-detail-features .page-main .list > .item .item-box > .text-box {
    width: 100%;
    max-width: none;
  }
}
