/* ==========================================
   sntfct.cn — 高级黑白灰设计系统 v2.0
   原则：无彩色 · 留白撑骨架 · 字重建层次 · 细线做分割
   ========================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif; }

/* ===== 灰度调色板 ===== */
:root {
    --black:   #0a0a0a;
    --g900:    #171717;
    --g800:    #262626;
    --g700:    #404040;
    --g600:    #525252;
    --g500:    #737373;
    --g400:    #a3a3a3;
    --g300:    #d4d4d4;
    --g200:    #e5e5e5;
    --g100:    #f5f5f5;
    --g50:     #fafafa;
    --white:   #ffffff;

    --bg:        var(--white);
    --bg-alt:    var(--g50);
    --bg-card:   var(--white);
    --text-1:    var(--g900);
    --text-2:    var(--g600);
    --text-3:    var(--g500);
    --text-4:    var(--g400);
    --line:      var(--g200);
    --line-soft: var(--g100);
    --accent:    var(--g900);
    --accent-soft: var(--g200);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
}

/* ===== 暗色模式 ===== */
[data-theme="night"] {
    --bg:        #0d0d0d;
    --bg-alt:    #141414;
    --bg-card:   #1a1a1a;
    --text-1:    #e5e5e5;
    --text-2:    #a3a3a3;
    --text-3:    #737373;
    --text-4:    #525252;
    --line:      #262626;
    --line-soft: #1e1e1e;
    --accent:    #e5e5e5;
    --accent-soft: #262626;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
}

/* ===== 全局 ===== */
body {
    background: var(--bg);
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
    /* 网格背景 */
    background-image: 
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
    background-size: 80px 80px;
    background-position: -1px -1px;
}

[data-theme="night"] body,
[data-theme="night"] {
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 80px 80px;
    background-position: -1px -1px;
}

::selection { background: var(--text-1); color: var(--bg); }

/* ===== 滚动进度条 ===== */
#scroll-progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0;
    background: var(--text-1); z-index: 9999;
    transition: width 0.1s linear;
}

/* ===== 鼠标光晕 ===== */
#cursor-glow {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
        rgba(0,0,0,0.02) 0%, transparent 50%);
}
[data-theme="night"] #cursor-glow {
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
        rgba(255,255,255,0.03) 0%, transparent 50%);
}

/* ===== 导航栏 ===== */
nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.nav-inner {
    max-width: 1100px; margin: 0 auto; padding: 0 28px;
    height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
    font-size: 1rem; font-weight: 700; letter-spacing: 0.02em;
    text-decoration: none; color: var(--text-1);
}
.nav-logo span { font-weight: 300; color: var(--text-3); }
.nav-links { display: flex; gap: 28px; }
.nav-links a {
    font-size: 0.8rem; font-weight: 500; letter-spacing: 0.05em;
    color: var(--text-3); text-decoration: none; position: relative;
    padding: 4px 0;
    transition: color 0.2s ease;
}
.nav-links a::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 0; height: 1px; background: var(--text-1);
    transition: width 0.2s ease;
}
.nav-links a:hover { color: var(--text-1); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--text-1); }
.nav-links a.active::after { width: 100%; }

/* 移动端 */
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-2); padding: 4px; }
@media (max-width: 768px) {
    .nav-links { display: none; }
    .mobile-toggle { display: flex; }
}
#mobile-menu {
    display: none; padding: 16px 28px 24px; border-top: 1px solid var(--line);
}
#mobile-menu.show { display: block; }
#mobile-menu a {
    display: block; padding: 12px 0; color: var(--text-3);
    text-decoration: none; font-size: 0.9rem;
}
#mobile-menu a:hover { color: var(--text-1); }

