/* ============================================================
   cs-nav.css — cbc-cloudstar 導覽（B 導覽）
   頂部導覽 .cs-head／主題切換 .cs-tg .cs-tg-one .cs-seg3／
   手機底部分頁列 .cs-tabbar／選單抽屜 .cs-drawer
   只使用 cs-tokens.css 的變數；z-index 一律低於 Pagefind #pf-modal（9999）
   層級：頂部 800、分頁列 900、抽屜 1000、下拉 810
   ============================================================ */

/* ---------- 停用 Episode 原本的導覽外觀（避免兩套選單） ---------- */
.gh-burger,
#gh-head .gh-head-menu,
#gh-head .gh-head-actions { display: none !important; }

/* ---------- 共用 ---------- */
.cs-head *,
.cs-tabbar *,
.cs-drawer * { box-sizing: border-box; }

.cs-head button,
.cs-tabbar button,
.cs-drawer button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    margin: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.cs-head :focus-visible,
.cs-tabbar :focus-visible,
.cs-drawer :focus-visible {
    outline: 2px solid var(--cs-pri);
    outline-offset: 2px;
}

.cs-star4 { width: 1em; height: 1em; display: inline-block; vertical-align: -.12em; flex: none; }

/* Logo：使用 A 的 .cs-logo（cs-base.css），只調高度 */

/* ---------- 頂部導覽 ---------- */
#cs-head.gh-head.cs-head {
    position: sticky;
    top: 0;
    z-index: 800;
    height: auto;
    background: var(--cs-nav);
    color: var(--cs-ink);
    box-shadow: 0 1px 0 var(--cs-line);
    font-family: var(--cs-font);
    font-size: calc(15px * var(--cs-ui, 1));
    font-weight: 500;
    transition: background-color .3s, color .3s;
}

.cs-head-in {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: calc(var(--cs-maxw, 1280px) + 40px);
    height: 64px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 32px);
}

.cs-head-brand { display: block; flex: none; line-height: 0; }
.cs-head .cs-logo { --cs-logo-h: 28px; display: block; }

/* 系列連結 */
.cs-nav { flex: 1 1 auto; min-width: 0; }
.cs-nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

#cs-head .cs-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--cs-ink);
    text-decoration: none;
    line-height: 1.2;
    transition: background-color .2s, color .2s;
}
#cs-head .cs-nav-link:hover,
#cs-head .cs-dd-btn[aria-expanded="true"] { background: var(--cs-bg); }
#cs-head .cs-nav-link[aria-current="page"] {
    color: var(--cs-pri);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--cs-pri);
    border-radius: 10px 10px 2px 2px;
}

.cs-navdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--cs-line); }
.cs-navdot--book { background: var(--cs-s-book); }
.cs-navdot--ceo { background: var(--cs-s-ceo); }
.cs-navdot--ecareer { background: var(--cs-s-ecareer); }
.cs-navdot--academy { background: var(--cs-s-academy); }
.cs-navdot--sport { background: var(--cs-s-sport); }
.cs-navdot--event { background: var(--cs-s-event); }
.cs-navdot--none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--cs-ink2); }

/* 「更多」下拉 */
.cs-dd { position: relative; }
.cs-dd-caret { transition: transform .2s; }
.cs-dd-btn[aria-expanded="true"] .cs-dd-caret { transform: rotate(180deg); }
.cs-dd-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 810;
    min-width: 180px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--cs-surf);
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
    box-shadow: var(--cs-shadow);
}
.cs-dd-menu[hidden] { display: none; }
#cs-head .cs-dd-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: 9px;
    color: var(--cs-ink);
    text-decoration: none;
}
#cs-head .cs-dd-item:hover,
#cs-head .cs-dd-item:focus-visible { background: var(--cs-bg); }
#cs-head .cs-dd-item[aria-current="page"] { color: var(--cs-pri); font-weight: 700; }

/* 右側動作 */
.cs-head-act { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }

