/* -------------------------------------------------------------------------- */
/* 動畫設定 */
/* -------------------------------------------------------------------------- */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInX {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInLogo {
    from { opacity: 0; transform: translate(-50%, calc(-50% - 10px)); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
        clip-path: inset(0 0 100% 0);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        clip-path: inset(0 0 0% 0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

@keyframes footerEntrance {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-white {
    0% { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 15px rgba(255, 255, 255, 0); }
    100% { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes rotateFlow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* -------------------------------------------------------------------------- */
/* 全域設定 */
/* -------------------------------------------------------------------------- */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    opacity: 1;
    background-color: #ebebebef;
}

body.first-load-animation {
    animation: fadeIn 1s ease-out forwards;
}

.inner-content {
    font-size: 24px;
    padding: 60px 10%; /* 原本的留白設定在這裡 */
    margin: 0 auto;     /* 居中 */
    text-indent: 2em;
    line-height: 1.8;
    text-align: justify;
    letter-spacing: 0.2rem;
    
}

.inner-content h3 {
    text-indent: 0;
}

.portfolio-grid-custom {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 電腦版：預設兩列 */
    gap: 30px;                     /* 影片之間的間距 */
    padding: 20px 0;
}

.custom-line {
    border: none;               /* 移除預設邊框 */
    border-top: 2px dashed #ccc; /* 設定上方邊框為虛線 */
    height: 0;                  /* 高度設為 0 */
    width: 90%;                /* 寬度撐滿 */
    margin: 120px auto;             /* 上下留白，讓頁面有呼吸感 */
    grid-column: span 2;
}

.custom-line2 {
    border: none;               /* 移除預設邊框 */
    border-top: 2px dashed #ccc; /* 設定上方邊框為虛線 */
    height: 0;                  /* 高度設為 0 */
    width: 90%;                /* 寬度撐滿 */
    margin: 20px auto;             /* 上下留白，讓頁面有呼吸感 */
    grid-column: span 2;
}

/* 初始狀態：隱形且位移 */
.reveal {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity; /* 效能優化 */
}

/* 觸發狀態：顯示並回位 */
.reveal.active {
    opacity: 1;
    transform: translateX(0);
}

.revealTop {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity; /* 效能優化 */
}

/* 觸發狀態：顯示並回位 */
.revealTop.active {
    opacity: 1;
    transform: translateY(0);
}

.revealDown {
    opacity: 0;
    transform: translateY(-15px);
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform, opacity; /* 效能優化 */
}

/* 觸發狀態：顯示並回位 */
.revealDown.active {
    opacity: 1;
    transform: translateY(0);
}

.unselectable {
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE10+/Edge */
  user-select: none;         /* 標準語法 (Chrome, Opera, 等) */
}

a[href=""], a[href="#"], a:not([href]) {
    pointer-events: none; /* 讓滑鼠點擊完全穿透，無法觸發任何事件 */
}

/* 維修模式的全螢幕遮罩 */
#repair-overlay {
    position: fixed;
    top: -1px;
    left: -1px;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    background-color: #ebebebef;
    display: none; /* 預設隱藏 */
    justify-content: center;
    align-items: center;
    z-index: 99990;
    color: rgb(46, 46, 46);
    font-family: Arial, sans-serif;
    text-align: center;
}

.repair-content h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    letter-spacing: 5px;
}

.repair-content p {
    color: #888;
    font-size: 1.2rem;
}

/* -------------------------------------------------------------------------- */
/* 導覽列與 Logo */
/* -------------------------------------------------------------------------- */

.header_class {
    background-color: #3a3636;
    width: 100%;
    min-height: 80px;
    position: relative; 
    display: flex;
    align-items: center;
    z-index: 99991;
}

.nav_logo {
    color: gray;
    font-size: 24px;
    font-weight: bold;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    opacity: 1;
}

.nav_logo a {
    text-decoration: none;
    color: inherit;
}

.play-logo-anim {
    animation: fadeInLogo 0.5s ease-out forwards;
}

.play-nav-anim {
    animation: fadeInX 0.5s ease-out forwards;
}

.play-nav-anim:nth-child(1) { animation-delay: 0.1s; }
.play-nav-anim:nth-child(2) { animation-delay: 0.2s; }
.play-nav-anim:nth-child(3) { animation-delay: 0.3s; }
.play-nav-anim:nth-child(4) { animation-delay: 0.4s; }
.play-nav-anim:nth-child(5) { animation-delay: 0.5s; }

.navbar {
    width: 100%;
    padding: 0 40px;
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
}

.nav-links li {
    margin-right: 30px;
    list-style: none;
    opacity: 1;
}

.nav-links a {
    text-decoration: none;
    color: #a29bfe;
    font-weight: 500;
    transition: 0.3s;
}

.nav-links a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: #a29bfe;
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: white;
}

.nav-links a:hover::after {
    width: 100%;
}

/* -------------------------------------------------------------------------- */
/* 跳轉網站提醒 */
/* -------------------------------------------------------------------------- */

/* 外層黑底：負責淡入效果 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); /* 稍微深一點更有質感 */
    display: none; /* 預設隱藏 */
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease; /* 淡入動畫 */
}

/* 當 active 類別被加上去時的狀態 */
.modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* 內層視窗：負責「由小放大」 */
.modal-box {
    background: #2a2a2a;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid #444;
    text-align: center;
    color: white;
    max-width: 80%;
    
    /* 初始狀態：縮小並隱藏 */
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* 帶點彈性的放大 */
}

/* 當外層 active 時，內層變回原尺寸 */
.modal-overlay.active .modal-box {
    transform: scale(1);
}
.modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background: #fff;
    color: #444;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-buttons button:hover {
    background: #444;
    color: #fff;
    transform: scale(1.05);
}

/* -------------------------------------------------------------------------- */
/* 手機版樣式 (完全隔離) */
/* -------------------------------------------------------------------------- */

.nav-toggler {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    z-index: 101;
}

.nav-toggler span {
    width: 25px;
    height: 3px;
    background-color: white;
    transition: 0.3s;
}

@media screen and (max-width: 768px) {
    .nav-toggler { display: flex; }
    .nav_logo { font-size: 20px; opacity: 1; }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background-color: #3a3636;
        padding: 20px;
        opacity: 0;
        visibility: hidden;
        transition: 0.4s;
    }

    #nav-check:checked ~ .nav-links {
        opacity: 1;
        visibility: visible;
    }

    .nav-links li {
        margin: 15px 0;
        opacity: 0;
        border: #3a3636 solid 10px;
        transform: translateX(-50px);
        transition: 0.4s ease-in-out;
    }

    #nav-check:checked ~ .nav-links li {
        opacity: 1;
        transform: translateX(0);
    }

    #nav-check:checked ~ .nav-links li:nth-child(1) { transition-delay: 0.1s; }
    #nav-check:checked ~ .nav-links li:nth-child(2) { transition-delay: 0.2s; }
    #nav-check:checked ~ .nav-links li:nth-child(3) { transition-delay: 0.3s; }
    #nav-check:checked ~ .nav-links li:nth-child(4) { transition-delay: 0.4s; }
    #nav-check:checked ~ .nav-links li:nth-child(5) { transition-delay: 0.5s; }
}

