/* ============================================================
   XGL 个人主页 — 样式表
   设计语言:赛博 / 紫色科技感 / 玻璃拟态(Glassmorphism)
   版本:v2.0(大厂作风精修版)
   ============================================================ */

/* ---------- 1. 设计令牌 Design Tokens ---------- */
:root {
    /* 品牌色 —— Midnight Galaxy 银河主题 */
    --primary: #6b5bd6;
    --primary-strong: #4a4e8f;
    --primary-soft: rgba(90, 78, 168, 0.18);
    --secondary: #4a4e8f;
    --accent: #a490c2;
    --success: #7bb9a8;

    /* 文本色 */
    --text: #e6e6fa;
    --text-muted: #aab0c8;
    --text-dim: #7c7f9d;

    /* 背景 */
    --bg: #211534;
    --bg-elevated: #2b1e3e;
    --bg-card: rgba(43, 30, 62, 0.6);
    --bg-card-hover: rgba(74, 78, 143, 0.3);

    /* 边框 */
    --border: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(124, 58, 237, 0.45);

    /* 圆角 */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --radius-full: 999px;

    /* 间距 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.4);
    --glow-primary: 0 0 18px rgba(124, 58, 237, 0.45);
    --glow-secondary: 0 0 18px rgba(59, 130, 246, 0.4);
    --glow-accent: 0 0 22px rgba(164, 144, 194, 0.55);

    /* 字体 */
    --font-display: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
    --font-body: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* 布局 */
    --container-max: 1040px;

    /* 缓动 */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 2. 基础样式 Reset & Base ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(60% 50% at 50% 0%, rgba(107, 91, 214, 0.16), transparent 70%),
        radial-gradient(60% 50% at 100% 100%, rgba(74, 78, 143, 0.14), transparent 70%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(107, 91, 214, 0.4);
    color: #fff;
}

/* 反图片下载(保持原有防下载逻辑) */
img {
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* 可访问性:键盘聚焦可见 */
:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* 尊重系统减弱动效偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 字体导入 */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

/* ---------- 3. 背景动画 ---------- */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(70% 70% at 50% 40%, #000 20%, transparent 100%);
    -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000 20%, transparent 100%);
    animation: gridMove 22s linear infinite;
}

.bg-glow {
    position: absolute;
    top: 40%;
    left: 50%;
    width: 720px;
    height: 720px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.32) 0%, transparent 70%);
    filter: blur(90px);
    transform: translate(-50%, -50%);
    will-change: transform;
}

.particles-canvas,
#fireworks-canvas,
#particles-canvas {
    position: fixed !important;
    inset: 0 !important;
    z-index: -1 !important;
    pointer-events: none;
}

/* ---------- 4. 布局容器 ---------- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5) var(--space-7);
}

/* ---------- 5. 头部 Header ---------- */
.header {
    margin-bottom: var(--space-7);
    position: sticky;
    top: var(--space-4);
    z-index: 50;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-6);
    background: rgba(13, 16, 39, 0.6);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(120deg, #fff 0%, #c7d2fe 50%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}

.nav ul {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
}

.nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: transform var(--ease) 0.2s, box-shadow var(--ease) 0.2s;
}

.nav a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(107, 91, 214, 0.45);
}

.nav a:active {
    transform: translateY(0);
}

/* ---------- 6. 卡片基类 ---------- */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* ---------- 7. 个人资料卡片 ---------- */
.profile-card {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-7);
}

.card-content {
    position: relative;
    text-align: center;
    width: 100%;
    max-width: 420px;
    padding: var(--space-7) var(--space-6);
    background: var(--bg-card);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
    animation: fadeInUp 0.7s var(--ease) both;
}

.card-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    background-size: 200% 100%;
    animation: gradientMove 5s linear infinite;
}

.avatar-container {
    position: relative;
    display: inline-block;
    margin-bottom: var(--space-5);
}

.avatar {
    position: relative;
    z-index: 2;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.4s var(--ease);
}

.avatar:hover {
    transform: scale(1.04);
}

.avatar-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150px;
    height: 150px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1.12);
    filter: blur(22px);
    opacity: 0.45;
    z-index: 1;
    animation: glowPulse 4s var(--ease) infinite alternate;
}

.name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(120deg, #fff, #c7d2fe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.title-text {
    margin-top: var(--space-2);
    font-size: 0.95rem;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

/* ---------- 8. 通用区块 Section ---------- */
.section {
    margin-bottom: var(--space-6);
}

.section-card {
    padding: var(--space-6) var(--space-6);
    background: var(--bg-card);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: transform var(--ease-soft) 0.25s, border-color var(--ease-soft) 0.25s, box-shadow var(--ease-soft) 0.25s;
    animation: fadeInUp 0.7s var(--ease) 0.1s both;
}

.section-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg), var(--glow-primary);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.section-title::before {
    content: '';
    width: 6px;
    height: 24px;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.section-content {
    color: var(--text-muted);
    line-height: 1.8;
}

.section-content p {
    margin-bottom: var(--space-3);
}

.section-content p:last-child {
    margin-bottom: 0;
}

.section-content strong {
    color: var(--text);
    font-weight: 600;
}

/* 我的项目跳转卡片 */
.projects-entry-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    flex-wrap: wrap;
}

.projects-entry-text {
    flex: 1;
    min-width: 220px;
}

.projects-entry-desc {
    color: var(--text-muted);
    line-height: 1.7;
}