.cs-head .cs-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--cs-ink2);
    transition: background-color .2s, color .2s;
}
.cs-head .cs-icon-btn:hover { background: var(--cs-bg); color: var(--cs-pri); }
.cs-head .cs-icon-btn svg { width: 20px; height: 20px; }

/* 桌機：淺／深膠囊 */
.cs-tg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 20px;
    background: var(--cs-bg);
    border: 1px solid var(--cs-line);
}
.cs-tg-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 28px;
    border-radius: 16px;
    color: var(--cs-ink2);
}
.cs-tg-btn.is-auto { color: var(--cs-ink); box-shadow: inset 0 0 0 1px var(--cs-line); }
.cs-tg-btn[aria-pressed="true"] { background: var(--cs-surf); color: var(--cs-ink); box-shadow: var(--cs-shadow); }

/* 手機：單鍵切換（淺色時顯示月亮、深色時顯示太陽） */
.cs-head .cs-tg-one { display: none; }
.cs-tg-sun { display: none; }
[data-theme="dark"] .cs-tg-moon { display: none; }
[data-theme="dark"] .cs-tg-sun { display: block; }

/* ✦ 活動報到（兩種主題相同：海軍藍＋金） */
#cs-head .cs-btn-checkin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--cs-checkin-bg);
    color: var(--cs-checkin-ink);
    border: 1px solid var(--cs-checkin-line);
    font-weight: 700;
    font-size: calc(14px * var(--cs-ui, 1));
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .2s, transform .2s;
}
#cs-head .cs-btn-checkin:hover { filter: brightness(1.15); }

/* 中等寬度：壓縮間距、報到鈕只留「報到」 */
@media (min-width: 768px) and (max-width: 1099px) {
    .cs-head-in { gap: 10px; }
    .gh-head.cs-head { font-size: calc(14px * var(--cs-ui, 1)); }
    #cs-head .cs-nav-link { padding: 8px 7px; gap: 5px; }
    .cs-nav-list { gap: 0; }
    .cs-head .cs-logo { --cs-logo-h: 24px; }
    .cs-head-act { gap: 6px; }
    #cs-head .cs-btn-checkin { padding: 7px 12px; font-size: calc(13px * var(--cs-ui, 1)); }
    .cs-btn-checkin-l { display: none; }
}

/* 窄桌機／平板直向：淺深膠囊改單鍵，騰出空間 */
@media (min-width: 768px) and (max-width: 899px) {
    .cs-head .cs-tg { display: none; }
    .cs-head .cs-tg-one { display: inline-grid; }
}

/* ---------- 手機頂部（≤767px）：Logo＋搜尋＋單鍵切換 ---------- */
@media (max-width: 767px) {
    .cs-head-in { height: 56px; gap: 6px; padding: 0 12px 0 16px; }
    .cs-head .cs-logo { --cs-logo-h: 24px; }
    .cs-nav,
    .cs-head .cs-tg,
    #cs-head .cs-btn-checkin { display: none; }
    .cs-head .cs-tg-one { display: inline-grid; }
    .cs-head .cs-icon-btn { background: var(--cs-bg); color: var(--cs-pri); width: 36px; height: 36px; }
    .cs-head .cs-icon-btn svg { width: 18px; height: 18px; }
}

/* ---------- 手機底部分頁列 ---------- */
.cs-tabbar { display: none; }

