/* =========================================
   1. 字体设置
   ========================================= */
@font-face {
    font-family: 'JuanaCustom';
    src: url('J-Extralight.woff2') format('woff2'); 
    font-weight: 200; font-style: normal; font-display: swap;
}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;1,400&family=Noto+Serif+SC:wght@300;400;600&display=swap');

/* =========================================
   2. 全局变量 & 配色
   ========================================= */
:root {
    --bg-color: #FAF5EF;      
    --dark-bg: #FFDAB9;       /* 统一底部背景 */
    
    --primary-color: #E34234; 
    --text-color: #5A4D4D;    
    --light-text: #2C241B;    
    --fab-color: #6B2E7F;     
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    color: var(--light-text);
    overflow-x: hidden; 
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   3. Hero 区域
   ========================================= */
.hero-wrapper {
    position: relative; width: 100%; height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background-color: var(--bg-color);
    overflow: hidden; z-index: 10;
}

/* 底部过渡 */
.hero-wrapper::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 100%; height: 35vh; 
    background: linear-gradient(to bottom, 
        rgba(255, 218, 185, 0) 0%, 
        rgba(255, 218, 185, 0.6) 60%, 
        #FFDAB9 100% 
    );
    pointer-events: none; z-index: 5;
}

/* 背景光斑 */
.hero-blobs { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; transition: transform 0.1s ease-out; will-change: transform; }
.blob-1 { width: 600px; height: 600px; background: #A5F3FC; top: -10%; left: 10%; } 
.blob-2 { width: 500px; height: 500px; background: #CCFBF1; bottom: 10%; right: 10%; } 
.blob-3 { width: 400px; height: 400px; background: #E0F2FE; top: 40%; left: 40%; } 

/* --- 标题容器 --- */
.title-container {
    z-index: 10;
    display: flex;
    align-items: flex-end; /* 底部对齐 */
    justify-content: center;
    width: 100%;
    max-width: 1400px;
    margin-top: -5vh;
    padding: 0 20px;
    gap: 20px;
}

/* 1. 左侧：滚筒问候语 */
.greeting-drum {
    flex: 1; 
    display: flex;
    justify-content: flex-end; 
    height: 1.5em; 
    overflow: visible; 
    position: relative;
    text-align: right;
    
    /* 左侧文字位置微调 */
    transform: translateY(12px); 
}

.greeting-track {
    position: relative;
    width: 100%; 
    text-align: right;
}

.drum-item {
    position: absolute; bottom: 0; right: 0;
    font-family: 'JuanaCustom', 'Playfair Display', 'Noto Serif SC', serif;
    font-size: clamp(40px, 9vw, 140px);
    color: var(--primary-color);
    line-height: 1;
    opacity: 0;
    transform: translateY(100%) rotateX(-90deg);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    transform-origin: center bottom;
    padding-bottom: 0;
}

.drum-item.active { opacity: 1; transform: translateY(0) rotateX(0deg); }
.drum-item.exit { opacity: 0; transform: translateY(-100%) rotateX(90deg); }

/* 2. 右侧：Zaki 名字 */
.static-name {
    flex: 1; 
    text-align: left; 
    font-family: 'JuanaCustom', 'Playfair Display', serif;
    font-size: clamp(40px, 9vw, 140px);
    font-weight: 200;
    color: var(--primary-color);
    line-height: 0.85; 
    margin: 0;
    letter-spacing: -0.02em;
    transform: translateY(0);
}

/* 内容区域 */
.content-area {
    z-index: 10; text-align: center; margin-top: 40px;
    opacity: 0; animation: fadeIn 1.5s ease 1s forwards;
    padding: 0 20px;
}
@keyframes fadeIn { to { opacity: 1; } }

.subtitle-text {
    font-family: 'Playfair Display', serif; font-style: italic;
    font-size: 1.3rem; color: var(--text-color); line-height: 1.6; letter-spacing: 0.05em;
}

/* Scroll 箭头 */
.scroll-indicator {
    position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; 
    gap: 15px; 
    text-decoration: none; z-index: 20; opacity: 0; animation: fadeIn 1s ease 2s forwards;
}
.scroll-text {
    font-family: 'Inter', sans-serif; font-size: 0.75rem; 
    text-transform: uppercase; letter-spacing: 0.2em; color: var(--primary-color);
}
.arrow-icon {
    width: 20px; height: 20px; border: solid var(--primary-color); border-width: 0 2px 2px 0;
    transform: rotate(45deg); animation: retroScroll 1.5s infinite ease-in-out;
}
@keyframes retroScroll {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50% { transform: rotate(45deg) translate(6px, 6px); }
}

/* =========================================
   4. 内容区域
   ========================================= */
.dark-section {
    position: relative; 
    background-color: var(--dark-bg);
    color: var(--light-text);
    width: 100%; padding: 100px 5% 80px; z-index: 1;
}
.container { max-width: 1100px; margin: 0 auto; position: relative; z-index: 3; }

/* =========================================
   5. About
   ========================================= */
.lang-switch-wrapper { position: absolute; top: 0; right: 0; z-index: 20; }
.lang-btn {
    background: none; border: 1px solid #2C241B; border-radius: 20px;
    padding: 6px 16px; color: #2C241B; font-family: 'Inter', sans-serif; font-size: 0.8rem;
    cursor: pointer; transition: all 0.3s ease;
}
.lang-btn:hover { background-color: rgba(44,36,27, 0.1); }
.lang-btn span.active { font-weight: 700; text-decoration: underline; }

.about-wrapper { position: relative; margin-bottom: 80px; }
.story-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 60px; align-items: center; }
.about-image-wrapper { width: 100%; aspect-ratio: 4/5; overflow: hidden; border-radius: 4px; box-shadow: 15px 15px 0px rgba(44,36,27, 0.1); }
.about-image-wrapper img { width: 100%; height: 100%; object-fit: cover; opacity: 0.95; }
.story-text { text-align: left; padding-top: 20px; }
.story-paragraph {
    font-family: 'Playfair Display', 'Noto Serif SC', serif;
    font-size: 2rem; line-height: 1.5; font-weight: 400; color: #2C241B; margin-bottom: 25px;
}
.story-paragraph.small {
    font-size: 1.05rem; opacity: 0.85; margin-top: 15px; font-family: 'Inter', 'Noto Serif SC', sans-serif; line-height: 1.8;
}

/* =========================================
   6. Education
   ========================================= */
.edu-section { margin-top: 60px; padding-top: 60px; border-top: 1px solid rgba(44,36,27, 0.15); }
.edu-title {
    font-family: 'Inter', sans-serif; font-size: 0.85rem; text-transform: uppercase; 
    letter-spacing: 0.2em; margin-bottom: 50px; opacity: 0.6; text-align: center;
}
.edu-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 50px; align-items: flex-start; }
.edu-item {
    display: flex; flex-direction: column; align-items: center; gap: 15px;
    opacity: 0.8; transition: all 0.3s; text-align: center;
    text-decoration: none !important; color: inherit !important; cursor: pointer; flex: 1; min-width: 150px;
}
.edu-item:hover { opacity: 1; transform: translateY(-5px); }
.edu-icon-wrapper { height: 90px; display: flex; align-items: center; justify-content: center; }
.edu-logo-img { height: 55px; width: auto; display: block; object-fit: contain; }
.edu-logo-img.ntu-special { height: 80px; }
.edu-icon { font-size: 3rem; line-height: 1; display: block; }
.edu-info-text { display: flex; flex-direction: column; gap: 4px; }
.edu-school { font-family: 'Inter', 'Noto Serif SC', sans-serif; font-weight: 600; font-size: 0.95rem; }
.edu-major { font-family: 'Inter', 'Noto Serif SC', sans-serif; font-size: 0.85rem; opacity: 0.7; }

/* =========================================
   7. Social Section
   ========================================= */
.social-section-wrapper {
    background-color: var(--dark-bg);
    padding-bottom: 100px;
    margin-top: -40px;
}
.section-label-line {
    font-family: 'Inter', sans-serif; font-size: 0.85rem; text-transform: uppercase;
    letter-spacing: 0.1em; opacity: 0.5; margin-bottom: 40px; 
    border-top: 1px solid rgba(44,36,27, 0.15); padding-top: 40px; color: #2C241B;
}

.social-flex-container {
    display: flex;
    flex-direction: row; 
    flex-wrap: wrap;     
    justify-content: space-between;
    gap: 20px;
}

.social-card {
    flex: 1;
    min-width: 220px;
    background: rgba(255,255,255, 0.4);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none !important; color: #2C241B !important;
    transition: all 0.3s ease;
}
.social-card:hover { background: #fff; transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.05); }

.social-icon-box {
    width: 48px; height: 48px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(44,36,27, 0.05); color: #2C241B; transition: all 0.3s;
}
.social-card:hover .linkedin-bg { background: #0077b5; color: white; }
.social-card:hover .xhs-bg { background: #ff2442; color: white; }
.social-card:hover .douyin-bg { background: #000; color: white; }
.social-card:hover .github-bg { background: #24292e; color: white; }

.social-info h3 { font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600; margin-bottom: 3px; }
.social-info .s-desc { font-size: 0.8rem; opacity: 0.7; font-family: 'Inter', sans-serif; }

/* =========================================
   8. Gallery (更新：加入第7张图的逻辑)
   ========================================= */
.gallery-wrapper {
    position: relative; width: 100%; height: 600px;
    display: flex; justify-content: center; align-items: center; margin: 20px 0 0px;
}
.photo-pile-container {
    position: relative; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
}
.photo-card {
    position: absolute; display: block;
    width: 500px; height: 300px;
    border: 8px solid #fff; border-radius: 4px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    background-color: #fff;
    left: 50% !important; top: 50%; margin-top: -150px;
    transform: translateX(-50%) rotate(0deg) scale(0.9);
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer; transform-origin: center center;
}
.photo-card-img { width: 100%; height: 100%; background-size: cover; background-position: center; }

/* Desktop Pile Logic (堆叠逻辑) */
.photo-card:nth-child(1) { transform: translateX(-50%) rotate(-8deg) scale(0.9); z-index: 1; }
.photo-card:nth-child(2) { transform: translateX(-50%) rotate(-4deg) scale(0.93); z-index: 2; }
.photo-card:nth-child(3) { transform: translateX(-50%) rotate(0deg) scale(0.96); z-index: 3; }
.photo-card:nth-child(4) { transform: translateX(-50%) rotate(4deg) scale(0.93); z-index: 2; }
.photo-card:nth-child(5) { transform: translateX(-50%) rotate(8deg) scale(0.9); z-index: 1; }
.photo-card:nth-child(6) { transform: translateX(-50%) rotate(-2deg) scale(0.95); z-index: 2; }
/* 🟢 新增：第7张图片样式 */
.photo-card:nth-child(7) { transform: translateX(-50%) rotate(3deg) scale(0.97); z-index: 3; }

/* 电脑端悬停展开 */
.photo-pile-container:hover .photo-card {
    left: var(--left) !important; top: 50%;
    transform: translateX(-50%) translateY(var(--y)) rotate(var(--rot)) scale(1);
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}
.photo-pile-container:hover .photo-card:hover {
    z-index: 100 !important;
    transform: translateX(-50%) translateY(-20px) scale(1.15) rotate(0deg) !important;
    border-color: #fff; box-shadow: 0 35px 80px rgba(0,0,0,0.3);
}
.card-caption {
    position: absolute; top: 100%; left: 0; width: 100%; margin-top: 20px; text-align: center;
    opacity: 0; transform: translateY(-10px); transition: all 0.4s ease 0.1s; pointer-events: none;
}
.caption-text {
    font-family: 'Inter', 'Noto Serif SC', sans-serif; font-size: 0.9rem;
    color: #2C241B; background: rgba(255, 255, 255, 0.6); padding: 6px 14px; border-radius: 20px; backdrop-filter: blur(5px);
}
.photo-card:hover .card-caption { opacity: 1; transform: translateY(0); }

/* =========================================
   9. Projects
   ========================================= */
#projects { padding-top: 0px !important; margin-top: -40px; }
.project-list { display: flex; flex-direction: column; gap: 100px; margin-bottom: 120px; margin-top: 40px; }
.project-item { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 60px; align-items: center; }
.project-item:nth-child(even) { direction: rtl; }
.project-item:nth-child(even) .project-info { direction: ltr; }
.project-preview { width: 100%; aspect-ratio: 16/9; overflow: hidden; border-radius: 8px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); }
.project-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.project-preview:hover img { transform: scale(1.05); }
.project-info { padding: 10px 0; }
.project-name { font-family: 'JuanaCustom', serif; font-size: 2.8rem; margin-bottom: 20px; color: #2C241B; }
.project-desc { font-family: 'Inter', 'Noto Serif SC', sans-serif; font-size: 1.05rem; line-height: 1.6; opacity: 0.8; margin-bottom: 30px; }
.project-link {
    display: inline-block; text-decoration: none; color: #2C241B; border-bottom: 1px solid #2C241B;
    padding-bottom: 4px; font-family: 'Inter', 'Noto Serif SC', sans-serif; font-weight: 500; transition: opacity 0.3s;
}
.project-link:hover { opacity: 0.6; }
.section-label {
    font-family: 'Inter', 'Noto Serif SC', sans-serif; font-size: 0.85rem; text-transform: uppercase;
    letter-spacing: 0.1em; opacity: 0.5; margin-bottom: 40px; border-bottom: 1px solid rgba(44,36,27, 0.1);
    padding-bottom: 20px; color: #2C241B;
}

/* =========================================
   10. Blog
   ========================================= */
.blog-list { display: flex; flex-direction: column; }
.blog-item { display: flex; justify-content: space-between; align-items: center; padding: 30px 0; border-bottom: 1px solid rgba(44,36,27, 0.1); cursor: pointer; transition: all 0.3s ease; text-decoration: none; color: #2C241B; }
.blog-item:hover { background-color: rgba(255,255,255,0.2); padding-left: 15px; }
.blog-meta { font-family: 'Inter', sans-serif; font-size: 0.85rem; opacity: 0.6; width: 140px; }
.blog-content { flex: 1; }
.blog-title { font-family: 'JuanaCustom', serif; font-size: 1.8rem; font-weight: 200; margin-bottom: 8px; }
.blog-tag { font-family: 'Inter', 'Noto Serif SC', sans-serif; font-size: 0.75rem; background-color: rgba(44,36,27,0.05); padding: 4px 10px; border-radius: 4px; opacity: 0.8; }
.blog-thumb { width: 160px; height: 100px; border-radius: 4px; overflow: hidden; margin-left: 30px; opacity: 0; transform: translateX(20px); transition: all 0.4s ease; }
.blog-thumb img { width: 100%; height: 100%; object-fit: cover; }
.blog-item:hover .blog-thumb { opacity: 1; transform: translateX(0); }

/* =========================================
   11. FAB Menu
   ========================================= */
.fab-menu-container { position: fixed; bottom: 40px; left: 40px; z-index: 99; }
.fab-btn {
    width: 50px; height: 50px; background-color: var(--fab-color); color: white; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; font-size: 24px; cursor: pointer;
    box-shadow: 0 4px 12px rgba(107, 46, 127, 0.4); transition: transform 0.3s ease; user-select: none;
}
.fab-btn:hover { transform: scale(1.1); }
.fab-options {
    position: absolute; bottom: 65px; left: 0; display: flex; flex-direction: column; gap: 10px;
    opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
.fab-options.active { opacity: 1; visibility: visible; transform: translateY(0); }
.fab-link {
    background-color: white; color: var(--fab-color); padding: 8px 16px; border-radius: 20px;
    text-decoration: none; font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); white-space: nowrap; opacity: 0; transform: translateX(-10px); transition: all 0.3s ease;
}
.fab-options.active .fab-link { opacity: 1; transform: translateX(0); }
.fab-link:hover { background-color: var(--fab-color); color: white; }
.fab-options.active .fab-link:nth-child(1) { transition-delay: 0.15s; }
.fab-options.active .fab-link:nth-child(2) { transition-delay: 0.1s; }
.fab-options.active .fab-link:nth-child(3) { transition-delay: 0.05s; }

/* =========================================
   12. 手机端全站适配 (核心修复版)
   ========================================= */
@media (max-width: 768px) {
    /* --- Hero 区域 --- */
    .hero-wrapper { height: 90vh; }
    
    .title-container { 
        flex-direction: column; 
        align-items: center; 
        justify-content: center;
        gap: 0; 
        margin-top: -5vh;
        width: 100%;
        padding: 0 10px;
    }

    /* 滚筒问候语 (修复乱码) */
    .greeting-drum {
        width: 100%;
        height: 1.4em; 
        justify-content: center;
        align-items: flex-end;
        /* 手机端重置位置 */
        transform: translateY(0); 
    }
    .greeting-track { 
        width: 100%; 
        min-width: 0;
        text-align: center; 
    }
    .drum-item { 
        position: absolute; 
        left: 0; right: 0; margin: auto;
        width: 100%; 
        font-size: 14vw; 
        text-align: center;
        /* 🔴 移除 opacity: 1 !important，恢复JS动画 */
        opacity: 0; 
        transform: translateY(100%) rotateX(-90deg);
        transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .drum-item.active { opacity: 1; transform: translateY(0) rotateX(0deg); }
    .drum-item.exit { opacity: 0; transform: translateY(-100%) rotateX(90deg); }

    /* Zaki 名字 */
    .static-name { 
        font-size: 38vw; 
        line-height: 1;
        margin-top: -1px; 
        text-align: center;
        transform: translateY(0);
    }

    .subtitle-text { font-size: 0.9rem; padding: 0 10px; margin-top: 30px; }
    
    /* --- About --- */
    .dark-section { padding: 60px 20px; }
    .story-grid { grid-template-columns: 1fr; gap: 40px; }
    .about-image-wrapper { aspect-ratio: 16/9; margin-top: 20px; }
    .lang-switch-wrapper { position: static; margin-bottom: 20px; text-align: right; }
    .story-paragraph { font-size: 1.6rem; }

    /* --- Education --- */
    .edu-grid { flex-direction: column; gap: 40px; }
    .edu-item { width: 100%; }
    .edu-icon-wrapper { height: auto; margin-bottom: 10px; }

    /* --- Social (修复显示不全) --- */
    .social-section-wrapper { padding-bottom: 60px; }
    .social-flex-container { flex-direction: column; gap: 15px; }
    /* 🔴 核心修复: 宽度 100% 且去掉 min-width */
    .social-card { width: 100%; min-width: 0; padding: 20px; }

    /* --- Gallery (修复交互：改为横向滑动) --- */
    .gallery-wrapper { 
        height: auto; /* 高度自适应 */
        min-height: 350px;
        margin: 20px 0; 
        overflow: hidden; /* 防止撑破页面 */
    }
    .photo-pile-container {
        display: flex;
        flex-direction: row; /* 横向排列 */
        overflow-x: auto;    /* 允许横向滑动 */
        scroll-snap-type: x mandatory; /* 滑动吸附 */
        justify-content: flex-start;
        align-items: flex-start;
        gap: 15px;
        padding-bottom: 20px; /* 给滚动条留位置 */
        width: 100%;
        height: auto;
    }
    .photo-card { 
        position: relative; /* 不再绝对定位 */
        left: auto !important; 
        top: auto !important; 
        margin-top: 0;
        
        /* 卡片大小调整 */
        width: 280px; 
        height: 180px; 
        flex-shrink: 0; /* 防止挤压 */
        
        /* 移除旋转 */
        transform: none !important; 
        scroll-snap-align: center;
    }
    /* 禁用 hover 效果防止错位 */
    .photo-pile-container:hover .photo-card { left: auto !important; transform: none !important; }
    /* 标题始终显示 */
    .card-caption { opacity: 1; transform: translateY(0); margin-top: 10px; }

    /* --- Projects --- */
    .project-item { grid-template-columns: 1fr; gap: 30px; margin-bottom: 60px; }
    .project-item:nth-child(even) { direction: ltr; }
    .project-name { font-size: 2.2rem; }
    
    /* --- Blog & FAB (修复留白) --- */
    .blog-item { flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px 0; }
    .blog-meta { width: 100%; margin-bottom: 0; }
    .blog-thumb { display: none; }
    .fab-menu-container { left: auto; right: 20px; bottom: 30px; }
    .fab-options { left: auto; right: 0; align-items: flex-end; }
}

/* =========================================
   13. Article Page Styles
   ========================================= */
.article-container { max-width: 800px; margin: 0 auto; padding: 120px 20px; }
.article-header { text-align: center; margin-bottom: 80px; }
.article-meta { font-family: 'Inter', sans-serif; font-size: 0.9rem; color: #2C241B; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 20px; }
.article-title { font-family: 'JuanaCustom', serif; font-size: 3.5rem; line-height: 1.1; color: #2C241B; margin-bottom: 40px; }
.article-cover { width: 100%; height: auto; border-radius: 4px; margin-bottom: 60px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); }
.article-body { font-family: 'Noto Serif SC', 'Inter', serif; font-size: 1.2rem; line-height: 1.8; color: #2C241B; }
.article-body p { margin-bottom: 30px; }
.article-body h2 { font-family: 'JuanaCustom', serif; font-size: 2rem; margin-top: 60px; margin-bottom: 30px; }
.article-body img { width: 100%; height: auto; border-radius: 4px; margin: 40px 0; }
.article-footer { margin-top: 100px; padding-top: 60px; border-top: 1px solid rgba(44,36,27, 0.1); text-align: center; }