/* =========================================================
   Gemistry 全站樣式 (gemistry-site-style)
   - 把 WoodMart 8 的 Top bar / Header / Footer 外觀改成 Rhode（rhodeskin.com）
   - 只改外觀，不改結構；位置由 WoodMart Header Builder 決定
   - 每區只在 body 有 gemistry-ss-{區塊} class（後台開關）時生效
   - 數值都來自 :root 的 --gemistry-ss-*（後台設定輸出）
   - 優先改 WoodMart 自己的 CSS 變數（--wd-*），少寫屬性；
     選擇器重複 body class 提高權重，壓過 WoodMart 動態 CSS，不用 !important
   ========================================================= */

/* =========================================================
   Top bar
   ========================================================= */

body.gemistry-ss-topbar.gemistry-ss-topbar {
	--wd-top-bar-h: var(--gemistry-ss-topbar-height);
	--wd-top-bar-sm-h: var(--gemistry-ss-topbar-height);
	--wd-top-bar-sticky-h: var(--gemistry-ss-topbar-height);
}

/* Rhode TopBanner：內縮的圓角卡片（不是滿版色條） */
body.gemistry-ss-topbar.gemistry-ss-topbar .whb-top-bar {
	margin: var(--gemistry-ss-topbar-inset) var(--gemistry-ss-topbar-inset) var(--gemistry-ss-topbar-gap);
	border: 0;
	border-radius: var(--gemistry-ss-topbar-radius);
	background-color: var(--gemistry-ss-topbar-bg);
	color: var(--gemistry-ss-topbar-color);
	overflow: hidden;
}

body.gemistry-ss-topbar-bold.gemistry-ss-topbar .whb-top-bar :is(p, span, a, div, li) { font-weight: 700; }

body.gemistry-ss-topbar.gemistry-ss-topbar .whb-top-bar .wd-nav-header {
	--wd-navigation-color: var(--gemistry-ss-topbar-color-rgb);
}

body.gemistry-ss-topbar.gemistry-ss-topbar .whb-top-bar :is(p, span, a, div, li) {
	color: inherit;
	font-size: var(--gemistry-ss-topbar-size);
	letter-spacing: calc(var(--gemistry-ss-topbar-spacing) * 1em);
	line-height: 1.4;
}

body.gemistry-ss-topbar-upper.gemistry-ss-topbar .whb-top-bar { text-transform: uppercase; }

body.gemistry-ss-topbar.gemistry-ss-topbar .whb-top-bar a { text-decoration: none; }
body.gemistry-ss-topbar-underline.gemistry-ss-topbar .whb-top-bar a {
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* =========================================================
   Header
   ========================================================= */

body.gemistry-ss-header.gemistry-ss-header {
	--wd-header-general-h: var(--gemistry-ss-header-height);
	--wd-header-general-sticky-h: var(--gemistry-ss-header-height);
	--wd-header-clone-h: var(--gemistry-ss-header-height);
	--wd-header-el-font-size: var(--gemistry-ss-header-nav-size);
	--wd-header-el-font-weight: var(--gemistry-ss-header-nav-weight);
	--wd-header-el-transform: none;
}

body.gemistry-ss-header-nav-upper.gemistry-ss-header { --wd-header-el-transform: uppercase; }

@media (max-width: 1024px) {
	body.gemistry-ss-header.gemistry-ss-header {
		--wd-header-general-sm-h: var(--gemistry-ss-header-height-m);
		--wd-header-general-h: var(--gemistry-ss-header-height-m);
	}
}

/* Rhode Header：外圍白底，內縮的米色導覽列、上方兩角圓角 */
/* 外圍底色只在頁首「佔位置」時塗上；Header Builder 開了 Overlap（.whb-overcontent）而且還沒往下捲時不塗，
   否則會在主視覺上蓋一層白，導覽列設透明也看不到下方內容 */
body.gemistry-ss-header.gemistry-ss-header .whb-header:not(.whb-overcontent) .whb-main-header,
body.gemistry-ss-header.gemistry-ss-header .whb-header.whb-sticked .whb-main-header,
body.gemistry-ss-header.gemistry-ss-header .whb-clone {
	background-color: var(--gemistry-ss-header-surround);
}

body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) {
	margin-inline: var(--gemistry-ss-header-inset);
}

