/* =====================================================================
   前台主页样式 - 现代玻璃拟态 · 极光 · 网格 · 微交互（响应式）
   ===================================================================== */

@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

:root {
    --bg-deep: #0b0e1a;
    --text: #f5f7ff;
    --text-muted: rgba(235, 238, 255, 0.72);
    --glass: rgba(255, 255, 255, 0.07);
    --glass-strong: rgba(255, 255, 255, 0.11);
    --stroke: rgba(255, 255, 255, 0.12);
    --accent: #6c8cff;
    --accent-2: #b06cff;
    --accent-3: #ff7ac6;
    --radius: 22px;
    --shadow: 0 24px 70px rgba(3, 6, 18, 0.55);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Inter", sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    line-height: 1.65;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    position: relative;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ---------------- 极光背景 ---------------- */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: -3;
    overflow: hidden;
    background: linear-gradient(160deg, #0b0e1a 0%, #141a2e 48%, #0d1020 100%);
}

.bg-mesh::before,
.bg-mesh::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.55;
    will-change: transform;
}

.bg-mesh::before {
    width: 55vmax;
    height: 55vmax;
    left: -16vmax;
    top: -16vmax;
    background: radial-gradient(circle, rgba(108, 140, 255, 0.55), transparent 62%);
    animation: blob-a 22s ease-in-out infinite alternate;
}

.bg-mesh::after {
    width: 50vmax;
    height: 50vmax;
    right: -16vmax;
    bottom: -16vmax;
    background: radial-gradient(circle, rgba(255, 122, 198, 0.5), transparent 62%);
    animation: blob-b 26s ease-in-out infinite alternate;
}

@keyframes blob-a {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(13vmax, 9vmax) scale(1.18); }
}

@keyframes blob-b {
    from { transform: translate(0, 0) scale(1.15); }
    to   { transform: translate(-11vmax, -7vmax) scale(1); }
}

/* 上传的背景图（叠在极光之上），竖屏默认 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image: var(--bg-portrait, none);
    background-position: center;
    background-repeat: no-repeat;
}

@media (orientation: landscape) {
    body::before {
        background-image: var(--bg-landscape, var(--bg-portrait, none));
    }
}

body.bg-cover::before { background-size: cover; }
body.bg-tile::before { background-size: auto; background-repeat: repeat; }

/* ---------------- 透视网格（底部淡出） ---------------- */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 100%, #000 0%, transparent 72%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 100%, #000 0%, transparent 72%);
}

/* 遮罩层，保证文字可读性 */
.page-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(6, 8, 18, var(--overlay-opacity, 0.35));
}

/* 胶片噪点 */
.bg-grain {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

.page-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 780px;
}

/* ---------------- 玻璃卡片（旋转渐变描边） ---------------- */
.card {
    position: relative;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    padding: 42px 30px;
    text-align: center;
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    box-shadow: var(--shadow), 0 0 70px rgba(108, 140, 255, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* 旋转渐变描边 */
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1.5px;
    pointer-events: none;
    background: conic-gradient(
        from var(--angle),
        rgba(108, 140, 255, 0.9),
        rgba(176, 108, 255, 0.8),
        rgba(255, 122, 198, 0.9),
        rgba(108, 140, 255, 0.9)
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: spin-border 8s linear infinite;
}

@keyframes spin-border {
    to { --angle: 360deg; }
}

/* 不支持 mask-composite 的浏览器回退：隐藏渐变描边（保留普通描边） */
@supports not ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
    .card::after {
        display: none;
    }
}

/* 跟随鼠标的柔光 */
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    border-radius: inherit;
    background: radial-gradient(
        560px circle at var(--mx, 50%) var(--my, 50%),
        rgba(108, 140, 255, 0.16),
        transparent 45%
    );
}

.card:hover::before {
    opacity: 1;
}

/* ---------------- 状态胶囊 ---------------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: #6ee7b7;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ---------------- 头像 ---------------- */
.avatar {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.35);
    margin-bottom: 22px;
    box-shadow: 0 0 0 6px rgba(108, 140, 255, 0.16), 0 0 48px rgba(108, 140, 255, 0.35);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.avatar:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 0 0 6px rgba(108, 140, 255, 0.24), 0 0 64px rgba(108, 140, 255, 0.5);
}

.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    font-size: 46px;
    font-weight: 700;
    color: #fff;
    user-select: none;
}

