/*
Theme Name: 榮箸教育基金會
Author: Brianlay, John Tam
Created by Brianlay, John Tam
Description: 榮箸客製化主題
Version: 1.0
Last Modified 2025/12/27 16:12
*/

/* =========================================
   1. 核心變數與基礎設定 (Variables & Reset)
   ========================================= */

:root {
    /* --- 色彩系統 --- */
    /* Primary: 硃砂紅 (Logo Red) */
    --bs-primary: #BA1626;
    --bs-primary-rgb: 186, 22, 38;

    /* Secondary: 古銅金 (Header Gold) */
    --bs-secondary: #C68E17;
    --bs-secondary-rgb: 198, 142, 23;

    /* Success: 竹青色 (Bamboo Green) */
    --bs-success: #557A46;
    --bs-success-rgb: 85, 122, 70;

    /* Info: 青花藍 (Blue Grey) */
    --bs-info: #607D8B;
    --bs-info-rgb: 96, 125, 139;

    /* Warning: 琥珀橙 (Amber) */
    --bs-warning: #E67E22;
    --bs-warning-rgb: 230, 126, 34;

    /* Danger: 深緋紅 (Deep Red) */
    --bs-danger: #8B0000;
    --bs-danger-rgb: 139, 0, 0;

    /* Light: 純白 */
    --bs-light: #FFFFFF;
    --bs-light-rgb: 255, 255, 255;

    /* Dark: 濃墨黑 */
    --bs-dark: #2C2C2C;
    --bs-dark-rgb: 44, 44, 44;

    /* --- 網站基礎 --- */
    --bs-body-bg: #fcf6e8;       /* 米宣紙色 */
    --bs-body-bg-rgb: 252, 246, 232;
    --bs-body-color: var(--bs-dark);
    --bs-body-color-rgb: 44, 44, 44;
    --bs-link-color: var(--bs-primary);
    --bs-link-hover-color: var(--bs-secondary);
    --bs-border-color: rgba(44, 44, 44, 0.15);
}

/* 基礎標籤重置 */
body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* 標題設定 */
h1, h2, h3, .h1, .h2, .h3 {
    color: var(--bs-primary) !important;
    font-weight: bold;
}

h4, h5, h6, .h4, .h5, .h6 {
    color: var(--bs-dark);
    font-weight: 600;
}

/* =========================================
   2. 全域通用工具類別 (Global Utilities)
   [優化] 將重複出現的特效提取至此，全站共用
   ========================================= */

/* 字體工具：統一楷體設定 */
.font-serif {
    font-family: "BiauKai", "DFKai-SB", "Kaiti TC", "KaiTi", "STKaiti", serif;
}

/* 特殊深紅 dark red 底色 */
.bg-dark-red {
    background-color: #7a0018;
}

/* 圖片工具 */
.object-fit-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* 文字截斷工具 (Line Clamp) */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lh-lg {
    line-height: 1.8;
}

/* 動畫與過渡工具 */
.transition-all {
    transition: all 0.3s ease;
}

.transition-color {
    transition: color 0.3s ease;
}

.transition-move {
    transition: transform 0.3s ease;
}

/* [優化] 卡片懸浮上浮特效 (合併了 News, Archive, Search 的重複代碼) */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
}

/* [優化] 圖片放大特效 */
.hover-zoom {
    transition: transform 0.5s ease;
}

/* 支援 .group-hover 父層控制或是直接 hover */
.group-hover:hover .hover-zoom,
.hover-zoom:hover {
    transform: scale(1.1);
}

/* 支援文字顏色隨 hover 改變 */
.group-hover:hover .transition-color,
.hover-text-primary:hover {
    color: var(--bs-primary) !important;
}

.group-hover:hover .transition-move {
    transform: translateX(5px);
}

/* =========================================
   3. Bootstrap 元件覆寫 (Component Overrides)
   ========================================= */

/* 按鈕 Button */
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: #9A1220; /* Darker Red */
    border-color: #9A1220;
}

