/* ================================================================
 * SAM Group — main.css
 * 階段一樣式：設計令牌 / 基底 / 版面 / 表頭 / 選單(含 Mega) /
 * 手機側欄 / 頁腳 / 全站 WhatsApp 懸浮鈕 / 手機底部固定列 / 按鈕。
 * 手機優先 (mobile-first)，以 min-width 媒體查詢向上疊加 Desktop。
 * ================================================================ */

/* ---------- 1. 設計令牌 (Design Tokens) ---------- */
:root {
	/* 品牌色 */
	--c-primary: #0a2647;
	/* 深藍（主色） */
	--c-primary-2: #12386b;
	--c-primary-dark: #061a32;
	--c-light-blue: #e8f1fb;
	/* 淺藍底 */
	--c-accent: #1769c9;
	/* CTA 藍 */
	--c-accent-dark: #0f55a8;
	--c-green: #25d366;
	/* WhatsApp / 公共衛生綠 */
	--c-green-dark: #1ebe5a;

	/* 設計草稿 sam.* 色（footer 還原用） */
	--c-sam-primary: #1e40af;
	/* footer 6px 強調線 */
	--c-sam-light: #3b82f6;
	/* footer 圖標亮藍 */
	--c-sam-accent: #f97316;
	/* 設計草稿橙：加強標籤 / 亮點 */

	/* 中性色 */
	--c-text: #1f2937;
	--c-muted: #6b7280;
	--c-border: #e5e7eb;
	--c-bg: #f7f9fc;
	--c-white: #ffffff;

	/* 字型 */
	--font-sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;

	/* 圓角 / 陰影 / 間距 */
	--radius: 10px;
	--radius-sm: 6px;
	--shadow-sm: 0 1px 3px rgba(10, 38, 71, .08);
	--shadow: 0 8px 24px rgba(10, 38, 71, .12);
	--shadow-lg: 0 16px 48px rgba(10, 38, 71, .18);

	/* 版面 */
	--container: 1000px;
	--header-h: 64px;
	--space-section: 56px;

	/* 過場 */
	--t-fast: .18s ease;
	--t: .28s ease;
}

/* ---------- 2. Reset / 基底 ---------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: 16px;
	line-height: 1.7;
	color: var(--c-text);
	background: var(--c-white);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-x: hidden;
}

img,
svg,
video {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: var(--c-accent);
	text-decoration: none;
	transition: color var(--t-fast);
}

a:hover {
	color: var(--c-accent-dark);
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 .5em;
	line-height: 1.3;
	font-weight: 700;
	color: var(--c-primary);
}

h1 {
	font-size: clamp(1.6rem, 4vw, 2.4rem);
}

h2 {
	font-size: clamp(1.35rem, 3vw, 1.9rem);
}

p {
	margin: 0 0 1em;
}

ul,
ol {
	margin: 0 0 1em;
	padding-left: 1.2em;
}

/* ---------- 3. 工具 class ---------- */
.container {
	width: 100%;
	max-width: var(--container);
	margin: 0 auto;
	padding: 0 16px;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--c-primary);
	color: #fff;
	padding: 10px 16px;
	z-index: 2000;
	border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
	left: 0;
}

/* ---------- 4. 按鈕 ---------- */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 22px;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: .95rem;
	border: 2px solid transparent;
	cursor: pointer;
	transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
	line-height: 1.2;
}

.btn:hover {
	transform: translateY(-1px);
}

.btn-sm {
	padding: 8px 14px;
	font-size: .85rem;
}

.btn .icon {
	flex: none;
}

.btn-whatsapp {
	background: var(--c-green);
	color: #fff;
}

.btn-whatsapp:hover {
	background: var(--c-green-dark);
	color: #fff;
}

.btn-primary {
	background: var(--c-accent);
	color: #fff;
}

.btn-primary:hover {
	background: var(--c-accent-dark);
	color: #fff;
}

.btn-outline {
	background: transparent;
	color: var(--c-primary);
	border-color: var(--c-primary);
}

.btn-outline:hover {
	background: var(--c-primary);
	color: #fff;
}

.btn-light {
	background: #fff;
	color: var(--c-primary);
}

