/* 實驗室風格重構 - 去 AI 化設計 */
/* =========================================
   1. 核心變數與重置 (Design Tokens)
   ========================================= */
:root {
    /* 品牌色系 */
    --navy-900: #0A1E3F; 
    --navy-800: #14325A; 
    --navy-700: #1C4E80; 
    --navy-100: #E6F0F9;
    
    --gold-500: #CBA16E;
    --gold-400: #DCC09B;
    --gold-100: #F9F3EB;
    
    /* 文字色彩 */
    --text-main: #334155;  
    --text-muted: #718096; 
    
    --bg-body: #F8FAFC;
    --bg-white: #FAFAFA; 
    
    /* 陰影系統 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 尺寸設定 */
    --sidebar-width: 220px;
    --radius-xl: 0px; 
    --radius-md: 0px; 
    --header-h: 80px;
    --ease-custom: cubic-bezier(0.19, 1, 0.22, 1); 
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { 
    background: var(--navy-900); 
    border-radius: 0; 
}

html { scroll-behavior: smooth; box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif; 
    font-size: 18px; 
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: multiply;
}

* { box-sizing: border-box; }
a { text-decoration: none; color: inherit; transition: all 0.4s var(--ease-custom); }
a:hover { text-shadow: 2px 0 var(--gold-500), -2px 0 var(--navy-700); }
ul { list-style: none; margin: 0; padding: 0; }
.icon { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* =========================================
   2. Header (全面改為明體)
   ========================================= */
header {
    font-family: "PMingLiU", "新細明體", serif; /* 橫列字體改為明體 */
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 clamp(20px, 5%, 40px);
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 2px solid var(--navy-900);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-h);
    transition: height 0.6s var(--ease-custom);
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
}
header.scrolled { height: 60px; box-shadow: var(--shadow-sm); }

.brand-area { display: flex; align-items: center; gap: 12px; }
.site-logo { width: 42px; height: 42px; object-fit: contain; }
.site-title { font-family: "PMingLiU", "新細明體", serif; font-size: 22px; font-weight: 700; color: var(--navy-900); letter-spacing: 0.5px; }

.nav-area ul { display: flex; gap: 8px; }
.nav-link {
    font-family: "PMingLiU", "新細明體", serif; /* 選單也套用明體 */
    font-size: 17px; font-weight: 700; color: var(--text-muted);
    padding: 8px 16px; border-radius: 0; position: relative; overflow: hidden;
    text-transform: uppercase; letter-spacing: 1px;
}
.nav-link::before {
    content: ''; position: absolute; bottom: 0; left: 0; width: 0%; height: 2px;
    background: var(--navy-800); transition: width 0.4s var(--ease-custom);
}
.nav-link:hover::before { width: 100%; }
.nav-link:hover { color: var(--navy-900); }

/* =========================================
   3. Back to Top Button (回到頁首小工具)
   ========================================= */
#backToTopBtn {
    position: fixed; bottom: 28px; right: 24px;
    width: 48px; height: 48px;
    background: var(--navy-900); color: var(--gold-400);
    border: 2px solid var(--navy-700); border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 900;
    opacity: 0; visibility: hidden; transform: translateY(16px);
    transition: opacity 0.4s, visibility 0.4s, transform 0.4s var(--ease-custom), background 0.3s, color 0.3s;
    box-shadow: 3px 3px 0 var(--navy-700);
    padding: 0;
}
#backToTopBtn.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#backToTopBtn:hover {
    background: var(--gold-500); color: var(--navy-900);
    transform: translateY(-4px); box-shadow: 4px 7px 0 var(--navy-900);
    text-shadow: none !important;
}
#backToTopBtn svg { width: 22px; height: 22px; pointer-events: none; }

/* =========================================
   4. Footer
   ========================================= */
footer { background: var(--navy-900); color: #94A3B8; padding: 80px 0 40px; margin-top: 100px; }
.footer-content { max-width: 1280px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; text-align: left; }
.footer-col h4 { color: #fff; margin-bottom: 24px; font-size: 18px; letter-spacing: 1px; margin-top: 0; }
.footer-col a:hover { color: var(--gold-500); }
.footer-bottom { text-align: center; margin-top: 60px; padding-top: 30px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 15px; }

/* 其餘排版及元件樣式... (略) */
/* =========================================
   5. 動畫與其它共用元件
   ========================================= */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1s var(--ease-custom), transform 1s var(--ease-custom); }
.reveal.active { opacity: 1; transform: translateY(0) skewY(0deg); }
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }

.layout-container { max-width: 1280px; margin: clamp(40px, 8vw, 100px) auto; padding: 0 clamp(20px, 5%, 60px); display: grid; grid-template-columns: var(--sidebar-width) 1fr; gap: 40px; align-items: start; position: relative; }
.sidebar { position: sticky; top: 100px; background: var(--bg-white); border-radius: 0; padding: 24px; border: 1px solid var(--navy-900); box-shadow: 4px 4px 0 var(--navy-900); width: var(--sidebar-width); z-index: 10; }
.sidebar-title { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--gold-500); font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.toc-link { display: flex; align-items: center; padding: 12px 14px; margin-bottom: 6px; border-radius: 0; color: var(--text-muted); font-weight: 500; font-size: 16px; transition: all 0.3s; border-left: 2px solid transparent; }
.toc-link svg { margin-right: 10px; width: 18px; height: 18px; color: #CBD5E1; transition:0.3s; }
.toc-link:hover { background: var(--navy-100); color: var(--navy-800); padding-left: 24px; }
.toc-link.active { background: #F0F7FF; color: var(--navy-800); font-weight: 700; border-left-color: var(--gold-500); }
.toc-link.active svg { color: var(--gold-500); }
.layout-container-full { max-width: 1280px; margin: clamp(40px, 8vw, 100px) auto; padding: 0 clamp(20px, 5%, 60px); }
.main-content { min-width: 0; }
.page-header-text { margin-bottom: 50px; }
.page-header-text h1 { font-family: 'Noto Sans TC', sans-serif; font-size: clamp(3rem, 6vw, 5rem); font-weight: 900; color: var(--navy-900); margin: 0 0 24px -4px; line-height: 1; letter-spacing: -2px; }
.page-header-text h1 span { display: inline-block; background: linear-gradient(120deg, transparent 0%, transparent 60%, var(--gold-400) 60%, var(--gold-400) 100%); background-size: 100% 40%; background-repeat: no-repeat; background-position: 0 90%; transform: skewX(-10deg); padding: 0 10px; }
.page-header-text p { font-size: 18px; color: var(--text-muted); max-width: 680px; }
.divider { width: 100px; height: 8px; background: var(--gold-500); margin-top: 24px; border-radius: 0; }

section { background: var(--bg-white); border-radius: 0; padding: clamp(30px, 5vw, 60px) clamp(20px, 4vw, 50px); margin-bottom: clamp(40px, 8vw, 80px); border: 1px solid transparent; scroll-margin-top: 100px; position: relative; overflow: hidden; }
.section-heading { display: flex; align-items: center; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 2px solid var(--navy-900); }
.section-heading h2 { font-size: 28px; color: var(--navy-900); margin: 0; font-weight: 700; display: flex; align-items: center; gap: 12px; }

/* RWD */
@media (max-width: 1024px) {
    .layout-container { grid-template-columns: 1fr; display: flex; flex-direction: column; }
    .sidebar { display: none; }
}
@media (max-width: 768px) {
    header { padding: 0 20px; flex-direction: column; height: auto; padding-bottom: 10px; }
    .nav-area ul { gap: 4px; }
    .page-header-text h1 { font-size: 32px; }
    section { padding: 32px 24px; }
    .layout-container-full { padding: 0 20px; }
}
/* =========================================
   6. 全站 UX 微優化
   ========================================= */
/* 鍵盤 focus ring */
:focus-visible {
    outline: 2.5px solid var(--gold-500);
    outline-offset: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* nav-link：目前頁面底線常駐 */
.nav-link.current-page::before { width: 100%; }
.nav-link.current-page { color: var(--navy-900); }

/* button 手型指標 */
button { cursor: pointer; }

/* section hover 左側金色邊框微提示 */
section { transition: box-shadow 0.35s var(--ease-custom); }
section:hover { box-shadow: inset 3px 0 0 var(--gold-500); }

/* gallery / dock / toc focus */
.gallery-btn:focus-visible,
.dock-node:focus-visible,
.toc-link:focus-visible {
    outline: 2px solid var(--gold-500);
    outline-offset: 2px;
}