.btn-secondary {
    background-color: var(--bs-secondary);
    border-color: var(--bs-secondary);
    color: #fff;
}
.btn-secondary:hover {
    background-color: #A67613; /* Darker Gold */
    border-color: #A67613;
    color: #fff;
}

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}
.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    color: #fff;
}

/* 卡片 Card */
.card {
    background-color: var(--bs-light);
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* 標籤 Badge */
.badge {
    backdrop-filter: blur(4px);
}

/* =========================================
   4. 頁首與導覽列 (Header & Navbar)
   ========================================= */

/* WordPress Admin Bar 修正 */
.admin-bar .navbar.fixed-top,
.admin-bar .navbar.sticky-top {
    top: 32px;
}

@media (max-width: 768px) {
    .admin-bar .navbar.fixed-top,
    .admin-bar .navbar.sticky-top {
        top: 46px;
    }
}

/* Brand Section */
.brand-section {
    background-color: var(--bs-body-bg);
}

/* Navbar */
.navbar {
    background-color: rgba(255, 255, 255, 0.95) !important;
}

.navbar-nav .nav-link {
    color: var(--bs-dark);
    padding-bottom: 5px;
    position: relative;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active,
.dropdown-item:active {
    color: var(--bs-primary) !important;
}

/* Dropdown */
.dropdown-menu {
    border-top: 3px solid var(--bs-primary) !important;
    background-color: #ffffff;
    margin-top: 10px;
}

.dropdown-item {
    padding: 10px 20px;
    color: var(--bs-dark);
}

.dropdown-item:hover {
    background-color: #fceceb;
    color: var(--bs-primary);
}

/* =========================================
   5. 頁尾 (Footer)
   ========================================= */

.site-footer {
    font-size: 0.95rem;
    background-color: #1a1a1a;
    border-top: 5px solid #BA1626;
}

.footer-links a:hover {
    color: var(--bs-secondary) !important; /* 金色 */
    padding-left: 5px;
}

.social-btn {
    width: 40px;
    height: 40px;
}
.social-btn:hover {
    background-color: var(--bs-primary) !important;
    transform: translateY(-3px);
}

/* Footer Form */
.site-footer ::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

.site-footer input:focus {
    box-shadow: none;
    border-color: var(--bs-secondary) !important;
    background-color: rgba(255,255,255,0.05) !important;
}

.hover-white:hover {
    color: #fff !important;
    opacity: 1 !important;
}

/* Scroll to Top Button */
.scroll-top-btn {
    transition: all 0.4s ease;
    border: 2px solid rgba(255,255,255,0.2);
}
.scroll-top-btn:hover {
    background-color: var(--bs-secondary) !important;
    color: #000 !important;
    transform: translateY(-5px);
}

/* =========================================
   6. 首頁區塊樣式 (Home Sections)
   ========================================= */

/* --- A. 輪播 Slider --- */
#home_slider .carousel-item img {
    height: 600px;
    object-fit: cover;
}

#home_slider .text_shadow {
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

#home_slider .slider-content-wrapper {
    background-color: rgba(0, 0, 0, 0.4);
    display: inline-block;
    max-width: 800px;
    min-width: 320px;
    backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
    #home_slider .carousel-item img {
        height: 100vh;
    }
    #home_slider .carousel-caption {
        bottom: 0%;
    }
    #home_slider .slider-content-wrapper {
        width: 100%;
        padding: 1rem !important;
    }
}

/* --- B. 寄語區塊 (Message) --- */

.decoration-circle {
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(198, 142, 23, 0.15) 0%, rgba(198, 142, 23, 0.05) 60%, rgba(198, 142, 23, 0) 80%);
    border: 2px solid rgba(198, 142, 23, 0.4);
    pointer-events: none; 
}

.message-card {
    border: 1px solid rgba(198, 142, 23, 0.4);
    border-radius: 8px;
    background-color: #fffffb !important; 
}

.message-card::before {
    content: '';
    position: absolute;
    top: 15px; bottom: 15px; left: 15px; right: 15px;
    border: 1px dashed rgba(198, 142, 23, 0.3);
    pointer-events: none;
    border-radius: 4px;
}