body.gemistry-ss-header.gemistry-ss-header .whb-general-header {
	border-radius: var(--gemistry-ss-header-radius) var(--gemistry-ss-header-radius) 0 0;
}

body.gemistry-ss-header-radius-all.gemistry-ss-header .whb-general-header:not(:has(+ .whb-header-bottom)),
body.gemistry-ss-header-radius-all.gemistry-ss-header .whb-header-bottom {
	border-bottom-left-radius: var(--gemistry-ss-header-radius);
	border-bottom-right-radius: var(--gemistry-ss-header-radius);
}

/* 主列與下方列：底色、文字 / 圖示色 */
body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) {
	border-bottom-width: 0;
	background-color: var(--gemistry-ss-header-bg);
	color: var(--gemistry-ss-header-color);
	transition: background-color .7s cubic-bezier(.76, 0, .24, 1), color .3s ease;
}

body.gemistry-ss-header-border.gemistry-ss-header .whb-main-header {
	border-bottom: 1px solid rgba(var(--gemistry-ss-header-color-rgb), .2);
}

body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) .wd-nav-header {
	--wd-navigation-color: var(--gemistry-ss-header-color-rgb);
	--nav-color: rgba(var(--gemistry-ss-header-color-rgb), 1);
	--nav-color-hover: rgba(var(--gemistry-ss-header-color-rgb), 1);
	--nav-color-active: rgba(var(--gemistry-ss-header-color-rgb), 1);
}

body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) .wd-nav-header > li > a {
	color: var(--gemistry-ss-header-color);
	letter-spacing: calc(var(--gemistry-ss-header-nav-spacing) * 1em);
}

/* 選單滑過：由左往右長出的底線（Rhode u-animate-underline） */
body.gemistry-ss-header-nav-underline.gemistry-ss-header .wd-nav-header > li > a .nav-link-text {
	position: relative;
}

body.gemistry-ss-header-nav-underline.gemistry-ss-header .wd-nav-header > li > a .nav-link-text::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -3px;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform .5s cubic-bezier(.76, 0, .24, 1);
}

body.gemistry-ss-header-nav-underline.gemistry-ss-header .wd-nav-header > li:is(:hover, .current-menu-item) > a .nav-link-text::after {
	transform: scaleX(1);
	transform-origin: left;
}

/* 圖示（搜尋、帳號、願望清單、購物車、手機選單） */
body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) .wd-tools-element > a {
	color: var(--gemistry-ss-header-color);
}

body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) .wd-tools-icon {
	color: inherit;
	font-size: var(--gemistry-ss-header-icon-size);
}

body.gemistry-ss-header.gemistry-ss-header :is(.whb-general-header, .whb-header-bottom) .wd-tools-icon::before {
	font-size: var(--gemistry-ss-header-icon-size);
}

/* 購物車圖示：把 WoodMart 字型圖示換成內建 SVG（mask + currentColor，顏色與大小跟著上面的設定）。
   Header Builder 設了自訂圖片（裡面有 img）時不處理。 */
body.gemistry-ss-header-cart-icon.gemistry-ss-header .wd-header-cart .wd-tools-icon:not(:has(img))::before {
	content: "";
	display: block;
	width: var(--gemistry-ss-header-icon-size);
	height: var(--gemistry-ss-header-icon-size);
	background-color: currentColor;
	-webkit-mask: var(--gemistry-ss-header-cart-icon) center / contain no-repeat;
	mask: var(--gemistry-ss-header-cart-icon) center / contain no-repeat;
}

/* 搜尋圖示（放大鏡）：同上。只換 ::before；::after 是 WoodMart 搜尋展開時的關閉 X，不動 */
body.gemistry-ss-header-search-icon.gemistry-ss-header :is(.wd-header-search, .wd-header-search-mobile) .wd-tools-icon:not(:has(img))::before {
	content: "";
	display: block;
	width: var(--gemistry-ss-header-icon-size);
	height: var(--gemistry-ss-header-icon-size);
	background-color: currentColor;
	-webkit-mask: var(--gemistry-ss-header-search-icon) center / contain no-repeat;
	mask: var(--gemistry-ss-header-search-icon) center / contain no-repeat;
}

