/* YS MAP 前端樣式 */

.ys-map {
	--ysmap-green: #1E7254;   /* 品牌主綠（標題） */
	--ysmap-dark: #0F4E3F;    /* 深墨綠（圖釘、名稱） */
	--ysmap-pin-w: 34px;      /* PC 端點大小（後台可設定，inline 覆寫） */
	--ysmap-pin-w-m: 34px;    /* 手機端點大小 */
	margin: 0;
}

.ys-map__scroll {
	overflow: visible;
}

.ys-map__inner {
	position: relative;
	width: 100%;
	line-height: 0;
}

.ys-map__img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	margin: 0;
}

/* ---- 端點（錨點在圖釘尖端） ---- */

.ys-map__pt {
	position: absolute;
	width: 0;
	height: 0;
	line-height: 1.4;
	z-index: var(--z, 2); /* 後台清單順序＝圖層高低（inline --z） */
	/* 白框位移（供角落變體覆寫） */
	--tx: -50%;
	--ty: 8px;
}

.ys-map__pt:hover,
.ys-map__pt.is-open,
.ys-map__pt:focus-within {
	z-index: 500;
	--ty: 0px;
}

.ys-map__pin {
	position: absolute;
	left: 0;
	bottom: 0;
	transform: translateX(-50%);
	width: var(--ysmap-pin-w);
	color: var(--ysmap-dark);
	cursor: pointer;
	transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	transform-origin: center bottom;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.ys-map__pin svg {
	display: block;
	width: 100%;
	height: auto;
	fill: currentColor;
	filter: drop-shadow(0 2px 3px rgba(7, 28, 23, 0.25));
}

.ys-map__pt:hover .ys-map__pin,
.ys-map__pt.is-open .ys-map__pin,
.ys-map__pt:focus-within .ys-map__pin {
	transform: translateX(-50%) scale(1.12);
}

.ys-map__pin:focus {
	outline: none;
}

.ys-map__pin:focus-visible {
	outline: 2px solid var(--ysmap-green);
	outline-offset: 2px;
	border-radius: 4px;
}

/* ---- 圖釘下方名稱（MAP 名稱，可留空）----
   pointer-events:none：文字不攔截滑鼠，重疊時不會擋住下方圖釘的 HOVER／點擊 */

.ys-map__label {
	position: absolute;
	top: 3px;
	left: 0;
	transform: translateX(-50%);
	width: -moz-max-content;
	width: max-content;
	max-width: 200px;
	text-align: center;
	font-size: var(--ysmap-lbl-fs, 15px) !important;
	font-weight: 500;
	line-height: var(--ysmap-lbl-lh, 20px) !important;
	letter-spacing: 0.06em;
	color: var(--ysmap-dark);
	white-space: normal;
	text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85), 0 0 8px rgba(255, 255, 255, 0.55);
	pointer-events: none;
	transition: opacity 0.2s;
	-webkit-user-select: none;
	user-select: none;
}

/* ---- HOVER 白框（LOGO + 標題） ---- */

