/* --- 基礎設定 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: "微軟正黑體", sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

/* --- 頂部導覽列 (首頁 A 的頂部按鈕) --- */
header {
    background-color: #2c3e50;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar {
    display: flex;
    flex-wrap: wrap; /* 允許按鈕在畫面變窄時自動換行 */
    gap: 10px;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}
.nav-btn {
    background-color: #34495e;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    transition: background-color 0.3s;
    white-space: nowrap;
}
.nav-btn:hover {
    background-color: #1abc9c; /* 滑鼠移過去的變色效果 */
}

/* --- 首頁 (A) 佈局 --- */
.home-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}
.hero-image {
    width: 100%;
    aspect-ratio: 16 / 9; /* 維持 16:9 比例 */
    background-color: #ddd; /* 圖片載入前/找不到圖片時的預設灰底 */
    background-image: url('images/hero.jpg'); /* 把大圖放到 images/hero.jpg 即可 */
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.text-box {
    width: 100%;
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    text-align: center;
    line-height: 1.6;
}

/* --- 時間軸區塊 --- */
.timeline-section {
    width: 100%;
    background-color: white;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.timeline-section h2 {
    text-align: center;
    margin-bottom: 40px;
}
.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}
/* 中央的直線 */
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #d8e2e8;
    transform: translateX(-50%);
}
.timeline-item {
    position: relative;
    width: 50%;
    padding: 0 40px 40px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}
.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
}
.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
}
.timeline-dot {
    position: absolute;
    top: 4px;
    width: 14px;
    height: 14px;
    background-color: #1abc9c;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #1abc9c;
}
.timeline-item:nth-child(odd) .timeline-dot {
    right: -7px;
}
.timeline-item:nth-child(even) .timeline-dot {
    left: -7px;
}
.timeline-date {
    display: inline-block;
    font-size: 13px;
    color: #1abc9c;
    font-weight: bold;
    margin-bottom: 4px;
}
.timeline-content h3 {
    font-size: 17px;
    color: #2c3e50;
}
/* 手機/窄螢幕：時間軸改成單側，靠左排列 */
@media (max-width: 768px) {
    .timeline::before { left: 10px; }
    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        width: 100%;
        left: 0;
        padding: 0 10px 32px 40px;
        text-align: left;
    }
    .timeline-item:nth-child(odd) .timeline-dot,
    .timeline-item:nth-child(even) .timeline-dot {
        left: 3px;
        right: auto;
    }
}

/* --- 凱尼快看 (影片頁面) 佈局 --- */
.video-container {
    max-width: 1600px;
    margin: 40px auto;
    padding: 0 20px;
}
.video-grid {
    display: grid;
    /* 這裡設定一列 6 個，1fr 代表等分空間 */
    grid-template-columns: repeat(6, 1fr); 
    gap: 20px; /* 影片之間的間距 */
}
.video-item {
    width: 100%;
    aspect-ratio: 9 / 16; /* 縱向影片的最佳比例 */
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.video-item iframe {
    width: 100%;
    height: 100%;
    border: none;
}
.empty-message {
    text-align: center;
    color: #888;
    font-size: 18px;
    padding: 60px 0;
}

/* --- 橫式長影片 (16:9) 專用格線，套用在 .video-grid 上多加 landscape class --- */
/* 例：收藏家、怕妖怪 這類非 Shorts 的分類頁面 */
.video-grid.landscape {
    grid-template-columns: repeat(3, 1fr); /* 一列 3 部 */
}
.video-grid.landscape .video-item {
    aspect-ratio: 16 / 9; /* 橫式比例 */
}

/* --- 保留未來直式畫面 (手機/平板) 的響應式設計 --- */
@media (max-width: 1400px) {
    .video-grid { grid-template-columns: repeat(4, 1fr); } /* 螢幕稍窄時變 4 欄 */
    .video-grid.landscape { grid-template-columns: repeat(2, 1fr); } /* 橫式：稍窄變 2 欄 */
}
@media (max-width: 992px) {
    .video-grid { grid-template-columns: repeat(3, 1fr); } /* 平板變 3 欄 */
}
@media (max-width: 600px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); } /* 手機變 2 欄 */
    .video-grid.landscape { grid-template-columns: repeat(1, 1fr); } /* 橫式：手機變 1 欄 */
    .nav-btn { padding: 8px 12px; font-size: 14px; }
}
/* --- 頁尾與瀏覽人次計數器 --- */
.site-footer {
    width: 100%;
    text-align: center;
    padding: 24px 0 8px;
    color: #888;
}
.visitor-counter {
    font-size: 15px;
}
.visitor-counter #visitor-count {
    font-weight: bold;
    color: #1abc9c;
}

/* --- 各分類頁面的置頂介紹區 --- */
.page-intro {
    text-align: center;
    margin-bottom: 32px;
    padding: 28px 20px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.page-intro h1 {
    font-size: 28px;
    color: #2c3e50;
    margin-bottom: 10px;
}
.page-intro p {
    font-size: 16px;
    color: #7f8c8d;
    letter-spacing: 0.5px;
}
/* 標題底下的小裝飾線 */
.page-intro h1::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background-color: #1abc9c;
    border-radius: 2px;
    margin: 12px auto 0;
}
@media (max-width: 600px) {
    .page-intro { padding: 20px 14px; margin-bottom: 22px; }
    .page-intro h1 { font-size: 22px; }
    .page-intro p { font-size: 14px; }
}
