/*
首页
====

只在站点首页加载（见 functions.php 里的 is_front_page() 判断）。

数值不是拍脑袋来的 —— 逐条抄自 Elementor 为原首页生成的
wp-content/uploads/elementor/css/post-7105.css，用来保证新旧两版外观 1:1。
那边是每个 element id 一条规则，这里是语义类，对应关系写在每段上面。

父主题 assets/css/main/main.css 里已有的 .image-feature / .image-border /
.mobile-scroll 直接复用，本文件不重复实现。

断点跟随原 Elementor 配置：1024px 和 767px。
*/

.sh-home {
	/* 原 Elementor 页面整体的正文行高是 1.6，比主题默认的 1.5 松一档，
	   商品卡等主题自带组件的高度也跟着差几像素，所以整块统一成 1.6。 */
	line-height: 1.6;
	--sh-container: 1140px;
	--sh-ink: #4a4068;
	--sh-hero-bg: #e1e6ef;
	--sh-green: #3bb54a;
	--sh-dark: #222222;
	/* 原 Elementor 的 column gap：default 10px → 20px 间距，extended 15px → 30px，wide 20px → 40px。 */
	--sh-gap: 20px;
}

@media (max-width: 1024px) {
	.sh-home {
		--sh-container: 1024px;
	}
}

@media (max-width: 767px) {
	.sh-home {
		--sh-container: 767px;
	}
}

.sh-home__container {
	max-width: var(--sh-container);
	margin-right: auto;
	margin-left: auto;
}

/* 原 Elementor 的列容器（.elementor-element-populated）四边都有 gap/2 的内距，
   不是只有左右 —— 上下那 10~20px 撑出了整页的纵向节奏，漏掉会让每个区块都偏矮。
   这里用 grid 的 gap 还原列间距，用容器内距还原列的四边内距，效果等价。 */
.sh-home__row {
	display: grid;
	gap: var(--sh-gap);
	padding: calc(var(--sh-gap) / 2);
}

/* 没有用 .sh-home__row 的区块，单独补上同样的四边内距。
   用了 .sh-home__row 的区块不要再加，否则内距翻倍。 */
.sh-home__section--heading .sh-home__container,
.sh-home__section--products .sh-home__container {
	padding: 10px;
}

/* 主题在 ≤992px 给 `.elementor-shortcode ul.products` 单独加了 5px 左右内距，
   原版的商品短代码正好在 Elementor 的 shortcode 组件里，所以吃到了这份内距。
   这里没有那层包装，得自己补，否则移动端商品图会比原版宽 5px、每行矮一点。 */
@media (max-width: 992px) {
	.sh-home__section--products .sh-home__container {
		padding-right: 15px;
		padding-left: 15px;
	}
}

/* 主题的标题/正文默认外边距会顶开间距，这里统一归零，间距全部由本文件显式给。
   必须用 :where() 把选择器权重压到 (0,1,0) —— 写成 `.sh-home h1` 是 (0,1,1)，
   会反过来压掉下面所有单类名的 margin 设置（踩过一次）。 */
.sh-home :where(h1, h2, h3) {
	margin: 0;
}

/* 正文段落保留主题自带的 margin-bottom（原 Elementor 版也保留着，
   它是区块高度的一部分），需要归零的地方单独写。 */

/* 原 Elementor 的 .elementor-heading-title 默认 line-height 是 1，
   不是主题的标题行高 —— 这是新旧两版行高差异的来源。 */
.sh-home__heading,
.sh-home__card-title,
.sh-home__testimonial-name,
.sh-home__hero-note {
	line-height: 1;
}

/* ── 区块 1：Hero ─────────────────────────────────────────────────────
   原 e0ee2b2：background #e1e6ef，container min-height 435px，内容垂直居中。
   移动端 min-height 归零、padding-top 26px。 */
.sh-home__hero {
	background-color: var(--sh-hero-bg);
}

/* 桌面端没有左右内距 —— 原内层 section 只在平板/移动端加 padding。
   min-height 用 450px：原版配的是 435px，但图片列的内容更高，实际渲染出来就是
   450px（量过新旧两版的元素盒），这里直接写实测值。 */
.sh-home__hero-inner {
	display: flex;
	min-height: 450px;
	align-items: center;
}

.sh-home__hero-copy {
	flex: 1 1 50%;
	min-width: 0;
}

