/* =========================================================
   个人主页样式 — 暖色编辑风
   纸张质感 · 衬线排版 · 不对称布局
   ========================================================= */

/* ===== 主题变量 ===== */
:root[data-theme="light"] {
    --paper:       #f5f0e6;          /* 纸张底色 */
    --paper-alt:   #efe8db;          /* 次级背景 */
    --ink:         #1c1917;          /* 主文字（暖黑） */
    --ink-soft:    #44403c;          /* 次文字 */
    --muted:       #8b8278;          /* 弱化文字 */
    --accent:      #9a3412;          /* 烧赭石 */
    --accent-hover:#7c2d12;          /* 悬停加深 */
    --rule:        #d6cdbb;          /* 分割线 */
    --highlight:   rgba(154,52,18,0.06); /* 选区高亮 */
}

:root[data-theme="dark"] {
    --paper:       #1a1714;          /* 暖深底色 */
    --paper-alt:   #221e1a;
    --ink:         #f0e9dc;          /* 暖白文字 */
    --ink-soft:    #c9bfb0;
    --muted:       #7d756a;
    --accent:      #e07a4e;          /* 暖橙 */
    --accent-hover:#ed8a5e;
    --rule:        #332e28;
    --highlight:   rgba(224,122,78,0.08);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    font-family: 'Hanken Grotesk', sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.65;
    font-weight: 400;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
    -webkit-font-smoothing: antialiased;
}

/* 纸张颗粒纹理：SVG 噪点叠加，营造印刷质感 */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

ol, ul { list-style: none; }

/* 文字选区颜色 */
::selection { background: var(--accent); color: var(--paper); }

/* ===== 通用容器 ===== */
.section {
    max-width: 880px;
    margin: 0 auto;
    padding: 100px 32px;
}

.section-rule {
    border-top: 1px solid var(--rule);
}

/* 板块标题：编号 + 标题水平排列 */
.section-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 56px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rule);
}

.section-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.05em;
}

.section-title {
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* ===== 顶部导航：杂志页眉 ===== */
.masthead {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    background: transparent;
    transition: background 0.4s ease, padding 0.4s ease, border-color 0.4s ease;
    border-bottom: 1px solid transparent;
}

/* 滚动后添加背景和分割线 */
.masthead.scrolled {
    background: var(--paper);
    border-bottom-color: var(--rule);
    padding: 14px 40px;
}

.masthead-logo {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.masthead-logo span { color: var(--accent); }

.masthead-nav {
    display: flex;
    gap: 32px;
    margin-left: auto;
    margin-right: 32px;
}

.nav-item {
    font-size: 0.92rem;
    color: var(--ink-soft);
    display: flex;
    align-items: baseline;
    gap: 6px;
    transition: color 0.3s ease;
}

.nav-item:hover { color: var(--accent); }

.nav-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--muted);
}

/* 当前板块高亮 */
.nav-item.active { color: var(--accent); }
.nav-item.active .nav-num { color: var(--accent); }

/* 主题切换：小字按钮 */
.theme-toggle {
    background: none;
    border: 1px solid var(--rule);
    border-radius: 4px;
    width: 32px; height: 32px;
    cursor: pointer;
    font-family: 'Fraunces', serif;
    font-size: 0.85rem;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* 根据当前主题显示对应文字 */
[data-theme="light"] .theme-label-dark { display: none; }
[data-theme="dark"] .theme-label-light { display: none; }

/* 移动端菜单按钮 */
.menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.menu-line {
    width: 22px; height: 1.5px;
    background: var(--ink);
    transition: all 0.3s ease;
}

.menu-btn.active .menu-line:nth-child(1) { transform: rotate(45deg) translate(3px, 3px); }
.menu-btn.active .menu-line:nth-child(2) { transform: rotate(-45deg) translate(3px, -3px); }

/* 移动端抽屉菜单 */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0; right: -100%;
    width: 75%;
    height: 100vh;
    background: var(--paper-alt);
    border-left: 1px solid var(--rule);
    padding: 100px 40px 40px;
    z-index: 999;
    transition: right 0.35s ease;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu.active {
    display: flex;
    right: 0;
}

.mobile-menu a {
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    color: var(--ink);
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
}

.mobile-menu .nav-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--muted);
    margin-right: 12px;
}

/* ===== Hero 首页 ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 120px 40px 80px;
}

/* 右上角状态标记 */
.status-badge {
    position: absolute;
    top: 110px; right: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.03em;
}

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #4a7c3a;          /* 绿色：可接活 */
    box-shadow: 0 0 0 3px rgba(74,124,58,0.15);
    animation: pulse 2.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(74,124,58,0.15); }
    50%      { box-shadow: 0 0 0 6px rgba(74,124,58,0.05); }
}

.hero-inner {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.hero-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 28px;
    letter-spacing: 0.05em;
}

.hero-name {
    font-family: 'Fraunces', serif;
    font-size: clamp(3.5rem, 10vw, 6.5rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--ink);
    margin-bottom: 16px;
    font-variation-settings: "opsz" 144; /* Fraunces 大字号光学尺寸 */
}

/* 名字中的斜体强调 */
.hero-name em {
    font-style: italic;
    font-weight: 500;
    color: var(--accent);
}

.hero-role {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin-bottom: 40px;
    letter-spacing: 0.02em;
}

.hero-lede {
    font-family: 'Fraunces', serif;
    font-size: 1.35rem;
    font-weight: 300;
    line-height: 1.5;
    color: var(--ink-soft);
    max-width: 520px;
    margin-bottom: 64px;
}