.btn-light:hover {
	background: var(--c-light-blue);
	color: var(--c-primary);
}

/* 漸變實心藥丸鈕（首頁熱銷「查看全部產品」等） */
.btn-grad {
	background: linear-gradient(135deg, var(--c-accent), var(--c-accent-dark));
	color: #fff;
	border-radius: 999px;
	padding: 14px 36px;
	box-shadow: 0 8px 24px rgba(10, 38, 71, .28);
	transition: transform var(--t-fast), box-shadow var(--t-fast);
}

.btn-grad:hover {
	color: #fff;
	transform: translateY(-2px);
	box-shadow: 0 12px 30px rgba(10, 38, 71, .4);
}

/* ================================================================
 * 5. 表頭 Site Header
 * ================================================================ */
.site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: #fff;
	border-bottom: 1px solid var(--c-border);
	transition: box-shadow var(--t-fast);
}

/* 注意：本元素不可加 backdrop-filter / transform，否則會建立 containing block
   與層疊上下文，把內部的 position:fixed 手機側欄困住、並被灰幕蓋住。 */
.site-header.scrolled {
	box-shadow: var(--shadow-sm);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: var(--header-h);
	gap: 12px;
}

/* 品牌標誌（無 logo 時的文字版：SAM + 紅色下劃線） */
.brand-text {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	font-weight: 900;
	color: var(--c-primary);
	letter-spacing: 1px;
}

.brand-text:hover {
	color: var(--c-primary);
}

.brand-sam {
	font-size: 1.5rem;
	line-height: 1;
}

.brand-bar {
	display: block;
	width: 70%;
	height: 4px;
	background: #e23b3b;
	border-radius: 2px;
	margin-top: 2px;
}

.brand-text-light .brand-sam {
	color: #fff;
}

/* 自訂 logo 圖片 */
.site-branding img,
.custom-logo {
	max-height: 44px;
	width: auto;
}

/* 漢堡鍵（手機） */
.menu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: 0;
}

.menu-toggle-bars {
	position: relative;
	width: 24px;
	height: 18px;
	display: block;
}

.menu-toggle-bars span {
	position: absolute;
	left: 0;
	height: 3px;
	width: 100%;
	background: var(--c-primary);
	border-radius: 2px;
	transition: transform var(--t), opacity var(--t), top var(--t);
}

.menu-toggle-bars span:nth-child(1) {
	top: 0;
}

.menu-toggle-bars span:nth-child(2) {
	top: 7.5px;
}

.menu-toggle-bars span:nth-child(3) {
	top: 15px;
}

.menu-open .menu-toggle-bars span:nth-child(1) {
	top: 7.5px;
	transform: rotate(45deg);
}

.menu-open .menu-toggle-bars span:nth-child(2) {
	opacity: 0;
}

.menu-open .menu-toggle-bars span:nth-child(3) {
	top: 7.5px;
	transform: rotate(-45deg);
}

/* ================================================================
 * 6. 主選單 — 手機側欄（預設 < 1024px）
 * ================================================================ */
.main-navigation {
	position: fixed;
	top: var(--header-h);
	right: 0;
	width: min(330px, 85vw);
	height: calc(100vh - var(--header-h));
	height: calc(100dvh - var(--header-h));
	background: #fff;
	z-index: 1100;
	display: flex;
	flex-direction: column;
	padding: 12px 0 24px;
	transform: translateX(100%);
	transition: transform var(--t);
	overflow-y: auto;
	box-shadow: var(--shadow-lg);
	visibility: hidden;
}

.menu-open .main-navigation {
	transform: translateX(0);
	visibility: visible;
}

.menu-backdrop {
	/* 必須低於 .site-header(1000)：面板位於 header 層疊層內，要在灰幕之上顯示。 */
	position: fixed;
	inset: 0;
	z-index: 990;
	background: rgba(6, 26, 50, .5);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--t), visibility var(--t);
}

.menu-open .menu-backdrop {
	opacity: 1;
	visibility: visible;
}

.nav-menu {
	list-style: none;
	margin: 0;
	padding: 0 8px;
	display: flex;
	flex-direction: column;
}

.nav-menu li {
	position: relative;
}