@media (max-width: 767px) {
    .cs-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        height: calc(var(--cs-tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--cs-nav);
        border-top: 1px solid var(--cs-line);
        font-family: var(--cs-font);
        transition: background-color .3s;
    }

    .cs-tabbar .cs-tab {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-width: 0;
        height: var(--cs-tabbar-h);
        padding: 0;
        color: var(--cs-ink2);
        font-size: calc(11px * var(--cs-ui, 1));
        font-weight: 500;
        line-height: 1.1;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    .cs-tabbar .cs-tab svg { flex: none; }
    .cs-tabbar .cs-tab[aria-current="page"],
    .cs-tabbar .cs-tab[aria-expanded="true"],
    .cs-tabbar .cs-tab.is-current { color: var(--cs-pri); font-weight: 700; }

    /* 中央凸起「報到」 */
    .cs-tabbar .cs-tab-chk { color: var(--cs-ink); font-weight: 700; justify-content: flex-end; padding-bottom: 9px; }
    .cs-tab-chk-ico {
        position: absolute;
        left: 50%;
        top: -20px;
        transform: translateX(-50%);
        display: grid;
        place-items: center;
        width: 54px;
        height: 54px;
        border-radius: 50%;
        background: var(--cs-checkin-bg);
        color: var(--cs-checkin-ink);
        border: 3px solid var(--cs-nav);
        box-shadow: 0 6px 14px -4px var(--cs-navy), 0 0 0 1px var(--cs-checkin-line) inset;
        transition: transform .2s;
    }
    .cs-tabbar .cs-tab-chk:active .cs-tab-chk-ico { transform: translateX(-50%) scale(.94); }
}

/* ---------- 選單抽屜 ---------- */
.cs-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    visibility: hidden;
    pointer-events: none;
    font-family: var(--cs-font);
    transition: visibility 0s linear .3s;
}
.cs-drawer.is-open { visibility: visible; pointer-events: auto; transition: none; }

.cs-drawer-scrim {
    position: absolute;
    inset: 0;
    background: var(--cs-navy);
    opacity: 0;
    transition: opacity .3s;
}
.cs-drawer.is-open .cs-drawer-scrim { opacity: .55; }

.cs-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: calc(100dvh - 56px);
    max-width: 560px;
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--cs-surf);
    color: var(--cs-ink);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 30px -6px var(--cs-navy);
    transform: translateY(105%);
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), background-color .3s, color .3s;
    outline: none;
}
.cs-drawer.is-open .cs-sheet { transform: translateY(0); }
.cs-drawer .cs-sheet:focus,
.cs-drawer .cs-sheet:focus-visible { outline: none; }
[data-theme="dark"] .cs-sheet { box-shadow: 0 -1px 0 var(--cs-line), 0 -10px 30px -6px var(--cs-navy); }
.cs-sheet.is-dragging { transition: none; }

.cs-sheet-grab { display: grid; place-items: center; height: 22px; margin: 0 -16px; cursor: grab; touch-action: none; }
.cs-sheet-grab span { width: 40px; height: 5px; border-radius: 5px; background: var(--cs-line); }

.cs-sheet-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cs-sheet-h {
    margin: 0;
    font-family: var(--cs-font);
    font-size: calc(13px * var(--cs-ui, 1));
    font-weight: 700;
    letter-spacing: .12em;
    color: var(--cs-ink2);
    line-height: 1.4;
}
.cs-sheet-h--sub { margin: 18px 0 8px; }
.cs-sheet-x {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--cs-bg) !important;
    color: var(--cs-ink2) !important;
}

.cs-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; list-style: none; }
.cs-tile {
    display: block;
    min-height: 62px;
    padding: 11px 13px;
    border-radius: 13px;
    color: var(--cs-pill-ink) !important;
    font-size: calc(16px * var(--cs-ui, 1));
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    transition: transform .15s, filter .2s;
}
.cs-tile small { display: block; margin-top: 3px; font-size: calc(12px * var(--cs-ui, 1)); font-weight: 500; opacity: .92; }
a.cs-tile:active { transform: scale(.97); }
a.cs-tile:hover { filter: brightness(1.06); }
.cs-tile--book { background: var(--cs-s-book); }
.cs-tile--ceo { background: var(--cs-s-ceo); }
.cs-tile--ecareer { background: var(--cs-s-ecareer); }
.cs-tile--academy { background: var(--cs-s-academy); }
.cs-tile--sport { background: var(--cs-s-sport); }
.cs-tile--event { background: var(--cs-s-event); }
.cs-tile.is-soon { opacity: .45; cursor: not-allowed; }

