/* JCT Meta Toolbar — 作者列旅行工具列 v1.0.0
 *
 * 尺寸跟 Google 偏好來源按鈕對齊：高 40px、圓角 20px、outlined。
 * 那顆按鈕用 shadow DOM 渲染且沒有 part 屬性，外觀完全改不動（實測固定
 * 158×40px），所以只能讓自製元件遷就它，站在同一條基線上。
 *
 * 顏色一律用 currentColor 或半透明灰，跟著主題的文字色走——深色模式
 * 因此只需要覆寫「有實色底」的那兩處（選單面板與圖示底色）。
 */

/* ── 作者列版型 ────────────────────────────────────────────────
 * .jct-mtb-host 由搬移腳本在「確實搬進來之後」才加上。
 * 版型調整全部掛在它底下，是為了避免「工具列沒出現、作者列版型卻被改掉」
 * ——搬移失敗、或 jct_meta_toolbar_show 把工具列關掉時，主題版型原封不動。 */
.entry-header .single-post-meta.jct-mtb-host {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 12px;
}

.entry-header .single-post-meta.jct-mtb-host > span {
	margin-right: 0;
}

/* 作者／日期靠左，整組工具（含 Google 那顆）靠右 */
.entry-header .single-post-meta.jct-mtb-host .jct-mtb {
	margin-left: auto;
}

/* ── 頁面（Page）：沒有作者列，掛在標題下方 ─────────────────────
 * Jannah 的 .entry-header 是置中版面，所以這裡也置中，
 * 不沿用文章那套「靠右」——那是為了跟作者／日期並排才有的行為。
 * 不動 .entry-header 本身的 display，避免影響標題與精選圖片的排版。 */
.jct-mtb-host--bare .jct-mtb {
	display: flex;
	justify-content: center;
	width: 100%;
	margin: 12px 0 0;
}

/* ── 容器 ──────────────────────────────────────────────────── */
.jct-mtb {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	vertical-align: middle;
	position: relative;
	font-size: 13px;
	line-height: 1;
}

.jct-mtb__swg {
	display: inline-flex;
	line-height: 0;
}

.jct-mtb__divider {
	width: 1px;
	height: 22px;
	background: currentColor;
	opacity: .18;
	flex: none;
}

/* ── 常駐膠囊 ──────────────────────────────────────────────── */
.jct-mtb__pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	height: 40px;
	padding: 0 16px 0 13px;
	border-radius: 20px;
	border: 1px solid rgba(128, 140, 152, .42);
	color: inherit;
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	background: transparent;
	transition: border-color .16s, color .16s, background-color .16s;
}

.jct-mtb__pill:hover,
.jct-mtb__pill:focus-visible {
	border-color: currentColor;
	background: rgba(128, 140, 152, .10);
	text-decoration: none;
}

.jct-mtb__pill svg {
	width: 18px;
	height: 18px;
	flex: none;
}

/* 紅綠燈號誌點
 *
 * 純裝飾：意思由膠囊的 title「機場天氣紅綠燈」承載，所以在 HTML 端
 * aria-hidden。兩顆包在同一個 flex item 裡，才不會被膠囊本身的
 * gap:6px 拆成看起來無關的兩個東西——紅綠要靠得夠近才讀得出是號誌。
 *
 * 左紅右綠：對齊台灣橫式號誌的排列。 */
.jct-mtb__signal {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	flex: none;
}

.jct-mtb__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	flex: none;
}

.jct-mtb__dot--red {
	background: #b91c1c;
}

.jct-mtb__dot--green {
	background: #15803d;
}

/* ── 更多 ──────────────────────────────────────────────────── */
.jct-mtb__more {
	position: relative;
	flex: none;
}

.jct-mtb__btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	padding: 0;
	cursor: pointer;
	display: grid;
	place-items: center;
	color: inherit;
	background: transparent;
	border: 1px solid rgba(128, 140, 152, .42);
	transition: border-color .16s, background-color .16s;
}

.jct-mtb__btn:hover,
.jct-mtb__btn[aria-expanded="true"] {
	border-color: currentColor;
	background: rgba(128, 140, 152, .10);
}

.jct-mtb__btn svg {
	width: 20px;
	height: 20px;
}

.jct-mtb__pill:focus-visible,
.jct-mtb__btn:focus-visible,
.jct-mtb__menu a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ── 下拉面板 ──────────────────────────────────────────────── */
.jct-mtb__menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 9999;
	width: 270px;
	padding: 6px;
	border-radius: 12px;
	text-align: left;
	background: #fff;
	border: 1px solid rgba(128, 140, 152, .30);
	box-shadow: 0 3px 6px rgba(18, 26, 34, .13), 0 14px 32px rgba(18, 26, 34, .18);
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity .18s, transform .18s;
}

.jct-mtb__menu[hidden] {
	display: none;
}

.jct-mtb__menu.is-open {
	opacity: 1;
	transform: translateY(0);
}

.jct-mtb__menu-title {
	margin: 0;
	padding: 8px 10px 6px;
	font-size: 11px;
	letter-spacing: .12em;
	text-transform: uppercase;
	opacity: .6;
}

.jct-mtb__menu a {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 9px 10px;
	border-radius: 8px;
	text-decoration: none;
	color: inherit;
}

.jct-mtb__menu a:hover {
	background: rgba(128, 140, 152, .12);
	text-decoration: none;
}

.jct-mtb__ico {
	width: 30px;
	height: 30px;
	border-radius: 8px;
	flex: none;
	margin-top: 1px;
	display: grid;
	place-items: center;
	background: rgba(11, 99, 197, .10);
	color: #0b63c5;
}

.jct-mtb__ico svg {
	width: 17px;
	height: 17px;
}

.jct-mtb__t {
	display: block;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
}

.jct-mtb__d {
	display: block;
	font-size: 12px;
	line-height: 1.45;
	opacity: .65;
}

/* ── 深色模式（Jannah 夜間模式會掛 .dark-skin） ─────────────────
 * 只需要覆寫有實色底的兩處，其餘靠 currentColor 自動跟著走。 */
.dark-skin .jct-mtb__menu {
	background: #1b242d;
	border-color: rgba(160, 175, 190, .22);
}

.dark-skin .jct-mtb__ico {
	background: rgba(90, 166, 245, .16);
	color: #5aa6f5;
}

/* 深色底下 700 系的紅綠會糊成一團，提亮到 500 系才讀得出來 */
.dark-skin .jct-mtb__dot--red {
	background: #ef4444;
}

.dark-skin .jct-mtb__dot--green {
	background: #22c55e;
}

/* ── 手機：收起膠囊，只留一顆「更多」，全部工具都在選單裡 ───────── */
@media (max-width: 767px) {
	.entry-header .single-post-meta.jct-mtb-host {
		justify-content: center;
	}

	.jct-mtb {
		gap: 6px;
	}

	.jct-mtb__pill,
	.jct-mtb__divider {
		display: none;
	}

	.jct-mtb__menu {
		right: auto;
		left: 50%;
		transform: translate(-50%, -6px);
	}

	.jct-mtb__menu.is-open {
		transform: translate(-50%, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.jct-mtb * {
		transition-duration: .001ms !important;
	}
}