.nav-menu a {
	display: block;
	padding: 13px 44px 13px 16px;
	/* 右側留位給摺疊鈕 */
	color: var(--c-primary);
	font-weight: 600;
	font-size: 1.02rem;
	border-bottom: 1px solid var(--c-border);
}

.nav-menu a:hover,
.nav-menu .current-menu-item>a {
	color: var(--c-accent);
	background: var(--c-light-blue);
}

/* 子選單（手機：手風琴摺疊） */
.nav-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height var(--t);
	background: var(--c-bg);
}

.nav-menu .menu-item-has-children.submenu-open>.sub-menu {
	max-height: 1200px;
}

.nav-menu .sub-menu a {
	padding-left: 32px;
	font-weight: 500;
	color: var(--c-muted);
}

.nav-menu .sub-menu .sub-menu a {
	padding-left: 48px;
}

/* 子選單摺疊鈕（手機） */
.submenu-toggle {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 36px;
	height: 36px;
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.submenu-toggle .chevron {
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid var(--c-primary);
	transition: transform var(--t-fast);
}

.menu-item-has-children.submenu-open>.submenu-toggle .chevron {
	transform: rotate(180deg);
}

.nav-cta {
	padding: 20px 16px 8px;
	margin-top: auto;
}

.nav-cta .btn {
	width: 100%;
	justify-content: center;
	border-radius: 999px;
}

/* ================================================================
 * 7. Desktop 選單與 Mega Menu（≥ 1024px）
 * ================================================================ */
@media (min-width: 1024px) {
	.menu-toggle {
		display: none;
	}

	.menu-backdrop {
		display: none;
	}

	.main-navigation {
		position: static;
		width: auto;
		height: auto;
		flex-direction: row;
		align-items: center;
		padding: 0;
		gap: 6px;
		transform: none;
		visibility: visible;
		box-shadow: none;
		overflow: visible;
		background: transparent;
	}

	.nav-menu {
		flex-direction: row;
		align-items: center;
		padding: 0;
	}

	.nav-menu>li>a {
		padding: 8px 14px;
		border-bottom: 0;
		border-radius: var(--radius-sm);
		font-size: .98rem;
	}

	/* 桌面：含子選單項目右側顯示 ▾ 提示，hover 時翻轉 */
	.nav-menu>li.menu-item-has-children>a::after {
		content: "";
		display: inline-block;
		width: 0;
		height: 0;
		border-left: 4px solid transparent;
		border-right: 4px solid transparent;
		border-top: 5px solid currentColor;
		margin-left: 6px;
		vertical-align: middle;
		transition: transform var(--t-fast);
	}

	.nav-menu>li.menu-item-has-children:hover>a::after,
	.nav-menu>li.menu-item-has-children:focus-within>a::after {
		transform: rotate(180deg);
	}

	/* 隱藏手機摺疊鈕 */
	.submenu-toggle {
		display: none;
	}

	/* 下拉子選單（一般） */
	.nav-menu .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		min-width: 230px;
		max-height: none;
		overflow: visible;
		background: #fff;
		border-radius: var(--radius);
		box-shadow: var(--shadow);
		padding: 8px;
		opacity: 0;
		visibility: hidden;
		transform: translateY(8px);
		transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
	}

	.nav-menu>li:hover>.sub-menu,
	.nav-menu>li:focus-within>.sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.nav-menu .sub-menu a {
		padding: 9px 12px;
		border-bottom: 0;
		color: var(--c-text);
		font-weight: 500;
	}

	.nav-menu .sub-menu a:hover {
		background: var(--c-light-blue);
		color: var(--c-accent);
	}

	.nav-menu .sub-menu .sub-menu {
		top: 0;
		left: 100%;
		margin-left: 4px;
	}

	/* Mega Menu：在選單項加上 CSS class「is-mega」即可啟用 */
	.nav-menu>li.is-mega {
		position: static;
	}

	.nav-menu>li.is-mega>.sub-menu {
		left: 0;
		right: 0;
		min-width: 0;
		width: 100%;
		max-width: var(--container);
		margin: 0 auto;
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 4px 18px;
		padding: 22px;
	}

	.nav-menu>li.is-mega>.sub-menu>li {
		padding: 0;
	}

	.nav-menu>li.is-mega>.sub-menu>li>a {
		font-weight: 700;
		color: var(--c-primary);
		border-bottom: 1px solid var(--c-border);
		padding-bottom: 8px;
		margin-bottom: 2px;
	}

	.nav-menu>li.is-mega>.sub-menu .sub-menu {
		position: static;
		transform: none;
		opacity: 1;
		visibility: visible;
		box-shadow: none;
		margin: 0;
		display: block;
		padding: 0;
	}

	.nav-menu>li.is-mega>.sub-menu .sub-menu a {
		font-weight: 400;
		padding: 6px 8px;
	}

	.nav-cta {
		margin-top: 0;
		padding: 0 0 0 8px;
	}

	.nav-cta .btn {
		width: auto;
	}
}