/* -------------------------------------------------------------------------- */
/* 整個頁面的主容器 */
/* -------------------------------------------------------------------------- */

.page-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;

    grid-template-rows: auto 1fr auto;
    transition: grid-template-rows 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}


/* -------------------------------------------------------------------------- */
/* Main 內容區設計 */
/* -------------------------------------------------------------------------- */

.content-container {
    flex: 1 0 auto;
    width: 100%;
    opacity: 0;
    
    /* 內容排版設定 */
    padding: 0;
    background-color: #ebebebef;
    
    word-wrap: break-word;

    animation: slideIn 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.content-exit {
    flex: 1 0 auto; 
    width: 100%;
    
    /* 內容排版設定 */
    padding: 0;
    background-color: #ebebebef;
    
    word-wrap: break-word;
    
    animation: slideOut 0.5s ease-in forwards !important;
}

.content-container::before,
.content-container::after {
    content: "";
    position: absolute;
    top: 0;
    width: 100vw; /* 填補一整屏的寬度 */
    height: 100%;
    z-index: -1;
    /* 使用當前容器的背景色或漸層 */
    background: inherit; 
    /* 核心效果：模糊與稍微暗化，模擬鏡像邊緣 */
    filter: blur(20px) brightness(0.7);
    pointer-events: none;
}

/* 左側鏡像 */
.content-container::before {
    left: -100vw;
    transform: scaleX(-1); /* 水平翻轉 */
}

/* 右側鏡像 */
.content-container::after {
    right: -100vw;
    transform: scaleX(-1);
}

/* -------------------------------------------------------------------------- */
/* Footer 設計 */
/* -------------------------------------------------------------------------- */

.footer_class {
    /* 基本樣式 */
    background-color: #3a3636;
    color: #ffffff;
    width: 100%;
    padding: 20px 0;
    opacity: 1;
    text-align: center;
    
    /* 佈局修正 */
    flex-shrink: 0;
    z-index: 99991;
    
}

.footer_class p {
    margin: 0;
    font-size: 14px;
    letter-spacing: 1px;
}

.play-footer-anim {
    animation: footerEntrance 1s ease-out forwards;
    animation-delay: 0.2s; 
}

/* -------------------------------------------------------------------------- */
/* home.html css語法 */
/* -------------------------------------------------------------------------- */

.hero-section {
    width: 100%;
    height: 80vh; /* 封面佔據螢幕高度的 80% */
    position: relative;
}

.hero-image {
    width: 100%;
    height: 100%;
    background-image: url('/static/asset/testing.png'); /* 替換成你的圖片路徑 */
    background-size: cover;
    background-position: center;

    /* 關鍵：CSS 遮罩 */
    /* 使用「非線性」漸層節點，讓過渡更自然 */
    mask-image: linear-gradient(
        to bottom, 
        black 0%, 
        rgba(0, 0, 0, 1) 0%, 
        rgba(0, 0, 0, 0.7) 20%, 
        rgba(0, 0, 0, 0.3) 40%, 
        rgba(0, 0, 0, 0.1) 60%, 
        transparent 100%
    );

    margin: -15% auto auto auto;
}

.inner-content_center {
    padding: 0px 10%; /* 原本的留白設定在這裡 */
    margin: 0 auto;     /* 居中 */
    white-space: nowrap;
    text-align: center;
    transform: translateY(150%);
}

.animatedTitle span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    letter-spacing: 0.5rem;
    transition: all 0.5s ease;
}