.sh-home__hero-media {
	display: flex;
	flex: 1 1 50%;
	min-width: 0;
	align-items: flex-end;
	justify-content: center;
}

.sh-home__hero-image {
	display: block;
	width: 519px;
	max-width: 100%;
	height: auto;
}

/* 原 50834686：62px / 1.2em / -1.5px，margin 0 0 20px 6px。 */
.sh-home__hero-title {
	margin: 0 0 20px 6px;
	font-size: 62px;
	line-height: 1.2em;
	letter-spacing: -1.5px;
}

/* 原 6bf9a88a：23px / 400 / 1.5em / -0.2px，色 #4a4068，padding 0 0 10px 10px。 */
.sh-home__hero-subtitle {
	padding: 0 0 10px 10px;
	color: var(--sh-ink);
	font-weight: 400;
	font-size: 23px;
	line-height: 1.5em;
	letter-spacing: -0.2px;
}

/* 原 2b594290：绿底白字，radius 4px，padding 22px 35px，19px/600，左侧 10px 内距。 */
.sh-home__button {
	display: inline-block;
	margin: 0 0 20px 10px;
	padding: 22px 35px;
	border-radius: 4px;
	color: #fff;
	background-color: var(--sh-green);
	font-weight: 600;
	font-size: 19px;
	line-height: 1;
	text-decoration: none;
}

.sh-home__button:hover,
.sh-home__button:focus {
	color: #fff;
	background-color: var(--sh-green);
	opacity: 0.9;
}

/* 原 2f97d111：15px，padding 0 0 15px 10px，且是最后一个 widget（无下外边距）。 */
.sh-home__hero-note {
	margin: 0;
	padding: 0 0 15px 10px;
	font-size: 15px;
}

/* ── 区块 2：三张分类入口大图 ─────────────────────────────────────────
   原 63412b4：padding 25px 10px 35px 10px。
   图本身交给父主题的 .image-feature。 */
.sh-home__section--features {
	padding: 25px 10px 35px 10px;
}

/* 列数跟着卡片数量走：auto-fit + 1fr 有几张卡就分几列，
   加一张减一张不用改这里。 */
