/* =========================================
   艾美爾再生醫學 - 核心樣式表 (ime.css)
   ========================================= */

/* --- 1. 變數定義 --- */
:root {
    --bg-color: #e0e1e3;
    --primary-gold: #c49a6c;
    --primary-brown: #785026;
    --text-dark: #333;
    --text-light: #fff;
    
    --navbar-height: 130px; 
    --footer-height: 160px;
}

/* --- 2. 全域設定 --- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 0; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    padding-top: var(--navbar-height); 
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- 3. 導覽列 (Navbar) --- */
.navbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    z-index: 1000;
    
    background-image: url('images/header-bg.svg');
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    
    background-color: transparent;
    display: flex;
    justify-content: center; 
}

.navbar-content {
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%; 
    padding-bottom: 0;
}

/* Logo */
.navbar .logo {
    display: flex;
    align-items: center;
}

.navbar .logo img {
    height: calc(var(--navbar-height) - 8px); 
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: opacity 0.3s;
}

.navbar .logo img:hover { opacity: 0.8; }

/* 選單連結 */
.nav-links { display: flex; }

.nav-links a {
    text-decoration: none;
    color: #754c24;
    margin-left: 40px;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-shadow: none;
    transition: all 0.3s ease; 
}

.nav-links a:hover {
    color: #8a5a2a; 
    text-shadow: 0 0 5px #c49a6c, 0 0 15px rgba(196, 154, 108, 0.5);
}

/* --- 4. Hero 手風琴特效 (電腦版預設) --- */
.hero-slider-section {
    padding: 50px 0;
    overflow: hidden;
}

.accordion-container {
    display: flex;
    width: 100%;
    gap: 20px;
    height: 650px; 
}

.panel {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    border-radius: 40px; 
    cursor: pointer;
    flex: 1; 
    position: relative;
    will-change: flex; 
    transition: flex 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.panel.active {
    flex: 1.8;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* --- 5. 通用內容區塊 --- */
.section-block { padding: 80px 0; }

.section-title {
    font-size: 1.2rem;
    color: var(--primary-brown);
    margin-bottom: 40px;
    border-left: 4px solid var(--primary-brown);
    padding-left: 15px;
}

/* --- 6. Exosome 區塊 (卡片階梯排版) --- */
.content-split {
    display: flex;
    gap: 50px;
    align-items: center;
    flex-wrap: nowrap; 
}

.content-split .img-box {
    flex: 0 0 560px;
    max-width: 560px; 
}

.content-split .text-box {
    flex: 1;
    min-width: 0;
}

.content-split .text-box h3 {
    color: var(--primary-brown);
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: bold;
}

.content-split .text-box p {
    line-height: 1.8;
    margin-bottom: 15px;
    font-size: 1rem;
    text-align: justify;
    color: #555;
}

/* Exosome 卡片 */
.exosome-card {
    position: relative;
    width: 560px;
    height: 305px;
    max-width: 100%;
    
    background-image: url('images/Exosome.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    
    display: flex;
    flex-direction: column; 
    justify-content: flex-end; 
    
    padding: 20px 30px;
    box-sizing: border-box;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    overflow: hidden;
}

.card-title {
    color: #fff;
    font-size: 3rem;
    font-weight: 200;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    width: 100%;
    text-align: left; 
    margin-bottom: 15px;
}

.card-icons {
    width: 100%;
    display: flex;
    justify-content: flex-end; 
    gap: 15px; 
}

.c-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* ICON 樣式 */
.c-icon img {
    width: 55px; 
    height: 55px;
    object-fit: contain;
    filter: brightness(0) invert(1) drop-shadow(0 3px 5px rgba(0,0,0,0.5));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ICON 滑過特效 */
.c-icon:hover img { 
    transform: scale(1.3) translateY(-5px); 
    filter: 
        brightness(0) invert(1) 
        drop-shadow(0 0 8px rgba(255, 255, 255, 0.9)) 
        drop-shadow(0 15px 20px rgba(0, 0, 0, 0.6));
}

/* --- 7. 關於艾美爾 (3D 輪播 - 寬版) --- */
.carousel-3d-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%; 
    height: 450px;   
    margin: 0 auto;
    perspective: 1000px;
    overflow: hidden;
}

.carousel-3d-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.c-item {
    position: absolute;
    width: 50%;
    height: 320px;
    background-color: var(--primary-brown);
    border-radius: 20px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 0;
    z-index: 0;
    transform: translateX(0) scale(0.8);
}

.c-item video { width: 100%; height: 100%; object-fit: cover; }

.c-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    opacity: 1;
    transition: opacity 0.5s;
    pointer-events: none;
}

/* 輪播狀態 */
.c-item.active {
    opacity: 1; z-index: 10;
    transform: translateX(0) scale(1.1); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}
.c-item.active .c-overlay { opacity: 0; }

.c-item.left {
    opacity: 1; z-index: 5;
    transform: translateX(-65%) scale(0.85); 
}

.c-item.right {
    opacity: 1; z-index: 5;
    transform: translateX(65%) scale(0.85);
}

/* 圓形影片 */
.c-item.circle-type {
    width: 320px; 
    height: 320px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
.c-item.circle-type video { width: 100%; height: 100%; object-fit: cover; }

/* 輪播按鈕 */
.c-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.8);
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--primary-brown);
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}
.c-btn:hover { background: #fff; transform: translateY(-50%) scale(1.1); }
.c-btn.prev { left: 20px; }
.c-btn.next { right: 20px; }

/* --- 8. 專業團隊 --- */
.team-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
    align-items: start;
}

