/* 通用樣式 */
body {
    font-family: 'Noto Sans TC', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #121212; /* 深色背景 */
    color: #E0E0E0; /* 預設文字顏色 */
    line-height: 1.6;
    overflow-x: hidden; /* 防止水平滾動條 */
}

h1, h2, h3, h4, h5, h6 {
    color: #FFFFFF;
    font-weight: 700;
    margin-bottom: 20px;
}

a {
    color: #33B5E5;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2a9cd1;
}

.section-container {
    padding: 80px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 按鈕樣式 */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease-out;
    cursor: pointer;
    border: none;
}

.btn:hover {
    transform: translateY(-3px); /* 鼠標懸停時按鈕向上移動多一點 */
}

.primary-btn {
    background-color: #33B5E5; /* 品牌藍 */
    color: #FFFFFF;
}

.primary-btn:hover {
    background-color: #2a9cd1;
    color: #FFFFFF;
}

.secondary-btn {
    background-color: #282828;
    color: #E0E0E0;
    border: 1px solid #444444;
}

.secondary-btn:hover {
    background-color: #404040;
    color: #FFFFFF;
}

.small-btn {
    padding: 8px 15px;
    font-size: 0.9em;
}

/* ======================== */
/* Header 樣式 (包含 Logo 和 Nav) */
/* ======================== */
header {
    display: flex;
    justify-content: space-between; /* 均勻分佈空間 */
    align-items: center; /* 垂直居中 */
    padding: 15px 0; /* 上下內邊距，左右間距由 .logo 和 .main-nav 處理 */
    background-color: #1a1a1ae3; /* 或你導覽列的背景色 */
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
     min-height: 80px; /* 設定最小高度，例如 80px */
    box-sizing: border-box; /* 確保 padding 和 border 計算在元素總高度內 */
}

/* 網站 Logo 樣式 */
.logo {
    display: flex;
    align-items: center;
    padding-left: 20px; /* 距離左側的間距 */
    margin-right: auto; /* 將 Logo 推到最左邊，其他導覽元素靠右 */
}

.logo img {
    height: 40px; /* 將高度變更為 60px，Logo 會變大 */
    width: auto; /* 保持圖片比例 */
    vertical-align: middle;
}


.main-nav {
    display: flex;
    gap: 15px; /* 導覽連結之間的間距 */
    padding-right: 20px; /* 距離右側的間距 */
}

.main-nav .nav-link { /* 使用 .nav-link 替代 ul li a */
    color: #E0E0E0; /* 預設文字顏色 */
    font-weight: 500; /* 加粗文字 */
    padding: 10px 20px; /* 增加內邊距，使其看起來像按鈕 */
    border-radius: 8px; /* 圓角 */
    background-color: #282828; /* 非活躍按鈕的深色背景 */
    transition: background-color 0.3s ease, color 0.3s ease; /* 添加過渡效果 */
    text-align: center;
    white-space: nowrap; /* 防止文字換行 */
}

.main-nav .nav-link:hover {
    background-color: #404040; /* 鼠標懸停時的背景色 */
    color: #FFFFFF; /* 鼠標懸停時的文字顏色 */
}

.main-nav .nav-link.active {
    background-color: #33B5E5; /* 活躍按鈕的品牌藍色背景 */
    color: #FFFFFF; /* 活躍按鈕的文字顏色 */
}

.main-nav .nav-link.active:hover {
    background-color: #2a9cd1; /* 活躍按鈕鼠標懸停時稍暗的藍色 */
}

/* ======================== */
/* 漢堡選單動畫樣式 */
/* ======================== */
.menu-toggle {
    display: none; /* 預設桌面版隱藏 */
    width: 30px; /* 漢堡圖示寬度 */
    height: 24px; /* 漢堡圖示高度 */
    position: relative;
    cursor: pointer;
    z-index: 1001; /* 確保在最上層 */
    transition: all 0.3s ease-in-out;
    padding-right: 20px; /* 與右側邊緣間距 */
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px; /* 線條高度 */
    background-color: #E0E0E0; /* 線條顏色 */
    border-radius: 2px;
    position: absolute;
    left: 0;
    transition: all 0.3s ease-in-out;
}

.menu-toggle span:nth-child(1) {
    top: 0;
}

.menu-toggle span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.menu-toggle span:nth-child(3) {
    bottom: 0;
}

/* 漢堡選單懸停時的動畫效果 或 active (打開選單) 時的效果 */
.menu-toggle:hover span:nth-child(1),
.menu-toggle.hover-active span:nth-child(1),
.menu-toggle.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.menu-toggle:hover span:nth-child(2),
.menu-toggle.hover-active span:nth-child(2),
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle:hover span:nth-child(3),
.menu-toggle.hover-active span:nth-child(3),
.menu-toggle.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}


/* Hero Section 樣式 */
.hero-section {
    min-height: 100vh; /* 確保全螢幕高度 */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* 已修正為您提供的背景圖檔名 */
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('../img/hero_background.jpg') no-repeat center center/cover;
    color: #FFFFFF;
    position: relative;
    padding-top: 80px; /* 預留 header 空間 */
}

