@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400..900&family=Lora:ital,wght@0,400..700;1,400..700&family=Noto+Sans+JP:wght@100..900&family=Noto+Serif+TC:wght@200..900&family=Noto+Serif:ital,wght@0,100..900;1,100..900&family=Raleway:ital,wght@0,100..900;1,100..900&display=swap');
/*.lora-<uniquifier> {
  font-family: "Lora", serif;
  font-optical-sizing: auto;
  font-weight: <weight>;
  font-style: normal;
}*/

/*
Bickham Script Pro 3 Regular
font-family: "bickham-script-pro-3", sans-serif;
font-weight: 400;
font-style: normal;
Bickham Script Pro 3 Bold
font-family: "bickham-script-pro-3", sans-serif;
font-weight: 700;
font-style: normal;
*/
.Bickham-Script-Pro-3-Regular{
font-family: "bickham-script-pro-3", sans-serif;
font-weight: 400;
font-style: normal;
}
.lora-Regular {
  font-family: "Lora", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}
.lora-Bold {
  font-family: "Lora", serif;
  font-optical-sizing: auto;
  font-weight: 700;
  font-style: normal;
}

body,
html {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    position: relative;
    width: 100%;
    height: auto;
    min-height: 100%;
    margin: 0;
    padding: 0;
    --vw-base: calc(100vw / 1920);
    background-color: #f3eee7;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    padding: 0;
}

a:link,
a:visited,
a:hover,
a:active {
    text-decoration: none;
}

button,
input,
textarea,
select,
option {
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    -webkit-border-radius: 0px;
    border-radius: 0;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}
ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
video {
    object-fit: cover;
    width: 100%;
    height: 100%;
    position: relative;
    display: block;
}


.container {
    width: 100%;
    height: auto;
    position: relative;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s ease;
}

.no-scroll {
    overflow: hidden;
    /* 禁止滚动条 */
    touch-action: none;
    /* 禁止移动端触摸滚动 */
    position: fixed;
    /* 防止页面跳动 */
    width: 100%;
    height: 100vh;
}
.opacity {
    opacity: 1;
    position: relative;
    visibility: visible;
}

/*影片區*/
.main1 {
  width: 100%;
  height: calc(950 * var(--vw-base));
  position: relative;
  background-color: #f3eee7;
  /* 確保超出容器的部分被隱藏，達成裁切感 */
  overflow: hidden; 
}

/* 這裡維持你的動畫觸發 */
.main1.active {
  animation: m1-bg-motion 1.5s forwards; /* 移除 alternate 避免來回彈跳，除非你原本就需要 */
  animation-delay: 0s;
  animation-timing-function: ease-out;
}

.m1-bg {
  width: 100%;
  /* 初始高度與容器一致 */
  height: calc(950 * var(--vw-base));
  position: relative;
  margin: 0 auto;
  z-index: 98;
  overflow: hidden; /* 重要：裁切關鍵 */
}

/* 動畫改為縮減容器高度 */
@keyframes m1-bg-motion {
  0% {
    height: calc(950 * var(--vw-base));
  }
  100% {
    height: calc(760 * var(--vw-base));
  }
}

.m1-bg img {
  object-fit: cover;
  width: 100%;
  /* 關鍵：高度固定為原始高度，不要隨父層縮放 */
  height: calc(950 * var(--vw-base)); 
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}


.m1-txt {
    width: 100%;
    height: calc(520*var(--vw-base));
    position: absolute;
    bottom: 0;
    left: 0;
    z-index: 105;
    overflow: hidden;
}
.m1-t1{
    color: rgba(255, 255, 255, 0.2);
    font-family: "Lora", serif;
    font-weight: 600;
    font-size: calc(48 * var(--vw-base));
    line-height: 3vw;
    letter-spacing: 0em;
    transform: scaleX(0.95);
    transform-origin: left center;
    writing-mode: vertical-rl;
    display: block;
    position: absolute;
    left: 12.6vw;
    top: 0.4vw;
    width: calc(50 * var(--vw-base));
    height: calc(260 * var(--vw-base));
    overflow: hidden;
    opacity: 0;
    letter-spacing: 0.1vw;
}
.m1-t2{
    color: rgba(255, 255, 255, 0.6);
    line-height: 3vw;
    font-size: calc(22 * var(--vw-base));
    font-family: 'Noto Serif TC', sans-serif;
    letter-spacing: 0.05em;
    font-weight: 600;
    transform: scaleX(0.95);
    transform-origin: left center;
    display: block;
    position: absolute;
    left: 12.75vw;
    top: 13.6vw;
    width: calc(120 * var(--vw-base));
    height: calc(50 * var(--vw-base));
    overflow: hidden;
    opacity: 0;
}
.m1-t1.active{
    animation: m1-t1-ani 1.5s ease;
    animation-delay: 1s;
    animation-fill-mode: forwards;
}
.m1-t2.active{
    animation: m1-t2-ani 1.5s ease;
    animation-delay: 1s;
    animation-fill-mode: forwards;
}
@keyframes m1-t1-ani {
    0% {
        left: 11.65vw;
        transform: scaleX(0.95);
        opacity: 0;
    }
    100% {
        left: 12.65vw;
        transform: scaleX(0.95);
        opacity: 1;
    }
}
@keyframes m1-t2-ani {
    0% {
        left: 13.75vw;
        transform: scaleX(0.95);
        opacity: 0;
    }
    100% {
        left: 12.75vw;
        transform: scaleX(0.95);
        opacity: 1;
    }
}
.m1-line{
    width: 1px;
    height: calc(0*var(--vw-base));
    background-color: rgba(255,255,255,.35);
    position: absolute;
    left: 12.7vw;
    top: 0.4vw;
    overflow: hidden; /* 🔴 很重要，避免 after 超出 */
}
.m1-line.active{
    animation: m1-line 1.5s linear;
    animation-delay: 2s;
    animation-fill-mode: forwards;
}
@keyframes m1-line {
    0% {
        height: calc(0*var(--vw-base));
    }
    100% {
        height: calc(665*var(--vw-base));
    }
}
.m1-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 1);

  transform-origin: top;
  transform: scaleY(0);
}