/* 團隊照片 (包含過渡動畫) */
.team-photo {
    background-color: var(--primary-brown);
    height: 280px;
    border-radius: 30px;
    background-size: cover; 
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

/* 電腦版滑過特效 (放大 + 光暈) */
.team-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(255, 255, 255, 0.8), 0 20px 40px rgba(0,0,0,0.4);
    filter: brightness(1.1);
}

.team-info h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-brown);
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
}
.team-info ul { list-style: none; }
.team-info li {
    margin-bottom: 10px;
    font-size: 1rem;
    line-height: 1.6;
    color: #444;
}

/* --- 9. Footer --- */
.main-footer {
    position: relative;
    width: 100%;
    height: var(--footer-height);
    margin-top: 80px;
    background-image: url('images/footer-bg.svg');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-content {
    color: var(--text-light);
    font-size: 0.9rem;
    padding-top: 45px; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- 10. 動畫效果 --- */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
.delay-1 { transition-delay: 0.2s; }
.delay-2 { transition-delay: 0.4s; }

/* =========================================
   圖片/影片放大彈跳視窗 (Lightbox)
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
    margin: auto; 
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content img,
.modal-content video {
    width: auto; height: auto;
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content img,
.modal-overlay.active .modal-content video { transform: scale(1); }


/* --- 11. RWD 手機版適配 (最終完整版) --- */

/* 呼吸動畫 (給團隊與輪播使用) */
@keyframes breathe {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(255,255,255,0.1); filter: brightness(1); }
    50% { transform: scale(1.03); box-shadow: 0 0 25px rgba(255,255,255,0.6); filter: brightness(1.1); }
    100% { transform: scale(1); box-shadow: 0 0 10px rgba(255,255,255,0.1); filter: brightness(1); }
}

@keyframes breathe-shadow-only {
    0% { box-shadow: 0 10px 20px rgba(0,0,0,0.2); filter: brightness(1); }
    50% { box-shadow: 0 10px 40px rgba(255,255,255,0.5); filter: brightness(1.2); }
    100% { box-shadow: 0 10px 20px rgba(0,0,0,0.2); filter: brightness(1); }
}

@media (max-width: 900px) {
    :root {
        --navbar-height: 130px; 
        --footer-height: 130px;
    }

    /* 導覽列 */
    .navbar { background-size: cover; align-items: center; padding-top: 0; }
    .navbar-content { flex-direction: row; justify-content: space-between; align-items: center; height: 100%; padding-bottom: 10px; }
    .navbar .logo img { height: 55px; width: auto; margin-bottom: 0; }
    .nav-links { display: flex; gap: 10px; margin-left: 10px; }
    .nav-links a { margin-left: 0; font-size: 15px; font-weight: 600; padding: 5px 0; white-space: nowrap; }

    /* === Hero 調整 (靜止、完美比例) === */
    .hero-slider-section .container {
        width: 100%; max-width: 100%; padding: 0;
        overflow-x: auto; overflow-y: hidden;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
        scroll-snap-type: x mandatory; scroll-behavior: smooth;
    }
    .hero-slider-section .container::-webkit-scrollbar { display: none; }


/* 1. 軌道設定：維持置中、長軌道 */
    .accordion-container {
        display: flex;
        flex-direction: row;
        height: 500px; 
        min-width: 200vw; 
        padding: 0 15px; /* 左右對稱留白，確保置中 */
        box-sizing: border-box;
        gap: 10px; 
    }

    /* 2. 沒選中時：自動填補，不要動 */
.panel {
        flex: 1; 
        border-radius: 15px; 
        transition: flex 0.5s ease;
        scroll-snap-align: center; 
        min-width: 50px; 
        
        /* --- 關鍵修改：對齊底部 --- */
        /* 水平置中 (center)，垂直靠底 (bottom) */
        /* 這樣能確保圖片下方的文字或重要資訊絕對不會被切掉 */
        background-position: center bottom; 
        
        background-repeat: no-repeat;
        background-size: cover; 
        
        filter: brightness(0.7); 
        animation: none; 
    }

    /* 選中時 */
    .panel.active {
        flex: 0 0 auto; 
        aspect-ratio: 960 / 1294; /* 維持完美比例 */
        background-size: cover; 
        
        /* 保持一致的底部對齊，確保展開時不會跳動 */
        background-position: center bottom; 
        
        filter: brightness(1); 
        transform: none; 
        animation: none; 
    }
    /* Exosome */
    .content-split { flex-direction: column; align-items: center; }
    .content-split .img-box { flex: auto; width: 100%; max-width: 560px; }
    .content-split .text-box { width: 100%; text-align: left; margin-top: 30px; }
    .exosome-card { height: auto; min-height: 280px; align-items: center; }
    .card-title { text-align: center; }
    .card-icons { justify-content: center; flex-wrap: wrap; }

    /* 關於艾美爾 (輪播圖) */
    .carousel-3d-wrapper { height: 300px; }
    .c-item { width: 60%; height: 200px; }
    .c-item.circle-type { width: 200px; height: 200px; }
    .c-item.left { transform: translateX(-55%) scale(0.8); }
    .c-item.right { transform: translateX(55%) scale(0.8); }
    .desktop-hint { display: none; }
    .mobile-hint { display: inline !important; }

    /* 輪播圖 (只呼吸光暈) */
    .c-item.active {
        animation: breathe-shadow-only 3s ease-in-out infinite;
    }
    
    /* 專業團隊 */
    .team-row { grid-template-columns: 1fr 1.5fr 1fr; gap: 5px; align-items: center; margin-bottom: 40px; }
    
    /* 團隊照片 (呼吸縮放 + 延遲) */
    .team-photo { 
        display: block; width: 100%; height: 160px; margin-bottom: 0; background-size: cover; 
        animation: breathe 3s ease-in-out infinite;
    }

    /* 設定不同的延遲，製造生動感 */
    .team-row:nth-child(1) .team-photo:last-child { animation-delay: -1.5s; }
    .team-row:nth-child(2) .team-photo:first-child { animation-delay: -0.5s; }
    .team-row:nth-child(2) .team-photo:last-child { animation-delay: -2.2s; }
    .team-row:nth-child(3) .team-photo:first-child { animation-delay: -1.0s; }
    .team-row:nth-child(3) .team-photo:last-child { animation-delay: -2.8s; }
    .team-row:nth-child(4) .team-photo:first-child { animation-delay: -0.3s; }
    .team-row:nth-child(4) .team-photo:last-child { animation-delay: -1.8s; }
    
    .team-info h3 { font-size: 14px; margin-bottom: 10px; text-align: center; }
    .team-info ul { padding-left: 0; text-align: center; }
    .team-info li { font-size: 12px; margin-bottom: 5px; line-height: 1.3; }

    .footer-content { padding-top: 35px; }
}