.hero-content {
    max-width: 800px;
    padding: 20px;
}

.hero-content h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
}

.hero-content p {
    font-size: 1.5em;
    margin-bottom: 30px;
}

.cta-buttons .btn {
    margin: 0 10px;
}

/* 內容區塊通用樣式 */
.content-section {
    display: none; /* 預設隱藏所有內容區塊 */
    padding-top: 80px; /* 為固定導覽列留出空間 */
}

.content-section.active {
    display: block; /* 活躍的區塊顯示 */
}

.section-container h2 {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 10px;
}

.section-container h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #33B5E5;
    margin: 10px auto 0;
}

/* 作品、合作、頻道網格佈局 */
.portfolio-grid, .collaboration-grid, .channel-grid {
    display: grid;
    /* 調整為四格佈局，minmax(250px, 1fr) 確保每格至少 250px 寬，然後等比例分配剩餘空間 */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

/* 作品/合作/頻道項目通用樣式 */
.portfolio-item, .collaboration-item, .channel-item {
    background-color: #0A0A0A; /* 卡片背景色 */
    border: 1px solid #333333; /* 卡片邊框 */
    border-radius: 10px;
    /* 移除或註釋掉 overflow: hidden; 如果它導致文字被切除 */
    /* overflow: hidden; */ /* 如果不移除，請確保內部標題沒有超出 */
    padding: 60px 30px 30px; /* 增加上方內邊距至 60px，左右和下方保持 30px */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative; /* 用於 category-tag 定位 */
    max-width: 900px; /* 限制單個項目寬度，用於全寬佈局 */
    margin: 0 auto; /* 居中 */
}

.category-tag {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%); /* 向上移動一半高度 */
    background-color: #33B5E5; /* 品牌藍 */
    color: #FFFFFF;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.5px;
    z-index: 5; /* 確保在上方 */
}

.item-display-box {
    margin-top: 0; /* 這裡設為 0，因為父容器的 padding 已經處理了上方空間 */
    width: 100%;
    padding-bottom: 20px; /* 圖片下方留白 */
}

.item-display-box img {
    max-width: 100%;
    height: auto; /* 保持圖片比例 */
    border-radius: 8px; /* 圖片圓角 */
    margin-bottom: 20px; /* 圖片和文字之間的間距 */
    display: block; /* 確保圖片獨佔一行，避免下方有額外空白 */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* 圖片懸停動畫 */
}

.item-display-box img:hover {
    transform: scale(1.03); /* 鼠標懸停時輕微放大效果更明顯 */
    box-shadow: 0 10px 20px rgba(0, 150, 255, 0.4); /* 添加藍色陰影效果更明顯 */
}

/* 聯絡資訊樣式 (已依據您最新提供的截圖調整為卡片形式) */
#contact-section .section-container {
    max-width: 1200px; /* 讓卡片有足夠空間排布 */
}

.contact-grid {
    display: grid;
    /* 預設四列，確保每列至少 250px 寬，然後等比例分配剩餘空間 */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px; /* 卡片間距 */
    margin-top: 40px;
    justify-content: center; /* 網格內容居中 */
}

.contact-card {
    background-color: #0A0A0A; /* 卡片背景色 */
    border: 1px solid #333333; /* 卡片邊框 */
    border-radius: 10px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.contact-card img {
    width: auto; /* 寬度自動調整以保持比例 */
    height: 120px; /* 設定高度 */
    margin-bottom: 20px;
    object-fit: contain;
}

.contact-card h3 {
    color: #FFFFFF;
    font-size: 1.4em;
    margin-bottom: 10px;
}

.contact-card p {
    color: #B0B0B0;
    font-size: 0.95em;
    margin-bottom: 20px;
    flex-grow: 1; /* 讓描述佔據更多空間，使按鈕對齊 */
}

.contact-card .btn {
    width: 100%; /* 按鈕寬度佔滿卡片 */
    padding: 10px 15px;
    font-size: 1em;
}


/* 作者介紹區塊樣式 */
#author-intro-section .section-container {
    max-width: 900px; /* 限制內容寬度 */
    margin: 0 auto;
    padding: 60px 20px; /* 內邊距 */
}

.author-details {
    display: flex;
    flex-direction: column; /* 預設為直向排列 */
    align-items: center; /* 居中對齊 */
    gap: 30px; /* 元素間距 */
}

.author-image-row {
    width: 100%; /* 確保佔滿寬度以便對齊 */
    text-align: right; /* 將圖片靠右對齊 */
}

.author-photo {
    width: 200px; /* 調整作者照片大小 */
    height: 200px;
    border-radius: 50%; /* 圓形照片 */
    object-fit: cover; /* 確保圖片不變形 */
    border: 3px solid #33B5E5; /* 品牌藍邊框 */
    box-shadow: 0 0 15px rgba(51, 181, 229, 0.5); /* 發光效果 */
}

.author-text-content {
    width: 100%; /* 預設手機版佔滿寬度 */
}