/* ================================================================
 * 8. 全站 WhatsApp 懸浮鈕
 * ================================================================ */
.floating-whatsapp {
	position: fixed;
	right: 16px;
	bottom: calc(72px + env(safe-area-inset-bottom));
	z-index: 900;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--c-green);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow);
	transition: transform var(--t-fast), background var(--t-fast);
}

.floating-whatsapp:hover {
	background: var(--c-green-dark);
	color: #fff;
	transform: scale(1.06);
}

.floating-whatsapp::after {
	content: "";
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 2px solid var(--c-green);
	opacity: .5;
	animation: samPulse 2.2s ease-out infinite;
}

@keyframes samPulse {
	0% {
		transform: scale(.9);
		opacity: .6;
	}

	100% {
		transform: scale(1.4);
		opacity: 0;
	}
}

/* ================================================================
 * 9. 手機底部固定列（已移除，僅保留懸浮鈕 Desktop 定位）
 * ================================================================ */
@media (min-width: 1024px) {
	.floating-whatsapp {
		bottom: 24px;
	}
}

/* ================================================================
 * 10. 頁腳 Footer
 * ================================================================ */
.site-footer {
	background: var(--c-primary);
	color: #bfdbfe;
	/* text-blue-200 */
	padding: 64px 0 0;
	/* pt-16 */
	margin-top: var(--space-section);
	border-top: 6px solid var(--c-sam-primary);
}

.site-footer {
	margin-top: 0px;
}

.footer-grid {
	display: grid;
	gap: 32px;
	grid-template-columns: 1fr;
}

/* Col 1：品牌 */
.footer-logo-badge {
	display: inline-block;
	background: #fff;
	padding: 12px;
	border-radius: 12px;
	margin-bottom: 16px;
	line-height: 0;
}

.footer-logo-badge a {
	display: inline-block;
	line-height: 0;
}

.footer-logo-badge img {
	width: auto;
	height: 40px !important;
	max-width: none !important;
	display: block;
}

.footer-logo-text {
	display: inline-block;
	font-weight: 900;
	color: var(--c-primary);
	font-size: 1.25rem;
	line-height: 40px;
	padding: 0 10px;
	text-decoration: none;
}

.footer-company {
	font-size: .875rem;
	/* text-sm */
	line-height: 1.7;
	color: #bfdbfe;
	margin: 0;
}

.footer-company-en {
	display: block;
	opacity: .85;
}

/* Col 2-4 欄目標題 */
.footer-col-title {
	color: #fff;
	font-size: 1.125rem;
	/* text-lg */
	font-weight: 700;
	margin: 0 0 16px;
}

/* Col 2-3：目錄 / 方案連結清單 */
.footer-col-list {
	list-style: none;
	padding: 0;
	margin: 0;
	color: #bfdbfe;
	font-size: .875rem;
}

.footer-col-list li {
	padding: 4px 0;
}

.footer-col-list a {
	color: #bfdbfe;
}

.footer-col-list a:hover {
	color: #fff;
}

/* Col 4：聯絡清單（圖標 + 文字） */
.footer-contact-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.footer-contact-list li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 6px 0;
	font-size: .875rem;
	color: #bfdbfe;
}

.footer-contact-list a {
	color: #bfdbfe;
}

.footer-contact-list a:hover {
	color: #fff;
}

