/* ============================================
   Museum Timeline - CSS Styles (v2 優化版)
   ============================================ */

* {
    box-sizing: border-box;
}

/* 主容器 */
.museum-timeline-wrapper {
    position: relative;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(0,0,0,1) 100%);
    padding: 40px 20px;
}

/* 滾動容器 */
.museum-timeline-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.museum-timeline-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.museum-timeline-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.museum-timeline-scroll-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.museum-timeline-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 時間軌道 */
.museum-timeline-track {
    display: flex;
    gap: 30px;
    padding: 20px 0;
    min-width: min-content;
}

/* 單個事件 */
.museum-timeline-event {
    flex: 0 0 350px;
    position: relative;
    animation: slideUp 0.6s ease-out forwards;
    animation-fill-mode: both;
}

.museum-timeline-event:nth-child(1) { animation-delay: 0s; }
.museum-timeline-event:nth-child(2) { animation-delay: 0.1s; }
.museum-timeline-event:nth-child(3) { animation-delay: 0.2s; }
.museum-timeline-event:nth-child(4) { animation-delay: 0.3s; }
.museum-timeline-event:nth-child(n+5) { animation-delay: 0.4s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 事件卡片 */
.event-card {
    background: #f5e5d5;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border-left: 4px solid #a00;
}

.event-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
}

/* 日期標籤 - 已移除 */
.event-date {
    display: none;
}

/* 事件標題 */
.event-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    margin: 12px 0;
    line-height: 1.4;
}

/* 事件敘述 */
.event-description {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.6;
    margin: 12px 0;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   特色圖片樣式 - 新增
   ============================================ */

.event-image {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    background: #f7fafc;
    margin: 16px 0;
}

.event-featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.event-card:hover .event-featured-image {
    transform: scale(1.05);
}

/* ============================================
   照片輪播 - 已移除
   ============================================ */

.event-carousel {
    display: none;
}

.carousel-track {
    display: none;
}

.carousel-item {
    display: none;
}

.carousel-image {
    display: none;
}

.carousel-prev,
.carousel-next {
    display: none;
}

/* ============================================
   新功能：事件底部和眼睛圖標按鈕
   ============================================ */

.event-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.event-view-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a00;
    transition: all 0.3s ease;
    padding: 0;
    border-radius: 50%;
}

.event-view-btn:hover {
    background: rgba(44, 82, 130, 0.1);
    transform: scale(1.15);
}

.event-view-btn:active {
    transform: scale(0.95);
}

.eye-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* ============================================
   彈跳視窗樣式
   ============================================ */

/* 背景覆蓋層 */
.timeline-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.timeline-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 彈跳視窗 */
.timeline-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    pointer-events: none;
}

.timeline-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

/* 模態內容 */
.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    max-height: 85vh;
    position: relative;
}

/* 關閉按鈕 */
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    transition: all 0.2s ease;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modal-close:hover {
    background: white;
    transform: rotate(90deg);
}

.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* ============================================
   模態主體 - 左右分欄佈局
   ============================================ */

/* 左側文字區 */
.modal-body {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    min-width: 0;
}

/* 模態標題 */
.modal-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 24px 0;
    line-height: 1.3;
    padding-right: 40px;
}

/* 模態文本 */
.modal-text {
    font-size: 15px;
    color: #4a5568;
    line-height: 1.8;
}

.modal-text p {
    margin: 0 0 16px 0;
}

.modal-text p:last-child {
    margin-bottom: 0;
}

.modal-text h2 {
    font-size: 20px;
    font-weight: 700;
    color: #2c5282;
    margin: 24px 0 12px 0;
}

.modal-text h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin: 16px 0 8px 0;
}

.modal-text ul,
.modal-text ol {
    margin: 12px 0;
    padding-left: 24px;
}

.modal-text li {
    margin: 6px 0;
}

/* ============================================
   右側圖片網格區
   ============================================ */

.modal-gallery {
    flex: 0 0 320px;
    background: #f7fafc;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-gallery-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: white;
}

.modal-gallery-title {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-gallery-grid {
    padding: 16px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-content: start;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #e2e8f0;
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    background: rgba(0, 0, 0, 0.3);
}

.gallery-item-icon {
    width: 32px;
    height: 32px;
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.gallery-item:hover .gallery-item-icon {
    opacity: 1;
    transform: scale(1);
}

/* 空狀態 */
.gallery-empty {
    padding: 40px 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
}

/* ============================================
   內嵌 Lightbox（全螢幕圖片預覽）
   ============================================ */

.modal-lightbox {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1002;
}

.modal-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-image-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Lightbox 控制按鈕 */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a202c;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: white;
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-close svg,
.lightbox-prev svg,
.lightbox-next svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* 圖片標題 */
.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    max-width: 80%;
    text-align: center;
}

/* 圖片計數器 */
.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* 時間軸點 - 已移除 */
.timeline-dot {
    display: none;
}

/* 時間軸線 - 已移除 */
.timeline-line {
    display: none;
}

/* 進度指示器 - 已移除 */
.timeline-progress {
    display: none;
}

/* 滾動提示 */
.scroll-hint {
    text-align: center;
    margin-top: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    opacity: 0;
    animation: fadeInOut 4s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 20%, 80%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

.hint-text {
    display: inline-block;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .museum-timeline-wrapper {
        padding: 30px 10px;
    }

    .museum-timeline-event {
        flex: 0 0 280px;
    }

    .event-card {
        padding: 16px;
    }

    .event-title {
        font-size: 16px;
    }

    .event-description {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }

    .event-image {
        height: 150px;
    }

    /* 彈跳視窗響應式 */
    .timeline-modal {
        width: 95%;
        max-width: 100%;
        max-height: 90vh;
    }

    /* 手機版改為上下佈局 */
    .modal-content {
        flex-direction: column;
    }

    .modal-body {
        padding: 24px;
        max-height: 40vh;
    }

    .modal-title {
        font-size: 22px;
        margin-bottom: 16px;
        padding-right: 40px;
    }

    .modal-text {
        font-size: 14px;
    }

    /* 圖片網格改為全寬 */
    .modal-gallery {
        flex: 0 0 auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }

    .modal-gallery-header {
        padding: 16px;
    }

    .modal-gallery-grid {
        padding: 12px;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    /* Lightbox 按鈕調整 */
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
    }

    .lightbox-caption {
        font-size: 12px;
        padding: 8px 16px;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    .museum-timeline-event {
        flex: 0 0 240px;
    }

    .event-card {
        padding: 12px;
    }

    .event-title {
        font-size: 15px;
    }

    .event-image {
        height: 120px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-title {
        font-size: 18px;
    }

    .modal-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 按鈕焦點狀態（鍵盤導航） */
.event-view-btn:focus-visible {
    outline: 2px solid #2c5282;
    outline-offset: 2px;
}

.modal-close:focus-visible {
    outline: 2px solid #2c5282;
    outline-offset: -2px;
}