.author-details p,
.author-details ul {
    max-width: 700px; /* 限制文字內容寬度 */
    margin: 0 auto; /* 居中 */
    line-height: 1.8;
    color: #E0E0E0;
    text-align: left; /* 文字靠左對齊 */
}

.author-details ul {
    list-style-type: disc; /* 列表點 */
    padding-left: 20px; /* 列表縮排 */
    margin-top: 10px;
}
.author-details ul li {
    margin-bottom: 5px;
}


/* Footer 樣式 */
footer {
    text-align: center;
    padding: 30px 20px;
    background-color: #1a1a1a;
    color: #888888;
    font-size: 0.9em;
    margin-top: 50px;
}

/* ======================== */
/* 動畫相關樣式 (優化版)  */
/* ======================== */

/* 基礎滾動動畫元素 - 預設狀態 (隱藏且偏移) */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px); /* 初始位置更往下 */
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform; /* 提升動畫性能 */
}

/* 基礎滾動動畫元素 - 活躍狀態 (顯示且歸位) */
.animate-on-scroll.active {
    opacity: 1;
    transform: translateY(0);
}

/* 針對特定區塊和元素進行更精細的動畫定義 */

/* Hero Section 的標題、段落和按鈕 */
.hero-section h1,
.hero-section p,
.hero-section .cta-buttons {
    opacity: 0;
    transform: translateY(40px) scale(0.98); /* 初始帶有輕微縮放效果 */
    transition: opacity 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.hero-section h1 { transition-delay: 0.3s; } /* 標題延遲 */
.hero-section p { transition-delay: 0.5s; } /* 段落延遲 */
.hero-section .cta-buttons { transition-delay: 0.7s; } /* 按鈕延遲 */

/* 活躍狀態時顯示 */
.hero-section.active h1,
.hero-section.active p,
.hero-section.active .cta-buttons {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* 列表項目的動畫：作品卡片、合作卡片、影音頻道項目等 */
.portfolio-item,
.collaboration-item,
.channel-item,
.contact-card { /* 新增 .contact-card 以便動畫 */
    opacity: 0;
    transform: translateY(60px); /* 更明顯的滑入距離 */
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
    will-change: opacity, transform;
}

.portfolio-item.active,
.collaboration-item.active,
.channel-item.active,
.contact-card.active {
    opacity: 1;
    transform: translateY(0);
}


/* ======================== */
/* 響應式設計 (Media Queries) */
/* ======================== */
@media (max-width: 768px) {
    .main-nav {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 70px; /* 調整為 header 的高度 */
        left: 0;
        width: 100%;
        background-color: #1a1a1a;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
        padding: 20px 0;
        z-index: 999;
        max-height: calc(100vh - 70px); /* 確保不超出螢幕高度 */
        overflow-y: auto; /* 允許滾動 */
    }

    .main-nav.active {
        display: flex; /* 點擊漢堡選單時顯示 */
    }

    .main-nav .nav-link {
        width: calc(100% - 40px); /* 左右留 20px padding */
        margin: 5px auto; /* 上下間距，左右居中 */
        font-size: 1.1em;
        padding: 15px 0; /* 增加點擊區域 */
    }

    .menu-toggle {
        display: block; /* 手機版顯示漢堡圖示 */
    }

    .hero-content h1 {
        font-size: 2.5em;
    }

    .hero-content p {
        font-size: 1.2em;
    }

    .cta-buttons {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .cta-buttons .btn {
        margin: 0;
    }

    /* 手機版：網格佈局改為單列 */
    .portfolio-grid, .collaboration-grid, .channel-grid, .contact-grid {
        grid-template-columns: 1fr;
    }

    .section-container {
        padding: 60px 15px;
    }

    /* 作者介紹在手機版依然是直向排列 */
    .author-details {
        flex-direction: column;
        align-items: center;
    }

    .author-image-row {
        text-align: center; /* 手機版圖片居中 */
        margin-bottom: 20px; /* 與下方文字的間距 */
    }

    .author-photo {
        margin: 0 auto; /* 確保居中 */
    }

    .author-text-content {
        text-align: left; /* 文字保持靠左 */
    }
}


/* 響應式設計：在大螢幕上，作者介紹圖片和文字可以並排 */
@media (min-width: 769px) {
    .author-details {
        flex-direction: row; /* 在大螢幕上改為橫向排列 */
        align-items: flex-start; /* 頂部對齊 */
        justify-content: center; /* 水平居中 */
    }

    .author-image-row {
        flex-shrink: 0; /* 防止圖片縮小 */
        width: auto; /* 讓圖片寬度由自身內容決定 */
        text-align: right; /* 確保圖片靠右，即使在 flex 容器中 */
        order: 2; /* 讓圖片在文字後面，實現右側對齊 */
    }

    .author-photo {
        margin-left: 30px; /* 圖片與文字的間距 */
        margin-right: 0; /* 清除手機版可能有的 margin */
    }

    .author-text-content {
        flex-grow: 1; /* 讓文字內容區佔據剩餘空間 */
    }
}