.footer-contact-icon {
	flex-shrink: 0;
	margin-top: 2px;
	color: var(--c-sam-light);
	/* 電話 / 傳真 / 電郵 亮藍 */
	display: inline-flex;
}

.footer-contact-list .icon-whatsapp {
	color: var(--c-green);
	/* WhatsApp 綠 */
}

.footer-contact-text {
	white-space: nowrap;
	/* 電話/傳真/WhatsApp/電郵 各自保持單行不換行 */
}

.footer-bottom {
	border-top: 1px solid rgba(255, 255, 255, .1);
	margin-top: 48px;
	padding: 32px 0;
	text-align: center;
}

.copyright {
	margin: 0;
	font-size: .875rem;
	color: #93c5fd;
	/* text-blue-300 */
}

@media (min-width: 768px) {
	.footer-grid {
		grid-template-columns: 1.3fr 1fr 1fr 1.2fr;
		gap: 48px;
	}
}

/* 手機版隱藏「產品目錄 / 解決方案」兩欄，僅保留品牌 + 聯絡我們 */
@media (max-width: 767.98px) {
	.footer-products,
	.footer-solutions {
		display: none;
	}
}

/* ================================================================
 * 11. 內容區 / 文章樣式（兜底範本用，後續階段會擴充）
 * ================================================================ */
.site-main {
	padding: 32px 16px;
	max-width: var(--container);
	margin: 0 auto;
}

/* 取消限寬與 padding，讓 Hero / 深藍區橫鋪滿；其他頁面維持 1000px 置中 */
.site-main {
	max-width: none;
	padding: 0;
}

.page-header {
	margin-bottom: 24px;
}

.post-list {
	display: grid;
	gap: 24px;
	grid-template-columns: 1fr;
}

@media (min-width: 640px) {
	.post-list {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.post-list {
		grid-template-columns: repeat(3, 1fr);
	}
}

.entry-card {
	background: #fff;
	border: 1px solid var(--c-border);
	border-radius: var(--radius);
	overflow: hidden;
	transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.entry-card:hover {
	box-shadow: var(--shadow);
	transform: translateY(-2px);
}

.entry-thumb {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--c-bg);
}

.entry-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.entry-body {
	padding: 16px;
}

.entry-title {
	font-size: 1.1rem;
	margin-bottom: 8px;
}

.entry-title a {
	color: var(--c-primary);
}

.entry-title a:hover {
	color: var(--c-accent);
}

.entry-excerpt {
	color: var(--c-muted);
	font-size: .92rem;
	margin-bottom: 12px;
}

.read-more {
	font-weight: 700;
	font-size: .9rem;
	color: var(--c-accent);
}

.entry-page,
.entry-single {
	max-width: 820px;
	margin: 0 auto;
}

.entry-header {
	margin-bottom: 20px;
}

.entry-meta {
	color: var(--c-muted);
	font-size: .85rem;
}

.entry-featured {
	margin-bottom: 24px;
	border-radius: var(--radius);
	overflow: hidden;
}

.entry-content {
	margin-bottom: 40px;
}

.entry-content>* {
	max-width: 100%;
}

.entry-content h2,
.entry-content h3 {
	margin-top: 1.4em;
}

.entry-content img {
	border-radius: var(--radius-sm);
}

.entry-content ul,
.entry-content ol {
	padding-left: 1.4em;
}

.post-nav {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 40px;
	padding-top: 20px;
	border-top: 1px solid var(--c-border);
}

.post-nav a {
	font-weight: 600;
}

/* 分頁 */
.pagination,
.page-links {
	margin-top: 32px;
}

.pagination .nav-links {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: center;
}

.pagination a,
.pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border: 1px solid var(--c-border);
	border-radius: var(--radius-sm);
	font-weight: 600;
}

.pagination .current {
	background: var(--c-primary);
	color: #fff;
	border-color: var(--c-primary);
}

/* ================================================================
 * 12. 區塊編輯器相容（Gutenberg）
 * ================================================================ */
.entry-content .alignwide {
	width: 100%;
	max-width: 1000px;
}

.entry-content .alignfull {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
}

.wp-block-button__link {
	border-radius: var(--radius-sm);
}