/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: #f0ece1;
    color: #333;
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 300px;
    background-color: #f7f5ed;
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 40px;
}

.profile-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 头像翻转 */
.avatar-container {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    perspective: 1000px;
}

.avatar-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.avatar-container:hover .avatar-flipper {
    transform: rotateY(180deg);
}

.avatar-front,
.avatar-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.avatar-back {
    transform: rotateY(180deg);
}

.avatar-front img,
.avatar-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.bio {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 40px;
}

.contact-info p {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 社交图标 */
.social-links {
    margin-top: 10vw;
    display: flex;
    gap: 15px;
}

.social-links a {
    display: block;
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.social-links a:hover {
    opacity: 1;
}

.social-links img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.copyright {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 20px;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- Top Nav --- */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    /* 顶部导航背景色，JS中的Canvas清空颜色需与此匹配 */
    background-color: rgba(240, 236, 225, 0.95);
    backdrop-filter: blur(5px);
    height: 80px;
}

/* 左侧导航组 */
.nav-left-group {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-item {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.nav-item:hover {
    color: #b89c72;
}

/* 筛选下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: none;
    border: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.dropbtn .arrow {
    font-size: 0.7rem;
    margin-left: 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 120px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1;
    border-radius: 4px;
    top: 100%;
    left: 0;
    padding: 5px 0;
}

.dropdown-content a {
    color: #333;
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}

.dropdown-content a:hover {
    background-color: #f5f5f5;
    color: #b89c72;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* 中间：Dino Game (修改版) */
.dino-game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 20px;
}

#dinoCanvas {
    /* 背景色设为透明，或者与顶部栏背景色完全一致 */
    background-color: transparent;
    border-bottom: 1px solid #bbb;
    cursor: pointer;
    /* 保持黑白或降低对比度以融入设计 */
    mix-blend-mode: multiply;
}

.game-hint {
    font-size: 0.6rem;
    color: #999;
    margin-top: 2px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    /* 避免遮挡画布点击 */
}

.dino-game-container:hover .game-hint {
    opacity: 1;
}

/* 右侧：语言切换 (修改版 - 图片) */
.lang-switch a {
    text-decoration: none;
    /* 移除边框，只显示图标 */
    border: none;
    padding: 0;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.lang-switch a:hover {
    opacity: 1;
}

.lang-switch img {
    width: 24px;
    height: 24px;
    border-radius: 2px;
    display: block;
}

/* --- Portfolio Grid --- */
.portfolio-grid {
    padding: 20px 60px 80px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 40px;
    row-gap: 60px;
}

.card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.card:hover {
    transform: translateY(-8px);
    opacity: 0.9;
}

.card-image img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    border-radius: 6px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.card-text {
    margin-top: 15px;
}

.card-text h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.card-text p {
    font-size: 0.8rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
}

.category-tag {
    font-weight: 700;
    color: #b89c72;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dino-game-container {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        padding: 40px 30px;
    }

    .social-links {
        margin-top: 40px;
    }

    .top-nav {
        padding: 15px 20px;
        height: auto;
        flex-wrap: wrap;
        gap: 15px;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        padding: 20px 30px;
    }
}

/* ==============================
   1. 作品详情模态框 (Modal) 样式 - 丝滑动画升级版
   ============================== */
.modal-overlay {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    /* 初始背景透明 */
    backdrop-filter: blur(0px);
    /* 初始无模糊 */

    /* 关键：使用 visibility 代替 display，这样动画才能生效 */
    visibility: hidden;
    pointer-events: none;
    /* 隐藏时不响应点击 */

    display: flex;
    /* 保持 flex 布局以便居中 */
    justify-content: center;
    align-items: center;

    /* 丝滑过渡：背景颜色和模糊度 */
    transition: background-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        backdrop-filter 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.5s step-end;
    /* visibility 在动画结束时切换 */
}

.modal-container {
    background-color: #fff;
    width: 90%;
    max-width: 1100px;
    height: 85vh;
    border-radius: 20px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;

    /* 初始状态：稍微缩小并向下偏移，模仿“浮上来”的感觉 */
    opacity: 0;
    transform: scale(0.94) translateY(40px);

    /* 核心动画曲线：ease-out-expo (类似 Apple 的动效) */
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- 激活状态 (Active) --- */
.modal-overlay.active {
    visibility: visible;
    pointer-events: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    /* 背景模糊加深 */
    transition: background-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        backdrop-filter 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s step-start;
    /* 立即显示 */
}

.modal-overlay.active .modal-container {
    opacity: 1;
    transform: scale(1) translateY(0);
    /* 回归正常大小和位置 */
}

/* 关闭按钮 */
.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    cursor: pointer;
    z-index: 10;
    font-size: 20px;
    transition: background 0.3s;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* --- 左侧：图片轮播 --- */
.modal-left-col {
    flex: 1.5;
    /* 占据 60% 左右宽度 */
    background-color: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* 保证图片完整显示 */
    display: none;
    /* 默认隐藏 */
}

.carousel-slide.active {
    display: block;
}

/* 轮播按钮 */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.3s;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

/* 轮播图指示器 */
.carousel-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    pointer-events: none;
}

/* --- 右侧：内容与评论 --- */
.modal-right-col {
    flex: 1;
    /* 占据剩余宽度 */
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #fff;
}

.modal-scroll-area {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    /* 占据除了底部评论框以外的空间 */
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-meta {
    font-size: 0.85rem;
    color: #999;
}

.modal-desc {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.8;
    white-space: pre-line;
    /* 保留换行 */
}

/* 底部评论区 */
.comment-section {
    border-top: 1px solid #eee;
    padding: 20px;
    background: #fafafa;
}

.comment-options {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.comment-input-area {
    display: flex;
    gap: 10px;
}

.comment-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    background: #fff;
    transition: border 0.3s;
}

.comment-input:focus {
    border-color: #b89c72;
}

.send-btn {
    background: #b89c72;
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

.name-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: none;
    /* 默认隐藏 */
}

/* 评论区展示区域 */
.comments-display-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.comments-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
}

.comment-item {
    padding: 15px;
    margin-bottom: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 3px solid #b89c72;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.comment-date {
    font-size: 0.8rem;
    color: #999;
}

.comment-text {
    color: #555;
    line-height: 1.6;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-loading,
.comment-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 0.9rem;
}

/* 滚动条样式 */
.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: #b89c72;
    border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
    background: #a38860;
}

/* ==============================
   2. 技能页 (Skills) Glassmorphism Spotlight Effect
   ============================== */

/* 容器：网格布局 */
/* 容器：网格布局 - 修正对齐 */
.skills-container {
    padding: 60px 40px;
    height: auto;
    background-color: transparent;
    display: block;
    /* 确保最大宽度居中生效 */
}

.skills-grid {
    display: grid;
    /* 每行 4 张卡片 */
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    /* 居中显示，与左右距离相等 */
    padding-bottom: 60px;
}

/* 
   卡片设计 
   - 磨砂玻璃背景
   - Spotlight 光照效果 (通过 CSS 变量 --mouse-x, --mouse-y)
*/
.skill-card {
    position: relative;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 24px;
    cursor: pointer;
    overflow: hidden;
    /* 必须保留 */
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.3s ease;

    /* 玻璃拟态核心 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
    /* 保证卡片有一定高度 */
}

/* 悬停时的 3D 上浮感 */
.skill-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    /* 投影加深 */
    z-index: 2;
    background-color: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
}

