/* assets/css/tools.css — 旅遊工具箱 tools.php
 * 版面：標題＋即時搜尋 → 黏在頁首下的「航線」各站導覽（捲動時飛機跟著移動）→ 四個旅程階段的工具清單 → 方案 CTA
 * 色票：每站各一色，主色沿用全站藍；字體跟隨後台前台字體設定（--font-main）。
 */
.tb-page {
    --tb-ink: #102a43;
    --tb-mut: #5b7088;
    --tb-line: #dfe8f2;
    --tb-bg: #f5f8fc;
    --tb-plan: #0073e6;  --tb-plan-soft: #e6f1fd;
    --tb-net:  #0d8f7f;  --tb-net-soft:  #e3f5f2;
    --tb-buy:  #6a4fd1;  --tb-buy-soft:  #eeeafc;
    --tb-pack: #c77700;  --tb-pack-soft: #fdf1df;
    --tb-go:   #c8406a;  --tb-go-soft:   #fbe8ee;
    --tb-top: 70px;      /* 頁首高度，tools.js 會依實際量測覆寫 */
    background: var(--tb-bg);
    color: var(--tb-ink);
    margin: 0;
}
.tb-page *, .tb-page *::before, .tb-page *::after { box-sizing: border-box; }
.tb-main { padding-top: var(--tb-top); padding-bottom: 72px; font-family: var(--font-main, inherit); }
.tb-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; position: relative; }
.tb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 標題＋搜尋 ── */
.tb-hero { padding: 40px 0 30px; }
/* Hero 卡片：沿用全站工具頁（假期日曆等）的淺色漸層＋點點底紋＋浮水印圖示 */
.tb-hero-card {
    position: relative; overflow: hidden; isolation: isolate;
    border-radius: 26px; border: 1px solid #e7eef7;
    background:
        radial-gradient(120% 130% at 88% -12%, rgba(59,130,246,.12), transparent 55%),
        radial-gradient(90% 120% at -5% 115%, rgba(245,158,11,.07), transparent 55%),
        linear-gradient(135deg, #fdfdfb 0%, #f4f8fd 58%, #eaf2fb 100%);
    box-shadow: 0 24px 50px -30px rgba(16,42,67,.40), 0 2px 6px rgba(16,42,67,.04);
    padding: 44px 44px 40px;
}
.tb-hero-card::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .55;
    background-image: radial-gradient(rgba(16,42,67,.06) 1px, transparent 1px); background-size: 20px 20px;
    -webkit-mask-image: linear-gradient(118deg, #000, transparent 68%); mask-image: linear-gradient(118deg, #000, transparent 68%);
}
.tb-hero-wm {
    position: absolute; right: 30px; bottom: -30px; z-index: -1; pointer-events: none;
    font-size: 11rem; color: #2563eb; opacity: .07; transform: rotate(-12deg);
}
.tb-stats { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tb-stats li {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 999px; padding: 6px 14px;
    font-weight: 700; font-size: .9rem; color: #334155; box-shadow: 0 4px 12px rgba(2,6,23,.06);
}
.tb-stats b { color: var(--tb-plan); font-variant-numeric: tabular-nums; }
.tb-title {
    margin: 0;
    font-size: clamp(2.4rem, 7vw, 4.2rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: .02em;
    color: var(--tb-ink);
}
.tb-sub { margin: 14px 0 0; max-width: 36em; text-wrap: pretty; font-size: clamp(1rem, 2.4vw, 1.15rem); line-height: 1.75; color: var(--tb-mut); }
.tb-search {
    margin-top: 28px; max-width: 560px;
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1.5px solid var(--tb-line); border-radius: 14px;
    padding: 0 14px 0 16px; height: 54px;
    transition: border-color .15s, box-shadow .15s;
}
.tb-search:focus-within { border-color: var(--tb-plan); box-shadow: 0 0 0 4px rgba(0,115,230,.14); }
.tb-search > i { color: #8aa0b6; }
.tb-search input {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
    font: inherit; font-size: 16px; color: var(--tb-ink);
}
.tb-search input::placeholder { color: #9aacbe; }
.tb-count { flex-shrink: 0; font-size: .85rem; font-weight: 700; color: #8aa0b6; font-variant-numeric: tabular-nums; }

/* ── 航線導覽（黏在頁首下） ── */
.tb-route {
    position: sticky; top: var(--tb-top); z-index: 50;
    background: rgba(245,248,252,.92);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--tb-line);
}
.tb-stops {
    list-style: none; margin: 0; padding: 14px 0 12px;
    display: grid; grid-template-columns: repeat(var(--n, 4), 1fr);
    position: relative;
}
/* 虛線航線：串起四站中心點 */
.tb-stops::before {
    content: ""; position: absolute; left: calc(50% / var(--n, 4)); right: calc(50% / var(--n, 4)); top: 29px; height: 0;
    border-top: 2px dashed #b9c9da;
}
.tb-stop a {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    text-decoration: none; color: var(--tb-mut); padding: 0 4px; border-radius: 10px;
}
.tb-stop a:focus-visible { outline: 2px solid var(--c); outline-offset: 3px; }
.tb-dot {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: #fff; border: 2px solid #b9c9da; color: #8aa0b6;
    font-weight: 900; font-size: .85rem; font-variant-numeric: tabular-nums;
    transition: background .25s, border-color .25s, color .25s;
}
.tb-stop-name { font-weight: 800; font-size: .95rem; color: var(--tb-ink); }
.tb-stop-when { font-size: .76rem; }
.tb-stop.is-on .tb-dot, .tb-stop.is-past .tb-dot { border-color: var(--c); }
.tb-stop.is-on .tb-dot { background: var(--c); color: #fff; }
.tb-stop.is-past .tb-dot { color: var(--c); }
.tb-stop.is-on .tb-stop-name { color: var(--c); }
.tb-stop a:hover .tb-dot { border-color: var(--c); }
/* 飛機：沿航線移到目前這一站（left 由 JS 設定） */
.tb-plane {
    position: absolute; top: 21px; left: 0;
    font-size: 15px; line-height: 1; color: var(--tb-ink);
    background: var(--tb-bg); padding: 0 3px;
    transform: translateX(-50%);
    transition: left .6s cubic-bezier(.45,.05,.25,1), opacity .3s;
    opacity: 0; pointer-events: none;
}
.tb-plane.is-ready { opacity: 1; }
.tb-plane.no-anim { transition: none; }

/* ── 旅程階段 ── */
.tb-phase { padding-top: 48px; scroll-margin-top: calc(var(--tb-top) + 92px); }
.tb-phase[hidden] { display: none; }
.tb-phase-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.tb-phase-no {
    flex-shrink: 0; font-size: 3.4rem; font-weight: 900; line-height: .9;
    color: var(--c); font-variant-numeric: tabular-nums;
}
.tb-phase-head h2 {
    margin: 0; font-size: clamp(1.35rem, 3.2vw, 1.7rem); font-weight: 900; color: var(--tb-ink);
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px;
}
.tb-phase-head h2 small { font-size: .9rem; font-weight: 700; color: var(--c); }
.tb-phase-head p { margin: 6px 0 0; color: var(--tb-mut); line-height: 1.7; max-width: 38em; }

.tb-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px;
    border-top: 2px solid var(--c);
}
.tb-item { border-bottom: 1px solid var(--tb-line); }
.tb-item[hidden] { display: none; }
.tb-item a {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 18px 10px 18px 4px; text-decoration: none; color: inherit;
    border-radius: 10px; transition: background .15s;
}
.tb-item a:hover { background: var(--c-soft); }
.tb-item a:focus-visible { outline: 2px solid var(--c); outline-offset: -2px; background: var(--c-soft); }
.tb-ic {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--c-soft); color: var(--c); font-size: 1.1rem;
}
.tb-item a:hover .tb-ic { background: #fff; }
.tb-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tb-name { font-weight: 800; font-size: 1.06rem; color: var(--tb-ink); display: flex; align-items: center; gap: 8px; }
.tb-ai {
    font-size: .68rem; font-weight: 900; letter-spacing: .04em;
    padding: 1px 7px; border-radius: 6px; background: var(--tb-ink); color: #fff;
}
.tb-desc { font-size: .94rem; line-height: 1.65; color: var(--tb-mut); }
.tb-go { flex-shrink: 0; align-self: center; color: #b9c9da; font-size: .8rem; transition: color .15s, transform .15s; }
.tb-item a:hover .tb-go { color: var(--c); transform: translateX(2px); }
.tb-item mark { background: #fff1a8; color: inherit; border-radius: 3px; padding: 0 1px; }

/* ── 搜尋無結果 ── */
.tb-empty { padding: 56px 0 8px; text-align: center; color: var(--tb-mut); line-height: 1.8; }
.tb-empty p { margin: 0; }
.tb-empty b { color: var(--tb-ink); }
.tb-empty a { color: var(--tb-plan); font-weight: 700; }

/* ── 方案 CTA ── */
.tb-cta {
    margin-top: 64px; padding: 28px 32px; border-radius: 20px;
    background: var(--tb-ink); color: #fff;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.tb-cta h2 { margin: 0; font-size: 1.3rem; font-weight: 900; color: #fff; }
.tb-cta p { margin: 6px 0 0; color: #b8c8da; line-height: 1.6; }
.tb-cta-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 13px 22px; border-radius: 999px;
    background: #fff; color: var(--tb-ink); font-weight: 900; text-decoration: none;
    transition: background .15s;
}
.tb-cta-btn:hover { background: #e6f1fd; }
.tb-cta-btn:focus-visible { outline: 3px solid #7cc4fa; outline-offset: 3px; }

/* ── 手機 ── */
@media (max-width: 760px) {
    .tb-wrap { padding: 0 16px; }
    .tb-hero { padding: 24px 0 20px; }
    .tb-hero-card { padding: 28px 20px 24px; border-radius: 22px; }
    .tb-hero-wm { font-size: 7rem; right: 12px; bottom: -18px; }
    .tb-stats { gap: 8px; }
    .tb-stats li { font-size: .82rem; padding: 5px 11px; }
    .tb-search:not(.has-q) .tb-count { display: none; }   /* 手機上沒輸入時讓位給提示文字 */
    .tb-list { grid-template-columns: 1fr; }
    .tb-phase { padding-top: 36px; scroll-margin-top: calc(var(--tb-top) + 70px); }
    .tb-phase-no { font-size: 2.6rem; }
    .tb-phase-head { gap: 14px; }
    .tb-stops { padding: 10px 0 8px; }
    .tb-stops::before { top: 22px; }
    .tb-dot { width: 26px; height: 26px; font-size: .8rem; }
    .tb-stop-name { font-size: .8rem; }
    .tb-stop-when { display: none; }
    .tb-plane { top: 16px; font-size: 12px; }
    .tb-cta { padding: 24px 20px; }
    .tb-cta-btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .tb-plane, .tb-dot, .tb-go, .tb-item a { transition: none; }
}