/* ===== Hero ===== */
.hero {
    min-height: 100vh; padding: 120px 28px 80px;
    display: flex; align-items: center;
    position: relative;
}
.hero-inner {
    max-width: 1100px; margin: 0 auto; width: 100%;
    display: grid; grid-template-columns: 1.2fr 1fr; gap: 60px; align-items: center;
}
.hero-tag {
    display: inline-block; font-size: 0.65rem; font-weight: 600;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--text-3); margin-bottom: 28px;
    padding: 6px 14px; border: 1px solid var(--line); border-radius: 100px;
}
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 300; line-height: 1.1; letter-spacing: -0.02em;
    margin-bottom: 8px; color: var(--text-1);
}
.hero-title strong { font-weight: 700; }
.hero-title .sub {
    display: block; font-weight: 700; color: var(--text-1);
}
.hero-desc {
    font-size: 1rem; color: var(--text-3); line-height: 1.8;
    max-width: 480px; margin-top: 24px;
}
.hero-actions { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px; font-size: 0.8rem; font-weight: 500;
    letter-spacing: 0.05em; text-decoration: none; border-radius: 2px;
    transition: all 0.2s ease; cursor: pointer; border: none;
}
.btn-primary { background: var(--text-1); color: var(--bg); }
.btn-primary:hover { background: var(--g700); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text-1); border: 1px solid var(--text-1); }
.btn-outline:hover { background: var(--text-1); color: var(--bg); }

/* Hero 头像 */
.hero-avatar { position: relative; display: flex; justify-content: center; }
.hero-avatar-frame {
    width: 100%; max-width: 340px; aspect-ratio: 1; position: relative;
}
.hero-avatar-frame::before {
    content: ''; position: absolute; inset: 0;
    background: var(--g100); border-radius: 4px;
    transform: rotate(4deg); opacity: 0.5;
}
.hero-avatar-frame img {
    position: relative; width: 100%; height: 100%;
    object-fit: cover; border-radius: 4px;
}

@media (max-width: 768px) {
    .hero { padding-top: 100px; }
    .hero-inner { grid-template-columns: 1fr; gap: 40px; text-align: center; }
    .hero-desc { margin: 24px auto 0; }
    .hero-actions { justify-content: center; }
    .hero-avatar-frame { max-width: 240px; }
}

/* ===== Section 通用 ===== */
section { padding: 100px 28px; position: relative; z-index: 2; }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-label {
    font-size: 0.65rem; font-weight: 600; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--text-4); margin-bottom: 12px;
}
.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700;
    letter-spacing: -0.01em; margin-bottom: 8px; color: var(--text-1);
}
.section-desc {
    color: var(--text-3); font-size: 0.9rem; line-height: 1.7;
    max-width: 520px; margin-top: 8px;
}
.section-divider {
    width: 40px; height: 1px; background: var(--text-1);
    margin: 16px 0 0; opacity: 0.3;
}

/* 交替背景 */
section.alt { 
    background: var(--bg);
    background-image: 
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
    background-size: 80px 80px;
    background-position: -1px -1px;
}

/* ===== 关于我 ===== */
.about-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center;
}
.about-image {
    width: 100%; aspect-ratio: 4/3;
    background: var(--g50); border-radius: 4px; overflow: hidden;
}
.about-image img {
    width: 100%; height: 100%; object-fit: cover;
}
.about-text { font-size: 0.95rem; line-height: 1.9; color: var(--text-2); }
.about-text p { margin-bottom: 16px; }
.about-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 32px; }
.about-stat .num { font-size: 2rem; font-weight: 300; color: var(--text-1); }
.about-stat .num sup { font-size: 0.8em; font-weight: 700; vertical-align: baseline; position: relative; top: -0.5em; }
.about-stat .label { font-size: 0.7rem; color: var(--text-4); margin-top: 4px; letter-spacing: 0.05em; }

@media (max-width: 768px) {
    .about-grid { grid-template-columns: 1fr; gap: 40px; }
    .about-stats { grid-template-columns: 1fr; gap: 16px; }
}

/* ===== 技能卡片 ===== */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 48px; }
.skill-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 4px; padding: 32px;
    transition: all 0.3s ease;
}
.skill-card:hover { border-color: var(--text-2); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.skill-icon {
    width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 4px;
    margin-bottom: 20px; color: var(--text-1);
}
.skill-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-1); }
.skill-card p { font-size: 0.85rem; color: var(--text-3); line-height: 1.7; margin-bottom: 20px; }
.skill-bar-wrap { margin-top: 16px; }
.skill-bar-label { display: flex; justify-content: between; font-size: 0.7rem; color: var(--text-4); margin-bottom: 6px; }
.skill-bar { width: 100%; height: 3px; background: var(--g200); border-radius: 2px; overflow: hidden; }
.skill-bar-fill { height: 100%; background: var(--text-1); border-radius: 2px; width: 0; transition: width 1s ease; }

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