.projects-entry-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: 13px 26px;
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text);
    background: linear-gradient(135deg, #6b5bd6, #4a4e8f);
    border: 1px solid rgba(164, 144, 194, 0.4);
    border-radius: var(--radius-full);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: transform var(--ease) 0.2s, box-shadow var(--ease) 0.2s;
    white-space: nowrap;
}

.projects-entry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(107, 91, 214, 0.5);
}

.projects-entry-arrow {
    transition: transform var(--ease) 0.2s;
}

.projects-entry-btn:hover .projects-entry-arrow {
    transform: translateX(4px);
}

@media (max-width: 480px) {
    .projects-entry-btn { width: 100%; justify-content: center; }
}

/* ---------- 9. 代码编辑器 ---------- */
.code-editor {
    position: relative;
    margin-top: var(--space-5);
    padding: var(--space-5);
    background: #05060f;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.7;
    color: #a7f3d0;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
    overflow: auto;
    max-height: 420px;
}

.code-editor-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* macOS 风格窗口红绿灯 */
.code-editor-header::before {
    content: '● ● ●';
    letter-spacing: 6px;
    color: rgba(148, 163, 184, 0.35);
    font-size: 12px;
}

.code-editor-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dim);
}

.code-editor-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 语法高亮 */
.code-comment { color: #22c55e; font-style: italic; }
.code-keyword { color: #e879f9; }
.code-string  { color: #fbbf24; }
.code-function { color: #38bdf8; }

/* ---------- 10. 联系信息 ---------- */
.contact-info {
    color: var(--text-muted);
    line-height: 1.8;
}

.contact-list {
    margin-top: var(--space-4);
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.contact-list li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text);
    transition: border-color var(--ease-soft), background var(--ease-soft);
}

.contact-list li:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: var(--border-strong);
}

.contact-list li::before {
    content: '✉';
    color: var(--secondary);
    font-size: 1rem;
}

/* ---------- 11. 女朋友 ---------- */
.girlfriend-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.girlfriend-avatar-container {
    position: relative;
    display: inline-block;
    margin-bottom: var(--space-4);
}

.girlfriend-avatar {
    position: relative;
    z-index: 2;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(236, 72, 153, 0.35);
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.girlfriend-avatar:hover {
    transform: scale(1.04);
    box-shadow: 0 0 24px rgba(236, 72, 153, 0.55);
}

.girlfriend-avatar-container .avatar-glow {
    background: linear-gradient(45deg, #ec4899, #f97316);
    opacity: 0.4;
}

.girlfriend-name {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 600;
    color: #f9a8d4;
    text-shadow: 0 0 16px rgba(236, 72, 153, 0.5);
}

.girlfriend-description {
    margin-top: var(--space-2);
    color: var(--text-muted);
}

/* ---------- 12. 访问统计 ---------- */
.stats-card {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: var(--space-6);
    padding: var(--space-6);
    background: var(--bg-card);
    backdrop-filter: blur(18px) saturate(130%);
    -webkit-backdrop-filter: blur(18px) saturate(130%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.stat-item {
    text-align: center;
    padding: var(--space-3);
}

.stat-item + .stat-item {
    border-left: 1px solid var(--border);
}

.stat-title {
    font-size: 0.82rem;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: var(--space-2);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(120deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- 13. 页脚 ---------- */
.footer {
    margin-top: var(--space-6);
    padding: var(--space-5);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(13, 16, 39, 0.4);
}

.footer p {
    letter-spacing: 0.3px;
}

/* ---------- 14. 动画 Keyframes ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes gridMove {
    0%   { background-position: 0 0; }
    100% { background-position: 56px 56px; }
}

@keyframes gradientMove {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes glowPulse {
    from { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0.4; }
    to   { transform: translate(-50%, -50%) scale(1.18) rotate(8deg); opacity: 0.55; }
}

/* 头像查看器(由 JS 动态创建,沿用注入动画) */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes heartBeat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes floatHeart {
    0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
    50%  { transform: translateY(-20px) rotate(180deg) scale(1.2); opacity: 0.8; }
    100% { transform: translateY(-40px) rotate(360deg) scale(0.8); opacity: 0; }
}
@keyframes clickHeart {
    0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50%  { transform: translate(-50%, -50%) scale(1.4); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* ---------- 15. 响应式 ---------- */
/* 平板 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container { padding: var(--space-5); }
    .card-content { max-width: 380px; }
}

/* 手机横屏 & 小平板 */
@media (max-width: 768px) {
    .header { top: var(--space-2); }
    .header-content {
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-4);
        border-radius: var(--radius-lg);
    }
    .nav ul {
        flex-direction: column;
        width: 100%;
        gap: var(--space-2);
    }
    .nav a { width: 100%; max-width: 260px; }
    .card-content { max-width: 100%; }
    .section-card { padding: var(--space-5); }
    .stats-card { padding: var(--space-5); }
    .stat-value { font-size: 1.6rem; }
    .container { padding: var(--space-4); }
}

/* 手机竖屏 */
@media (max-width: 480px) {
    .container { padding: var(--space-3); }
    .title { font-size: 1.05rem; letter-spacing: 1px; }
    .name { font-size: 1.7rem; }
    .avatar, .avatar-glow { width: 120px; height: 120px; }
    .girlfriend-avatar { width: 150px; height: 150px; }
    .section-title { font-size: 1.15rem; }
    .code-editor { font-size: 12px; padding: var(--space-4); }
    .stats-card { grid-template-columns: 1fr; }
    .stat-item + .stat-item { border-left: none; border-top: 1px solid var(--border); }
}

/* ---------- 16. 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: var(--radius-full);
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--secondary); }