/* --- CSS Variables 简约配色定义 --- */
:root {
    --bg-color: #f9f7f1;       /* 奶油米白 */
    --text-primary: #333333;   /* 深炭灰 */
    --text-secondary: #666666; /* 次级灰 */
    --accent-color: #cba0aa;   /* 干枯玫瑰粉 */
    --nav-height: 70px;
    --transition-smooth: all 0.5s cubic-bezier(0.4, 0.0, 0.2, 1); /* App级丝滑过渡曲线 */
/* 优先使用 KaiTi (Windows), STKaiti (Mac), 没找到就用通用楷体 */
    --font-hand: 'KaiTi', 'STKaiti', '楷体', 'SimKai', 'BiauKai', 'Noto Serif SC', serif;
}

/* --- 基础设定 --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Lato', 'Noto Serif SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100vh; /* 确保满屏，防止滚动条跳动 */
    display: flex;
    flex-direction: column;
}
h1, h2, h3 { font-family: 'Noto Serif SC', serif; font-weight: 700; }

/* --- 导航栏 (固定顶部) --- */
.navbar {
    height: var(--nav-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    background: rgba(249, 247, 241, 0.9); /* 半透明背景 */
    backdrop-filter: blur(10px); /* 毛玻璃效果 */
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.nav-brand { font-family: 'Noto Serif SC'; font-weight: 700; font-size: 1.5rem; color: var(--accent-color); }
.nav-links { list-style: none; display: flex; gap: 30px; }
.nav-links li {
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    position: relative;
    padding: 5px 0;
}
.nav-links li:hover { color: var(--text-primary); }
/* 选中状态：底部粉色小横条 */
.nav-links li.active { color: var(--text-primary); }
.nav-links li.active::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
    background-color: var(--accent-color);
    animation: slideIn 0.3s ease forwards;
}

/* --- 核心交互：视图切换机制 --- */
#main-container {
    flex: 1;
    position: relative;
    margin-top: var(--nav-height); /* 留出导航栏位置 */
    overflow: hidden;
}

/* 所有视图默认隐藏且透明 */
.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px); /* 初始稍微向下偏移 */
    transition: var(--transition-smooth);
    padding: 40px 5%;
    overflow-y: auto; /* 每个视图内部可滚动 */
}

/* 激活视图状态：显示、不透明、位置回正 */
.view.active-view {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    z-index: 10;
}

/* --- 通用内容样式 --- */
.content-wrapper { max-width: 900px; margin: 0 auto; padding-bottom: 60px; }
h2 { font-size: 2rem; margin-bottom: 20px; text-align: center; }
.section-intro { text-align: center; margin-bottom: 40px; color: var(--text-secondary); }

/* --- VIEW 1: 首页特定样式 --- */
.avatar-box {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* 两个头像之间的距离 */
    margin-bottom: 30px; /* 离大标题的距离 */
}

.avatar {
    width: 100px;  /* 头像大小，可根据需要调整 */
    height: 100px;
    border-radius: 50%; /* 圆形 */
    object-fit: cover; /* 保证图片不变形 */
    border: 3px solid #fff; /* 白边框，显得精致 */
    box-shadow: 0 4px 15px rgba(0,0,0,0.15); /* 阴影 */
    transition: transform 0.3s ease;
}

/* 鼠标放上去有个可爱的小互动 */
.avatar:hover {
    transform: rotate(10deg) scale(1.1);
    z-index: 1;
}

/* --- 首页标题优化 --- */
.hero-content h1 {
    font-size: 3.2rem;
    font-weight: 400;
    letter-spacing: 2px;
    margin-bottom: 40px; /* 留出空间给计时器 */
    color: var(--text-primary);
}

/* --- 计时器区域容器 --- */
.timer-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* 拉开一点距离，显得不拥挤 */
    margin-top: 50px; /*稍微往上提一点，靠近标题 */
}

/* 1. 你的选择：方案 B (浪漫衬线风格) */
.timer-intro {
    font-family: 'Noto Serif SC', serif;
    font-style: italic;
    font-size: 1.4rem;          /* 稍微再大一点点 */
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

/* 装饰线：做成精致的淡粉色细线 */
.timer-intro::after {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: var(--accent-color);
    margin: 8px auto 0;
    opacity: 0.6;
}

/* --- 计时器主体 --- */
#hero-timer {
    display: flex;
    align-items: flex-end; /* 底部对齐 */
    gap: 25px; /* 数字组之间的间距 */
}

.t-block {
    display: flex;
    flex-direction: column; /* 上下排列：数字在上，单位在下 */
    align-items: center;
}