/* 帳號圖示（人像）：同上 */
body.gemistry-ss-header-account-icon.gemistry-ss-header .wd-header-my-account .wd-tools-icon:not(:has(img))::before {
	content: "";
	display: block;
	width: var(--gemistry-ss-header-icon-size);
	height: var(--gemistry-ss-header-icon-size);
	background-color: currentColor;
	-webkit-mask: var(--gemistry-ss-header-account-icon) center / contain no-repeat;
	mask: var(--gemistry-ss-header-account-icon) center / contain no-repeat;
}

body.gemistry-ss-header.gemistry-ss-header .wd-tools-element .wd-tools-count {
	min-width: 15px;
	height: 15px;
	background-color: var(--gemistry-ss-header-count-bg);
	color: var(--gemistry-ss-header-count-color);
	font-size: 11px;
	font-weight: 400;
	line-height: 15px;
}

/* 往下捲：固定頁首 */
body.gemistry-ss-header.gemistry-ss-header .whb-sticked :is(.whb-general-header, .whb-header-bottom),
body.gemistry-ss-header.gemistry-ss-header .whb-clone :is(.whb-general-header, .whb-header-bottom) {
	background-color: var(--gemistry-ss-header-sticky-bg);
}

body.gemistry-ss-header.gemistry-ss-header .whb-sticked .whb-main-header,
body.gemistry-ss-header.gemistry-ss-header .whb-clone { box-shadow: none; }

body.gemistry-ss-header-sticky-shadow.gemistry-ss-header .whb-sticked .whb-main-header,
body.gemistry-ss-header-sticky-shadow.gemistry-ss-header .whb-clone { box-shadow: 0 1px 12px rgba(0, 0, 0, .08); }

/* 首頁頂部透明（需在 Header Builder 開 Overlap 才會疊在主視覺上） */
body.home.gemistry-ss-header-transparent.gemistry-ss-header .whb-header:not(.whb-sticked) .whb-main-header {
	background-color: transparent;
}

body.home.gemistry-ss-header-transparent.gemistry-ss-header .whb-header:not(.whb-sticked) :is(.whb-general-header, .whb-header-bottom) {
	background-color: transparent;
	color: var(--gemistry-ss-header-transparent-color);
}

body.home.gemistry-ss-header-transparent.gemistry-ss-header .whb-header:not(.whb-sticked) :is(.whb-general-header, .whb-header-bottom) .wd-nav-header {
	--wd-navigation-color: var(--gemistry-ss-header-transparent-color-rgb);
	--nav-color: rgba(var(--gemistry-ss-header-transparent-color-rgb), 1);
	--nav-color-hover: rgba(var(--gemistry-ss-header-transparent-color-rgb), 1);
}

body.home.gemistry-ss-header-transparent.gemistry-ss-header .whb-header:not(.whb-sticked) :is(.whb-general-header, .whb-header-bottom) :is(.wd-nav-header > li > a, .wd-tools-element > a) {
	color: var(--gemistry-ss-header-transparent-color);
}

/* =========================================================
   Footer（Rhode：米色圓角卡片、分隔線、底線動畫連結、白底訂閱欄）
   ========================================================= */

body.gemistry-ss-footer.gemistry-ss-footer .wd-footer {
	margin: var(--gemistry-ss-footer-margin);
	border-radius: var(--gemistry-ss-footer-radius);
	background-color: var(--gemistry-ss-footer-bg);
	color: var(--gemistry-ss-footer-color);
	overflow: hidden;
	--wd-title-color: var(--gemistry-ss-footer-color);
	--wd-text-color: var(--gemistry-ss-footer-color);
	--wd-link-color: var(--gemistry-ss-footer-color);
	--wd-link-color-hover: var(--gemistry-ss-footer-color);
	--brdcolor-gray-300: var(--gemistry-ss-footer-line);
}

/* WoodMart 的淺色 / 深色配色會蓋掉文字色 */
body.gemistry-ss-footer.gemistry-ss-footer .wd-footer :is(.footer-sidebar, .wd-copyrights, .color-scheme-light, .color-scheme-dark) {
	background-color: transparent;
	color: var(--gemistry-ss-footer-color);
}