@keyframes drawLine {
  0% {
    transform: scaleY(0);
    opacity: 1;
  }

  70% {
    transform: scaleY(1);
    opacity: 1;
  }

  100% {
    transform: scaleY(1);
    opacity: 0;
    /* 畫完淡出再重來 */
  }
}

.m1-line.active::after {
  animation: drawLine 3s ease-in-out infinite;
  animation-delay: 3s;
  
}

.m-bottom-line{
    width: 100%;
    height: 1px;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: rgba(137, 126, 121, 0.5);
    z-index: 10;
}

/* 基礎視覺比例設定 */
.m-scale {
  display: inline-block;
  transform: scaleX(0.95);
  /* 預設維持 left，給左邊的 2024 使用 */
  transform-origin: left center; 
}

/* 🎯 針對 brand-info 內部的文字，將基準點改為右側 */
.brand-info .m-scale {
  transform-origin: right center;
}


/* =========================================
   MAIN2
========================================= */
:root {
    --vw-base: calc(100vw / 1920);
    --bg: #f3eee7;
    --narrow-w: 6vw;
    --active-w: 30vw; 
    --card-h: 20vw; 
    --gap: 3vh;
}

/* 讓 main2 成為容器 */
.main.main2 {
    position: relative;
    width: 100%;
    /* 高度由 pinSpacing 自動撐開，不要手動設死 */
}

.viewport {
    position: relative; /* Pin 之後 GSAP 會處理 fixed */
    width: 100vw;
    height: 100vh;
    display: grid; 
    grid-template-columns: 20% 25% 30% 25%;
    overflow: hidden;
}
/* 圖片卡片基礎樣式 */
.img-card {
    width: var(--narrow-w);
    height: var(--card-h);
    margin-bottom: var(--gap);
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
/* 右側文字堆疊區 */
.txt-stack, #txtTrack {
    position: absolute;
    top: var(--line4-top); 
    left: 0;
    width: 100%;
}

/* 圖片容器 */
.gallery-container { position: relative; width: 100%; height: 100%;z-index:20; }
.img-track {
    position: absolute; top: 0; right: 0;
    display: flex; flex-direction: column; 
    align-items: flex-end; width: 100%;
    will-change: transform;
}
.img-card {
    position: relative;
    width: var(--narrow-w);
    height: var(--card-h);
    opacity: 1 !important; /* 強制圖片容器透明度為 1 */
    overflow: visible;     /* 確保線條末端圖示不被切掉 */
    cursor: pointer;
}

.img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1 !important; /* 確保圖片本身不變透明 */
    z-index: 1;
}

/* 遮罩層：負責所有的「黑影」 */
.img-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 這是你要求的 50% 黑 */
    z-index: 2;
    pointer-events: none;
    
    /* 核心邏輯：
       1. 未選取時：opacity 為 1 (顯示 50% 黑)
       2. 已選取時：opacity 為 0 (完全清晰)
    */
    opacity: var(--mask-opacity, 1); 
    transition: opacity 0.4s ease;
}

/* --- 核心需求：只有選取中 (.active) 移入才反黑 --- */
.img-card.active:hover::after {
    opacity: 1 !important; /* 重新顯現 50% 黑 */
}

/* 未選取的卡片 hover 時保持原樣 (50%黑) */
.img-card:not(.active):hover::after {
    opacity: 1; 
}

/* 線條：只有 Hover 時會根據 CSS 變寬 */
.m2-title-line {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0%; /* 預設寬度為 0 */
    height: 1px;
    background-color: rgba(255, 255, 255, 0.5);
    z-index: 35;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); /* 平滑動畫 */
    overflow: visible !important; 
    pointer-events: none; /* 防止線條干擾滑鼠事件 */
}

/* --- 核心邏輯：只有「選取中」且「滑入」時，線條才伸長 --- */
.img-card.active:hover .m2-title-line {
    width: 90%; 
}

