/* ================================================
   凌云小站 · 个人主页 v2
   视觉升级 · 卡片感 · 动画 · 响应式
   ================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --bg: #ffffff;
    --surface: #fafaf9;
    --text-primary: #1c1917;
    --text-secondary: #78716c;
    --text-tertiary: #a8a29e;
    --border: #e7e5e4;
    --accent: #1c1917;
    --accent-hover: #44403c;
    --accent-bg: #f5f5f4;
    --accent-light: #6366f1;      /* subtle indigo accent for interactive */
    --accent-light-bg: rgba(99,102,241,0.06);
    --header-bg: rgba(255,255,255,0.82);
    --glow-1: rgba(99,102,241,0.05);
    --glow-2: rgba(168,162,158,0.04);
    --card-shadow: 0 1px 3px rgba(28,25,23,0.06), 0 1px 2px rgba(28,25,23,0.04);
    --card-shadow-hover: 0 8px 24px rgba(28,25,23,0.08);
    --content-w: 800px;
    --header-w: 960px;
    --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 深色模式 */
[data-theme="dark"] {
    --bg: #0c0a09;
    --surface: #1c1917;
    --text-primary: #f5f5f4;
    --text-secondary: #a8a29e;
    --text-tertiary: #78716c;
    --border: #292524;
    --accent: #f5f5f4;
    --accent-hover: #e7e5e4;
    --accent-bg: #292524;
    --accent-light: #818cf8;
    --accent-light-bg: rgba(129,140,248,0.08);
    --header-bg: rgba(12,10,9,0.82);
    --glow-1: rgba(129,140,248,0.08);
    --glow-2: rgba(120,113,108,0.05);
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.4);
}

/* 系统偏好 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg: #0c0a09;
        --surface: #1c1917;
        --text-primary: #f5f5f4;
        --text-secondary: #a8a29e;
        --text-tertiary: #78716c;
        --border: #292524;
        --accent: #f5f5f4;
        --accent-hover: #e7e5e4;
        --accent-bg: #292524;
        --accent-light: #818cf8;
        --accent-light-bg: rgba(129,140,248,0.08);
        --header-bg: rgba(12,10,9,0.82);
        --glow-1: rgba(129,140,248,0.08);
        --glow-2: rgba(120,113,108,0.05);
        --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
        --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.4);
    }
}

/* ---------- Reset ---------- */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }

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

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color:inherit; text-decoration:none; }
img { max-width:100%; display:block; }
button { background:none; border:none; cursor:pointer; color:inherit; font:inherit; }

/* ---------- Container ---------- */
.container {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 0 28px;
}

/* ---------- 通用 Section ---------- */
.section {
    padding: 88px 0;
}

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

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 44px;
    letter-spacing: -0.01em;
}

/* ================================================
   导航栏
   ================================================ */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 56px;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: var(--header-w);
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-logo {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0; bottom: -4px;
    width: 100%; height: 2px;
    background: var(--accent-light);
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--text-primary);
}
.nav-link:hover::after { transform: scaleX(1); }

.nav-link.active {
    color: var(--text-primary);
    font-weight: 600;
}
.nav-link.active::after { transform: scaleX(1); }

/* 工具按钮 */
.header-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}
.tool-btn:hover {
    background: var(--accent-bg);
    color: var(--text-primary);
}

#langToggle {
    width: auto;
    padding: 0 8px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

/* 汉堡菜单 */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px; height: 36px;
    padding: 6px;
    border-radius: 8px;
}

.hamburger span {
    display: block;
    width: 100%; height: 2px;
    background: var(--text-primary);
    transition: transform 0.25s, opacity 0.25s;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ================================================
   Hero 首屏
   ================================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 88px 28px 72px;
    position: relative;
    overflow: hidden;
}

/* 背景光晕 */
.hero-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 600px 400px at 18% 45%, var(--glow-1) 0%, transparent 70%),
        radial-gradient(ellipse 500px 350px at 78% 55%, var(--glow-2) 0%, transparent 70%);
}

/* 浮动粒子 */
.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--s, 4px);
    height: var(--s, 4px);
    border-radius: 50%;
    background: var(--text-tertiary);
    opacity: 0.12;
    animation: particle-float var(--d, 7s) ease-in-out infinite;
}

