/* =========================================================
   系專業實驗室：快速選單 lab-finder（2026.10）
   搭配 assets/js/lab-finder.js；選單內容依頁面上的 .lab-card 自動產生。
   ========================================================= */
.labs-page.lf-page { overflow: clip; } /* 讓選單可以黏在上方（hidden 會讓 sticky 失效） */

.lf { position: sticky; top: 70px; z-index: 40; margin: 0 0 36px; transition: box-shadow .3s; }
.lf.is-stuck { box-shadow: 0 14px 24px -20px rgba(18, 19, 22, .45); }
.lf-bar { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.lf-in { position: relative; display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 8px 0 14px; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4); border: 1px solid #dedfe3; border-radius: 999px; }
.lf.is-stuck .lf-in { background: rgba(255, 255, 255, .94); }
.lf-label { flex: none; display: flex; align-items: center; gap: 8px; padding-right: 12px; border-right: 1px solid #dedfe3; font: 700 11px/1 ui-monospace, Menlo, monospace; letter-spacing: .14em; color: #8a8f99; }
.lf-label b { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 99px; background: #121316; color: #fff; font-size: 12px; letter-spacing: 0; }

.lf-track { position: relative; flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; padding: 6px 0; mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 22px), transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 22px), transparent); }
.lf-track::-webkit-scrollbar { display: none; }
.lf-pill { position: absolute; top: 6px; bottom: 6px; left: 0; width: 0; border-radius: 99px; background: var(--pc, #121316); opacity: 0; transition: transform .5s cubic-bezier(.2, .8, .2, 1), width .5s cubic-bezier(.2, .8, .2, 1), background .4s, opacity .3s; z-index: 0; }
.lf-chip { position: relative; z-index: 1; flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 10px; border: 0; border-radius: 99px; background: transparent; color: #4b505a; font: 700 14px/1 "Noto Sans TC", sans-serif; cursor: pointer; transition: color .3s, background .25s; white-space: nowrap; }
.lf-chip i { font: 700 11px/1 ui-monospace, Menlo, monospace; font-style: normal; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); transition: background .3s, color .3s, box-shadow .3s; }
.lf-chip:hover { background: rgba(18, 19, 22, .05); color: #121316; }
.lf-chip.is-on { color: #fff; }
.lf-chip.is-on:hover { background: transparent; }
.lf-chip.is-on i { background: #fff; color: var(--c); box-shadow: none; }
.lf-chip .ext { font-size: 11px; opacity: .6; }

.lf-all { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border: 0; border-radius: 999px; background: #121316; color: #fff; font: 700 14px/1 "Noto Sans TC", sans-serif; cursor: pointer; transition: background .3s, transform .2s; }
.lf-all:hover { background: #2b2f36; }
.lf-all:active { transform: scale(.96); }
.lf-all .g { display: grid; grid-template-columns: repeat(3, 4px); gap: 2px; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.lf-all .g i { width: 4px; height: 4px; border-radius: 1px; background: currentColor; }
.lf.is-open .lf-all .g { transform: rotate(45deg); }

/* 滑過預覽 */
.lf-peek { position: absolute; top: calc(100% + 12px); left: 0; width: 240px; padding: 8px; background: #fff; border-radius: 16px; box-shadow: 0 24px 40px -20px rgba(18, 19, 22, .5); pointer-events: none; opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top left; transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1), left .35s cubic-bezier(.2, .8, .2, 1); }
.lf-peek.show { opacity: 1; transform: none; }
.lf-peek img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #eee; }
.lf-peek b { display: block; margin: 8px 4px 0; font-size: 14px; color: #121316; }
.lf-peek small { display: block; margin: 2px 4px 2px; font-size: 12px; color: #8a8f99; }

/* 全部實驗室面板 */
.lf-panel { position: absolute; left: 24px; right: 24px; top: calc(100% + 12px); max-width: 1152px; margin: 0 auto; padding: 18px; background: #fff; border-radius: 26px; box-shadow: 0 40px 70px -30px rgba(18, 19, 22, .55); opacity: 0; visibility: hidden; transform: translateY(-10px); transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1), visibility 0s .4s; }
.lf.is-open .lf-panel { opacity: 1; visibility: visible; transform: none; transition: opacity .3s, transform .4s cubic-bezier(.2, .8, .2, 1); }
.lf-panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 4px 6px 14px; }
.lf-panel-h b { font-size: 18px; font-weight: 900; color: #121316; }
.lf-panel-h span { font: 600 12px/1 ui-monospace, Menlo, monospace; color: #8a8f99; letter-spacing: .08em; }
.lf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-height: min(64vh, 560px); overflow-y: auto; }
.lf-card { position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border: 0; border-radius: 16px; background: #f3f3f0; text-align: left; cursor: pointer; font-family: inherit; opacity: 0; transform: translateY(10px); transition: background .25s, transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s; }
.lf.is-open .lf-card { opacity: 1; transform: none; transition-delay: calc(var(--i) * 35ms); }
.lf-card:hover { background: color-mix(in srgb, var(--c) 12%, #fff); transform: translateY(-3px); }
.lf-card img { width: 96px; height: 72px; object-fit: cover; border-radius: 10px; background: #ddd; }
.lf-card i { position: absolute; left: 14px; top: 14px; font: 700 10.5px/1 ui-monospace, Menlo, monospace; font-style: normal; color: #fff; background: var(--c); padding: 4px 6px; border-radius: 6px; }
.lf-card b { display: block; font-size: 15px; font-weight: 900; color: #121316; line-height: 1.35; }
.lf-card small { display: block; margin-top: 4px; font-size: 12px; color: #8a8f99; }
.lf-card.is-on { box-shadow: inset 0 0 0 2px var(--c); background: #fff; }

/* 被選到的卡片：短暫亮框提示 */
.lab-card.lf-flash { animation: lfFlash 1.4s ease-out; }
@keyframes lfFlash { 0%, 30% { box-shadow: 0 0 0 4px var(--accent), 0 40px 80px -50px rgba(18, 19, 22, .45); } 100% { box-shadow: 0 0 0 0 transparent; } }
.lab-card { scroll-margin-top: 160px; }

@media (max-width: 991px) {
	.lf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.lf-peek { display: none; }
}
@media (max-width: 600px) {
	.lf { top: 62px; margin-bottom: 26px; }
	.lf-bar { padding: 0 12px; }
	.lf-in { height: 56px; padding: 0 6px 0 10px; }
	.lf-label { display: none; }
	.lf-chip { height: 36px; padding: 0 12px 0 8px; font-size: 13px; }
	.lf-all { height: 42px; padding: 0 14px; }
	.lf-all span { display: none; }
	.lf-panel { left: 8px; right: 8px; padding: 12px; border-radius: 20px; }
	.lf-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
	.lf-pill, .lf-card, .lf-panel, .lf-peek { transition: none; }
	.lab-card.lf-flash { animation: none; }
}

/* 左右滑動 */
.lf-track { scroll-snap-type: x proximity; cursor: grab; touch-action: pan-x; overscroll-behavior-x: contain; }
.lf-chip { scroll-snap-align: center; }
.lf-in.is-drag .lf-track { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
.lf-in.is-drag .lf-chip { pointer-events: none; }
.lf-arrow { flex: none; width: 30px; height: 30px; margin: 0 -4px; padding: 0 0 2px; border: 1px solid #dedfe3; border-radius: 50%; background: #fff; color: #121316; font: 700 18px/1 "Noto Sans TC", sans-serif; cursor: pointer; display: grid; place-items: center; z-index: 2; opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1), background .2s, color .2s; }
.lf-arrow:hover { background: #121316; color: #fff; border-color: #121316; }
.lf-in.can-l .lf-arrow.prev, .lf-in.can-r .lf-arrow.next { opacity: 1; transform: none; pointer-events: auto; }
.lf-in:not(.can-l) .lf-arrow.prev, .lf-in:not(.can-r) .lf-arrow.next { width: 0; margin: 0; border: 0; }
.lf-in:not(.can-l) .lf-track { mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); }
.lf-in:not(.can-r) .lf-track { mask-image: linear-gradient(90deg, transparent, #000 14px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px); }
.lf-in:not(.can-l):not(.can-r) .lf-track { mask-image: none; -webkit-mask-image: none; }
@media (max-width: 600px) { .lf-arrow { width: 26px; height: 26px; font-size: 16px; } }