.ys-map__card {
	position: absolute;
	bottom: calc(var(--ysmap-pin-w) + 16px);
	left: 0;
	transform: translate(var(--tx), var(--ty));
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 12px 32px rgba(7, 28, 23, 0.16), 0 2px 8px rgba(7, 28, 23, 0.08);
	padding: 20px 24px;
	width: -moz-max-content;
	width: max-content;
	min-width: 170px;
	max-width: 280px;
	text-align: center;
	line-height: 1.5;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.ys-map__card::after {
	content: '';
	position: absolute;
	left: 50%;
	bottom: -7px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-radius: 3px;
	transform: translateX(-50%) rotate(45deg);
}

.ys-map__pt:hover .ys-map__card,
.ys-map__pt.is-open .ys-map__card,
.ys-map__pt:focus-within .ys-map__card {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.ys-map__card-logo {
	display: block;
	margin: 0 auto 10px;
	max-width: 190px;
	max-height: 120px;
	width: auto;
	height: auto;
}

.ys-map__card-title {
	display: block;
	color: var(--ysmap-green);
	font-size: var(--ysmap-card-fs, 16px) !important;
	font-weight: 600;
	line-height: var(--ysmap-card-lh, 24px) !important;
	text-decoration: none;
}

a.ys-map__card-title:hover {
	color: var(--ysmap-dark);
	text-decoration: underline;
}

/* ---- 變體：靠近頂端 → 白框開在下方 ---- */

.ys-map__pt--flip {
	--ty: -8px;
}

.ys-map__pt--flip:hover,
.ys-map__pt--flip.is-open,
.ys-map__pt--flip:focus-within {
	--ty: 0px;
}

.ys-map__pt--flip .ys-map__card {
	bottom: auto;
	top: 16px;
}

.ys-map__pt--flip .ys-map__card::after {
	bottom: auto;
	top: -7px;
}

.ys-map__pt--flip:hover .ys-map__label,
.ys-map__pt--flip.is-open .ys-map__label,
.ys-map__pt--flip:focus-within .ys-map__label {
	opacity: 0;
}

/* ---- 變體：靠近左右邊緣 → 白框往內偏移 ---- */

.ys-map__pt--edge-l {
	--tx: -14%;
}

.ys-map__pt--edge-l .ys-map__card::after {
	left: 14%;
}

.ys-map__pt--edge-r {
	--tx: -86%;
}

.ys-map__pt--edge-r .ys-map__card::after {
	left: 86%;
}

/* ---- 圖片下方滑動提示（桌機隱藏） ---- */

.ys-map__hint {
	display: none;
	margin: 12px 0 0;
	text-align: center;
	font-size: 13px;
	line-height: 1.6;
	color: #6b7c76;
	letter-spacing: 0.05em;
}

/* ---- 平板（768–1024px）---- */

@media (min-width: 768px) and (max-width: 1024px) {
	.ys-map__pin {
		width: var(--ysmap-pin-w-t, var(--ysmap-pin-w, 34px));
	}

	.ys-map__label {
		font-size: var(--ysmap-lbl-fs-t, 15px) !important;
		line-height: var(--ysmap-lbl-lh-t, 20px) !important;
	}

	.ys-map__card-title {
		font-size: var(--ysmap-card-fs-t, 16px) !important;
		line-height: var(--ysmap-card-lh-t, 24px) !important;
	}

	.ys-map__card {
		bottom: calc(var(--ysmap-pin-w-t, 34px) + 16px);
	}

	.ys-map__pt--flip .ys-map__card {
		bottom: auto;
	}
}

/* ---- 手機（≤767px）：圖片高度最少 700px、左右滑動 ---- */

@media (max-width: 767px) {
	.ys-map__scroll {
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: thin;
	}

	.ys-map__inner {
		width: -moz-max-content;
		width: max-content;
	}

	.ys-map__hint {
		display: block;
	}

	/* 提高特異性 + !important：需壓過 Elementor / 主題的 img { height:auto; max-width:100% } */
	.ys-map .ys-map__scroll .ys-map__img {
		width: auto !important;
		height: 700px !important;
		max-width: none !important;
		min-height: 0 !important;
	}

	.ys-map__pin {
		width: var(--ysmap-pin-w-m);
	}

	.ys-map__label {
		font-size: var(--ysmap-lbl-fs-m, 15px) !important;
		line-height: var(--ysmap-lbl-lh-m, 20px) !important;
	}

	.ys-map__card-title {
		font-size: var(--ysmap-card-fs-m, 16px) !important;
		line-height: var(--ysmap-card-lh-m, 24px) !important;
	}

	.ys-map__card {
		bottom: calc(var(--ysmap-pin-w-m) + 16px);
		max-width: 250px;
		padding: 16px 20px;
	}

	.ys-map__pt--flip .ys-map__card {
		bottom: auto;
	}
}