.message-title { font-size: 2rem; }
.message-body { font-size: 1.2rem; line-height: 2; }
.sign-name { font-size: 1.5rem; }

@media (min-width: 992px) {
    .content-wrapper {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        height: 650px;
        width: auto;
    }
    .message-title {
        font-size: 3rem !important;
        margin-bottom: 0 !important;
        margin-left: 2rem !important;
        letter-spacing: 0.2em;
    }
    .message-body {
        font-size: 1.5rem;
        text-align: justify;
    }
    .message-body p {
        margin-left: 1.8em;
        margin-bottom: 0;
    }
    .message-sign {
        margin-top: 0 !important;
        margin-right: 2rem !important;
    }
}
@media (max-width: 768px) {
    .decoration-circle {
        width: 350px;
        height: 350px;
    }
}

/* --- C. 七大特色 (Features) --- */

.feature-img-container {
    width: 200px;
    height: 200px;
}

@media (min-width: 992px) and (max-width: 1200px) {
    .feature-img-container {
        width: 170px;
        height: 170px;
    }
}

.circle-mask {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background-color: #000;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border-color: rgba(255, 204, 0, 0.3) !important;
}

.feature-badge {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    border: 2px solid #fff;
    background-color: var(--bs-primary) !important;
    bottom: 0px; 
    right: 0px; 
    z-index: 10;
    transition: transform 0.3s ease;
}

/* 特色區塊獨有的 Hover 效果 */
.group-hover:hover .circle-mask {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.5) !important;
    border-color: var(--bs-secondary) !important;
}
.group-hover:hover .feature-badge {
    transform: scale(1.1) rotate(10deg);
}

/* --- D. Vimeo 背景影音 --- */
.section-video-bg {
    height: 600px; 
    width: 100%;
    position: relative;
    background-color: #000;
}

.video-foreground,
.video-foreground iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 56.25vw;
    min-height: 100%; 
    min-width: 177.77vh;
    z-index: 0;
    pointer-events: none;
}

@media (max-width: 767px) {
    .section-video-bg {
        height: 500px;
    }
}

/* --- E. 精選文章卡片 (News Card) --- */
/* [優化] 大部分樣式已移至全域 .post-card 或 .hover-lift，此處僅保留特殊設定 */
.border-top.border-3.border-primary {
    border-top-width: 3px !important;
    border-color: var(--bs-primary) !important;
}

/* =========================================
   7. 內頁樣式 (Inner Pages)
   ========================================= */

/* --- A. Archive 彙整頁 --- */

.archive-description {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* 分頁導覽 (Pagination) */
.custom-pagination ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 10px;
    align-items: center;
}

.custom-pagination a,
.custom-pagination span.current {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    text-decoration: none;
    font-weight: bold;
    font-family: serif;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.custom-pagination a {
    background-color: #fff;
    color: #1a1a1a;
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.custom-pagination a:hover {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    transform: translateY(-2px);
}

.custom-pagination span.current {
    background-color: var(--bs-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(186, 22, 38, 0.3);
    cursor: default;
}

/* --- B. Search 搜尋結果頁 --- */
.search-bar-wrapper {
    margin-top: -80px;
    position: relative;
    z-index: 10;
}
.search-form input:focus {
    box-shadow: 0 0 0 0.25rem rgba(186, 22, 38, 0.15) !important;
    border-color: var(--bs-primary) !important;
}

@media (max-width: 768px) {
    /* 手機版把橫式卡片變回直式 */
    .search-card .row { flex-direction: column; }
    .search-card .col-md-4 { width: 100%; height: 200px; }
    .search-card .col-md-8 { width: 100%; }
    
    .search-bar-wrapper {
        margin-top: 0;
        margin-bottom: 2rem !important;
    }
}

/* --- C. Single Post 單篇文章頁 --- */
.bg-gradient-to-t {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.4) 100%);
}

.article-content {
    font-size: 1.15rem;
    line-height: 1.9;
    color: #333;
    text-align: justify;
}

.article-content p {
    margin-bottom: 1.8rem;
}

/* 首字下沉 */
.article-content > p:first-of-type::first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    margin-right: 0.5rem;
    margin-top: 0.1rem;
    color: var(--bs-primary);
    font-weight: bold;
    font-family: serif;
}