/* 滚动提示：文字链接，不用按钮 */
.hero-scroll {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--accent);
    transition: gap 0.3s ease;
}

.hero-scroll:hover { gap: 16px; }

.scroll-arrow { font-size: 1rem; }

/* ===== 关于我：不对称双栏 ===== */
.about-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr; /* 左宽右窄 */
    gap: 64px;
    align-items: start;
}

.about-prose p {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1.65;
    color: var(--ink-soft);
    margin-bottom: 24px;
}

/* 右侧元信息：定义列表样式 */
.about-meta {
    border-left: 1px solid var(--rule);
    padding-left: 32px;
}

.about-meta dt {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    margin-top: 18px;
}

.about-meta dt:first-child { margin-top: 0; }

.about-meta dd {
    font-size: 0.98rem;
    color: var(--ink);
    margin-bottom: 4px;
}

.about-meta dd a {
    color: var(--ink);
    border-bottom: 1px solid var(--rule);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.about-meta dd a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===== 技能：分类列表 ===== */
.skills-layout {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 两列 */
    gap: 40px 64px;
}

.skill-group-title {
    font-family: 'Fraunces', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 8px;
}

/* 标题前的小横线装饰 */
.skill-group-title::before {
    content: '—';
    color: var(--accent);
    margin-right: 8px;
}

.skill-list {
    font-size: 0.95rem;
    color: var(--ink-soft);
    line-height: 1.7;
}

/* ===== 作品：编辑式索引 ===== */
.work-index {
    /* 用编号列表 */
    counter-reset: work;
}

.work-item {
    border-bottom: 1px solid var(--rule);
    transition: background 0.3s ease;
}

.work-item:first-child {
    border-top: 1px solid var(--rule);
}

.work-link {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 24px;
    padding: 28px 0;
    align-items: baseline;
    transition: padding-left 0.3s ease;
}

/* 悬停时整行右移 + 背景高亮 */
.work-item:hover {
    background: var(--highlight);
}

.work-item:hover .work-link {
    padding-left: 12px;
}

.work-year {
    grid-row: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--muted);
}

.work-title {
    grid-row: 1;
    font-family: 'Fraunces', serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--ink);
    transition: color 0.3s ease;
}

.work-item:hover .work-title { color: var(--accent); }

.work-arrow {
    grid-row: 1;
    font-size: 1.2rem;
    color: var(--muted);
    transition: color 0.3s ease, transform 0.3s ease;
}

.work-item:hover .work-arrow {
    color: var(--accent);
    transform: translateX(6px);
}

.work-desc {
    grid-row: 2;
    grid-column: 2;
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.work-tags {
    grid-row: 3;
    grid-column: 2;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 6px;
}

/* ===== 联系 ===== */
.contact-layout {
    max-width: 560px;
}

.contact-lede {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem;
    font-weight: 300;
    line-height: 1.55;
    color: var(--ink-soft);
    margin-bottom: 40px;
}

.contact-email {
    font-family: 'Fraunces', serif;
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--ink);
    display: inline-block;
    margin-bottom: 40px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--accent);
    transition: color 0.3s ease;
}

.contact-email:hover {
    color: var(--accent);
}

.contact-links {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.contact-links a {
    font-size: 0.95rem;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--rule);
    padding-bottom: 2px;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.contact-links a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===== 页脚：版权页 ===== */
.colophon {
    border-top: 1px solid var(--rule);
    padding: 40px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 880px;
    margin: 0 auto;
}

.colophon-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.colophon-year {
    font-family: 'Fraunces', serif;
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin-top: 4px;
}

.back-top {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--muted);
    transition: color 0.3s ease;
}

.back-top:hover { color: var(--accent); }

/* ===== 滚动揭示动画 ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Hero 入场动画：逐元素淡入 ===== */
.hero-inner > * {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFade 0.8s ease forwards;
}

.hero-eyebrow { animation-delay: 0.1s; }
.hero-name    { animation-delay: 0.25s; }
.hero-role    { animation-delay: 0.45s; }
.hero-lede    { animation-delay: 0.6s; }
.hero-scroll  { animation-delay: 0.8s; }

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

/* ===== 响应式：平板 ===== */
@media (max-width: 768px) {
    .masthead-nav { display: none; }
    .menu-btn { display: flex; }

    .masthead { padding: 16px 24px; }
    .masthead.scrolled { padding: 12px 24px; }

    .section { padding: 72px 24px; }
    .hero { padding: 100px 24px 60px; }

    .status-badge { top: 90px; right: 24px; }

    .about-layout { grid-template-columns: 1fr; gap: 40px; }
    .about-meta { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 32px; }

    .skills-layout { grid-template-columns: 1fr; gap: 32px; }

    /* 作品列表简化为两行 */
    .work-link {
        grid-template-columns: 50px 1fr auto;
    }
    .work-desc, .work-tags {
        grid-column: 2;
    }

    .colophon {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 32px 24px;
    }
}

/* ===== 响应式：手机 ===== */
@media (max-width: 480px) {
    .section-title { font-size: 1.6rem; }
    .hero-lede { font-size: 1.15rem; }
    .contact-email { font-size: 1.4rem; }
    .work-title { font-size: 1.2rem; }
    .hero-name { font-size: 3rem; }
}

/* 尊重「减少动画」偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
    .hero-inner > * { opacity: 1; transform: none; }
}
