/* ==========================================================================
   首頁 Hero Banner（可從後台編輯）
   版型定案：選項 A —— 2.4:1 寬幅、左側文字鎖定區。
   標記由 tw-homepage 外掛 includes/banner.php 的 [techez_hero] 短碼輸出。
   2026-09-14 從子主題 blocksy-child/assets/css/hero.css 搬進外掛。子主題那一份
   只剩「外掛不在時的備援」用途；兩份的**規則**必須相同（註解可以不同），
   tools/selftest.php 組 I 會比對。改這裡的規則，子主題那一份要一起改。
   命名空間刻意用 tz-hero，與舊的 techez-hero-slider 完全分開，
   兩者可並存，方便用 ?techez_hero=1 逐一比對後再切換。
   ========================================================================== */

.tz-hero {
	--tz-hero-focus: center;
	--tz-hero-accent: #d3b574;

	position: relative;
	width: 100%;
	/* 2.4:1；1440 寬時正好 600px，並限制極端視窗下的高度 */
	height: clamp(440px, 41.6667vw, 820px);
	overflow: hidden;
	background: #0f1114;
	/* 讓內部可用 cqw / cqh 做影片的等比覆蓋裁切 */
	container-type: size;
}

.tz-hero__track {
	position: absolute;
	inset: 0;
}

.tz-hero__slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity .8s ease;
}

.tz-hero__slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 1;
}

/* --- 背景 --- */

.tz-hero__media {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.tz-hero__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--tz-hero-focus);
	display: block;
}

/* 影片：object-fit 對 iframe 無效，YouTube 會自己補黑邊。
   改用容器查詢單位算出「等比覆蓋」所需的尺寸，把黑邊擠到可視範圍外。
   不支援 cq 單位的瀏覽器會忽略這兩行 max()，退回上面的 100% / 100%。 */
.tz-hero__yt {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	transform: translate(-50%, -50%) scale(1.06);
	border: 0;
	/* 播放器介面不接受滑鼠事件，否則暫停鍵、標題列、更多影片會冒出來 */
	pointer-events: none;
}

@supports (width: 1cqw) {
	.tz-hero__yt {
		width: max(100%, calc(100cqh * 16 / 9));
		height: max(100%, calc(100cqw * 9 / 16));
	}
}

/* 再蓋一層，確保任何情況下都收不到點擊 */
.tz-hero__shield {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
}

.tz-hero__scrim {
	position: absolute;
	inset: 0;
	z-index: 3;
	background: linear-gradient(90deg,
		rgba(10, 12, 14, .86) 0%,
		rgba(10, 12, 14, .62) 42%,
		rgba(10, 12, 14, 0) 72%);
}

/* --- 文字層 --- */

.tz-hero__inner {
	position: relative;
	z-index: 4;
	height: 100%;
	max-width: 1320px;
	margin: 0 auto;
	padding: 0 40px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	gap: 24px;
	pointer-events: none;
}

.tz-hero__inner > * { pointer-events: auto; }

.tz-hero__kicker {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 2.4px;
	text-transform: uppercase;
	color: var(--tz-hero-accent);
}

.tz-hero__kicker i {
	width: 28px;
	height: 1px;
	background: var(--tz-hero-accent);
	display: block;
}

.tz-hero__title {
	max-width: 780px;
	margin: 0;
	font-size: clamp(30px, 3.7vw, 52px);
	line-height: 1.28;
	font-weight: 500;
	letter-spacing: .5px;
	color: #ffffff;
}

.tz-hero__desc {
	max-width: 500px;
	margin: 0;
	font-size: clamp(15px, 1.25vw, 18px);
	line-height: 1.85;
	font-weight: 300;
	color: rgba(255, 255, 255, .85);
}

.tz-hero__badge {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 38px;
	padding: 0 18px;
	border-radius: 19px;
	border: 1px solid rgba(255, 255, 255, .35);
	background: rgba(255, 255, 255, .08);
	font-size: 15px;
	color: #ffffff;
}

.tz-hero__badge i {
	font-style: normal;
	font-size: 13px;
	color: rgba(255, 255, 255, .62);
}

.tz-hero__actions {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-top: 6px;
	flex-wrap: wrap;
}

