/* style.css */
:root {
    /* 基础色相 MD3 Tonal Palette Logic */
    --hue-primary: 260; /* 紫色调 */
    --hue-secondary: 320; /* 粉色调 (ACG Accent) */
    
    /* 亮色模式变量 */
    --bg-color: #f0f2f5;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --glass-surface: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --accent-glow: rgba(120, 50, 255, 0.2);
    
    /* 渐变球颜色 */
    --blob-1: #e0c3fc;
    --blob-2: #8ec5fc;
    --blob-3: #ffdee9;

    /* 尺寸与间距 */
    --radius-lg: 24px; /* Superellipse */
    --radius-md: 16px;
    --spacing-unit: 1rem;
    
    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", Consolas, monospace;
}

/* 暗色模式覆盖 */
[data-theme="dark"] {
    --bg-color: #050507;
    --text-main: #f5f5f7;
    --text-muted: #a1a1a6;
    --glass-surface: rgba(20, 20, 25, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --accent-glow: rgba(120, 50, 255, 0.4);

    --blob-1: #240b36;
    --blob-2: #102d4d;
    --blob-3: #2c001e;
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 氛围背景 & 噪点 */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: 
        radial-gradient(circle at 15% 50%, var(--blob-1), transparent 40%),
        radial-gradient(circle at 85% 30%, var(--blob-2), transparent 40%),
        radial-gradient(circle at 50% 80%, var(--blob-3), transparent 40%);
    filter: blur(60px);
    opacity: 0.8;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='noiseFilter'><feTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(#noiseFilter)'/></svg>");
    pointer-events: none;
}

/* 玻璃拟态通用类 */
.glass-surface {
    background: var(--glass-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* Header */
.glass-header {
    position: sticky;
    top: 20px;
    margin: 0 auto;
    width: 90%;
    max-width: 1200px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    
    /* Header 也是玻璃 */
    background: var(--glass-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 100px; /* Pill shape */
}

.logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}
.code-bracket { color: var(--text-muted); }
.highlight { color: #ff0055; }

#theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
}
#theme-toggle:hover { background: rgba(128,128,128,0.1); }

/* Main Layout */
main {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 80px;
    padding-top: 40px;
}

.avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 40px; /* Superellipse look */
    object-fit: cover;
    box-shadow: 0 10px 40px var(--accent-glow);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar:hover { transform: scale(1.05) rotate(2deg); }

.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: #00ff88;
    border: 4px solid var(--bg-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, #ff0055, #7000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.tech-stack {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.tech-stack span {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 6px 16px;
    background: rgba(128, 128, 128, 0.1);
    border-radius: 100px;
    border: 1px solid var(--glass-border);
}

/* Section Titles */
.section-title {
    font-size: 1.8rem;
    margin-bottom: 32px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.section-title small {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    font-family: var(--font-mono);
}

/* Portals (Related Sites) */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 80px;
}

.portal-item {
    display: flex;
    align-items: center;
    padding: 24px;
    text-decoration: none;
    color: var(--text-main);
    position: relative;
    overflow: hidden;
}

.portal-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}
[data-theme="dark"] .portal-item:hover { background: rgba(40, 40, 50, 0.8); }

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 16px;
    flex-shrink: 0;
}

.color-blog { background: linear-gradient(135deg, #ff9a9e, #fecfef); color: #c74c5e; }
.color-lab { background: linear-gradient(135deg, #84fab0, #8fd3f4); color: #2e7d63; }

.portal-info h3 { font-size: 1.1rem; margin-bottom: 4px; }
.portal-info p { font-size: 0.9rem; color: var(--text-muted); }

.arrow-icon {
    margin-left: auto;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.portal-item:hover .arrow-icon {
    opacity: 1;
    transform: translateX(0);
}

/* GitHub Zone */
.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.repo-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.repo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 48px var(--accent-glow);
    border-color: rgba(120, 50, 255, 0.3);
}

.repo-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.repo-lang {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
}
.repo-lang::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3178c6; /* TS Blue */
    margin-right: 6px;
}
.repo-lang.color-rust::before { background: #dea584; }
.repo-lang.color-vue::before { background: #42b883; }
.repo-lang.color-js::before { background: #f1e05a; }
.repo-lang.color-batch::before { background: #C1F12E; }

.repo-card h3 a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.2rem;
    /* 链接下划线动画 */
    background-image: linear-gradient(to right, #7000ff, #ff0055);
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.3s ease;
}
.repo-card:hover h3 a { background-size: 100% 2px; }

.repo-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 12px 0 24px;
    flex-grow: 1;
}

/* Footer */
.glass-footer {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--glass-border);
    background: linear-gradient(to top, var(--glass-surface), transparent);
}

.social-links {
    margin-bottom: 20px;
}

.social-links a {
    color: var(--text-muted);
    font-size: 1.5rem;
    margin: 0 12px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
    color: var(--text-main);
    transform: scale(1.2);
}

.glass-footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Animation Keyframes */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(0, 255, 136, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .hero-title { font-size: 2.2rem; }
    .glass-header { width: 95%; padding: 0 16px; }
    .portal-grid { grid-template-columns: 1fr; }
}