/* ============================================================
   hanmortis.top - 个人主页样式
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-1: #06b6d4;   /* cyan */
    --accent-2: #8b5cf6;   /* purple */
    --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC',
                 sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

strong {
    color: var(--accent-1);
    font-weight: 600;
}

/* ---------- 背景粒子 ---------- */
.bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--accent-1);
    border-radius: 50%;
    opacity: 0;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* ---------- 导航栏 ---------- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
}

.navbar.scrolled {
    padding: 10px 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

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

.nav-links a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 60px;
}

.hero-content {
    max-width: 600px;
}

.hero-avatar {
    margin: 0 auto 24px;
}

.avatar-placeholder {
    width: 90px;
    height: 90px;
    margin: 0 auto;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3), 0 0 80px rgba(6, 182, 212, 0.15);
    animation: avatarGlow 3s ease-in-out infinite;
}

@keyframes avatarGlow {
    0%, 100% {
        box-shadow: 0 0 40px rgba(139, 92, 246, 0.3), 0 0 80px rgba(6, 182, 212, 0.15);
    }
    50% {
        box-shadow: 0 0 60px rgba(139, 92, 246, 0.5), 0 0 100px rgba(6, 182, 212, 0.3);
    }
}

.hero-name {
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    min-height: 1.8em;
    font-family: var(--font-mono);
}

.cursor {
    color: var(--accent-1);
    animation: blink 0.8s step-end infinite;
}

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

.hero-desc {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 480px;
    margin: 16px auto 32px;
    line-height: 1.8;
}

/* ---------- 按钮 ---------- */
.hero-btns {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(139, 92, 246, 0.5);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-hover);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--accent-1);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 8px 18px;
    font-size: 0.85rem;
}

/* ---------- 滚动提示 ---------- */
.scroll-hint {
    margin-top: 48px;
}

.scroll-arrow {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.5; }
    50% { transform: rotate(45deg) translateY(8px); opacity: 1; }
}

/* ---------- 通用 Section ---------- */
.section {
    position: relative;
    z-index: 1;
    padding: 80px 24px;
}

.section-dark {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(4px);
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 48px;
    letter-spacing: -0.3px;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    margin: 12px auto 0;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* ---------- 关于 ---------- */
.about-content {
    max-width: 650px;
    margin: 0 auto;
}

.about-content p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 16px;
    text-align: justify;
}

.tags {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.tag {
    display: inline-block;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 50px;
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-2);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ---------- 技能 ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.skill-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: var(--transition);
    cursor: default;
}

.skill-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-1);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(6, 182, 212, 0.1), 0 0 0 1px rgba(6, 182, 212, 0.15) inset;
}

.skill-icon {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.skill-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.skill-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---------- 项目 ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: var(--transition);
}

.project-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.project-icon {
    font-size: 1.6rem;
}

.project-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.project-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.project-tags span {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 50px;
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-1);
    border: 1px solid rgba(6, 182, 212, 0.15);
}

.project-links {
    display: flex;
    gap: 12px;
}

/* ---------- 联系方式 ---------- */
.contact-content {
    text-align: center;
}

.contact-text {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: var(--transition);
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.contact-item:hover {
    border-color: var(--accent-1);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.1);
}

.contact-icon {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: var(--transition);
}

.contact-item:hover .contact-icon {
    color: var(--accent-1);
}

/* ---------- 页脚 ---------- */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 24px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---------- 滚动渐入动画 ---------- */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 技能卡片错开延迟 */
.skill-card:nth-child(1) { transition-delay: 0.0s; }
.skill-card:nth-child(2) { transition-delay: 0.1s; }
.skill-card:nth-child(3) { transition-delay: 0.2s; }
.skill-card:nth-child(4) { transition-delay: 0.3s; }
.skill-card:nth-child(5) { transition-delay: 0.4s; }
.skill-card:nth-child(6) { transition-delay: 0.5s; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 20px;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-links a {
        font-size: 0.82rem;
    }

    .hero {
        padding: 100px 20px 40px;
    }

    .hero-name {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section {
        padding: 60px 20px;
    }

    .section-title {
        font-size: 1.5rem;
    }

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

    .skill-card {
        padding: 20px 16px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .contact-item {
        width: 100%;
        justify-content: center;
    }
}

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

    .hero-btns {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- 选中样式 ---------- */
::selection {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