/* ---------------- 姓名与签名 ---------------- */
.name {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.15;
    background: linear-gradient(92deg, #ffffff 15%, #c7d2ff 55%, #f3c6ff 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 30px rgba(108, 140, 255, 0.35));
}

.signature {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 1.02rem;
    letter-spacing: 0.3px;
}

.motto {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.5px;
}

/* ---------------- 跑马灯 ---------------- */
.marquee {
    margin: 26px 0 4px;
    overflow: hidden;
    border-block: 1px solid var(--stroke);
    padding: 11px 0;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.marquee-track {
    display: flex;
    gap: 2.6rem;
    width: max-content;
    white-space: nowrap;
    animation: marquee 24s linear infinite;
}

.marquee-track span {
    font-size: 0.88rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ---------------- 分区标题 ---------------- */
.section-title {
    font-size: 0.8rem;
    text-align: left;
    margin: 32px 0 14px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-title::before {
    content: "";
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

.section-title::after {
    content: "";
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, rgba(108, 140, 255, 0.5), transparent);
}

/* ---------------- 音乐播放器 ---------------- */
.music-player {
    margin: 26px auto 4px;
    display: inline-flex;
    padding: 8px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--stroke);
}

.music-player iframe {
    max-width: 100%;
    border-radius: 9px;
    display: block;
}

/* ---------------- 关于我 ---------------- */
.about { text-align: left; }
.about-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.85;
    text-align: left;
}

/* ---------------- 数据统计 ---------------- */
.stats { text-align: left; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.stat-item {
    background: var(--glass);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 20px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.stat-item:hover {
    transform: translateY(-4px);
    border-color: rgba(108, 140, 255, 0.5);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff, #c7d2ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ---------------- 技能 ---------------- */
.skills { text-align: left; }
.skills-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skill-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
}

.skill-name { font-weight: 600; font-size: 0.95rem; }

.skill-cat {
    font-size: 0.72rem;
    color: var(--accent-2);
    background: rgba(176, 108, 255, 0.16);
    border: 1px solid rgba(176, 108, 255, 0.3);
    padding: 1px 8px;
    border-radius: 999px;
}

.skill-level {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.skill-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.skill-fill {
    position: relative;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
    box-shadow: 0 0 14px rgba(108, 140, 255, 0.55);
    transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.skill-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    animation: shimmer 2.4s ease-in-out infinite;
}

@keyframes shimmer {
    to { transform: translateX(100%); }
}

/* ---------------- 项目卡片 ---------------- */
.projects { text-align: left; }
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
    gap: 16px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--glass);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.28s ease, background 0.28s ease, box-shadow 0.28s ease;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(108, 140, 255, 0.55);
    background: var(--glass-strong);
    box-shadow: 0 18px 40px rgba(3, 6, 18, 0.45);
}

.project-thumb { overflow: hidden; }

.project-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .project-thumb img { transform: scale(1.08); }

.project-body { padding: 15px 16px; }
.project-title { font-size: 1.06rem; font-weight: 600; }

.project-desc {
    margin-top: 5px;
    font-size: 0.87rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------------- 时间线 ---------------- */
.timeline { text-align: left; }
.timeline-list {
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: 18px;
    border-left: 2px solid rgba(108, 140, 255, 0.35);
}

.timeline-item {
    position: relative;
    padding: 0 0 22px 16px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -25px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    box-shadow: 0 0 0 4px rgba(108, 140, 255, 0.18);
}

.timeline-date {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.timeline-title { font-size: 1rem; font-weight: 600; margin-top: 2px; }
.timeline-desc { font-size: 0.87rem; color: var(--text-muted); margin-top: 3px; }

/* ---------------- 友情链接 ---------------- */
.friends { text-align: left; }
.friends-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.friend-item {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    padding: 11px 15px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.friend-item:hover {
    border-color: rgba(108, 140, 255, 0.5);
    background: var(--glass-strong);
}

.friend-name { font-weight: 600; font-size: 0.92rem; }
.friend-desc { font-size: 0.78rem; color: var(--text-muted); }

/* ---------------- 联系方式 ---------------- */
.contacts {
    margin-top: 32px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.contact-item {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--glass);
    border: 1px solid var(--stroke);
    color: #fff;
    text-decoration: none;
    transition: transform 0.18s ease, background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    will-change: transform;
}

.contact-item:hover {
    background: linear-gradient(135deg, rgba(108, 140, 255, 0.4), rgba(255, 122, 198, 0.4));
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 26px rgba(108, 140, 255, 0.35);
}

.contact-item .icon { width: 24px; height: 24px; }

/* ---------------- 页脚 ---------------- */
.site-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 0.84rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ---------------- 入场与滚动揭示动画 ---------------- */
.card > :not(section) {
    animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
}

/* 滚动揭示（仅在 JS 可用时隐藏，避免无 JS 时内容不可见） */
.js .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.js .reveal.revealed {
    opacity: 1;
    transform: none;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 520px) {
    body { padding: 16px 12px; }
    .card { padding: 30px 18px; border-radius: 18px; }
    .avatar { width: 88px; height: 88px; }
    .name { font-size: 1.7rem; }
    .projects-grid { grid-template-columns: 1fr; }
}

/* 尊重系统“减少动态效果”设置 */
@media (prefers-reduced-motion: reduce) {
    .bg-mesh::before,
    .bg-mesh::after,
    .card > :not(section),
    .marquee-track,
    .skill-fill::after,
    .card::after {
        animation: none;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .project-card,
    .avatar,
    .contact-item,
    .stat-item,
    .friend-item {
        transition: none;
    }
}
