/* =========================================
   全域設定與漸層背景動態控制
   ========================================= */
html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans TC', '微軟正黑體', sans-serif;
}

body {
    color: #333;
    line-height: 1.6;
    overflow-x: hidden; 
}

/* 網頁外部背景 (方向：左上 ➡️ 右下 to bottom right) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; 
    
    background: linear-gradient(to bottom right, 
        #4caf50 0%,   /* 綠色 */
        #b7e4c7 25%,  /* 淺綠色 */
        #f2fcf5 50%,  /* 白綠色 (切換中心點) */
        #b7e4c7 75%,  /* 淺綠色 */
        #4caf50 100%  /* 綠色 */
    );
    background-size: 200% 200%;
    
    background-position: 0% 0%;
    transition: background-position 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

body.page-loaded::before {
    background-position: 100% 100%; 
}

body.modal-open-bg::before {
    background-position: 0% 0%;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* =========================================
   導覽列 (標題)
   ========================================= */
header {
    background: linear-gradient(to bottom right, 
        #1b4332 0%, 
        #2d6a4f 25%, 
        #4caf50 50%, 
        #2d6a4f 75%, 
        #1b4332 100%
    );
    background-size: 200% 200%;
    background-position: 0% 0%;
    transition: background-position 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    
    color: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

header.page-loaded {
    background-position: 100% 100%;
}

header.modal-open-bg {
    background-position: 0% 0%;
}

header h1 {
    font-size: 1.5rem;
}

nav ul {
    display: flex;
    gap: 1.5rem;
}

nav a {
    color: #fff;
    font-weight: bold;
    transition: color 0.3s ease;
}

nav a:hover {
    color: #95d5b2;
}

/* =========================================
   首頁滿版區塊 (Hero Banner)
   ========================================= */
main {
    width: 100%;
}

.full-width-banner {
    position: relative;
    width: 100%;
    height: 65vh; 
    overflow: hidden;
}

.full-width-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(242, 252, 245, 0.9);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.banner-text h2 {
    color: #1b4332;
    margin-bottom: 1rem;
    font-size: 2.2rem;
}

.banner-text p {
    font-size: 1.1rem;
    color: #2d6a4f;
    font-weight: bold;
}

/* =========================================
   進入頁面/滾動滑動特效
   ========================================= */
.fade-slide {
    opacity: 0;
    transform: translateY(60px); 
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.8s ease;
}

.fade-slide.scroll-active {
    opacity: 1;
    transform: translateY(0);
}

.banner-text.fade-slide {
    transform: translate(-50%, calc(-50% + 60px));
}
.banner-text.fade-slide.scroll-active {
    transform: translate(-50%, -50%);
}

/* =========================================
   其他主要內容區塊設定
   ========================================= */
.section-container {
    max-width: 1200px; 
    margin: 0 auto;
    padding-top: 80px;
    padding-left: 2rem;
    padding-right: 2rem;
    margin-bottom: 4rem;
    border-bottom: 1px solid rgba(45, 106, 79, 0.3); 
    padding-bottom: 4rem;
}

.section-container:last-child {
    border-bottom: none;
}

.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h2 {
    color: #1b4332;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

/* =========================================
   卡片排版與慢速滑動特效
   ========================================= */
.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 2rem;
}

.card {
    background-color: rgba(255, 255, 255, 0.95); 
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    
    opacity: 0;
    transform: translateY(60px);
    
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.8s ease, 
                box-shadow 0.4s ease;
}

.card.scroll-active {
    opacity: 1;
    transform: translateY(0);
}

.card.scroll-active:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(27, 67, 50, 0.2);
}

.card img {
    width: 100%;
    height: 220px; 
    object-fit: cover;
    display: block;
}

.card-content {
    padding: 1.5rem;
}

.card-content h3 {
    color: #2d6a4f;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.card.origin-hidden {
    opacity: 0 !important;
    pointer-events: none;
}

.card.shrunk {
    transform: scale(0) !important;
    opacity: 0 !important;
    pointer-events: none;
}

/* =========================================
   表格樣式 (活動行事曆)
   ========================================= */
.event-table {
    width: 100%;
    max-width: 900px;
    margin: 1rem auto 0 auto;
    border-collapse: collapse;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

.event-table th, .event-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.event-table th {
    background-color: #2d6a4f;
    color: #fff;
}

.event-table tr:hover {
    background-color: #f0fdf4;
}

.table-responsive {
    overflow-x: auto;
}

/* =========================================
   聯絡我們按鈕樣式
   ========================================= */
.contact-buttons-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.contact-action-btn {
    display: inline-block;
    width: 100%;
    max-width: 400px;
    padding: 1.2rem 2rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.btn-phone {
    background-color: #4caf50;
    color: #fff;
}
.btn-phone:hover {
    background-color: #388e3c;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.3);
}

.btn-email {
    background-color: #2d6a4f;
    color: #fff;
}
.btn-email:hover {
    background-color: #1b4332;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(45, 106, 79, 0.3);
}

/* =========================================
   頁尾
   ========================================= */
footer {
    background-color: #081c15; 
    color: #fff;
    text-align: center;
    padding: 1.5rem 1rem;
}

/* =========================================
   RWD 響應式設計
   ========================================= */
@media (max-width: 992px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }
    
    nav ul {
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .full-width-banner {
        height: 50vh;
    }

    .banner-text {
        width: 85%;
        padding: 1.5rem;
    }

    .banner-text h2 {
        font-size: 1.6rem;
    }

    .hero h2 {
        font-size: 1.6rem;
    }
    
    .gallery {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   慢速互動大視窗 (Modal) 內部漸層與黏性按鈕
   ========================================= */
.modal {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(8, 28, 21, 0.75); 
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.modal.show {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    /* ★ 新增：大視窗內部的反方向動態漸層 (由左下往右上 to top right) */
    background: linear-gradient(to top right, 
        #4caf50 0%,   /* 綠色 */
        #b7e4c7 25%,  /* 淺綠色 */
        #f2fcf5 50%,  /* 白綠色 */
        #b7e4c7 75%,  /* 淺綠色 */
        #4caf50 100%  /* 綠色 */
    );
    background-size: 200% 200%;
    /* 背景動畫與位置控制由 JS 同步處理 */

    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: fixed; 
    overflow-y: auto; 
    box-sizing: border-box;
    z-index: 2100;
}

/* ★ 黏性定位：讓按鈕永遠貼齊在視窗內部右上角，跟著滾動不消失 */
.close-btn {
    position: sticky;   /* 黏著在內部滾動視窗 */
    top: 15px;          /* 距離視窗頂部 */
    float: right;       /* 推到最右側 */
    margin-top: -15px;  /* 抵銷一點 padding，完美貼齊邊緣 */
    margin-right: -15px;/* 抵銷一點 padding，完美貼齊邊緣 */
    z-index: 2200;      
    
    color: #666;
    font-size: 32px; 
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
    width: 46px;     
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); 
}

.close-btn:hover {
    color: #1b4332;
    background: #fff;
    transform: rotate(90deg) scale(1.1); 
}

.modal-content img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    clear: right; /* 確保圖片不受浮動的關閉按鈕干擾排版 */
}

.modal-content h3 {
    color: #1b4332;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.modal-content .short-desc {
    color: #2d6a4f;
    font-weight: bold;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(183, 228, 199, 0.6);
}

.modal-content .detail-text {
    color: #333;
    font-size: 1.1rem;
    line-height: 1.8;
}