.animatedTitle span.active {
    opacity: 1;
    transform: translateY(0);
}

@media screen and (max-width: 768px) {
    .hero-image {
        width: 100%;
        height: 100%;
        background-image: url('/static/asset/testing.png'); /* 替換成你的圖片路徑 */
        background-size: cover;
        background-position: center;

        /* 關鍵：CSS 遮罩 */
        /* 使用「非線性」漸層節點，讓過渡更自然 */
        mask-image: linear-gradient(
            to bottom, 
            black 0%, 
            rgba(0, 0, 0, 1) 0%, 
            rgba(0, 0, 0, 0.7) 20%, 
            rgba(0, 0, 0, 0.3) 40%, 
            rgba(0, 0, 0, 0.1) 60%, 
            transparent 100%
        );

        margin: -30% 0 0 0;
    }
}

/* -------------------------------------------------------------------------- */
/* showreel.html css語法 */
/* -------------------------------------------------------------------------- */

/* 網格基礎設定 */
.portfolio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 電腦版：預設兩列 */
    gap: 30px;                     /* 影片之間的間距 */
    padding: 20px 0;
}

.portfolio-grid::before {
    content: "";
    position: absolute;
    /* 這裡的 top 大約是 [置頂影片高度] + [間距] */
    /* 你可以根據實際視覺效果調整數值，例如 450px */
    top: 620px; 
    bottom: 0;
    left: 50%;
    width: 1px;
    background: #ddd;
    transform: translateX(-50%);
    z-index: 0;
}