body.gemistry-ss-footer.gemistry-ss-footer .wd-footer :is(p, li, span, .widget-title, .title, h1, h2, h3, h4, h5, h6) { color: inherit; }

body.gemistry-ss-footer.gemistry-ss-footer .wd-footer .footer-sidebar {
	border-bottom: 1px solid var(--gemistry-ss-footer-line);
}

body.gemistry-ss-footer.gemistry-ss-footer .wd-footer .widget-title {
	font-size: var(--gemistry-ss-footer-title-size);
	font-weight: 700;
	letter-spacing: .02em;
}

body.gemistry-ss-footer-title-upper.gemistry-ss-footer .wd-footer .widget-title { text-transform: uppercase; }

body.gemistry-ss-footer.gemistry-ss-footer .wd-footer a:not(.btn):not(.button) {
	color: var(--gemistry-ss-footer-color);
	text-decoration: none;
}

/* 連結滑過底線（Rhode u-animate-underline） */
body.gemistry-ss-footer-link-underline.gemistry-ss-footer .wd-footer :is(.widget ul, .menu, .wd-nav) a:not(.btn):not(.button) {
	background-image: linear-gradient(currentColor, currentColor);
	background-position: 100% 100%;
	background-repeat: no-repeat;
	background-size: 0 1px;
	transition: background-size .5s cubic-bezier(.76, 0, .24, 1);
}

body.gemistry-ss-footer-link-underline.gemistry-ss-footer .wd-footer :is(.widget ul, .menu, .wd-nav) a:not(.btn):not(.button):hover {
	background-position: 0 100%;
	background-size: 100% 1px;
}

/* 版權列 */
body.gemistry-ss-footer.gemistry-ss-footer .wd-footer .wd-copyrights {
	border-top: 0;
	background-color: var(--gemistry-ss-footer-copy-bg);
	font-size: var(--gemistry-ss-footer-copy-size);
}

/* 訂閱欄：白底輸入框 + 右側按鈕（Rhode Footer-newsletter） */
body.gemistry-ss-footer-newsletter.gemistry-ss-footer .wd-footer form:has(input[type="email"]) {
	display: flex;
	align-items: stretch;
	width: 100%;
	max-width: 32rem;
	overflow: hidden;
	border: 1px solid var(--gemistry-ss-footer-line);
	border-radius: 12px;
	background: #fff;
}

body.gemistry-ss-footer-newsletter.gemistry-ss-footer .wd-footer form:has(input[type="email"]) input[type="email"] {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	height: 48px;
	margin: 0;
	padding: 0 1rem;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--gemistry-ss-footer-color);
}

body.gemistry-ss-footer-newsletter.gemistry-ss-footer .wd-footer form:has(input[type="email"]) input[type="email"]::placeholder {
	color: var(--gemistry-ss-footer-color);
	opacity: .6;
}

/* 外掛表單常把欄位包在 p / div 裡：讓包裝層也撐開 */
body.gemistry-ss-footer-newsletter.gemistry-ss-footer .wd-footer form:has(input[type="email"]) > :is(p, div):has(input[type="email"]) {
	display: flex;
	flex: 1 1 auto;
	margin: 0;
}

body.gemistry-ss-footer-newsletter.gemistry-ss-footer .wd-footer form:has(input[type="email"]) :is(button, input[type="submit"]) {
	flex: 0 0 auto;
	min-width: 6rem;
	height: auto;
	margin: 0;
	padding: 0 1.25rem;
	border: 0;
	border-left: 1px solid var(--gemistry-ss-footer-line);
	border-radius: 0 12px 12px 0;
	background: #fff;
	color: var(--gemistry-ss-footer-color);
	text-transform: uppercase;
	box-shadow: none;
}

body.gemistry-ss-footer-newsletter.gemistry-ss-footer .wd-footer form:has(input[type="email"]) :is(button, input[type="submit"]):hover {
	background: var(--gemistry-ss-footer-bg);
}

@media (prefers-reduced-motion: reduce) {
	body[class*="gemistry-ss-"] :is(.whb-general-header, .whb-header-bottom, .wd-footer a),
	body[class*="gemistry-ss-"] .nav-link-text::after { transition: none; }
}