/* 2. 数字优化：书卷气衬线体 */
.t-block span {
    font-family: 'Noto Serif SC', serif; /* 关键：换成衬线体 */
    font-size: 2.8rem;
    font-weight: 500;            /* 稍微加点重，显得庄重 */
    color: #2c2c2c;              /* 接近黑色，像墨水色 */
    line-height: 1;
    
    /* 【专业技巧】开启等宽数字，防止秒数跳动时左右抖动 */
    font-variant-numeric: tabular-nums; 
    min-width: 1.4ch;            /* 最小宽度保底 */
}

/* 3. 单位优化：极小的大写字母，像注脚 */
.t-block label {
    font-family: 'Lato', sans-serif; /* 单位保留无衬线体，形成对比 */
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: #999;
    margin-top: 8px;
    text-transform: uppercase;
}

/* 4. 分隔符优化：去掉斜杠，改用优雅的竖线 */
.t-sep {
    font-size: 2rem;
    font-weight: 400;            /* 稍微加粗一点 */
    color: var(--accent-color);  /* 使用主题粉色 */
    opacity: 1;                  /*以此保证完全不透明，最清晰 */
    margin-bottom: 18px;         /* 调整垂直位置，跟数字底部对齐 */
    font-family: 'Noto Serif SC', serif;
    text-shadow: 0 2px 5px rgba(203, 160, 170, 0.3); /* 加一点淡淡的粉色光晕 */
}

/* 适配移动端 */
@media screen and (max-width: 768px) {
    .timer-intro { font-size: 1.1rem; }
    #hero-timer { gap: 12px; }
    .t-block span { font-size: 2rem; }
    .t-sep { font-size: 1.5rem; margin-bottom: 10px; }
    .t-block label { font-size: 0.5rem; }
}

