@charset "UTF-8";
/* ============================================================
   Bottom Sheet 元件（Phase 2）
   由 js/components/tool/bottomSheet.js 操控。
   三段：peek / half / full，高度變數定義於 css/responsive.css :root。
   詳見 docs/rwd-spec.md
   ============================================================ */

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* 元件實際高度固定為 full，靠 translateY 露出各段可視高度 */
    height: var(--sheet-full);
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.18);
    z-index: 1600;
    display: flex;
    flex-direction: column;
    /* 預設藏在畫面下方，open() 才移上來 */
    transform: translateY(100%);
    will-change: transform;
}

/* touch-action 是沿祖先鏈「取交集」的：若面板根元素設 none，
   內層捲動區就完全無法以觸控捲動（none ∩ 任何值 = none）。
   因此根元素只允許垂直捲動，把 none 留給把手（見下方），
   兩者交集後把手仍為 none，拖曳不會被瀏覽器接手。 */
.bottom-sheet,
.sheet-host {
    touch-action: pan-y;
}

/* 拖曳期間關閉過場，跟手；放開後由 JS 加回 is-animating 做 snap。
   .sheet-host 由 attachBottomSheet 標記，可附掛在 .bottom-sheet 或被收編的既有元素（如 #left-sidebar）。 */
.sheet-host.is-animating {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-sheet[aria-hidden="true"] {
    pointer-events: none;
}

/* 把手點擊／拖曳區 */
.bottom-sheet-handle-area {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 貼近面板上緣，把垂直空間讓給內容。
       注意：內容區為 touch-action:pan-y，觸控時這裡是唯一的拖曳區，
       band 高度就是可抓取範圍（目前約 19px）。若實機覺得難抓，
       解法是把標題列也納入拖曳區，而不是把這裡加高。 */
    padding: 8px 0 6px;
    cursor: grab;
    /* 手勢一律交給 JS 處理，瀏覽器不得接手捲動 */
    touch-action: none;
}

.bottom-sheet-handle-area:active {
    cursor: grabbing;
}

.bottom-sheet-handle {
    width: 40px;
    height: 5px;
    border-radius: 999px;
    background: #cbd5e1;
}

/* 內容區：自身可捲動，捲到頂才會把拖曳交還給 sheet */
.bottom-sheet-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* contain：捲到頂／底時不把手勢往外傳，避免觸發下拉重新整理 */
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: calc(16px + var(--safe-bottom));
    scrollbar-width: thin;
    scrollbar-color: #c2e9f2 transparent;
}

.bottom-sheet-content::-webkit-scrollbar {
    width: 5px;
}

.bottom-sheet-content::-webkit-scrollbar-thumb {
    background: #c2e9f2;
    border-radius: 999px;
}

/* 背景遮罩（full 段才顯示，點擊收合至 half） */
.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    z-index: 1599;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.bottom-sheet-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
    .sheet-host.is-animating,
    .bottom-sheet-backdrop {
        transition-duration: 0.01ms;
    }
}
