/* ==========================================================
 * 歡喜緣 商品規格色票 — 前台
 * 依 Figma「商品分類-內頁」node 1457:8760
 * ========================================================== */
.twh-vs {
	--twh-vs-white: #ffffff;
	--twh-vs-ink: #292421;      /* 主-木墨黑 */
	--twh-vs-gold: #b67b19;     /* 燙金起點 */
	--twh-vs-gold-mid: #d1a64f; /* 燙金中段 */
	--twh-vs-gold-end: #a96f14; /* 燙金終點 */
	--twh-vs-gap: 20px;
	font-family: "Noto Serif TC", serif;
}

/* 原生 select 保留給 WooCommerce 運作，畫面上隱藏 */
.twh-vs__select {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.twh-vs__list {
	display: flex;
	flex-wrap: wrap;
	gap: 12px var(--twh-vs-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.twh-vs__cell {
	margin: 0;
	padding: 0;
	list-style: none;
}

.twh-vs__cell.is-hidden {
	display: none;
}

/* 共用按鈕重設（避免被主題按鈕樣式影響） */
.twh-vs .twh-vs__item {
	margin: 0 !important;
	font-family: inherit !important;
	line-height: 1.4 !important;
	cursor: pointer !important;
	box-shadow: none !important;
	text-shadow: none !important;
	transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.twh-vs .twh-vs__item:focus-visible {
	outline: 2px solid var(--twh-vs-gold-mid) !important;
	outline-offset: 3px !important;
}

/* ---------- 色票圓點：22px ---------- */
.twh-vs .twh-vs__item--color {
	display: block !important;
	width: 22px !important;
	height: 22px !important;
	min-height: 0 !important;
	padding: 0 !important;
	background: var(--twh-vs-color, transparent) !important;
	border: 1px solid rgba(255, 255, 255, 0.6) !important;
	border-radius: 50% !important;
}

.twh-vs .twh-vs__item--color:hover {
	border-color: var(--twh-vs-white) !important;
}

/* 選取：外圈金色光環 */
.twh-vs .twh-vs__item--color.is-selected {
	border-color: var(--twh-vs-white) !important;
	box-shadow: 0 0 0 2px var(--twh-vs-ink), 0 0 0 3px var(--twh-vs-gold-mid) !important;
}

/* 不可選：斜線 */
.twh-vs .twh-vs__item--color.is-disabled {
	position: relative !important;
	opacity: 0.35 !important;
	cursor: not-allowed !important;
}

.twh-vs .twh-vs__item--color.is-disabled::after {
	content: "" !important;
	position: absolute !important;
	top: 50% !important;
	left: -2px !important;
	width: calc(100% + 4px) !important;
	height: 1px !important;
	background: var(--twh-vs-white) !important;
	transform: rotate(-45deg) !important;
}

/* ---------- 方框按鈕 ----------
 * Figma：預設與 hover 皆為 1px 古銅金框線 + 燙金漸層字、圓角 4px
 * 選取：底色加一層淡金、框線加粗，與未選取區隔
 * ------------------------------------------------------------------ */
.twh-vs .twh-vs__item--button {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	min-height: 0 !important;
	padding: 8px !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	background: transparent !important;
	border: 1px solid var(--twh-vs-gold) !important;
	border-radius: 0.25rem !important;
	opacity: 1 !important;
}

.twh-vs .twh-vs__item--button:hover,
.twh-vs .twh-vs__item--button:focus {
	background: transparent !important;
	border-color: var(--twh-vs-gold) !important;
}

/* 文字：燙金漸層（預設、hover、選取都一樣） */
.twh-vs .twh-vs__item--button .twh-vs__text {
	color: transparent !important;
	background: linear-gradient(180deg, var(--twh-vs-gold) 0%, var(--twh-vs-gold-mid) 50%, var(--twh-vs-gold-end) 100%) !important;
	-webkit-background-clip: text !important;
	background-clip: text !important;
	-webkit-text-fill-color: transparent !important;
}

/* 選取：淡金底 + 框線加粗 */
.twh-vs .twh-vs__item--button.is-selected {
	background: rgba(182, 123, 25, 0.2) !important;
	box-shadow: inset 0 0 0 1px var(--twh-vs-gold-mid) !important;
}

/* 不可選：降低透明度 + 刪除線 */
.twh-vs .twh-vs__item--button.is-disabled {
	opacity: 0.3 !important;
	text-decoration: line-through !important;
	text-decoration-color: var(--twh-vs-gold) !important;
	cursor: not-allowed !important;
}

/* ---------- 變化表格改成「標籤在上、選項在下」 ---------- */
.variations_form table.variations:has(.twh-vs) {
	width: 100%;
	margin: 0 0 20px;
	border: 0;
	background: none;
}

.variations_form table.variations:has(.twh-vs) tbody,
.variations_form table.variations:has(.twh-vs) tr {
	display: block;
	background: none;
	border: 0;
}

.variations_form table.variations:has(.twh-vs) tr {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 20px;
}

.variations_form table.variations:has(.twh-vs) th,
.variations_form table.variations:has(.twh-vs) td {
	display: block;
	padding: 0;
	text-align: left;
	background: none;
	border: 0;
}

/* 屬性標籤：16px Bold、60% 透明 */
.variations_form table.variations:has(.twh-vs) .label label {
	margin: 0;
	font-family: "Noto Serif TC", serif;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: #ffffff;
	opacity: 0.6;
}

/* 「清除」連結 */
.variations_form table.variations:has(.twh-vs) .reset_variations {
	display: inline-block;
	margin-top: 12px;
	font-size: 14px;
	color: #d1a64f;
	text-decoration: underline;
}

/* ---------- RWD ---------- */
@media (max-width: 768px) {
	.twh-vs {
		--twh-vs-gap: 14px;
	}

	.twh-vs .twh-vs__item--button {
		font-size: 15px !important;
	}
}