/* 更新动画序列 (配合 HTML 中的 fade-up-N) */
.fade-up-1 { opacity: 0; animation: fadeUp 0.8s 0.1s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up-2 { opacity: 0; animation: fadeUp 0.8s 0.3s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up-3 { opacity: 0; animation: fadeUp 0.8s 0.5s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up-4 { opacity: 0; animation: fadeUp 0.8s 0.7s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up-5 { opacity: 0; animation: fadeUp 0.8s 0.9s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }


/* --- 3. 音乐播放按钮 (网易云黑胶风格) --- */
.music-btn {
    position: fixed;
    /* ✅ 修改点 1：移到右下角，避免遮挡顶部文字 */
    top: 90px;
    left: 25px;
    
    width: 50px; 
    height: 50px;
    
    /* 黑胶唱片底色 */
    background: #181818; 
    /* 模拟黑胶的纹理圈圈 (可选) */
    background-image: repeating-radial-gradient(
      #181818 0, 
      #181818 2px, 
      #282828 3px, 
      #181818 4px
    );
    
    border-radius: 50%;
    
    /* 居中专辑图 */
    display: flex; 
    justify-content: center; 
    align-items: center;
    
    cursor: grab; /* ✅ 修改点 2: 鼠标变成抓手形状，暗示可拖拽 */
    z-index: 1000;
    
    /* 阴影：让它看起来浮在页面上 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    
/* ✅ 修改点 3: 关键！只对变形和阴影做过渡，绝对不要写 'all' */
    /* 否则拖拽时按钮会慢半拍，很难受 */
    transition: transform 0.3s, box-shadow 0.3s;

    /* 解决移动端点击高亮问题 */
    -webkit-tap-highlight-color: transparent;

    /* 防止拖拽时选中页面文字 */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.music-btn img {
    pointer-events: none; 
}

/* 拖拽时的样式 (JS会添加这个类) */
.music-btn.dragging {
    cursor: grabbing;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    transform: scale(1.1); /* 拖起来时稍微变大一点 */
    transition: none; /* 拖拽时由 JS 实时控制，不需要 CSS 过渡 */
}

/* 鼠标悬停时的可爱效果 */
.music-btn:hover {
    transform: scale(1.1); /* 稍微变大 */
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* 唱片中间的图片 (专辑封面) */
.music-btn .album-art {
    width: 65%;   /* 图片占唱片的 65%，留出黑色边框 */
    height: 65%;
    border-radius: 50%; /* 圆形图片 */
    object-fit: cover;
    border: 2px solid #000; /* 图片和黑胶之间的分割线 */
}

/* --- 旋转动画状态 --- */

/* 定义旋转动画：3秒一圈，匀速 */
@keyframes diskRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 当添加了 .playing 类时 (音乐播放中) */
.music-btn.playing {
    /* 这里的 animation 应用在按钮本身上，带动里面的图片一起转 */
    animation: diskRotate 4s linear infinite;
    /* 播放时加一点粉色的光晕，提示正在播放 */
    box-shadow: 0 0 15px rgba(203, 160, 170, 0.6);
    border-color: var(--accent-color);
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .music-btn {
        bottom: 80px; /* 手机上稍微提搞一点，避开某些浏览器的底部工具栏 */
        right: 20px;
        width: 45px;
        height: 45px;
    }
}


#home {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0; /* 首页全屏，不需要padding */
}
.hero-bg {
    position: absolute; top:0; left:0; width:100%; height:100%;
    /* 【替换】首页大图 */
    background: url('./assets/background.jpg') center/cover;
    opacity: 0.2; /* 降低背景透明度，突出文字 */
    z-index: -1;
}
.hero-content h1 { font-size: 3.5rem; margin-bottom: 15px; }
.subtitle { font-size: 1.2rem; color: var(--text-secondary); font-weight: 300; }
.heart-beat { font-size: 3rem; color: var(--accent-color); margin-top: 30px; animation: pulse 1.5s infinite ease-in-out; }

/* --- VIEW 2: 时光轴样式 --- */
.timeline-box { border-left: 2px solid rgba(203, 160, 170, 0.3); padding-left: 30px; margin-top: 40px; }
.tl-item { position: relative; margin-bottom: 40px; }
/* 时光轴圆点 */
.tl-item::before {
    content: ''; position: absolute; left: -36px; top: 5px; width: 10px; height: 10px;
    background: var(--bg-color); border: 2px solid var(--text-secondary); border-radius: 50%;
    transition: all 0.3s ease;
}
/* 高亮关键节点 */
.tl-item.highlight::before { background: var(--accent-color); border-color: var(--accent-color); box-shadow: 0 0 0 4px rgba(203, 160, 170, 0.2); }
.tl-date { font-family: 'Noto Serif SC'; font-weight: 700; color: var(--accent-color); display: block; margin-bottom: 5px; }
.tl-item h3 { font-size: 1.3rem; margin-bottom: 10px; }

/* --- VIEW 3: 相册样式 --- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.photo-frame {
    aspect-ratio: 1 / 1; /* 正方形构图 */
    overflow: hidden; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); cursor: pointer;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
/* 悬停轻微放大 */
.photo-frame:hover img { transform: scale(1.05); }

/* --- 信笺 (手写笔记风格美化) --- */
/* 1. 让信笺页面的容器变成弹性盒子，且占满高度 */
#letter {
    display: flex;
    flex-direction: column;
    /* 保证容器至少有一屏高，这样才能居中 */
    min-height: 100%; 
    /* 覆盖掉默认的 padding，由内部 wrapper 控制，防止双重间距 */
    padding: 0; 
}

/* 2. 让包裹信纸的容器“自动”居中 */
#letter .content-wrapper {
    /* 关键魔法：margin: auto 在 flex 容器中会实现水平+垂直完美居中 */
    /* 当文字变多超过屏幕高度时，它会自动转为顶部对齐并允许滚动 */
    margin: auto; 
    
    width: 100%;
    /* 给上下留一点呼吸空间，防止信纸贴着屏幕边缘 */
    padding: 40px 20px; 
}

.letter-paper {
    height: auto; /* 关键：随内容自动扩长 */
    min-height: 400px; /* 给个最小高度，没字的时候也不至于太扁 */
    
    /* 保持之前的样式，确保背景线随高度自动延伸 */
    background-repeat: repeat;
    position: relative;
    /* 1. 纸张底色：柔和的米白色 */
    background-color: #fdfaf5;

    /* 2. 绘制信纸横线 (CSS魔法) */
    /* 使用重复线性渐变来创建线条 */
    --line-spacing: 44px; /* 定义行间距变量，方便统一调整 */
    --line-color: rgba(220, 180, 180, 0.4); /* 淡粉色的线条 */
    
    background-image: repeating-linear-gradient(
        to bottom,
        var(--line-color),
        var(--line-color) 1px, /* 线条高度为 1px */
        transparent 1px,
        transparent var(--line-spacing) /* 透明区域填充到下一行开始 */
    );
    
    /* 调整背景起始位置，让第一行字在第一条线下面 */
    background-position: 0 1.2em;

    /* 3. 纸张质感与边框 */
    /* 内边距需要精细调整，确保文字与线条对齐 */
    padding: 80px 40px 40px; 
    border-radius: 4px;
    /* 复合阴影，营造纸张浮起和微微卷曲的效果 */
    box-shadow: 
        0 2px 10px rgba(0,0,0,0.05), 
        0 10px 30px -10px rgba(0,0,0,0.1);

    /* 4. 默认文字样式 */
    font-family: var(--font-hand); /* 这里会自动应用上面定义的楷体 */
        
    /* ✅ 修改点 1：楷体字号可以稍微大一点点，看着更清楚 */
    font-size: 1.4rem; 

    /* ✅ 修改点 2：楷体本身颜色较淡，稍微加深一点墨水色 */
    color: #4a3c38; 

    /* ✅ 修改点 3：行高保持不变，依然对齐格子 */
    line-height: var(--line-spacing);

    /* ✅ 修改点 4：楷体比较方正，字间距稍微收一点，不像行书那么散 */
    letter-spacing: 1px;
}

/* 信笺标题 */
.letter-paper h2 {
    /* 标题使用更正式的衬线体，与正文形成对比 */
    font-family: var(--font-serif);
    font-size: 2rem;
    color: #333;
    text-align: center;
    /* 确保标题也占据整数倍的行高，保持对齐 */
    line-height: var(--line-spacing);
    margin-bottom: var(--line-spacing); /* 空一行 */
}

/* 信笺正文 */
.letter-content p {
    margin-bottom: var(--line-spacing); /* 段落间空一行 */
}

/* 用于“酸、苦、辣”：透明度降低且模糊 */
.effect-blur {
    opacity: 0.4;           /* 降低透明度，数值越小越透明 (0.0 - 1.0) */
    filter: blur(1.2px);    /* 添加高斯模糊，数值越大越模糊 */
    display: inline-block;  /* 确保 blur 滤镜在某些浏览器中正确应用于内联元素 */
    transform: scale(0.95); /* 稍微缩小一点，增强“退后”的感觉 (可选) */
}

/* 用于“甜”：加重强调 */
.effect-sweet {
    font-weight: 900;       /* 字重设为最大，让字体变粗 */
    font-size: 1.2em;       /* 字体稍微放大一点点 */
    color: #ff5e78;         /* 换一个看起来很“甜”的粉红色 (可选，不喜欢可以删掉) */
    text-shadow: 1px 1px 2px rgba(255, 94, 120, 0.3); /* 添加一点柔和的甜蜜光晕 (可选) */
    margin: 0 2px;          /* 增加一点左右间距，让它更突出 */
}

/* 落款部分 */
.signature-box {
    margin-top: calc(var(--line-spacing) * 2); /* 空两行 */
    text-align: center;
    color: #ff8e9e; /* 粉色文字 */
    
    /* 使用 flex 布局来绘制两侧的横线 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 两侧的横线 (伪元素) */
.signature-box::before,
.signature-box::after {
    content: '';
    display: block;
    width: 40px; /* 线条长度 */
    height: 1px;
    background-color: #ffd1d8; /* 浅粉色线条 */
    margin: 0 15px; /* 与文字的间距 */
}

.signature-text {
    font-size: 1.4rem;
    /* 手写体的对齐可能需要微调，这里向上提一点点 */
    position: relative;
    top: -2px;
}

/* 日期 */
.letter-date {
    text-align: right;
    /* 日期使用清晰的无衬线体 */
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: #aaa;
    margin-top: var(--line-spacing);
    font-weight: 300;
    letter-spacing: 1px;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .letter-paper {
        /* 手机上缩小字号和间距 */
        --line-spacing: 38px;
        padding: 70px 25px 30px;
        font-size: 1.2rem;
    }
    .letter-paper h2 {
        font-size: 1.6rem;
    }
    .signature-text {
        font-size: 1.2rem;
    }
    /* 手机上两侧横线短一点 */
    .signature-box::before,
    .signature-box::after {
        width: 25px;
    }
}


/* --- 动画 Keyframes --- */
@keyframes slideIn { from { width: 0; } to { width: 100%; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
/* 首页文字入场动画 */
.fade-up-1 { opacity: 0; animation: fadeUp 0.8s 0.2s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up-2 { opacity: 0; animation: fadeUp 0.8s 0.4s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
.fade-up-3 { opacity: 0; animation: fadeUp 0.8s 0.6s forwards cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .navbar { padding: 0 20px; }
    .nav-brand { font-size: 1.2rem; }
    .nav-links { gap: 15px; }
    .nav-links li { font-size: 0.9rem; }
    .hero-content h1 { font-size: 2.5rem; }
    .letter-paper { padding: 30px; }
}