/* 處理最頂端影片：跨越兩格 */
.video-item.featured {
    grid-column: span 2; 
    display: flex;        /* 開啟彈性佈局 */
    flex-direction: column; /* 讓標題跟在影片下方 */
    align-items: center;
}

.video-item.featured h3{
    text-align: center;
    font-size: 28px;
}

.video-item {
    display: flex;        /* 開啟彈性佈局 */
    flex-direction: column; /* 讓標題跟在影片下方 */
    align-items: center;
}

.video-item h3 {
    text-align: center;
    font-size: 22px;
}

/* 影片容器（維持 16:9 比例） */
.video-placeholder {
    position: relative; /* 為了讓播放按鈕絕對定位 */
    width: 85%;
    max-width: 640px;
    aspect-ratio: 16 / 9; /* 自動鎖定比例 */
    background-color: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.video-placeholder iframe, 
.video-placeholder div[id^="player-"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    /* 關鍵：確保圖片填滿容器並自動裁切邊緣 */
    object-fit: cover; 
    /* 確保圖片置中，不要切到重要內容 */
    object-position: center; 
    display: block; /* 消除圖片下方的微小間隙 */
    transition: transform 0.5s ease;
}

.video-line {
    border: none;               /* 移除預設邊框 */
    border-top: 2px dashed #ccc; /* 設定上方邊框為虛線 */
    height: 0;                  /* 高度設為 0 */
    width: 100%;                /* 寬度撐滿 */
    margin: 30px 0;             /* 上下留白，讓頁面有呼吸感 */
    grid-column: span 2;
}

/* 播放按鈕容器 */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 68px;
    height: 68px;
    background: rgba(255, 255, 255, 0.2); /* 半透明背景 */
    backdrop-filter: blur(8px);           /* 毛玻璃效果 */
    border: 1.5px solid rgba(255, 255, 255, 0.8); /* 白色細邊框 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none; /* 讓點擊穿透，這點非常重要 */
}

/* 播放按鈕內的三角形 */
.play-button::after {
    content: '';
    margin-left: 5px; /* 微調讓三角形在圓心中視覺平衡 */
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #ffffff;
}

/* 當滑鼠移入影片時的變化 */
.video-placeholder:hover .play-button {
    background: rgba(255, 255, 255, 0.9); /* 變為實心白 */
    transform: translate(-50%, -50%) scale(1.15); /* 輕微彈跳放大 */
    border-color: #fff;
}

.video-placeholder:hover .play-button::after {
    border-color: transparent transparent transparent #111; /* 三角形變深色 */
}

/* 只在置頂影片 (Featured) 使用這個動畫，增加儀式感 */
.video-item.featured .play-button {
    animation: pulse-white 2s infinite;
}

/* 手機版適配 (螢幕小於 768px) */
@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr; /* 全部變單列 */
    }
    
    .video-item.featured {
        grid-column: span 1; /* 手機版不需要跨行 */
    }

    .video-line {
        grid-column: span 1; /* 手機版不需要跨行 */
    }

    .video-placeholder {
        width: 100%;
        max-width: 480px;
        aspect-ratio: 16 / 9; /* 自動鎖定比例 */
        background-color: #ddd;
        border-radius: 8px;
        overflow: hidden;
    }

    .portfolio-grid::before {
            content: "";
            position: absolute;
            /* 這裡的 top 大約是 [置頂影片高度] + [間距] */
            /* 你可以根據實際視覺效果調整數值，例如 450px */
            top: 620px; 
            bottom: 0;
            left: 50%;
            width: 0px;
            background: #ddd;
            transform: translateX(-50%);
            z-index: 0;
    }
}

