@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@400;500;600;700&display=swap');

:root {
    /* Colors - 恢復原始 Earthy 配色 */
    --background: #F9F8F4;      /* Warm Alabaster */
    --foreground: #2D3A31;      /* Deep Forest Green */
    --primary: #8C9A84;         /* Sage Green */
    --secondary: #DCCFC2;       /* Soft Clay / Mushroom */
    --border: #E6E2DA;          /* Stone */
    --interactive: #C27B66;      /* Terracotta */
    --white: #ffffff;
    
    /* Typography */
    --font-heading: 'Noto Serif TC', serif;
    --font-body: 'Noto Serif TC', serif;
    
    /* Effects */
    --radius-standard: 12px;
    --radius-full: 9999px;
    --shadow-sm: 0 4px 6px -1px rgba(45, 58, 49, 0.05);
    --shadow-lg: 0 20px 40px -10px rgba(45, 58, 49, 0.05);
    
    /* Transitions */
    --transition-fast: all 0.3s ease-out;
    --transition-slow: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    line-height: 1.8;
    color: var(--foreground);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Paper Grain Texture */
.grain-overlay {
    pointer-events: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 9999;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* 統一圖片優化 */
img {
    border-radius: var(--radius-standard);
    max-width: 100%;
    height: auto;
    display: block; /* 移除底部間隙 */
    image-rendering: -webkit-optimize-contrast; /* 改善縮放後的清晰度 */
}

/* --- Layout --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
}

.section {
    padding: 120px 0;
    border-top: 1px solid var(--border);
}

.section:first-of-type {
    border-top: none;
    padding-top: 60px;
}

/* --- Header & Nav (優化效能版) --- */
header {
    background: rgba(249, 248, 244, 0.98); /* 提高不透明度，移除 backdrop-filter 以提升捲動流暢度 */
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    will-change: transform; /* 提示瀏覽器優化層疊 */
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 90px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
}

.logo img {
    height: 50px; /* 強制鎖定 Logo 大小 */
    width: auto;
    border-radius: 0; /* Logo 不加圓角 */
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--foreground);
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.1em;
    transition: var(--transition-fast);
    position: relative;
}

.nav-links a:hover { color: var(--primary); }

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--foreground);
    font-weight: 600;
    line-height: 1.4;
}

h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); margin-bottom: 2rem; font-weight: 700; }
h2 { font-size: 2.2rem; text-align: center; margin-bottom: 60px; }
h3 { font-size: 1.6rem; color: var(--primary); margin-bottom: 20px; }

p { margin-bottom: 1.5rem; text-align: justify; }
.highlight { color: var(--primary); font-weight: 600; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 14px 32px;
    background: var(--foreground);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: var(--interactive);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: var(--white);
}

/* --- History Layout (新版雙欄) --- */
.history-layout {
    display: flex;
    gap: 60px;
    align-items: flex-start;
    position: relative;
}

.timeline-column {
    flex: 1;
    position: relative;
    padding-left: 40px;
}

.timeline-column::before {
    content: '';
    position: absolute;
    left: 7px; top: 10px; bottom: 10px;
    width: 1px;
    background: var(--border);
}

.timeline-item { position: relative; margin-bottom: 32px; }
.timeline-item::after {
    content: '';
    position: absolute;
    left: -38px; top: 8px;
    width: 10px; height: 10px;
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: 50%;
}

.timeline-date {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    display: block;
    margin-bottom: 4px;
}

.media-column {
    flex: 0 0 350px;
    position: sticky;
    top: 120px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.media-box img { border-radius: 0; } /* 歷史照片保持原始要求，無裝飾 */

/* --- Master List (網格) --- */
.filter-container {
    display: grid;
    grid-template-columns: repeat(6, auto);
    gap: 12px;
    margin-bottom: 60px;
    justify-content: center;
}

.filter-btn {
    padding: 10px 20px;
    min-width: 120px;
    text-align: center;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition-fast);
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.master-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 80px 40px;
}

.master-card { display: flex; flex-direction: column; gap: 24px; align-items: flex-start; }
.master-bio { width: 100%; display: flex; align-items: center; gap: 24px; }
.master-photo {
    width: 120px; height: 120px;
    flex-shrink: 0;
    object-fit: cover;
    background-color: var(--border);
    border-radius: var(--radius-standard);
}

.master-info h3 { margin-bottom: 8px; font-size: 1.4rem; }
.master-info p { margin-bottom: 0; color: var(--primary); font-weight: 500; }

.master-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-standard);
    background: #000;
    width: 100%;
}

.master-video-wrapper iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: none;
}

/* --- Lightbox --- */
.lightbox-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: zoom-out;
}

.lightbox-overlay.active { display: flex; }
.lightbox-img { max-width: 90%; max-height: 90%; }
.lightbox-close { position: absolute; top: 20px; right: 30px; color: var(--white); font-size: 40px; cursor: pointer; }
.zoom-trigger { cursor: zoom-in; }

/* --- Mobile Menu --- */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 32px; height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 2000;
}

.menu-toggle span {
    width: 100%; height: 1.5px;
    background: var(--foreground);
    transition: var(--transition-fast);
}

@media (max-width: 1150px) {
    .master-grid { grid-template-columns: repeat(2, 1fr); }
    .history-layout { flex-direction: column; }
    .media-column { position: static; width: 100%; order: -1; margin-bottom: 40px; }
}

@media (max-width: 992px) {
    .menu-toggle { display: flex; }
    .nav-links {
        position: fixed;
        top: 0; right: -100%;
        width: 100%; height: 100vh;
        background: var(--background);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        transition: var(--transition-slow);
        visibility: hidden;
    }
    .nav-links.active { right: 0; visibility: visible; }
    .nav-links a { font-size: 1.5rem; }
    
    .menu-toggle.is-active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.is-active span:nth-child(2) { opacity: 0; }
    .menu-toggle.is-active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

@media (max-width: 768px) {
    .master-grid { grid-template-columns: 1fr; }
    .filter-container { grid-template-columns: repeat(3, auto); }
    .container { padding: 0 20px; }
}

/* --- Animations --- */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Footer 恢復原始居中設定 */
footer {
    padding: 80px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--border);
    color: rgba(45, 58, 49, 0.6);
    font-size: 0.95rem;
}

footer p {
    margin: 0;
    text-align: center;
}