.article-content h2 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
    border-left: 5px solid var(--bs-secondary);
    padding-left: 15px;
}

.article-content h3 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #7a0018;
}

/* 引言 */
.article-content blockquote {
    background-color: #fcfcfc;
    border-left: 4px solid var(--bs-primary);
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    font-style: italic;
    color: #555;
    position: relative;
    border-radius: 0 5px 5px 0;
}
.article-content blockquote::before {
    content: '\201C';
    font-family: serif;
    font-size: 4rem;
    color: rgba(186, 22, 38, 0.1);
    position: absolute;
    top: -10px;
    left: 10px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin: 1.5rem 0;
}

.article-content ul, 
.article-content ol {
    margin-bottom: 1.8rem;
    padding-left: 2rem;
}
.article-content li { margin-bottom: 0.5rem; }

.article-content a {
    color: var(--bs-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: all 0.2s;
}
.article-content a:hover {
    background-color: rgba(186, 22, 38, 0.1);
    color: #000;
}

.tag-cloud-link {
    display: inline-block;
    background: #f1f1f1;
    padding: 2px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.tag-cloud-link:hover {
    background: var(--bs-primary);
    color: #fff;
}

.last-no-border:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* --- D. Page 靜態頁面 --- */
.page-header {
    height: 400px;
    background-size: cover;
    background-position: center center;
    margin-bottom: 2rem;
}

.responsive-min-height {
    min-height: 500px;
}
@media (max-width: 768px) {
    .responsive-min-height { min-height: 330px; }
}

.page-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}
.page-content h2 {
    font-size: 1.75rem;
    color: #7a0018;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}
.page-content h3 {
    font-size: 1.4rem;
    color: #1a1a1a;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: bold;
}
.page-content ul {
    list-style-type: square;
    color: var(--bs-primary);
}
.page-content ul li span { color: #333; }

/* 側邊選單 */
.list-group-flush .page_item {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.list-group-flush .page_item:last-child {
    border-bottom: none;
}
.list-group-flush .page_item a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}
.list-group-flush .page_item a:hover {
    background-color: #fcf6e8;
    color: var(--bs-primary);
    padding-left: 25px;
}
.list-group-flush .page_item.current_page_item > a {
    background-color: var(--bs-primary);
    color: #fff;
    border-left: 5px solid var(--bs-secondary);
}
.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #ccc;
}

/* =========================================
   8. 其他功能頁面 (Others)
   ========================================= */

/* --- 404 錯誤頁面 --- */
.error-page-wrapper {
    padding: 100px 0; 
}

.error-number-wrap {
    font-size: 10rem;
    font-weight: bold;
    line-height: 1;
    font-family: "BiauKai", "DFKai-SB", "Kaiti TC", serif;
    user-select: none; 
    cursor: default;
}
.error-number-wrap .fa-bowl-rice {
    font-size: 8rem;
    color: var(--bs-secondary);
    opacity: 0.8;
}
.error-number-wrap span.text-primary {
    color: var(--bs-primary) !important;
    text-shadow: 4px 4px 0px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .error-number-wrap { font-size: 6rem; }
    .error-number-wrap .fa-bowl-rice { font-size: 4.5rem; }
}

/* --- 社群分享 (榮箸風格版) --- */
.share-box-wrapper {
    border-top: 1px solid rgba(198, 142, 23, 0.3);
    border-bottom: 1px solid rgba(198, 142, 23, 0.3);
}

.share-label {
    color: var(--bs-secondary);
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.btn-share-rongzhu {
    background-color: transparent;
    border: 1px solid rgba(198, 142, 23, 0.5);
    color: #5d4037;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.btn-share-rongzhu:hover,
.btn-share-rongzhu.active { 
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(186, 22, 38, 0.2);
}

@media (max-width: 576px) {
    .btn-share-rongzhu { width: 100%; justify-content: center; }
    .share-label { width: 100%; text-align: center; margin-bottom: 10px; display: block; }
}