.tz-hero__cta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 52px;
	padding: 0 30px;
	background: var(--tz-hero-accent);
	color: #1c1e21;
	font-size: 16px;
	font-weight: 500;
	letter-spacing: .5px;
	text-decoration: none;
	border-radius: 0;
	transition: background-color .2s ease, color .2s ease;
}

.tz-hero__cta:hover,
.tz-hero__cta:focus-visible {
	background: #e5cd97;
	color: #1c1e21;
}

.tz-hero__cta--ghost {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .38);
	color: #ffffff;
	font-weight: 400;
}

.tz-hero__cta--ghost:hover,
.tz-hero__cta--ghost:focus-visible {
	background: rgba(255, 255, 255, .12);
	border-color: rgba(255, 255, 255, .7);
	color: #ffffff;
}

/* 沒有按鈕時，整張可點 */
.tz-hero__link {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: block;
}

/* --- 左右箭頭 --- */

.tz-hero__arrow {
	position: absolute;
	top: 50%;
	/* 7 不是 6：圓點列（.tz-hero__dots）是整個輪播寬、z-index 6、在 DOM 裡排在箭頭後面；
	   箭頭放到底部那一排時（≤1424），同一層會被圓點列蓋住、點不到（2026-09-14 營運站點擊實測）。 */
	z-index: 7;
	width: 48px;
	height: 48px;
	margin: -24px 0 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .32);
	border-radius: 0;
	background: rgba(0, 0, 0, .18);
	cursor: pointer;
	opacity: 0;
	transition: opacity .25s ease, background-color .2s ease;
}

.tz-hero:hover .tz-hero__arrow,
.tz-hero__arrow:focus-visible { opacity: 1; }

.tz-hero__arrow:hover { background: rgba(0, 0, 0, .42); }

.tz-hero__arrow::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 11px;
	height: 11px;
	border-top: 2px solid #ffffff;
	border-right: 2px solid #ffffff;
}

.tz-hero__arrow--prev { left: 28px; }
.tz-hero__arrow--next { right: 28px; }

.tz-hero__arrow--prev::before { transform: translate(-30%, -50%) rotate(-135deg); }
.tz-hero__arrow--next::before { transform: translate(-70%, -50%) rotate(45deg); }

/* --- 圓點 --- */

.tz-hero__dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 30px;
	z-index: 6;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
}

.tz-hero__dot {
	width: 10px;
	height: 3px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(255, 255, 255, .45);
	cursor: pointer;
	transition: width .3s ease, background-color .3s ease;
}

.tz-hero__dot.is-active {
	width: 30px;
	background: var(--tz-hero-accent);
}

/* 圓點有幾顆（給下面「箭頭放到圓點兩側」算位置用）。
   圓點列總寬 ＝ 30（亮的那顆）＋ 10 ×（n－1）＋ 間距 10 ×（n－1）＝ 20n＋10。
   :has() 不支援的瀏覽器用預設 6（2026-09-14 營運站是 6 張）。 */
.tz-hero { --tz-hero-dots: 6; }
.tz-hero:has(.tz-hero__dot:nth-child(2))  { --tz-hero-dots: 2; }
.tz-hero:has(.tz-hero__dot:nth-child(3))  { --tz-hero-dots: 3; }
.tz-hero:has(.tz-hero__dot:nth-child(4))  { --tz-hero-dots: 4; }
.tz-hero:has(.tz-hero__dot:nth-child(5))  { --tz-hero-dots: 5; }
.tz-hero:has(.tz-hero__dot:nth-child(6))  { --tz-hero-dots: 6; }
.tz-hero:has(.tz-hero__dot:nth-child(7))  { --tz-hero-dots: 7; }
.tz-hero:has(.tz-hero__dot:nth-child(8))  { --tz-hero-dots: 8; }
.tz-hero:has(.tz-hero__dot:nth-child(9))  { --tz-hero-dots: 9; }
.tz-hero:has(.tz-hero__dot:nth-child(10)) { --tz-hero-dots: 10; }
.tz-hero:has(.tz-hero__dot:nth-child(11)) { --tz-hero-dots: 11; }
.tz-hero:has(.tz-hero__dot:nth-child(12)) { --tz-hero-dots: 12; }

/* --- 響應式 --- */