/* 
    Spotlight 光层 
    使用 radial-gradient 模拟聚光灯。
    默认透明，由 JS 更新位置
*/
.skill-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 1px;
    /* 撑开 1px 用于做边框高亮效果 */
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y),
            rgba(255, 255, 255, 0.8),
            transparent 40%);
    opacity: 0;
    /* 默认隐藏，JS 移入时控制或者配合 hover */
    transition: opacity 0.5s ease;
    z-index: 1;
    /* 在内容之下，背景之上？不对，要在顶层通过 mask 做边框或者作为 overlay */
    pointer-events: none;

    /* 这里我们用作“表面光泽”，叠加在背景上 */
    mix-blend-mode: overlay;
}

.skill-card:hover::before {
    opacity: 1;
}

/* 内容层 */
.skill-card-content {
    position: relative;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* 悬浮时，如果底图滑上来，文字淡出 */
.skill-card:hover .skill-card-content {
    opacity: 0;
}

/* 
   滑动的底图 (Cover Image)
*/
.skill-cover-slide {
    position: absolute;
    left: 0;
    bottom: -100%;
    /* 默认在底部外 */
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: bottom 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 4;
    /* 盖住内容 */
}

/* 悬浮时滑上来 */
.skill-card:hover .skill-cover-slide {
    bottom: 0;
}

/* --- 卡片内部排版 --- */
.skill-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.skill-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.skill-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

.skill-desc-preview {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* 限制行数 */
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 
   详情模态框的特定调整 (复用 .modal-overlay, 但增加一些 Skills 特有的样式) 
*/
.skill-detail-modal .modal-container {
    max-width: 600px;
    /* 技能详情不需要太宽 */
    height: auto;
    max-height: 80vh;
    padding: 0;
    flex-direction: column;
}

.skill-detail-header {
    padding: 40px 40px 20px 40px;
    background: linear-gradient(135deg, #f7f5ed 0%, #fff 100%);
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.skill-detail-icon {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.skill-detail-title h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.skill-detail-title span {
    color: #888;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.skill-detail-body {
    padding: 30px 40px;
    line-height: 1.8;
    color: #444;
    font-size: 1rem;
    overflow-y: auto;
}

/* 响应式调整 */
@media (max-width: 1400px) {
    .skills-container {
        padding: 60px 60px;
        /* 中等屏幕稍微减小留白 */
    }

    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .skills-container {
        padding: 40px 30px;
        /* 小屏幕减少留白以利用空间 */
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }
}