@keyframes particle-float {
    0%, 100% { transform: translate(0,0) scale(1); opacity: 0.12; }
    25% { transform: translate(18px,-16px) scale(1.15); opacity: 0.18; }
    50% { transform: translate(-8px,-28px) scale(0.9); opacity: 0.10; }
    75% { transform: translate(12px,-12px) scale(1.05); opacity: 0.15; }
}

/* Hero 主体 */
.hero-body {
    position: relative;
    z-index: 1;
    max-width: var(--content-w);
    margin: 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 56px;
}

.hero-text { flex: 1; }

/* 诗句打字机 */
.hero-poem {
    margin-bottom: 12px;
    min-height: 2em;
}

.poem-line {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-tertiary);
    letter-spacing: 0.06em;
    display: inline;
    animation: poem-fade-in 1s ease forwards;
}

@keyframes poem-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.poem-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: var(--text-tertiary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-greeting {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}

.hero-desc {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 480px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* 头像 */
.hero-avatar { flex-shrink: 0; }

.avatar-wrapper {
    width: 150px; height: 150px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--border) 0%, var(--text-tertiary) 100%);
    box-shadow: 0 20px 40px rgba(28,25,23,0.1);
}

.avatar-img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 11px 22px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
    border: 1px solid var(--border);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--accent-bg);
}

/* ================================================
   关于我
   ================================================ */
.about-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 48px;
    align-items: start;
}

.about-text p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.8;
}
.about-text p:last-child { margin-bottom: 0; }

.about-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.about-role {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-light);
    letter-spacing: 0.02em;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--accent-light-bg);
    display: inline-block;
    align-self: flex-start;
}

.about-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.about-tag {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: border-color 0.2s, color 0.2s;
}
.about-tag:hover {
    border-color: var(--accent-light);
    color: var(--text-primary);
}

/* ================================================
   技能卡片
   ================================================ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.skill-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    display: flex;
    gap: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--card-shadow);
}
.skill-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent-light);
}

.skill-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--accent-light-bg);
    color: var(--accent-light);
    flex-shrink: 0;
}

.skill-body { flex: 1; }

.skill-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.skill-desc {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: border-color 0.2s;
}
.skill-tag:hover { border-color: var(--accent-light); }

/* ================================================
   时间线（桌面端左右交替布局）
   ================================================ */
.section-timeline { overflow: hidden; }

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 12px 0;
}

/* 中央竖线 (仅桌面) */
.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--border);
    transform: translateX(-50%);
}

/* 年份标题 — 居中，跨整行 */
.tl-year {
    position: relative;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-tertiary);
    letter-spacing: -0.03em;
    padding: 40px 0 24px;
    z-index: 2;
}
.tl-year:first-child { padding-top: 0; }

/* 年份圆点 — 在中央线上 */
.tl-year::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--text-tertiary);
    border: 3px solid var(--bg);
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* 事件行 — 占 50% 宽度，左右交替 */
.tl-event {
    position: relative;
    width: 50%;
    padding: 10px 0;
}

/* 右侧事件 */
.tl-event.tl-right {
    margin-left: auto;
    padding-left: 36px;
    text-align: left;
}

/* 左侧事件 */
.tl-event.tl-left {
    margin-right: auto;
    padding-right: 36px;
    text-align: right;
}

/* 事件圆点 — 在中央线上 */
.tl-event::before {
    content: '';
    position: absolute;
    top: 22px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent-light);
    border: 3px solid var(--bg);
    z-index: 1;
    transition: transform 0.3s, background 0.3s;
}
.tl-event.tl-right::before { left: -5px; }
.tl-event.tl-left::before  { right: -5px; }

.tl-event:hover::before {
    background: var(--accent);
}

/* 卡片 */
.tl-card {
    display: inline-flex;
    gap: 12px;
    align-items: baseline;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    box-shadow: var(--card-shadow);
    white-space: nowrap;
}
.tl-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent-light);
}

.tl-date {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    font-feature-settings: "tnum";
    min-width: 56px;
    flex-shrink: 0;
}