@media (max-width: 1024px) {
	.tz-hero__inner { padding: 0 28px; gap: 20px; }
	.tz-hero__arrow--prev { left: 16px; }
	.tz-hero__arrow--next { right: 16px; }
}

/* 768～1424：垂直置中的箭頭會壓到左邊的文字（滑鼠移上輪播才出現，1280／1366 筆電看得到）。
   2026-09-14 量測：文字左緣 ＝ max(0,(版面寬－1320)/2)＋40（≤1024 是 28），左箭頭右緣 76（≤1024 是 64），
   版面寬 ≤1391 就重疊。媒體查詢的寬度含捲軸（Windows 17px）→ 視窗 ≤1408 就可能重疊；
   取 1424，捲軸 17px 時仍留 ≥8px 間隙，1440 維持垂直置中。
   這個範圍改放到底部、圓點兩側（與圓點間距 16px）。不放左右下角：文字層在這些寬度是垂直置中，
   底下只剩 43px（1100 寬第 3 張），48px 的左箭頭會壓到按鈕；圓點兩側水平上離按鈕很遠。
   文字位置一個像素都不動（要與頁首 logo 對齊）。 */
@media (min-width: 768px) and (max-width: 1424px) {
	.tz-hero__arrow { top: auto; bottom: 7px; margin: 0; }
	.tz-hero__arrow--prev { left: calc(50% - var(--tz-hero-dots) * 10px - 5px - 16px - 48px); }
	.tz-hero__arrow--next { left: calc(50% + var(--tz-hero-dots) * 10px + 5px + 16px); right: auto; }
}

@media (max-width: 767px) {
	.tz-hero {
		/* 手機直向：文字需要空間，改用較高的版面 */
		height: 480px;
	}

	.tz-hero__scrim {
		/* 橫向漸層在窄螢幕蓋不住文字，改由下往上 */
		background: linear-gradient(180deg,
			rgba(10, 12, 14, .30) 0%,
			rgba(10, 12, 14, .58) 42%,
			rgba(10, 12, 14, .92) 100%);
	}

	.tz-hero__inner {
		justify-content: flex-end;
		padding: 0 20px 62px;
		gap: 16px;
	}

	.tz-hero__title { max-width: none; }
	.tz-hero__desc  { max-width: none; }

	.tz-hero__actions { gap: 12px; }
	.tz-hero__cta { height: 48px; padding: 0 24px; font-size: 15px; }

	/* 觸控裝置沒有 hover，箭頭常駐顯示。
	   2026-09-14：原本垂直置中（top:50%），390 寬時正好壓在標題與說明文字上
	   （文字層靠下對齊，中線穿過文字）。改到最下面一排、圓點左右兩側 ——
	   文字層有 62px 底部內距、內容往上長，所以不論文字多長都碰不到箭頭；文字位置一個像素都沒動。 */
	.tz-hero__arrow { opacity: 1; width: 42px; height: 42px; top: auto; bottom: 10px; margin-top: 0; }
	.tz-hero__dots { bottom: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.tz-hero__slide { transition: none; }
	.tz-hero__dot   { transition: none; }
}

/* ==========================================================================
   新舊 Hero 的切換
   ==========================================================================
   這裡原本有一條 body.tz-new-hero .techez-hero-slider { display:none }，
   用來在新 Hero 出現時把舊輪播藏起來。2026-09-03 舊輪播的標記、CSS 與 JS
   都已刪除（見 style.css 末段與 techez-backups/phaseE2-deadcode/），
   沒有東西要藏了，故一併移除。
   關掉 TECHEZ_NEW_HERO 現在只會讓 Hero 不輸出，不會退回舊輪播。
   ========================================================================== */

/* Hero 與下方 NEWS 的間距，交給 .tz-news 自己的 padding-top 負責。
   這裡刻意 margin-bottom: 0 ——
   舊 Hero 時代這條是 95px（手機 48px），但 .tz-news 已經有
   padding-top: 96px 且底色是白的，兩者相加會在深色 Hero 下方
   先擠出一條 95px 的頁面底色（灰）再接白色留白，
   看起來像一個空掉的區塊。2026-09-03 移除。 */
body.tz-new-hero .tz-hero {
	margin-bottom: 0;
}