.sh-home__row--features {
	grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

/* 必须的定位上下文：父主题的 .image-feature figcaption 是绝对定位，但
   .image-feature 本身没有 position。原 Elementor 版是靠全局的
   .elementor-element{position:relative} 兜住的，这里补上，否则 caption
   会以更外层的祖先为基准，飞到页面上方去。 */
.sh-home__feature {
	position: relative;
}

/* 主题的 .wp-caption 带 margin-bottom: 1em（16px），原 Elementor 版把它归零了，
   不归零每个 CTA 列都会高 16px。 */
.sh-home__feature .wp-caption {
	margin-bottom: 0;
}

/* 必须的：父主题的 `.image-feature a { overflow: hidden }` 用来裁掉 hover 时放大的
   图片，但 overflow 对行内元素不生效。原版那条 a 是块级，靠的是
   `.elementor-widget-image.image-feature a { display: block }` —— 而这里没有
   .elementor-widget-image 这层类，所以得自己声明成块级，否则鼠标移上去图片会
   溢出 .wp-caption。 */
.sh-home__feature a {
	display: block;
}

/* ── 区块 3 / 11：商品区标题 ──────────────────────────────────────────
   原 141eed01 padding 0 0 15px 0；54823e33 padding 55px 0 20px 0。 */
.sh-home__section--heading-spaced {
	padding-top: 55px;
	padding-bottom: 20px;
}

.sh-home__section--heading:not(.sh-home__section--heading-spaced) {
	padding-bottom: 15px;
}

.sh-home__heading--center {
	text-align: center;
}

/* 「Real talk」和「Our most popular products」两处标题在原版里单独设了
   line-height 1.4em / letter-spacing -0.3px，其余标题是默认的 1。 */
.sh-home__section--intro-extended .sh-home__heading,
.sh-home__section--heading-spaced .sh-home__heading {
	line-height: 1.4em;
	letter-spacing: -0.3px;
}

/* ── 区块 5 / 7 / 13：居中标题 + 导语 ─────────────────────────────────
   原为 16/66/16 三栏，两侧空栏只用来限定正文宽度，这里直接给 max-width。
   三处 column gap 不同（default / extended / wide），宽度差在 10px 级别。
   三块都带一条 #eaeaea 的上边框（原 Elementor 的 border_border: solid）。 */
.sh-home__section--intro {
	padding-top: 50px;
	border-top: 1px solid #eaeaea;
}

.sh-home__section--intro-wide {
	padding-bottom: 10px;
}

/* 中间那栏在原版里宽 760px（66% 的 1140 加回列内距），
   减掉各区块不同的列内距后正文宽度分别是 740 / 730 / 720。 */
.sh-home__intro {
	width: 66.666%;
	max-width: 760px;
	margin-right: auto;
	margin-left: auto;
}

.sh-home__section--intro-default .sh-home__intro {
	padding: 10px;
}

.sh-home__section--intro-extended .sh-home__intro {
	padding: 15px;
}

.sh-home__section--intro-wide .sh-home__intro {
	padding: 20px;
}

/* 标题 widget 与正文 widget 之间的间距 = 标题 widget 的下外边距 + 正文 widget 的
   上内距，原版三处取值不同（Why 是 20px，另两处是 15px），按实测值给。 */
.sh-home__intro-body {
	padding-top: 20px;
}

.sh-home__section--intro-extended .sh-home__intro-body,
.sh-home__section--intro-wide .sh-home__intro-body {
	padding-top: 15px;
}

/* ── 区块 6：三张图文卡片 ─────────────────────────────────────────────
   原 4ab7341e：padding 0 0 30px 0，column gap extended。
   卡片图 max-width 25%，标题 20px 居中。 */
.sh-home__section--cards {
	padding-bottom: 30px;
}

.sh-home__row--cards {
	grid-template-columns: repeat(3, 1fr);
	--sh-gap: 30px;
}

.sh-home__card-image {
	margin-bottom: 20px;
}

.sh-home__card-image img {
	display: block;
	width: auto;
	max-width: 25%;
	height: auto;
	margin: 0 auto;
}

.sh-home__card-title {
	margin-bottom: 15px;
	font-size: 20px;
	text-align: center;
}


/* 滚动入场淡入 —— 对应原来 Elementor 的 animated-fast elementor-invisible。
   初始隐藏态挂在 html.js 上，JS 没跑起来时内容照常显示。 */
.js .sh-home__card--animate {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.js .sh-home__card--animate.is-visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.js .sh-home__card--animate {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* ── 区块 8 / 9：客户见证 ─────────────────────────────────────────────
   原 1a818c77 padding 0 0 20px 0；196a5a08 padding 40px 0 70px 0。
   两栏 50/50、垂直居中，column gap extended。
   照片侧用父主题的 .image-border。 */
.sh-home__section--testimonial {
	padding-bottom: 20px;
}

.sh-home__testimonial {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
	align-items: center;
	padding: 15px;
}

.sh-home__testimonial--photo-left .sh-home__testimonial-photo {
	order: -1;
}

/* 原 section 9 的文字列 padding 是 10px 10px 10px 40px（左内距比常规的 15px 大），
   文字因此比图片列多缩进 25px。 */
.sh-home__testimonial--photo-left .sh-home__testimonial-copy {
	padding-left: 25px;
}

/* 原 Elementor 给这张图设的是 space 10%（相对列内容宽度），不是它的原始宽度
   158px —— 实际渲染出来只有 54×8。 */
.sh-home__testimonial-signature {
	display: block;
	width: 10%;
	height: auto;
	margin: 20px 0 10px;
}

.sh-home__testimonial-name {
	font-size: 20px;
}

/* 第二条见证的上下留白比第一条大。 */
.sh-home__section--testimonial + .sh-home__section--testimonial {
	padding-top: 40px;
	padding-bottom: 70px;
}

/* ── 区块 10：本周特惠 ───────────────────────────────────────────────
   原 56fe7973：整宽深色底 #222222，上下 70px 内距，内容垂直居中。 */
.sh-home__section--offer {
	padding: 70px 0;
	background-color: var(--sh-dark);
}

.sh-home__offer {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	align-items: center;
	padding: 10px;
}

/* 标题 50px / ls -0.8px / 白。
   margin-bottom 5px = 原 Elementor 的 widget 间距 20px 加上标题自己的 -15px。 */
.sh-home__offer-title {
	margin-bottom: 5px;
	color: #fff;
	font-size: 50px;
	line-height: 1;
	letter-spacing: -0.8px;
}

/* 正文 19px/400、lh 1.5、半透明白，右 20px。
   margin-bottom 25px 同理 = widget 间距 20px + 自己的 5px。 */
.sh-home__offer-body {
	margin: 10px 20px 25px 0;
	padding-bottom: 2px;
	color: rgba(255, 255, 255, 0.79);
	font-weight: 400;
	font-size: 19px;
	line-height: 1.5em;
}

/* 这个按钮是白底黑字，不是首页通用的绿底白字。 */
.sh-home__offer .sh-home__button {
	margin: 0;
	padding: 22px 35px;
	border-radius: 4px;
	color: #000;
	background-color: #fff;
	font-weight: 400;
	font-size: 17px;
}

.sh-home__offer .sh-home__button:hover,
.sh-home__offer .sh-home__button:focus {
	color: #000;
	background-color: #fff;
}

/* 图片外面套一圈 5px 的半透明白描边。
   左右各 10px 而不是原版的 20px —— 原版的 20px 是从 570px 宽的列里减的，
   我们的列本身已经少了 gap 那一份，减 10px 才能得到同样宽的描边框。 */
.sh-home__offer-media {
	margin: 0 10px;
	border: 5px solid rgba(255, 255, 255, 0.09);
}

/* 图片只有 237px 宽，水平居中；靠上下负外边距探出描边框 —— 这是原版的效果。 */
.sh-home__offer-media img {
	display: block;
	width: 237px;
	max-width: 100%;
	height: auto;
	margin: -120px auto -85px;
}

/* ── 区块 14：品牌 logo ──────────────────────────────────────────────
   原 dc4a89b：padding 0 0 45px 0，六列平分；移动端每行两个。 */
.sh-home__section--brands {
	padding-bottom: 45px;
}

.sh-home__row--brands {
	grid-template-columns: repeat(6, 1fr);
}

/* 原 Elementor 的 space 85%（相对列内容宽度），不是撑满整列。 */
.sh-home__brand img {
	width: 85%;
	max-width: 100%;
	height: auto;
}

/* ── 平板 ─────────────────────────────────────────────────────────────
   对应 post-7105.css 里的 @media(max-width:1024px)。
   必须写在 767 断点之前 —— 两个断点会同时命中，靠后的一条生效。 */
@media (max-width: 1024px) {
	.sh-home__hero-inner {
		min-height: 0;
		padding: 10px 0 0 20px;
	}

	.sh-home__hero-title {
		font-size: 42px;
	}

	.sh-home__hero-subtitle {
		font-size: 18px;
	}

	.sh-home__button {
		font-size: 16px;
	}

	.sh-home__hero-note {
		font-size: 14px;
	}

	.sh-home__hero-image {
		width: 310px;
		margin: 25px 0 10px;
	}

	/* 原版在 ≤1024px 把这一块的上下 70px 内距也去掉了，只剩左右 10px。 */
	.sh-home__section--offer {
		padding: 0 10px;
	}

	.sh-home__offer-title {
		font-size: 41px;
	}

	.sh-home__offer-body {
		font-size: 22px;
	}

	/* 平板/移动端图片容器多一层 10px 内距（原版列内距在这个断点变大），
	   桌面端没有 —— 加了桌面会高 20px。 */
	.sh-home__offer-media {
		margin: 20px 10px;
		padding: 10px;
	}

	/* 原版的 wide 间距（20px）在 ≤1024px 会收窄到 15px，
	   不收窄「Brands we stock」的正文会多折一行。 */
	.sh-home__section--intro-wide .sh-home__intro {
		padding: 15px;
	}

	.sh-home__offer-media img {
		width: 58%;
		margin: -45px 0 -35px;
	}
}

/* ── 移动端 ───────────────────────────────────────────────────────────
   对应 post-7105.css 里的 @media(max-width:767px) 一组规则。 */
@media (max-width: 767px) {
	.sh-home__hero-inner {
		min-height: 0;
		flex-direction: column;
		padding: 26px 15px 0;
	}

	.sh-home__hero-media {
		justify-content: center;
	}

	/* 下面几条标题字号要写成 `.sh-home xxx`：主题在 ≤768px 有 `.site h1`（30px）
	   和 `.site h2`，权重 (0,1,1) 比单类名高，不加前缀会被它们压掉。 */
	.sh-home .sh-home__hero-title {
		margin: 0 0 10px;
		font-size: 38px;
		letter-spacing: -0.5px;
	}

	.sh-home .sh-home__hero-subtitle {
		padding: 0 0 10px;
		font-size: 16px;
		letter-spacing: 0;
	}

	.sh-home__button {
		padding: 15px 22px;
		font-size: 14px;
	}

	.sh-home__hero-note {
		padding: 0;
		font-size: 12px;
	}

	/* 图片上下各带一段外边距（原 Elementor 图片 widget 的 margin 25px 0 10px），
	   桌面端被 hero 的固定高度盖住了，移动端会实打实撑高。 */
	.sh-home__hero-image {
		width: 300px;
		margin: 25px 0 10px;
	}

	.sh-home__section--features {
		padding: 10px 10px 20px 10px;
	}

	/* 列堆叠成一列后，grid 的 gap 模型和 Elementor 的列内距模型不再等价：
	   gap 只在列之间加空隙，顶/底不会补，堆叠层数越多偏得越多。
	   这里整体换成 Elementor 的模型 —— 行不再留 gap 和内距，
	   四边内距全部交给每个列自己。 */
	.sh-home__row {
		gap: 0;
		padding: 0;
	}

	.sh-home__row > * {
		padding: calc(var(--sh-gap) / 2);
	}

	/* CTA 图：单列堆叠，且列只有上下内距，左右不留 —— 图片铺满列宽，
	   横向留白由区块自身的内距负责（原版就是这样）。 */
	.sh-home__row--features {
		grid-template-columns: 1fr;
	}

	.sh-home__row--features > * {
		padding-right: 0;
		padding-left: 0;
	}

	/* 品牌：每行两个。 */
	.sh-home__row--brands {
		grid-template-columns: repeat(2, 1fr);
	}

	/* 卡片：单列堆叠。 */
	.sh-home__row--cards {
		grid-template-columns: 1fr;
	}

	/* 桌面端卡片正文的段落下外边距计入列高，移动端不计（原版两个断点行为不同），
	   这里跟着改，否则每张卡片会高 19px。 */
	.sh-home__card-body p {
		margin-bottom: 0;
	}

	.sh-home .sh-home__heading--center {
		font-size: 24px;
		letter-spacing: 0;
	}

	.sh-home__section--intro {
		padding-top: 30px;
	}

	/* 原版两侧的空栏在移动端是隐藏的，正文占满整宽，
	   不能再用 66.666% —— 否则文字会挤成窄窄一条。 */
	.sh-home__intro {
		width: 100%;
		max-width: none;
	}

	/* 「Brands we stock」在移动端连下内距也去掉了。 */
	.sh-home__section--intro-wide {
		padding-bottom: 0;
	}

	/* 签名图上下留白在移动端比桌面大（原版是 widget 间距撑出来的）。 */
	.sh-home__testimonial-signature {
		margin: 30px 0 14px;
	}

	.sh-home__testimonial {
		grid-template-columns: 1fr;
	}

	/* 移动端两块见证都是图片在前。 */
	.sh-home__testimonial-photo {
		order: -1;
	}

	.sh-home__testimonial--photo-left .sh-home__testimonial-copy {
		padding-left: 0;
	}

	.sh-home__section--testimonial + .sh-home__section--testimonial {
		padding-top: 0;
		padding-bottom: 50px;
	}

	.sh-home__section--offer {
		padding: 0 10px;
	}

	.sh-home__offer {
		grid-template-columns: 1fr;
	}

	.sh-home .sh-home__offer-title {
		padding-top: 20px;
		font-size: 24px;
		letter-spacing: 0;
	}

	.sh-home .sh-home__offer-body {
		font-size: 15px;
	}

	.sh-home__offer .sh-home__button {
		margin-bottom: 20px;
		padding: 15px;
		font-size: 14px;
	}

	.sh-home__offer-media {
		margin: 0 10px 20px;
	}

	.sh-home__offer-media img {
		width: 50%;
		margin: -30px auto -10px;
	}

	/* 原版这块在移动端把下内距也去掉了。 */
	.sh-home__section--heading-spaced {
		padding: 30px 0 0;
	}

	.sh-home__row--brands {
		grid-template-columns: repeat(2, 1fr);
	}
}
