/* ==========================================================
   美好祈福 主題樣式：版面、頁首、搜尋、底部選單
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--mh-paper);
	color: var(--mh-ink);
	font-family: var(--mh-font-sans);
	font-size: var(--mh-fs-body);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button, input { font-family: inherit; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }

/* App 外框：手機全寬；平板、電腦的內容寬度由 --mh-max 控制並置中 */
.mh-app {
	min-height: 100vh;
	display: flex; flex-direction: column;
	background: var(--mh-paper);
	padding-bottom: calc(var(--mh-tabbar-h) + env(safe-area-inset-bottom, 0px));
}
.mh-main { display: block; flex-grow: 1; }
.mh-container { width: 100%; max-width: var(--mh-max); margin-inline: auto; }

/* 頁首 */
.mh-header-inner {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 20px var(--mh-gutter) 12px;
	max-width: var(--mh-max); margin-inline: auto;
}
.mh-topnav, .mh-search-inline, .mh-footer-nav { display: none; }
.mh-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mh-seal {
	width: 40px; height: 40px; flex-shrink: 0;
	background: var(--mh-red); color: var(--mh-on-red);
	border-radius: 6px; display: flex; align-items: center; justify-content: center;
	font-family: var(--mh-font-serif); font-size: 20px; font-weight: 700;
}
/* 加上 .mh-header 提高優先權：WooCommerce 頁面的 .woocommerce-page img { height:auto } 會把 LOGO 撐回原尺寸 */
.mh-header .mh-logo-img { display: block; height: 40px; width: auto; max-width: 180px; object-fit: contain; flex-shrink: 0; }
@media (min-width: 1024px) { .mh-header .mh-logo-img { height: 44px; max-width: 220px; } }
.mh-brand-text { display: flex; flex-direction: column; min-width: 0; }
.mh-brand-name {
	font-family: var(--mh-font-serif); font-size: var(--mh-fs-brand); font-weight: 700;
	letter-spacing: var(--mh-track-brand); line-height: 1.3; white-space: nowrap;
}
.mh-brand-tagline { font-size: 11px; color: var(--mh-muted); letter-spacing: var(--mh-track-tagline); white-space: nowrap; }

/* 語言切換 */
.mh-lang { position: relative; flex-shrink: 0; }
.mh-lang summary {
	list-style: none; cursor: pointer;
	min-height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 4px;
	border: 1px solid var(--mh-line); background: var(--mh-card); color: var(--mh-ink);
	border-radius: 22px; font-size: var(--mh-fs-label); white-space: nowrap;
}
.mh-lang summary::-webkit-details-marker { display: none; }
.mh-lang-name { display: none; }
.mh-lang-code { font-weight: 700; }
@media (min-width: 768px) {
	.mh-lang-name { display: inline; }
	.mh-lang-code { display: none; }
}
.mh-lang ul {
	position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
	margin: 0; padding: 6px; list-style: none; min-width: 150px;
	background: var(--mh-card); border: 1px solid var(--mh-line); border-radius: 12px;
}
.mh-lang li a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: var(--mh-fs-body-sm); }
.mh-lang li a[aria-current="true"] { color: var(--mh-red); font-weight: 700; }
.mh-lang li a:hover { background: var(--mh-paper); }

/* 搜尋框 */
.mh-search { width: 100%; padding: 0 var(--mh-gutter) 16px; max-width: var(--mh-max); margin-inline: auto; }
.mh-search label {
	display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px;
	background: var(--mh-card); border: 1px solid var(--mh-line); border-radius: 23px; color: var(--mh-muted);
}
.mh-search input {
	flex-grow: 1; min-width: 0; border: 0; outline: none; background: transparent;
	font-size: var(--mh-fs-body); color: var(--mh-ink);
}
.mh-search input::placeholder { color: var(--mh-muted); opacity: .8; }
.mh-search label:focus-within { border-color: var(--mh-red); }

/* 底部選單 */
.mh-tabbar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
	width: 100%; max-width: var(--mh-max); margin: 0 auto;
	display: grid; grid-template-columns: repeat(var(--mh-tabs, 4), minmax(0, 1fr));
	background: var(--mh-card); border-top: 1px solid var(--mh-line);
	padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}
.mh-tabbar a {
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
	min-height: 48px; color: var(--mh-muted); font-size: var(--mh-fs-caption); font-weight: 500;
	text-align: center; line-height: 1.25; padding: 0 2px;
}
.mh-tabbar a[aria-current="page"] { color: var(--mh-red); font-weight: 700; }

/* 一般頁面內容（非 Elementor） */
.mh-content { width: 100%; padding: 8px var(--mh-gutter) 32px; max-width: var(--mh-max); margin-inline: auto; }
.mh-content h1 { font-family: var(--mh-font-serif); font-size: 24px; letter-spacing: var(--mh-track-h2); margin: 8px 0 16px; }
.mh-content p { line-height: 1.75; }
.mh-list-item { display: block; padding: 14px 16px; margin-bottom: 10px; background: var(--mh-card); border: 1px solid var(--mh-line); border-radius: var(--mh-radius-card); }
.mh-list-item h2 { font-family: var(--mh-font-serif); font-size: var(--mh-fs-h4); margin: 0 0 4px; }
.mh-list-item p { margin: 0; color: var(--mh-muted); font-size: var(--mh-fs-label); }

