/* * File: assets/css/modules/public-navigation.css
 * Description: 導航列與吸附標題 (RWD: Full Width Bg, Centered Content)
 */

/* --- Sticky Header (Top) --- */
.se-sticky-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 50;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    /* [RWD] Transition for smoother resizing */
    transition: padding 0.3s ease;
}

/* --- Anchor Navigation Bar --- */
.se-anchor-bar {
    position: sticky;
    /* [Note] 57px is the approx height of se-sticky-header */
    top: 57px; 
    background: #fff;
    z-index: 40;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    white-space: nowrap;
}

.se-anchor-btn {
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    /* [Flex Fix] Prevent shrinking */
    flex-shrink: 0; 
}

.se-anchor-btn.active {
    background: #dc2626;
    color: #fff;
}


/* =========================================
   Desktop RWD Enhancements (>= 1024px)
   ========================================= */
@media (min-width: 1024px) {
    
    /* 1. Centering Content Strategy
       利用 padding 計算，讓內容維持在 var(--se-container-max) 寬度內，
       同時保持背景色延伸至全螢幕。
    */
    .se-sticky-header,
    .se-anchor-bar {
        padding-left: max(1rem, calc((100% - var(--se-container-max)) / 2 + 1rem));
        padding-right: max(1rem, calc((100% - var(--se-container-max)) / 2 + 1rem));
    }

    /* 2. Anchor Bar Layout */
    .se-anchor-bar {
        justify-content: center; /* 居中排列 */
        gap: 1rem; /* 加大間距 */
        overflow: visible; /* 解除捲動 */
        flex-wrap: wrap; /* 若項目過多則換行，避免破版 */
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    .se-anchor-btn {
        padding: 0.5rem 1.5rem; /* 加大按鈕 */
        font-size: 0.95rem;
    }
    
    .se-anchor-btn:hover {
        background: #e5e7eb;
    }
    .se-anchor-btn.active:hover {
        background: #b91c1c; /* Darker red */
    }

    /* 3. Header Title Typography */
    /* 假設 h1 在 header 內，稍微加大字體 */
    .se-sticky-header h1 {
        font-size: 1.25rem;
    }
}

/* --- Mobile Progress Bar --- */
.se-theme-progress-container {
    display: none; /* Desktop hidden */
    width: 60px;
    height: 3px;
    background: #e5e7eb;
    margin: 10px auto 0;
    border-radius: 99px;
    position: relative;
    overflow: hidden;
}

.se-theme-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 20%; /* Fixed relative width */
    background: #ef4444; /* Default red */
    border-radius: 99px;
    transition: left 0.1s ease-out;
}

@media (max-width: 768px) {
    .se-theme-progress-container {
        display: block;
    }
}