.tl-title {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ================================================
   联系
   ================================================ */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.contact-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    text-align: center;
}

.contact-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent-light);
}

.contact-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-light-bg);
    color: var(--accent-light);
    margin: 0 auto;
}

.contact-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.contact-value {
    font-size: 0.9rem;
    color: var(--accent-light);
    word-break: break-all;
    font-weight: 500;
    transition: color 0.2s;
}
.contact-value:hover { color: var(--text-primary); }

/* ================================================
   页脚
   ================================================ */
.footer {
    padding: 36px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.footer-icp {
    color: var(--text-tertiary);
    transition: color 0.2s;
}
.footer-icp:hover { color: var(--text-primary); }

/* ================================================
   语言切换过渡
   ================================================ */
[data-i18n] {
    opacity: 1;
    transition: opacity 0.2s ease;
}

body.i18n-switching [data-i18n] {
    opacity: 0;
    transition: opacity 0s;
}

/* ================================================
   滚动渐入
   ================================================ */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 时间线事件独立渐入 */
.tl-event {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.tl-event.tl-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ================================================
   响应式
   ================================================ */

/* 平板 768px */
@media (max-width: 768px) {
    .container { padding: 0 20px; }
    .header-inner { padding: 0 20px; }

    .section { padding: 64px 0; }
    .section-title { font-size: 1.25rem; margin-bottom: 32px; }

    /* 导航菜单下拉 */
    .header-nav {
        position: fixed;
        top: 56px; left: 0; right: 0;
        background: var(--header-bg);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        flex-direction: column;
        padding: 16px 24px;
        gap: 4px;
        border-bottom: 1px solid var(--border);
        transform: translateY(-110%);
        opacity: 0;
        transition: transform 0.3s, opacity 0.3s;
        pointer-events: none;
    }
    .header-nav.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    .header-nav .nav-link {
        display: block;
        padding: 10px 0;
        font-size: 1rem;
        width: 100%;
    }
    .hamburger { display: flex; }

    /* Hero */
    .hero { padding: 80px 20px 56px; }
    .hero-body {
        flex-direction: column-reverse;
        text-align: center;
        gap: 36px;
    }
    .hero-greeting { font-size: 2rem; }
    .hero-desc { max-width: 100%; font-size: 0.95rem; }
    .hero-actions { justify-content: center; }
    .avatar-wrapper { width: 120px; height: 120px; }

    /* 关于 */
    .about-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .about-side { align-items: flex-start; }

    /* 技能 */
    .skills-grid { grid-template-columns: 1fr; }

    /* 时间线 — 移动端单列左对齐 */
    .timeline::before {
        left: 14px;
        transform: none;
    }
    .tl-year {
        text-align: left;
        padding: 32px 0 16px 28px;
        font-size: 1.5rem;
    }
    .tl-year::before {
        left: 7px;
        top: 50%;
        transform: translateY(-50%);
        width: 12px; height: 12px;
    }
    .tl-event.tl-left,
    .tl-event.tl-right {
        width: 100%;
        margin: 0;
        padding: 8px 0 8px 28px;
        text-align: left;
    }
    .tl-event.tl-right::before,
    .tl-event.tl-left::before {
        left: 9px;
        right: auto;
        width: 8px; height: 8px;
    }
    .tl-card {
        display: inline-flex;
        flex-direction: row;
        gap: 8px;
        white-space: nowrap;
    }
    .tl-date { min-width: auto; }

    /* 时间线 — 移动端禁止渐入动画 */
    .tl-event {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* 联系 — 移动端禁止 hover 上移 */
    .contact-card { transform: none !important; }
    .contact-card:hover { transform: none !important; }

    /* 联系 */
    .contact-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
}

/* 手机 480px */
@media (max-width: 480px) {
    .section { padding: 48px 0; }
    .container { padding: 0 16px; }
    .header-inner { padding: 0 16px; }

    .hero { padding: 72px 16px 48px; }
    .hero-greeting { font-size: 1.6rem; }
    .hero-desc { font-size: 0.9rem; }
    .avatar-wrapper { width: 100px; height: 100px; }

    .poem-line { font-size: 0.95rem; }
}