:root {
    --bg-color: #f4f7f5;
    --card-bg: #fbfcfb;
    --card-hover-bg: #f4f7f5;
    --accent-color: #5a7d6c;
    --accent-hover-color: #7a9d8c;
    --text-primary: #3a4a40;
    --text-secondary: #6a7a70;
    --border-color: rgba(90, 125, 108, 0.25);
    --shadow-color: rgba(58, 74, 64, 0.15);
    --heading-font: 'Georgia', 'Noto Sans TC', serif;
}

body { 
    font-family: 'Noto Sans TC', sans-serif; 
    color: var(--text-primary); 
    text-align: center; 
    padding: 20px; 
    margin: 0; 
    background-color: var(--bg-color);            
    min-height: 100vh; 
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
}

/* 優化header標題區設計 */
header {
    margin-bottom: 60px;
    position: relative;
    padding: 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px var(--shadow-color);
    text-align: center;
    
    /* 設定與banner相同的高度比例 */
    width: 100%;
    aspect-ratio: 1200 / 400;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 底圖設置 */
    background-image: url('header3.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    border: 1px solid var(--border-color);
}

h1, h2 { 
    font-family: var(--heading-font); 
    color: var(--accent-color); 
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
    padding: 0.2em 0.5em;
}

h1 { 
    font-weight: 700; 
    font-size: clamp(2rem, 5vw, 4rem);
    color: #ffffff;
    text-shadow: 
        2px 2px 4px rgba(128, 128, 128, 0.8),
        4px 4px 8px rgba(128, 128, 128, 0.6),
        6px 6px 12px rgba(128, 128, 128, 0.4);
    margin: 0;
    z-index: 4;
    position: relative;
    letter-spacing: 2px;
}

@keyframes reveal-bg {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

h1::before,
.service-title h2::before,
.full-post-container h2::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    opacity: 0.1; 
    border-radius: 5px;
    z-index: -1;
    transform: scaleX(0);
    transform-origin: left;
    animation: reveal-bg 0.8s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

h1::before { 
    animation-delay: 0.3s; 
}

.full-post-container h2::before { 
    animation-delay: 0.5s; 
}

.service-item h2::before { 
    animation-delay: 0.6s; 
}

/* 群組頁面導航樣式 */
.group-nav {
    margin-bottom: 30px;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px var(--shadow-color);
}

.group-nav .back-link {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
    margin-bottom: 10px;
}

.group-nav .back-link:hover {
    color: var(--accent-hover-color);
}

.group-nav h2 {
    margin: 0;
    font-size: 1.8em;
}

.group-nav .group-description {
    color: var(--text-secondary);
    margin-top: 5px;
    font-style: italic;
}

.header-banner-section { 
    width: 100%; 
    margin-bottom: 40px;
    max-width: 1200px; /* 與container和blocks-grid一致 */
    margin-left: auto;
    margin-right: auto;
}

.header-banner-item { 
    display: block; 
    margin-bottom: 20px; 
    border-radius: 15px; 
    overflow: hidden; 
    box-shadow: 0 10px 25px var(--shadow-color); 
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
    animation: fadeInDown 0.6s ease-out forwards; 
    opacity: 0; 
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    position: relative;
}

.header-banner-item:hover { 
    transform: translateY(-5px) scale(1.01); 
    box-shadow: 0 15px 30px var(--shadow-color);
    background-color: var(--card-hover-bg);
}

.header-banner-item img, 
.header-banner-item iframe { 
    width: 100%; 
    display: block; 
    aspect-ratio: 1200 / 400; 
    object-fit: cover; 
    border: 0; 
}

.blocks-grid { 
    display: flex; 
    justify-content: center; 
    gap: 30px; 
    flex-wrap: wrap;
    width: 100%; /* 確保與header-banner同寬 */
    max-width: 1200px; /* 與container同寬 */
    margin: 0 auto; /* 置中對齊 */
}

.service-item { 
    position: relative; 
    width: 350px; 
    height: 350px;
    border-radius: 15px; 
    overflow: hidden; 
    box-shadow: 0 10px 25px var(--shadow-color); 
    animation: fadeInUp 0.5s ease-out forwards; 
    opacity: 0; 
    display: flex; 
    flex-direction: column;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
}

.service-item:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 15px 30px var(--shadow-color);
    background-color: var(--card-hover-bg);
}

.service-item.no-media { 
    background: linear-gradient(135deg, #eef1ef, var(--card-bg)); 
}

.service-media { 
    position: relative; 
    width: 100%; 
    height: 310px;
    background: #eef1ef; 
    overflow: hidden; 
}

.service-media img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    transition: transform 0.4s ease; 
}

.service-item:hover .service-media img { 
    transform: scale(1.05); 
}

.service-media iframe { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    border: 0; 
}

.service-title { 
    padding: 8px; /* 從4px增加到8px */
    min-height: 15px; /* 從10px增加到15px */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-grow: 1; 
}

.service-title h2 { 
    margin: 0; 
    color: var(--text-primary); 
    font-size: 1.2em; 
}

.service-item > a { 
    text-decoration: none; 
    color: inherit; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
}

.full-post-container { 
    max-width: 800px; 
    margin: 40px auto; 
    padding: 30px 40px; 
    border-radius: 15px; 
    text-align: left;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px var(--shadow-color);
    position: relative;
}

.full-post-container h2 { 
    font-size: 2em; 
}

.post-content { 
    line-height: 1.8; 
    color: var(--text-secondary); 
}

.post-content img, 
.post-content iframe { 
    max-width: 100%; 
    height: auto; 
    border-radius: 8px; 
    margin: 15px 0; 
}

.video-container { 
    position: relative; 
    width: 100%; 
    padding-top: 56.25%; 
}

.video-container iframe { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
}

.back-link { 
    display: inline-block; 
    margin-top: 30px; 
    color: var(--accent-color); 
    text-decoration: none; 
    font-weight: bold; 
    transition: color 0.3s ease; 
}

.back-link:hover { 
    color: var(--accent-hover-color); 
}

footer { 
    margin-top: 60px; 
    padding-top: 20px; 
    border-top: 1px solid var(--border-color); 
    color: var(--text-secondary); 
}

footer a { 
    color: var(--text-secondary); 
    text-decoration: none; 
    transition: color 0.3s ease; 
}

footer a:hover { 
    color: var(--accent-color); 
}

@keyframes fadeInUp { 
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

@keyframes fadeInDown { 
    from { 
        opacity: 0; 
        transform: translateY(-20px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

.instagram-media, 
.tiktok-embed { 
    margin: 1px auto !important; 
}

.service-media .instagram-media, 
.service-media .tiktok-embed { 
    min-height: 200px; 
}

/* 按讚功能樣式 */
.like-section {
    position: absolute;
    bottom: 8px;
    right: 12px;
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 15px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.like-section:hover { 
    background-color: rgba(255, 255, 255, 0.9); 
}

.like-button { 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 2px; 
    display: flex; 
    align-items: center; 
    transition: transform 0.2s ease; 
}

.like-button:hover { 
    transform: scale(1.1); 
}

.like-button.liked { 
    cursor: default; 
}

.like-button svg { 
    width: 16px; 
    height: 16px; 
    fill: var(--text-secondary); 
    transition: fill 0.3s ease; 
}

.like-button.liked svg, 
.like-button:hover svg { 
    fill: #e74c3c; 
}

.like-count { 
    font-size: 0.8em; 
    font-weight: bold; 
    color: var(--text-primary); 
    margin-left: 4px; 
}

.header-banner-item .like-section { 
    bottom: 15px; 
    right: 20px; 
    padding: 6px 12px; 
}

@media (max-width: 768px) {
    h1 { 
        font-size: 2.2em; 
    }
    
    .blocks-grid { 
        gap: 25px; 
    }
    
    .service-item { 
        width: 100%; /* 改為100%寬度，與header-banner一致 */
        max-width: none; /* 移除最大寬度限制 */
        height: auto;
        aspect-ratio: 1/1; /* 保持正方形 */
    }
    
    .full-post-container { 
        padding: 20px; 
    }
    
    .service-title { 
        padding: 4px 15px;
        min-height: 12px;
    }
    
    .service-title h2 { 
        font-size: 1.0em;
        line-height: 1.1;
        margin: 0;
    }
    
    .like-section {
        bottom: 6px;
        right: 10px;
        padding: 2px 6px;
        border-radius: 12px;
    }
    
    .like-button svg { 
        width: 14px; 
        height: 14px; 
    }
    
    .like-count { 
        font-size: 0.75em; 
    }
    
    .service-media { 
        height: calc(100% - 15px);
    }
}
