/* Action Card 页脚 Newsletter 样式 —— 从 www.dten.test 主题原样搬来（wp-content/themes/dten-theme/footer.php），
   那边改了这里跟着改。由 scripts/import-action-card.mjs 拷进 ch/footer/。分三段：主题文件末尾的全局 HubSpot 基础样式、
   限定在 .dten-newsletter 里的品牌样式、最后是 Action Card 页脚专有的几条。 */

/*  Hupspot form styling */

.hsfc-Step__Content {
	padding: 0 !important;
}

.hsfc-EmailField {
	position: relative;
}

.hsfc-Step__Content input {
	padding: 6px 12px !important;
	margin-bottom: 0 !important;
}

.hsfc-ErrorAlert {
	font-size: 14px !important;
	position: absolute !important;
}

.hsfc-FieldLabel {
	display: none !important;
}

.hsfc-NavigationRow {
	margin-top: 10px !important;
}

.hsfc-Button {
	padding: 8px 16px !important;
	font-weight: normal !important;
	border-radius: 20px !important;
}

/* Newsletter：HubSpot developer embed 直接渲染进页面 DOM（不是 iframe），
   样式全部限定在 .dten-newsletter 内 —— 文件末尾的 "Hupspot form styling"
   是全局的，会作用到其它页面的 HubSpot 表单，这里只在其基础上覆盖。 */
/* HubSpot 在 .hsfc-Form 上写死了 Helvetica，改为沿用 footer 的 Lato */
.dten-newsletter .hsfc-Form,
.dten-newsletter .hsfc-Form * {
	font-family: inherit !important;
}

.dten-newsletter .hsfc-Step__Content > .hsfc-Row {
	margin-bottom: 12px !important;
}

.dten-newsletter .hsfc-TextInput {
	height: 44px !important;
	padding: 0 20px !important;
	border: 1px solid #d5dbe1 !important;
	border-radius: 9999px !important;
	background: #fff !important;
	color: #06292c !important;
	font-size: 14px !important;
	box-shadow: none !important;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dten-newsletter .hsfc-TextInput::placeholder {
	color: #9aa1a9 !important;
	opacity: 1;
}

.dten-newsletter .hsfc-TextInput:focus {
	border-color: #4eb857 !important;
	box-shadow: 0 0 0 3px rgba(78, 184, 87, 0.2) !important;
	outline: none !important;
}

.dten-newsletter .hsfc-DropdownInput__Caret {
	right: 18px !important;
}

/* 校验提示：HubSpot 每输入一个字符都会先撤掉提示、约半秒后重新校验再插回来，
   提示一进一出会把整个 footer 顶得上下跳。给输入框所在行预留一行提示的高度
   （44px 输入框 + 4px 间距 + 16px 行高），提示出现/消失不再改变布局。
   全局样式把提示设成 absolute 会压到下一行上，这里仍留在文档流，
   提示超出预留行数时才多占位。 */
.dten-newsletter {
	container-type: inline-size;
}

/* 表单是 HubSpot 异步渲染的，渲染前这里高度为 0，出来时会把下方版权行往下顶；
   按渲染后的高度先占位：邮箱行 + 8px 行距 + 44px 按钮 */
.dten-newsletter .hs-form-html {
	--dten-nl-field-row: 64px;
	min-height: calc(var(--dten-nl-field-row) + 8px + 44px);
}

/* 手机上这一栏只有 180px 左右，常见提示（12px 下 178~183px 宽）放不下一行，预留两行 */
@container (max-width: 219px) {
	.dten-newsletter .hs-form-html {
		--dten-nl-field-row: 80px;
	}
}

.dten-newsletter .hsfc-Step__Content > .hsfc-Row:has(.hsfc-TextInput) {
	min-height: var(--dten-nl-field-row);
	margin-bottom: 8px !important;
}

.dten-newsletter .hsfc-ErrorAlert {
	position: static !important;
	margin-top: 4px !important;
	padding-left: 20px;
	font-size: 12px !important;
	line-height: 16px !important;
	animation: dten-newsletter-error-in 0.2s ease;
}

@keyframes dten-newsletter-error-in {
	from {
		opacity: 0;
	}
}

.dten-newsletter .hsfc-NavigationRow {
	margin-top: 0 !important;
}

/* 提交失败提示的容器平时是空的，但它 20px 的 margin-bottom 会穿透到按钮行
   上方，撑出一块空白；改为只给里面的提示留间距 */
.dten-newsletter .hsfc-NavigationRow__Alerts {
	margin-bottom: 0 !important;
}

.dten-newsletter .hsfc-NavigationRow__Alerts > * {
	margin-bottom: 8px !important;
}

.dten-newsletter .hsfc-NavigationRow__Buttons {
	display: block !important;
}

.dten-newsletter .hsfc-Button {
	width: 100% !important;
	height: 44px !important;
	padding: 0 !important;
	border-radius: 9999px !important;
	background: #4eb857 !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	transition: background-color 0.2s ease;
}

.dten-newsletter .hsfc-Button:hover,
.dten-newsletter .hsfc-Button:focus {
	background: #55c156 !important;
}

/* 键盘焦点框保留，只把浏览器默认的橙色换成品牌绿 */
.dten-newsletter .hsfc-Button:focus-visible {
	outline: 2px solid #4eb857 !important;
	outline-offset: 2px;
}

/* 国家行默认隐藏，由上方脚本按 IP 预填；预填失败时脚本加 is-country-visible 放出来。
   万一脚本没跑成、国家为空就提交，HubSpot 会在这一行报错，带报错的行同样放出来 */
.dten-newsletter:not(.is-country-visible) .hsfc-Row:has(input[name="0-1/country_region_cc"]):not(:has(.hsfc-ErrorAlert)) {
	display: none !important;
}

/* 隐藏 reCAPTCHA 徽章，按需求也不放文字声明。用 visibility 而非
   display:none，免得影响验证码本身运行。 */
.dten-newsletter .hsfc-Row:has(.hsfc-ReCaptchaV2, .hsfc-ReCaptchaV3) {
	height: 0;
	margin: 0 !important;
	overflow: hidden;
}

.dten-newsletter .grecaptcha-badge {
	visibility: hidden !important;
}

/* ---- Action Card 专有 ----
   原型给占位表单写的 .news form / .news input / .news button 规则会落到 HubSpot 渲染出来的元素上：
   form 被设成横向 flex（邮箱行和按钮行挤成一排）、input 被设成 flex:1。上面的品牌样式已用 !important 盖住
   输入框和按钮的外观，这里只撤掉布局相关的几条。上外边距沿用原型 .news form 的取值；宽度与官网页脚一致：
   www.dten.dev 页脚 1200px 四栏、每栏 300px，输入框和按钮都是 300px 宽（原型的 Newsletter 栏占 1.6 份，放开了有近 400px）。 */
.news .dten-newsletter {
	margin-top: 16px;
	max-width: 300px;
}

.news .dten-newsletter form {
	display: block;
	gap: normal;
	margin-top: 0;
	max-width: none;
}

.news .dten-newsletter input {
	flex: none;
}