/* 行雲星聚・活動護照卡 */
.cs-passport {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--cs-passport-bg);
    border: 1px solid var(--cs-checkin-line);
    color: var(--cs-white) !important;
    text-decoration: none;
}
.cs-passport-st {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--cs-goldfoil);
    color: var(--cs-navy);
}
.cs-passport-t b { display: block; font-size: calc(15px * var(--cs-ui, 1)); line-height: 1.35; }
.cs-passport-t small { display: block; font-size: calc(12px * var(--cs-ui, 1)); opacity: .8; }
.cs-passport em { font-style: normal; font-size: calc(13px * var(--cs-ui, 1)); font-weight: 700; color: var(--cs-checkin-ink); white-space: nowrap; }

/* 抽屜三段切換 */
.cs-seg3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: var(--cs-bg);
}
.cs-seg3-btn {
    padding: 9px 0 !important;
    border-radius: 9px !important;
    color: var(--cs-ink2) !important;
    font-size: calc(14px * var(--cs-ui, 1)) !important;
    line-height: 1.2;
}
.cs-seg3-btn[aria-pressed="true"] {
    background: var(--cs-surf) !important;
    color: var(--cs-ink) !important;
    font-weight: 700;
    box-shadow: var(--cs-shadow);
}

.cs-sheet-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.cs-chip {
    display: block;
    padding: 10px 6px;
    border: 1px solid var(--cs-line);
    border-radius: 11px;
    text-align: center;
    color: var(--cs-ink) !important;
    font-size: calc(14px * var(--cs-ui, 1));
    font-weight: 500;
    text-decoration: none;
}
.cs-chip:hover { background: var(--cs-bg); }

/* 開啟抽屜時鎖住頁面捲動 */
html.cs-lock,
html.cs-lock body { overflow: hidden; }

/* 桌機不使用抽屜 */
@media (min-width: 768px) {
    .cs-drawer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cs-sheet,
    .cs-drawer-scrim,
    .cs-dd-caret { transition: none; }
}

/* ---------- v2.0.1：頂部行事曆圖示、分頁列系列標籤 ---------- */
.cs-head .cs-head-cal { display: inline-grid; place-items: center; }
.cs-tabbar .cs-tab span { white-space: nowrap; }
@media (max-width: 359px) {
    .cs-tabbar .cs-tab-more { display: none; } /* 極窄手機：「總經理俱樂部」縮為「總經理」 */
}

/* v2.0.2：寬螢幕攤開選單（不需下拉） */
.cs-nav-list > .cs-nav-wide { display: none; }
@media (min-width: 1360px) {
    .cs-nav-list > .cs-nav-wide { display: block; }
    .cs-nav-list > .cs-nav-narrow { display: none; }
}

@media (min-width: 1024px) { .cs-head .cs-logo { --cs-logo-h: 34px; } }

/* v2.0.5：頂部加 Simon 老師（音符）與活動報名圖示；窄手機縮小圖示避免擠壓 */
.cs-head .cs-head-simon, .cs-head .cs-head-reg { display: inline-grid; place-items: center; }
@media (max-width: 400px) {
    .cs-head-in { gap: 4px; padding-right: 8px; }
    .cs-head .cs-icon-btn { width: 32px; height: 32px; }
    .cs-head .cs-icon-btn svg { width: 17px; height: 17px; }
    .cs-head .cs-logo { --cs-logo-h: 21px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
    .cs-head .cs-head-simon, .cs-head .cs-head-reg { display: none; } /* 平板寬度空間不足，頁尾仍有入口 */
}

/* v2.0.7：抽屜「開啟活動通知」（連星聚通知設定） */
.cs-notify { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; margin-top: 8px; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--cs-checkin-line); color: var(--cs-ink) !important; text-decoration: none; font-weight: 700; font-size: calc(14px * var(--cs-ui, 1)); }
.cs-notify svg { color: var(--cs-gold); }
.cs-notify small { display: block; font-weight: 400; font-size: calc(12px * var(--cs-ui, 1)); color: var(--cs-ink2); }