/* Elementor：頁面內容全寬貼齊 App 外框 */
.mh-main .elementor-section.elementor-section-boxed > .elementor-container { max-width: 100%; }

/* 頁尾 */
.mh-footer { border-top: 1px solid var(--mh-line); }
.mh-footer-inner {
	max-width: var(--mh-max); margin-inline: auto; padding: 24px var(--mh-gutter);
	display: flex; flex-direction: column; gap: 6px; color: var(--mh-muted); font-size: var(--mh-fs-caption);
}
.mh-footer-brand { font-family: var(--mh-font-serif); font-size: 16px; font-weight: 700; color: var(--mh-ink); letter-spacing: var(--mh-track-brand); }

/* ==========================================================
   平板（768px 以上）
   ========================================================== */
@media (min-width: 768px) {
	.mh-header-inner { padding-top: 24px; padding-bottom: 16px; }
	.mh-search { padding-bottom: 20px; }
}

/* 手機、平板內頁：返回＋置中標題（取代品牌頁首，對應視覺稿） */
.mh-subbar { display: none; }
@media (max-width: 1023px) {
	body.mh-sub .mh-header { display: none; }
	body.mh-sub .mh-subbar {
		position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 4px;
		padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top));
		background: rgba(247, 241, 230, .96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
		border-bottom: 1px solid var(--mh-line);
	}
	.admin-bar.mh-sub .mh-subbar { top: 46px; }
	button.mh-subbar-btn { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
	.mh-subbar-btn { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--mh-ink); }
	.mh-subbar-title {
		flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
		font-family: var(--mh-font-serif); font-size: 17px; font-weight: 700; letter-spacing: var(--mh-track-h2);
	}
	/* 功能頁原本的返回列由上方的共用頂部列取代 */
	body.mh-sub .mh-func-bar { display: none; }
}

/* 手機、平板：詳細頁底部改成行動按鈕列（點燈、導航），取代底部選單 */
.mh-cta-bar { display: none; }
@media (max-width: 1023px) {
	body.mh-has-cta .mh-tabbar { display: none; }
	body.mh-has-cta .mh-cta-bar {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
		padding: 12px var(--mh-gutter) calc(12px + env(safe-area-inset-bottom, 0px));
		background: var(--mh-card); border-top: 1px solid var(--mh-line);
	}
	.mh-cta-text { display: flex; flex-direction: column; flex-shrink: 0; line-height: 1.3; }
	.mh-cta-small { font-size: var(--mh-fs-caption); color: var(--mh-muted); }
	.mh-cta-label { font-family: var(--mh-font-serif); font-size: 16px; font-weight: 700; }
	.mh-cta-bar .mh-cta-btn { flex: 1; min-height: 48px; justify-content: center; }
	/* 頁尾只在電腦版顯示（手機版像 App，視覺稿沒有頁尾） */
	.mh-footer { display: none; }
}

/* ==========================================================
   電腦（1024px 以上）：頁首導覽取代底部選單
   ========================================================== */
@media (min-width: 1024px) {
	.mh-app { padding-bottom: 0; }
	.mh-tabbar { display: none; }

	.mh-header {
		position: sticky; top: 0; z-index: 40;
		background: rgba(247, 241, 230, .94);
		-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
		border-bottom: 1px solid var(--mh-line);
	}
	.admin-bar .mh-header { top: 32px; }
	.mh-header-inner { padding: 14px var(--mh-gutter); gap: 20px; }
	.mh-brand { flex-shrink: 0; }
	.mh-seal { width: 44px; height: 44px; font-size: 22px; }

	/* 導覽優先完整顯示；空間不夠時由搜尋框讓出寬度 */
	.mh-topnav { display: flex; align-items: center; gap: 2px; flex: 1 0 auto; justify-content: flex-start; }
	.mh-topnav a {
		display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
		border-radius: 22px; color: var(--mh-ink); font-size: 15px; font-weight: 500; white-space: nowrap;
	}
	.mh-topnav a:hover { background: var(--mh-card); }
	.mh-topnav a[aria-current="page"] { color: var(--mh-red); font-weight: 700; }
	.mh-topnav svg { display: none; } /* 電腦版只顯示文字，圖示留給手機底部選單 */

	.mh-search-inline { display: block; flex: 0 1 260px; min-width: 140px; }
	.mh-search-inline label {
		display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
		background: var(--mh-card); border: 1px solid var(--mh-line); border-radius: 21px; color: var(--mh-muted);
	}
	.mh-search-inline label:focus-within { border-color: var(--mh-red); }
	.mh-search-inline input { flex-grow: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; color: var(--mh-ink); }
	.mh-search { display: none; } /* 電腦版改用頁首的搜尋框 */

	.mh-footer-inner { flex-direction: row; align-items: center; justify-content: space-between; padding: 32px var(--mh-gutter); }
	.mh-footer-nav { display: flex; gap: 20px; }
	.mh-footer-nav a:hover { color: var(--mh-red); }
}

/* 1024–1279px：空間較窄，縮小導覽內距 */
@media (min-width: 1024px) and (max-width: 1279px) {
	.mh-topnav a { padding: 0 10px; font-size: 14px; }
}
@media (min-width: 1280px) {
	.mh-header-inner { gap: 28px; }
}

/* Elementor 卡片：沒有放圖片時，不顯示灰色占位圓形／方塊 */
.mh-cards .mh-card-img.mh-ph { display: none; }