/* -------------------------------------------------------------------------- */
/* social.html css語法 */
/* -------------------------------------------------------------------------- */

.portfolio-grid-social {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 自動適應列數 */
    gap: 30px; /* 項目之間的間距 */
    padding: 20px 0;
}

.social-card {
    flex: 1; /* 三個等寬 */
    display: flex;
    flex-direction: column; /* 讓內容由上往下排 */
    align-items: center;    /* 關鍵：讓子元素水平置中 */
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 15px;

    opacity: 0;
    transform: translateY(30px) scale(0.9); /* 從下方 30px 且縮小 0.9 倍的位置開始 */
    transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1); /* 讓手動觸發更流暢 */
    z-index: 10;
    overflow: hidden;   /* 最關鍵！這會把超出圓角的「旋轉扇子」切掉 */
}
.social-card.is-visible {
    animation: cardAppear 0.8s forwards;
}

.social-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        transparent, 
        #00d2ff, 
        #3a7bd5, 
        #ff00c1, 
        transparent 30%
    );
    animation: rotateFlow 4s linear infinite;
    z-index: -2; /* 放在最底層 */
}

.social-card::after {
    content: '';
    position: absolute;
    inset: 2px; /* 這裡要跟 padding 的數值一樣 */
    background: #fff; /* 跟背景顏色一致，用來擋住中間的流光 */
    border-radius: 13px; /* 稍微縮小圓角以符合視覺 */
    z-index: -1; /* 放在內容下面，但在流光上面 */
}

.social-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 11;
}

.social-card:hover::before {
    filter: brightness(1.5);
    animation-duration: 2s; /* 懸停時轉快一點，增加回饋感 */
}

/* 頭像容器 */
.social-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%; /* 圓形 */
    overflow: hidden;   /* 確保圖片不超出圓形 */
    margin-bottom: 15px;
    border: 3px solid #fff;
    
    /* 如果圖片沒置中，也可以在這邊加 flex */
    display: flex;
    justify-content: center;
    align-items: center;
}

.social-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 關鍵：裁切圖片確保不變形並填滿 */
}

.social-content {
    font-size: 24px;
    color: #333;
    line-height: 1.6;
    letter-spacing: 0.1rem;
    text-align: left;
    padding: 10px;
}

.social-content a {
    display: block;
    text-align: center;  /* 確保文字在寬度內置中 */
    text-decoration: none;
    color: #000;
    text-indent: 0;
    transition: all 0.3s ease;
}

.social-content a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: #000;
    transition: width 0.3s ease;
}

.social-content a:hover {
    color: #5ec4ffef;
}

.social-content a:hover::after {
    width: 100%;
}

@media screen and (max-width: 768px) {
    .portfolio-grid-social {
        grid-template-columns: 1fr; /* 手機版改為單列 */
    }
    .social-card {
        /* 將垂直排列改為水平排列 */
        flex-direction: row; 
        
        /* 讓內容垂直居中對齊 */
        align-items: center; 
        
        /* 靠左對齊，並留出內邊距 */
        justify-content: flex-start;
        padding: 15px;
        gap: 15px; /* 頭像與文字之間的間距 */
    }

    .social-avatar {
        /* 在手機版縮小一點頭像，避免太佔空間 */
        width: 100px;
        height: 100px;
        flex-shrink: 0; /* 防止頭像被文字擠壓變形 */
        margin-bottom: 0; /* 移除原本垂直排列時的底部間距 */
    }

    .social-content {
        /* 讓文字區塊向左對齊 */
        padding: 0 0 0 20px;
        text-align: left;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .social-content a {
        /* 手機版按鈕可以改為靠左，或是保持置中 */
        display: inline-block;
        width: fit-content;
        margin-left: 0;
    }
}
