/* ====================================================
   1. 基礎設定 & 字體引進
==================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;500;700&family=Space+Mono:wght@400;700&family=Syncopate:wght@700&family=Noto+Sans+TC:wght@300;500;700;900&family=Noto+Serif+TC:wght@700;900&display=swap');

:root { --bg-color: #050505; --text-main: #e0e0e0; --text-sub: #999999; --accent: #00FF94; --gap: 8vw; --logo-font: 'Noto Serif TC', serif; --body-font: 'Noto Sans TC', sans-serif; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--bg-color); color: var(--text-main); font-family: var(--body-font); overflow: hidden; height: 100vh; height: 100dvh; width: 100vw; }

/* ====================================================
   2. 首頁動態背景 & 雷射特效層
==================================================== */
.hero-bg-layer { position: absolute; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -2; overflow: hidden; opacity: 0.4; }
.hero-bg-img { width: 100%; height: 100%; object-fit: cover; animation: hero-move 30s ease-in-out infinite alternate; filter: blur(2px); }
@keyframes hero-move { 0% { transform: scale(1.1) translate(0, 0); } 100% { transform: scale(1.2) translate(-2%, 1%); } }

.laser-layer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; overflow: hidden; perspective: 1000px; }
.laser-beam { position: absolute; width: 250%; height: 3px; background: linear-gradient(90deg, transparent 0%, rgba(0, 255, 148, 0.9) 40%, #ffffff 50%, rgba(0, 255, 148, 0.9) 60%, transparent 100%); box-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent), 0 0 60px var(--accent); opacity: 0; mix-blend-mode: screen; will-change: transform, opacity; }
.laser-wash { position: absolute; top: 80%; left: -50%; width: 200%; height: 30vh; background: linear-gradient(0deg, transparent, rgba(0, 255, 148, 0.15), transparent); mix-blend-mode: screen; filter: blur(20px); animation: wash-sweep 20s ease-in-out infinite alternate; }
@keyframes wash-sweep { 0% { transform: rotate(-15deg) translateY(20vh); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(15deg) translateY(-60vh); opacity: 0; } }

.beam-1 { top: -10%; left: -50%; transform-origin: 20% 50%; animation: sweep-1 14s ease-in-out infinite alternate; }
@keyframes sweep-1 { 0% { transform: rotate(-25deg) translateY(0); opacity: 0; } 20%, 80% { opacity: 0.8; } 100% { transform: rotate(35deg) translateY(120vh); opacity: 0; } }
.beam-2 { bottom: -20%; right: -50%; transform-origin: center; animation: sweep-2 18s cubic-bezier(0.4, 0, 0.2, 1) infinite; animation-delay: 2s; }
@keyframes sweep-2 { 0% { transform: rotate(-45deg) translateY(0); opacity: 0; } 30% { opacity: 0.7; } 70% { opacity: 0.9; } 100% { transform: rotate(15deg) translateY(-180vh); opacity: 0; } }
.beam-3 { top: 30%; left: -50%; transform-origin: left center; animation: sweep-3 12s linear infinite; animation-delay: 5s; }
@keyframes sweep-3 { 0% { transform: rotate(10deg); opacity: 0; } 10%, 14%, 22% { opacity: 0.8; } 12%, 18% { opacity: 0; } 50% { transform: rotate(60deg); opacity: 0.9; } 90%, 100% { opacity: 0; } }
.beam-4 { top: 60%; left: -50%; height: 1px; animation: sweep-4 9s ease-in-out infinite alternate; animation-delay: 1s; }
@keyframes sweep-4 { 0% { transform: rotate(-5deg) translateY(40vh); opacity: 0; } 50% { opacity: 0.6; } 100% { transform: rotate(10deg) translateY(-40vh); opacity: 0; } }
.beam-5 { top: -50%; right: -20%; transform-origin: right center; animation: sweep-5 16s ease-in-out infinite alternate; animation-delay: 7s; }
@keyframes sweep-5 { 0% { transform: rotate(70deg) translateX(50vw); opacity: 0; } 30%, 80% { opacity: 0.7; } 100% { transform: rotate(30deg) translateX(-50vw); opacity: 0; } }

/* ====================================================
   3. 元素出場與大標題動畫
==================================================== */
.scroll-item { opacity: 0; transform: translateX(50px) scale(0.95); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.scroll-item.is-visible { opacity: 1; transform: translateX(0) scale(1); }
.text-reveal-mask { overflow: hidden; display: block; }
.text-reveal-mask span.reveal-inner { display: block; transform: translateY(110%); }
@keyframes rise-up { 0% { transform: translateY(110%); } 100% { transform: translateY(0); } }
@keyframes auto-drift { 0%, 100% { transform: translate(0, 0) skew(0deg); } 20% { transform: translate(4px, 2px) skew(-0.5deg); } 40% { transform: translate(-3px, 1px) skew(0.25deg); } 60% { transform: translate(2px, -3px) skew(0deg); } 80% { transform: translate(-1px, 2px) skew(-0.25deg); } }
.text-reveal-mask.is-visible span.reveal-inner { animation: rise-up 1s cubic-bezier(0.16, 1, 0.3, 1) forwards, auto-drift 15s ease-in-out 1s infinite alternate; }
.text-reveal-mask.is-visible span.delay-1 { animation: rise-up 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards, auto-drift 12s ease-in-out 1.2s infinite alternate; }
.text-reveal-mask.is-visible span.delay-2 { animation: rise-up 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards, auto-drift 18s ease-in-out 1.4s infinite alternate; }

/* ====================================================
   4. 跑馬燈 & 畫廊軌道
==================================================== */
.marquee-container { position: fixed; top: 0; left: 0; width: 100%; height: 45px; background: rgba(17, 17, 17, 0.8); z-index: 20; display: flex; align-items: center; border-bottom: 1px solid #222; backdrop-filter: blur(5px); }
.marquee-content { display: flex; gap: 50px; font-family: 'Space Mono', monospace; font-size: 1.2rem; font-weight: 700; color: var(--accent); text-transform: uppercase; white-space: nowrap; animation: scroll 20s linear infinite; }
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.gallery-track { display: flex; align-items: center; height: 100%; padding: 0 10vw; gap: var(--gap); will-change: transform; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; position: relative; z-index: 2; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.gallery-track::-webkit-scrollbar { display: none; }

/* ====================================================
   🌟 5. 單框幻燈片卡片樣式 (加入下方敘述)
==================================================== */
.chapter-title { font-family: 'Syncopate', sans-serif; font-size: 10vh; font-weight: 700; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.3); white-space: nowrap; letter-spacing: -2px; line-height: 1.1; flex-shrink: 0; display: flex; flex-direction: column; position: relative; z-index: 5; }
.chapter-title .sub-zh { font-family: var(--body-font); font-size: 5rem; color: var(--accent); -webkit-text-stroke: 0; letter-spacing: 0px; margin-bottom: 1rem; font-weight: 900; text-shadow: 0 0 15px rgba(0, 255, 148, 0.6), 0 0 30px rgba(0, 255, 148, 0.4); }

.project-card { position: relative; flex-shrink: 0; cursor: pointer; height: 55vh; width: 35vw; transition: transform 0.5s ease; border-radius: 2px; }
.card-img-window { width: 100%; height: 100%; overflow: hidden; border-radius: 2px; }
.card-img-track { display: flex; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.card-scroll-img { width: 100%; height: 100%; object-fit: cover; flex-shrink: 0; filter: grayscale(100%) contrast(110%) brightness(0.8); transition: filter 0.5s ease; }

.project-card:hover { transform: scale(1.05) !important; z-index: 10; }
@keyframes card-flash-glow { 0% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 20px 40px rgba(0, 255, 148, 0.3); } 50% { box-shadow: 0 0 50px rgba(0, 255, 255, 1), 0 30px 80px rgba(0, 255, 148, 0.8), 0 0 90px rgba(0, 200, 255, 0.8); } 100% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.5), 0 20px 40px rgba(0, 255, 148, 0.3); } }
.project-card:hover { animation: card-flash-glow 0.6s ease-in-out infinite alternate; }
.project-card:hover .card-scroll-img { filter: grayscale(0%) contrast(100%) brightness(1.2); }

/* 🌟 卡片下方資訊區 (加入過渡動畫，配合 JS 淡入淡出) */
.card-info { display: none !important; }
.card-title-bottom { margin-top: 15px; font-size: 1.2rem; font-weight: 500; color: white; opacity: 0.6; font-family: var(--body-font); letter-spacing: 1px; transition: all 0.3s ease; }

/* 🌟 新增的「首頁卡片敘述」樣式 */
.card-desc-bottom {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: 300;
    color: #888;
    line-height: 1.6;
    font-family: var(--body-font);
    opacity: 0.6;
    transition: all 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制只顯示兩行，超過變點點點，保持排版整齊 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 滑鼠移上去時，標題發青藍光，敘述變亮 */
.project-card:hover .card-title-bottom { opacity: 1; color: #00FFFF; text-shadow: 0 0 10px rgba(0, 255, 255, 0.8); }
.project-card:hover .card-desc-bottom { opacity: 1; color: #ccc; }

/* ====================================================
   6. 側邊選單 & 閃電抖動
==================================================== */
.brand-sidebar { position: fixed; bottom: 40px; left: 40px; z-index: 10; }
.logo-box { margin-bottom: 20px; }
.logo-en { font-family: 'Syncopate', sans-serif; font-weight: 700; font-size: 1.4rem; letter-spacing: 1px; color: var(--accent); line-height: 1; text-shadow: 0 4px 15px rgba(0, 0, 0, 0.9), 0 0 30px rgba(0, 0, 0, 1); }
.logo-zh-3d { font-family: var(--logo-font); font-weight: 900; font-size: 2rem; color: #ffffff; letter-spacing: 5px; margin-top: 10px; text-shadow: 1px 1px 0px var(--accent), 2px 2px 0px var(--accent), 3px 3px 0px #000, 0 0 25px rgba(0, 0, 0, 0.9); display: inline-block; transform: translate(-2px, -2px); }

.nav-link { display: block; font-family: var(--body-font); font-size: 0.9rem; color: var(--text-sub); text-decoration: none; margin-bottom: 15px; transition: all 0.2s ease; cursor: pointer; transform-origin: left center; letter-spacing: 1px; }
.nav-link.active { color: var(--accent); padding-left: 20px; font-weight: 700; transform: scale(1.6); text-shadow: 0 0 15px rgba(0, 255, 148, 0.6); }

@keyframes text-glitch { 0%, 100% { transform: scale(1.6) translate(0, 0) skew(0deg); } 20% { transform: scale(1.6) translate(-2px, 1px) skew(2deg); } 40% { transform: scale(1.6) translate(2px, -1px) skew(-2deg); } 60% { transform: scale(1.6) translate(-1px, 2px) skew(0deg); } 80% { transform: scale(1.6) translate(1px, -2px) skew(1deg); } }
.nav-link:hover { color: var(--accent); padding-left: 20px; font-weight: 700; text-shadow: 0 0 10px rgba(0, 255, 148, 0.8), 2px 2px 0px rgba(0,255,255,0.5), -2px -2px 0px rgba(255,0,255,0.5); animation: text-glitch 0.3s linear infinite; }

.contact-btn-nav { margin-top: 20px; color: white; border: 1px solid white; padding: 8px 15px; display: inline-block; font-size: 0.9rem; text-transform: uppercase; transition: 0.3s; cursor: pointer; font-family: 'Space Mono', sans-serif; }
.contact-btn-nav:hover { background: var(--accent); color: black; border-color: var(--accent); }

/* ====================================================
   7. 燈箱
==================================================== */
.overlay-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 5, 5, 0.98); z-index: 100; display: flex; opacity: 0; pointer-events: none; transition: opacity 0.4s ease; backdrop-filter: blur(5px); }
.overlay-modal.active { opacity: 1; pointer-events: all; }
.close-btn { position: absolute; top: 30px; right: 30px; color: white; font-size: 1.5rem; cursor: pointer; background: none; border: 1px solid #333; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.3s; z-index: 101; }
.close-btn:hover { background: var(--accent); color: black; border-color: var(--accent); }

.lightbox-content { width: 100%; height: 100%; display: grid; grid-template-columns: 350px 1fr; gap: 0; }
.lb-sidebar { padding: 60px 40px; border-right: 1px solid #222; display: flex; flex-direction: column; justify-content: center; background: #050505; z-index: 5; }
.lb-title { font-size: 2.5rem; font-family: var(--body-font); margin-bottom: 10px; font-weight: 700; color: white; }
.lb-subtitle { font-family: 'Space Mono', monospace; color: var(--accent); margin-bottom: 30px; font-size: 0.9rem;}
.lb-desc { line-height: 1.8; color: #aaa; font-size: 1rem; font-family: var(--body-font); }

.jump-char { display: inline-block; opacity: 0; transform: translateY(20px); animation: jump-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes jump-in { 0% { opacity: 0; transform: translateY(20px); } 50% { opacity: 1; transform: translateY(-5px); } 100% { opacity: 1; transform: translateY(0); } }

.lb-main-view { position: relative; width: 100%; height: 100%; overflow: hidden; display: flex; align-items: center; background: #000; }
.lb-scroll-track { display: flex; width: 100%; height: 100%; align-items: center; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); }
.lb-scroll-img { width: 100%; height: 80vh; object-fit: contain; flex-shrink: 0; }

.contact-content { width: 100%; height: 100%; display: grid; grid-template-columns: 1.2fr 1fr; }
.contact-info-panel { padding: 80px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid #222; }
.contact-form-panel { padding: 80px; display: flex; flex-direction: column; justify-content: center; background: #0a0a0a; }
.info-item { margin-bottom: 30px; }
.info-label { font-family: 'Space Mono'; color: var(--accent); font-size: 0.75rem; margin-bottom: 5px; display: block;}
.info-value { font-family: var(--body-font); color: white; font-size: 1.5rem; font-weight: 500; }
.social-btn { display: inline-flex; align-items: center; gap: 10px; border: 1px solid #444; color: white; padding: 10px 20px; text-decoration: none; font-family: 'Space Mono'; font-size: 0.8rem; transition: 0.3s; margin-top: 10px; }
.social-btn:hover { border-color: var(--accent); color: var(--accent); }
.form-group { margin-bottom: 25px; }
.form-input { width: 100%; background: transparent; border: none; border-bottom: 1px solid #333; color: white; font-family: var(--body-font); font-size: 1.3rem; padding: 10px 0; transition: 0.3s; }
.form-input:focus { outline: none; border-bottom-color: var(--accent); }
.submit-btn { background: transparent; border: 1px solid var(--accent); color: var(--accent); padding: 15px 40px; font-family: 'Space Mono'; font-size: 1rem; cursor: pointer; margin-top: 20px; transition: 0.3s; text-transform: uppercase; }
.submit-btn:hover { background: var(--accent); color: black; }

.chatbot-btn { position: fixed; bottom: 30px; right: 30px; width: 60px; height: 60px; background: #111; border: 1px solid var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 90; transition: 0.3s; box-shadow: 0 0 20px rgba(0, 255, 148, 0.2); }
.chatbot-btn:hover { transform: scale(1.1); background: var(--accent); }
.chatbot-btn::before { content: '?'; font-family: 'Space Mono'; font-size: 1.5rem; color: var(--accent); }
.chat-window { position: fixed; bottom: 100px; right: 30px; width: 350px; height: 500px; background: #080808; border: 1px solid #333; z-index: 90; display: flex; flex-direction: column; transform: translateY(20px); opacity: 0; pointer-events: none; transition: 0.3s ease; box-shadow: 0 10px 40px rgba(0,0,0,0.8); }
.chat-window.active { transform: translateY(0); opacity: 1; pointer-events: all; }
.chat-header { padding: 15px; background: #111; border-bottom: 1px solid #333; display: flex; justify-content: space-between; align-items: center; }
.chat-title { font-family: 'Space Mono'; color: white; font-size: 0.9rem; }
.chat-status { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 5px var(--accent); }
.chat-body { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.msg { max-width: 85%; padding: 10px 15px; font-size: 1rem; line-height: 1.5; font-family: var(--body-font); word-break: break-all;}
.msg.bot { background: #1a1a1a; color: #ccc; border-left: 2px solid var(--accent); align-self: flex-start; }
.msg.user { background: transparent; border: 1px solid #444; color: white; align-self: flex-end; }
.chat-options { padding: 15px; background: #111; border-top: 1px solid #333; display: flex; flex-wrap: wrap; gap: 10px; }
.option-btn { background: transparent; border: 1px solid #444; color: white; padding: 5px 12px; font-size: 0.9rem; cursor: pointer; transition: 0.2s; font-family: var(--body-font); }
.option-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ====================================================
   🎵 8. 音樂播放器按鈕
==================================================== */
.sound-toggle { position: fixed; top: 30px; right: 30px; z-index: 100; color: var(--text-sub); font-family: 'Space Mono', monospace; font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; gap: 8px; border: 1px solid #333; padding: 8px 15px; border-radius: 20px; background: rgba(5, 5, 5, 0.6); backdrop-filter: blur(5px); transition: all 0.3s ease; letter-spacing: 1px; }
.sound-toggle:hover { border-color: var(--accent); color: white; }
@keyframes electric-jitter { 0% { transform: translate(0, 0); box-shadow: 0 0 10px rgba(0, 255, 148, 0.5); } 10% { transform: translate(-1px, 1px); box-shadow: 0 0 25px rgba(0, 255, 148, 0.8), 0 0 5px #fff; } 20% { transform: translate(1px, -1px); box-shadow: 0 0 10px rgba(0, 255, 148, 0.5); } 30% { transform: translate(-2px, 0); box-shadow: 0 0 30px rgba(0, 255, 148, 1), 0 0 10px #fff; } 40% { transform: translate(1px, 2px); box-shadow: 0 0 10px rgba(0, 255, 148, 0.5); } 50% { transform: translate(-1px, -1px); box-shadow: 0 0 20px rgba(0, 255, 148, 0.7); } 60% { transform: translate(2px, 1px); box-shadow: 0 0 10px rgba(0, 255, 148, 0.5); } 70% { transform: translate(-1px, -2px); box-shadow: 0 0 35px rgba(0, 255, 148, 0.9), 0 0 5px #fff; } 80% { transform: translate(1px, 1px); box-shadow: 0 0 10px rgba(0, 255, 148, 0.5); } 90% { transform: translate(-2px, 1px); box-shadow: 0 0 20px rgba(0, 255, 148, 0.8); } 100% { transform: translate(0, 0); box-shadow: 0 0 10px rgba(0, 255, 148, 0.5); } }
.sound-toggle.is-playing { color: var(--accent); border-color: var(--accent); font-weight: bold; text-shadow: 0 0 5px var(--accent); animation: electric-jitter 0.15s infinite linear; }

/* ====================================================
   🔥 9. RWD 跨平台適應
==================================================== */
@media (max-width: 1024px) {
    .gallery-track { flex-direction: column; align-items: flex-start; padding: 180px 5vw 100px 5vw; gap: 80px; height: auto; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
    .brand-sidebar { position: fixed; top: 45px; left: 0; width: 100%; background: rgba(5,5,5,0.95); backdrop-filter: blur(10px); padding: 15px 5vw; border-bottom: 1px solid #333; display: flex; flex-direction: column; align-items: flex-start; z-index: 15; bottom: auto; }
    .logo-box { margin-bottom: 0; display: flex; align-items: baseline; gap: 10px;}
    .logo-en { font-size: 1.2rem; }
    .logo-zh-3d { font-size: 1rem; margin-top: 0; letter-spacing: 1px; text-shadow: 1px 1px 0px var(--accent); transform: none; }
    .contact-btn-nav { position: absolute; right: 5vw; top: 15px; margin-top: 0; padding: 5px 10px; font-size: 0.75rem; }
    .sound-toggle { top: 15px; right: 15px; font-size: 0.7rem; padding: 5px 10px; } 
    .nav-links-wrapper { display: flex; flex-direction: row; overflow-x: auto; width: 100%; gap: 15px; margin-top: 15px; padding-bottom: 5px; -ms-overflow-style: none; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .nav-links-wrapper::-webkit-scrollbar { display: none; }
    .nav-link { margin-bottom: 0; white-space: nowrap; font-size: 0.85rem; }
    .nav-link:hover, .nav-link.active { transform: scale(1.1); padding-left: 0; }
    .chapter-title { font-size: 3rem; margin-right: 0 !important; }
    .chapter-title .sub-zh { font-size: 3.5rem; }
    
    .project-card { width: 90vw; height: auto; aspect-ratio: 4/3; }

    .lightbox-content { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .lb-sidebar { padding: 30px 5vw; border-right: none; border-bottom: 1px solid #222; }
    .lb-title { font-size: 1.8rem; }
    .lb-main-view { padding: 20px 0; }
    .lb-scroll-img { height: 45vh; }

    .contact-content { grid-template-columns: 1fr; overflow-y: auto; }
    .contact-info-panel, .contact-form-panel { padding: 40px 5vw; }
    .info-value { font-size: 1.2rem; }
    .chat-window { width: 90vw; right: 5vw; bottom: 100px; height: 60vh; }
}

@media (max-width: 480px) {
    .chapter-title { font-size: 2.2rem; }
    .chapter-title .sub-zh { font-size: 2.8rem; }
    .logo-en { font-size: 1rem; }
    .logo-zh-3d { display: none; }
    .sound-toggle { top: 60px; right: 5vw; }
}