/* ===== 图库 ===== */
.gallery-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
    margin-top: 32px;
}
.gallery-item {
    aspect-ratio: 1; border-radius: 4px; overflow: hidden; cursor: pointer;
    background: var(--g50); position: relative;
    transition: all 0.3s ease;
}
.gallery-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: filter 0.3s ease; }
.gallery-item:hover img { filter: grayscale(0%); }

/* ===== 联系方式 ===== */
.contact-section {
    padding: 100px 28px; text-align: center;
}
.contact-section h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; margin-bottom: 16px; }
.contact-section p { color: var(--g300); font-size: 0.9rem; max-width: 500px; margin: 0 auto 32px; line-height: 1.7; }
.contact-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.contact-link {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; background: var(--bg); color: var(--text-1);
    border-radius: 2px; text-decoration: none; font-size: 0.85rem;
    transition: all 0.2s ease;
}
.contact-link:hover { background: var(--g200); }

/* ===== 页脚 ===== */
footer {
    padding: 32px 28px; text-align: center;
    border-top: 1px solid var(--line);
    color: var(--text-4); font-size: 0.75rem;
}
footer a { color: var(--text-4); text-decoration: none; transition: color 0.2s ease; }
footer a:hover { color: var(--text-1); }

/* ===== 返回顶部 ===== */
#back-to-top {
    position: fixed; bottom: 24px; right: 24px; z-index: 50;
    width: 40px; height: 40px; border-radius: 2px;
    background: var(--bg-card); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; pointer-events: none;
    transition: all 0.3s ease; color: var(--text-2);
}
#back-to-top.show { opacity: 1; pointer-events: auto; }
#back-to-top:hover { background: var(--text-1); color: var(--bg); }

/* ===== 主题切换 ===== */
#theme-toggle {
    position: fixed; bottom: 24px; left: 24px; z-index: 50;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-card); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease;
}
#theme-toggle:hover { transform: scale(1.1); }
#theme-toggle svg { color: var(--text-2); transition: all 0.3s ease; }
#theme-icon-sun { position: absolute; }
#theme-icon-moon { position: absolute; opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="night"] #theme-icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="night"] #theme-icon-moon { opacity: 1; transform: rotate(0) scale(1); }

/* ===== 滚动渐显 ===== */
.scroll-reveal {
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
.scroll-reveal.active { opacity: 1; transform: translateY(0); }

/* ===== 图片模态框 ===== */
#image-modal {
    position: fixed; inset: 0; z-index: 9998;
    display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.85); cursor: pointer;
}
#image-modal.show { display: flex; }
#image-modal img { max-width: 90vw; max-height: 90vh; border-radius: 4px; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g300); border-radius: 2px; }
[data-theme="night"] ::-webkit-scrollbar-thumb { background: var(--g600); }

/* ===== 音乐播放器 ===== */
#music-panel.open { display: block !important; }
#music-panel { font-size: 0.85rem; }
#playlist { list-style: none; margin: 0; padding: 0; }
#playlist li {
    padding: 6px 8px; cursor: pointer; border-radius: 2px;
    color: var(--text-3); font-size: 0.8rem;
    transition: background 0.2s, color 0.2s;
}
#playlist li:hover { background: var(--bg); color: var(--text-1); }
#playlist li.active { color: var(--text-1); font-weight: 500; background: var(--bg); }
.music-progress-container {
    height: 3px; background: var(--line); border-radius: 2px;
    cursor: pointer; position: relative;
}
.music-progress-fill {
    height: 100%; border-radius: 2px; width: 0%;
    transition: width 0.2s linear;
}
.playing-indicator { display: flex; align-items: center; gap: 2px; }
.playing-indicator span {
    width: 2px; background: var(--text-1); border-radius: 1px;
    animation: soundBar 0.8s ease-in-out infinite alternate;
}
.playing-indicator span:nth-child(2) { animation-delay: 0.2s; height: 10px; }
.playing-indicator span:nth-child(3) { animation-delay: 0.4s; height: 6px; }
.playing-indicator span:nth-child(4) { animation-delay: 0.6s; height: 14px; }
.playing-indicator.hidden { display: none; }
@keyframes soundBar {
    0% { height: 4px; }
    100% { height: 16px; }
}