/* 針對線條末端圖示的細節微調 */
.m2-title-line::after {
    content: "";
    position: absolute;
    right: 0; 
    top: 0; 
    width: calc(19 * var(--vw-base));
    height: calc(3 * var(--vw-base));
    background-image: url("../img/04/m-barbgafdot.png");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0; /* 預設隱藏 */
    transition: opacity 0.3s ease;
}

/* 當線條開始伸長時，顯示圖示 */
.img-card.active:hover .m2-title-line::after {
    opacity: 1;
}

/* 遮罩補強：讓 GSAP 可以透過變數控制偽元素 */
.img-card::after {
    /* ... 你原本的設定 ... */
    opacity: var(--mask-opacity, 1); 
    transition: opacity 0.4s ease; /* 即使 JS 沒跑，CSS 自己也會動 */
}

/* 當 JS 偵測到捲動中的 Hover */
.img-card.active.is-hovered::after {
    opacity: 1 !important;
}

.img-card.active.is-hovered .m2-title-line {
    width: 90%;
}

.img-card.active.is-hovered .m2-title-line::after {
    opacity: 1;
}
/* 預設禁止點擊 */
.img-card .project-link,
.txt-item a {
    pointer-events: none;
    cursor: default;
    text-decoration: none;
    color: inherit;
}

/* 只有 active 狀態下可以點擊 */
.img-card.active .project-link,
.txt-item.active a {
    pointer-events: auto;
    cursor: pointer;
}

/* 增加滑過效果提示使用者可以點擊 */
.img-card.active:hover {
    filter: brightness(1.1);
    transition: filter 0.3s;
}

/* 列表文字 */
.list-container { position: relative; margin-left: 12.5vw; }
.txt-stack { position: absolute; top: 52.5%; left: 0; width: 100%; } /* 對應 m-line4 的 53% */
.txt-item {
    position: absolute; top: 0; left: 0; min-height: 40px; 
    display: flex; align-items: center;
    font-size: calc(22 * var(--vw-base)); font-weight: 600;
    letter-spacing: 0.1em; line-height: 2.35vw; color: #897e79;
    opacity: 0; white-space: normal; word-break: break-all;
    width: 90%; will-change: transform, opacity;
    font-family: 'Noto Serif TC', sans-serif;
}

.scroll-proxy { height: 600vh; } 

.year-display, #yearDisplay{
    display:flex; align-items:center; justify-content:end;
    font-family: "Lora", serif; font-weight: 600;
    font-size: calc(36 * var(--vw-base)); line-height: 3vw;
    color:#897e79; letter-spacing: 0.1em;
}


/* 1. Slogan 容器：設定一個基準高度與位置 */
.slogan-container {
    position: absolute;      /* 改為絕對定位 */
    right: 0;
    top: 50%;               /* 對齊視窗中心點，或與標題基準線對齊 */
    transform: translateY(-160px); /* 關鍵：將基準線往上提，放在標題上方 */
    display: flex;
    align-items: flex-end;   /* 讓內容底部對齊基準線 */
    justify-content: flex-end;
    padding-right: 2vw;
    height: 10px;           /* 容器本身高度極小 */
    z-index: 10;
}


/* Slogan 的外層容器，必須與標題容器對齊 */
.slogan-container {
    position: relative; /* 改回 relative，確保它在 list-container 附近 */
    display: block;    /* 讓它成為一個垂直的軌道 */
    height: 0;         /* 不佔據空間，防止擠壓標題 */
    overflow: visible;
}

.slogan-item {
    position: absolute;
    bottom: -0.8vw;
    right: 1vw;
    width: 20vw;
    text-align: right;
    white-space: normal;
    word-break: break-all;
    font-size: calc(18 * var(--vw-base));
    color: #897e79;
    letter-spacing: 0.2em;
    font-weight: 500;
    font-family: 'Noto Serif TC', sans-serif;
    opacity: 0;
    will-change: transform, opacity;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}



.m-line1, .m-line2, .m-line3 {
    width: 1px; height: 0%; background-color: rgba(137, 126, 121, 0.5);
    position: fixed; z-index: 10;
}
.m-line4 {
    width: 0%; height: 1px; background-color: rgba(137, 126, 121, 0.5);
    position:fixed; top: 52.5%; left: 0; z-index: 10;
}
.m-line1 { left: 12.7vw; top: 0; }
.m-line2 { left: 69vw; bottom: 0; }
.m-line3 { left: 86.5vw; top: 0; }
/* 隱藏 Gallery 軌道，等待線條動畫結束 */
/* 預設隱藏並往左偏移 */
.img-track, .txt-stack, .slogan-track, .year-display,
#imgTrack, #txtTrack, #sloganTrack, #yearDisplay {
    opacity: 0;
    visibility: hidden; /* 防止佔位與意外顯示 */
    will-change: transform, opacity;
}

.gallery-ready .img-track, 
.gallery-ready .txt-stack, 
.gallery-ready .slogan-track,
.gallery-ready .year-display,
.gallery-ready #yearDisplay {
    opacity: 1;
    visibility: visible;
}