:root {
    --nav-font: 'Avenir Black', 'Avenir', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --text-font: "Microsoft JhengHei", "Heiti TC", "Noto Sans TC", sans-serif;
}

body { margin: 0; padding: 0; background-color: #f8f9fa; }

/* =========================================
   覆蓋外部 scroll_top.css 的 .sideFixBox 位置
   （無法修改原始檔案，改用 !important 蓋過）
   往左移動 80px：right 由 10px 改為 90px
   ========================================= */
.sideFixBox { right: 110px !important; }

/* =========================================
   電腦版 Nav 側邊欄整體容器
   ========================================= */
#desktop-nav { margin: 0; padding: 0; top: 50px !important; height: calc(100% - 50px) !important; }
#desktop-nav-container { width: 100%; }

/* =========================================
   Nav 整體往下移 50px（手機版 + 電腦版）
   ========================================= */
#mobile-nav.sticky-top { top: 50px !important; margin-top: 50px; }

/* =========================================
   上下指示與 TOP 控制區塊
   ========================================= */
.nav-control-btn {
    font-family: var(--nav-font);
    font-weight: 900;
    font-size: 1rem;
    border: none;
    background-color: #000000;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 100px; 
    flex-shrink: 0;
    padding: 0; margin: 0; border-radius: 0;
    transition: background-color 0.3s;
}
.nav-control-btn:hover { background-color: #222222; }

.nav-scroll-container {
    overflow-y: auto; scroll-behavior: smooth; width: 100%;
    -ms-overflow-style: none; scrollbar-width: none;  
}
.nav-scroll-container::-webkit-scrollbar { display: none; }

/* =========================================
   Nav 色塊選單
   ========================================= */
.nav-btn {
    font-family: var(--nav-font);
    border: none;
    background-color: var(--theme-color);
    color: #ffffff; 
    transition: background-color 0.3s ease, color 0.3s ease, filter 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-end; 
    height: 80px;
    width: auto;       
    min-width: 100px;  
    flex-shrink: 0;       
    padding: 0;        
    margin: 0;            
    border-radius: 0; 
}

.nav-btn:hover:not(.active) { filter: brightness(1.15); }

.nav-btn.active {
    background-color: #ffffff !important;
    color: var(--theme-color) !important;
}

/* =========================================
   橫向動態展開的中文字
   ========================================= */
.nav-text {
    font-family: var(--text-font);
    font-size: 0.95rem;
    font-weight: normal;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap; 
    transition: max-width 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
}

.nav-btn:hover .nav-text {
    max-width: 200px; 
    opacity: 1;
    margin-left: 15px; 
}

#mobile-nav-container .nav-btn {
    justify-content: center;
    padding: 0 20px;
}
#mobile-nav-container .nav-text {
    max-width: 200px; 
    opacity: 1;
    margin-right: 15px; 
}

/* =========================================
   縱向雙行年份與向下箭頭區塊
   ========================================= */
.nav-num-block {
    width: 100px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1.05;
}

.nav-num-part { 
    font-variant-numeric: tabular-nums; 
    font-size: 18pt; 
    font-weight: 900;
}

.nav-num-arrow {
    font-size: 10pt; 
    margin: -1px 0;
    opacity: 0.8;
}

/* =========================================
   動態載入的 Content 內容排版
   ========================================= */
/* 巨大年份浮水印 (預設為電腦版設定) */
.dynamic-watermark {
    display: block;
    font-family: 'Avenir Book', Avenir, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: normal;
    font-size: 7vw;
    color: #ffffff;
    letter-spacing: -0.06em;
    line-height: 1; /* 電腦版維持緊湊的行高 */
    position: relative;
    z-index: 1;
}

/* 白底標籤 (專案名稱) */
.dynamic-name-tag {
    background-color: #ffffff;
    display: inline-block;
    padding: 5px 40px; 
    margin-top: -20px; 
    margin-bottom: 50px; 
    border-radius: 0;  
    font-size: 2.2rem;
    font-weight: 900;
    position: relative;
    z-index: 2;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* 內容短文 */
.dynamic-context-text {
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
    font-weight: 400; 
    font-size: 1rem;  
    line-height: 1.8; 
    letter-spacing: 0.03em;
}

/* 【核心修改 1】針對手機版的標題與浮水印專屬優化 */
@media (max-width: 767px) {
    .dynamic-watermark {
        /* 透過 17vw 讓年份(如 1966-1969) 在手機上大約佔據 90% 寬度 */
        font-size: 17vw; 
        /* 將行高稍微拉開至 1.15，並加上下 padding 確保數字的頂部與底部不會被裁切 */
        line-height: 1.15; 
        padding-top: 5px;
        padding-bottom: 5px;
        letter-spacing: -0.02em; /* 手機版字距稍微放寬以保持易讀性 */
    }
    .dynamic-name-tag {
        font-size: 1.5rem; /* 手機版標題稍微縮小 */
        padding: 5px 20px;
        margin-top: -15px; /* 微調手機版的重疊距離 */
        margin-bottom: 30px;
    }
}


/* =========================================
   書本展示區塊 (Book Grid)
   ========================================= */
.book-grid-container {
    margin-top: 3rem;
    position: relative;
    z-index: 2; 
}

@media (min-width: 768px) {
    .book-grid-container {
        width: 120%;
        margin-left: -10%; 
    }
}
@media (min-width: 992px) {
    .book-grid-container {
        width: 130%;
        margin-left: -15%; 
    }
}

/* 【核心修改 2】導入 Flexbox 確保每一個 item 在同一排的高度絕對相等 */
.book-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-align: left; 
    display: flex;             /* 啟用 Flexbox */
    flex-direction: column;    /* 讓圖片與標題直向排列 */
    height: 100%;              /* 強制撐滿 Bootstrap 行 (Row) 提供的高度 */
}

.book-item:hover {
    transform: translateY(-10px); 
}

.img-cover {
    width: 100%;
    margin-bottom: 1rem;
    display: block; 
    text-decoration: none; 
    flex-shrink: 0; /* 確保圖片區塊不會被 Flexbox 壓縮 */
}

.img-cover img {
    border: 3px solid var(--hex-color, #ffffff); 
    width: 100%;
    aspect-ratio: 1 / 1.414; 
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease; 
}

.book-item:hover .img-cover img {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5); 
}

.book-title {
    font-family: var(--text-font);
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* 【關鍵設定】讓標題自動填滿剩餘空間，確保不管幾行字，底部都對齊 */
}

/* 針對手機版進一步微調書本標題大小，避免擁擠 */
@media (max-width: 767px) {
    .book-title {
        font-size: 0.95rem; 
    }
}

