/**
 * 精美现代的文档站点样式
 * 增强版视觉设计
 */

/* ===== 基础重置和变量 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 颜色系统 - 更丰富的色彩 */
    --vp-c-white: #ffffff;
    --vp-c-black: #000000;
    --vp-c-gray-1: #f8fafc;
    --vp-c-gray-2: #e5e7eb;
    --vp-c-gray-3: #d1d5db;
    --vp-c-text-1: #1e293b;
    --vp-c-text-2: #475569;
    --vp-c-text-3: #64748b;
    --vp-c-brand: #3b82f6;
    --vp-c-brand-light: #60a5fa;
    --vp-c-brand-lighter: #93c5fd;
    --vp-c-brand-dark: #2563eb;
    --vp-c-brand-darker: #1e40af;
    
    /* 提示框颜色 */
    --vp-c-tip-1: #10b981;
    --vp-c-tip-2: #ecfdf5;
    --vp-c-tip-border: #34d399;
    --vp-c-info-1: #3b82f6;
    --vp-c-info-2: #eff6ff;
    --vp-c-info-border: #60a5fa;
    --vp-c-warning-1: #f59e0b;
    --vp-c-warning-2: #fffbeb;
    --vp-c-warning-border: #fbbf24;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* 渐变 */
    --gradient-brand: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-warm: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-cool: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-sunset: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* 字体 */
    --vp-font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 
                           'Noto Sans SC', 'Helvetica Neue', Arial, sans-serif;
    --vp-font-family-mono: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

/* ===== 全局样式 ===== */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--vp-font-family-base);
    line-height: 1.7;
    color: var(--vp-c-text-1);
    background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* 背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    z-index: -1;
    pointer-events: none;
}

/* ===== 容器和布局 ===== */
.container {
    max-width: 52rem;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem;
}

/* ===== 标题样式 ===== */
.page-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 2.5rem;
    color: var(--vp-c-text-1);
    letter-spacing: -0.03em;
    text-align: center;
    position: relative;
    padding-bottom: 1rem;
}

/* 彩虹渐变动画效果 */
.rainbow-text {
    background: linear-gradient(
        90deg,
        #ff0000,
        #ff7f00,
        #ffff00,
        #00ff00,
        #0000ff,
        #4b0082,
        #9400d3,
        #ff0000
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-animation 3s linear infinite;
}

@keyframes rainbow-animation {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-brand);
    border-radius: 2px;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    position: relative;
}

h2 {
    font-size: 1.875rem;
    margin: 3.5rem 0 1.5rem;
    padding-top: 2rem;
    border-top: 2px solid var(--vp-c-gray-2);
    letter-spacing: -0.02em;
    color: var(--vp-c-text-1);
    font-weight: 700;
}

h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

h3 {
    font-size: 1.375rem;
    margin: 2.5rem 0 1.25rem;
    letter-spacing: -0.01em;
    color: var(--vp-c-text-1);
    font-weight: 600;
}

/* 锚点链接 */
.header-anchor {
    float: left;
    margin-left: -0.87em;
    padding-right: 0.23em;
    font-weight: 500;
    color: var(--vp-c-brand);
    text-decoration: none;
    opacity: 0;
    transition: all 0.3s ease;
}

h2:hover .header-anchor,
h3:hover .header-anchor {
    opacity: 1;
}

.header-anchor:hover {
    color: var(--vp-c-brand-dark);
}

/* ===== 段落和文本 ===== */
p {
    margin: 1.25rem 0;
    line-height: 1.8;
    color: var(--vp-c-text-1);
}

strong {
    font-weight: 600;
    color: var(--vp-c-text-1);
}

/* ===== 提示框样式 - 增强版 ===== */
.alert {
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    border-left: 4px solid;
    border-radius: 12px;
    background-color: var(--vp-c-gray-1);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: inherit;
    filter: brightness(1.2);
}

.alert:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.alert h3 {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert h3::before {
    content: '●';
    font-size: 0.75rem;
}

.alert p {
    margin: 0.75rem 0;
    color: var(--vp-c-text-1);
}

.alert p:first-of-type {
    margin-top: 0;
}

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

.alert-info {
    border-left-color: var(--vp-c-info-1);
    background: linear-gradient(135deg, var(--vp-c-info-2) 0%, rgba(239, 246, 255, 0.5) 100%);
}

.alert-info h3 {
    color: var(--vp-c-info-1);
}

.alert-warning {
    border-left-color: var(--vp-c-warning-1);
    background: linear-gradient(135deg, var(--vp-c-warning-2) 0%, rgba(255, 251, 235, 0.5) 100%);
}

.alert-warning h3 {
    color: #d97706;
}

.alert-tip {
    border-left-color: var(--vp-c-tip-1);
    background: linear-gradient(135deg, var(--vp-c-tip-2) 0%, rgba(236, 253, 245, 0.5) 100%);
}

.alert-tip h3 {
    color: #059669;
}

/* ===== 列表样式 ===== */
ul {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

li {
    margin: 0.75rem 0;
    line-height: 1.8;
    color: var(--vp-c-text-1);
    position: relative;
}

li::marker {
    color: var(--vp-c-brand);
    font-weight: 600;
}

/* ===== 链接卡片 - 大幅增强 ===== */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.link-card {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border: 2px solid var(--vp-c-gray-2);
    border-radius: 16px;
    text-decoration: none;
    color: var(--vp-c-text-1);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.link-card:hover {
    border-color: var(--vp-c-brand);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.link-card:active {
    transform: translateY(-2px);
}

.link-card img {
    width: 32px;
    height: 32px;
    margin-right: 1rem;
    flex-shrink: 0;
    border-radius: 8px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.link-card:hover img {
    transform: scale(1.1) rotate(5deg);
}

.link-content {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.link-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--vp-c-text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.link-card:hover .link-title {
    color: var(--vp-c-brand);
}

.link-url {
    font-size: 0.875rem;
    color: var(--vp-c-brand);
    font-family: var(--vp-font-family-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.link-status {
    font-size: 0.8125rem;
    color: var(--vp-c-text-3);
    margin-top: 0.375rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.03);
}

/* 测速状态颜色 - 更鲜明 */
.status-testing {
    color: #6b7280;
    animation: pulse 1.5s ease-in-out infinite;
    background-color: #f3f4f6;
}

.status-excellent {
    color: #059669;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    font-weight: 700;
}

.status-good {
    color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    font-weight: 700;
}

.status-normal {
    color: #2563eb;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    font-weight: 700;
}

.status-slow {
    color: #d97706;
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    font-weight: 700;
}

.status-very-slow {
    color: #dc2626;
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    font-weight: 700;
}

.status-failed {
    color: #991b1b;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    font-weight: 700;
}

/* 卡片边框颜色根据速度变化 - 更明显 */
.link-card.speed-excellent {
    border-color: #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
}

.link-card.speed-good {
    border-color: #22c55e;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.link-card.speed-normal {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.link-card.speed-slow {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.link-card.speed-very-slow {
    border-color: #ef4444;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.link-card.speed-failed {
    border-color: #dc2626;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
    opacity: 0.7;
}

/* 测速中的脉冲动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== 代码块样式 - 精美版 ===== */
.code-block {
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: none;
    border-radius: 12px;
    overflow-x: auto;
    position: relative;
}

.code-block pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #f97316, #ec4899, #8b5cf6, #3b82f6);
}

.code-block code {
    font-family: var(--vp-font-family-mono);
    font-size: 0.9375rem;
    color: #f472b6;
    line-height: 1.8;
    text-shadow: 0 0 10px rgba(244, 114, 182, 0.3);
}

/* ===== 分隔线 - 更明显的样式 ===== */
.divider {
    margin: 3rem 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(99, 102, 241, 0.3) 20%, rgba(168, 85, 247, 0.4) 50%, rgba(99, 102, 241, 0.3) 80%, transparent 100%);
    position: relative;
}

.divider::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, #6366f1 50%, transparent 100%);
    opacity: 0.6;
    filter: blur(1px);
}

/* ===== 区块间距 ===== */
.section {
    margin: 3rem 0;
}

.header {
    margin-bottom: 4rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .container {
        padding: 2rem 1rem 4rem;
    }
    
    .page-title {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
        margin: 2.5rem 0 1rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    .link-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    
    .link-card {
        padding: 1rem 1.25rem;
    }
    
    .alert {
        padding: 1rem 1.25rem;
        margin: 1.5rem 0;
    }
}

/* ===== 深色模式 - 精美版 ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --vp-c-gray-1: #1e293b;
        --vp-c-gray-2: #334155;
        --vp-c-gray-3: #475569;
        --vp-c-text-1: #f1f5f9;
        --vp-c-text-2: #cbd5e1;
        --vp-c-text-3: #94a3b8;
        --vp-c-brand: #60a5fa;
        --vp-c-brand-light: #93c5fd;
        --vp-c-brand-dark: #3b82f6;
    }
    
    body {
        background: linear-gradient(to bottom, #0f172a 0%, #1e293b 100%);
    }
    
    body::before {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    }
    
    .link-card {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-color: #334155;
    }
    
    .link-card::before {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    }
    
    .link-card:hover {
        border-color: var(--vp-c-brand);
        box-shadow: 0 10px 40px -10px rgba(96, 165, 250, 0.3);
    }
    
    .alert {
        background-color: #1e293b;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .alert-info {
        background: linear-gradient(135deg, rgba(30, 58, 138, 0.3) 0%, rgba(30, 64, 175, 0.2) 100%);
    }
    
    .alert-warning {
        background: linear-gradient(135deg, rgba(120, 53, 15, 0.3) 0%, rgba(146, 64, 14, 0.2) 100%);
    }
    
    .alert-tip {
        background: linear-gradient(135deg, rgba(6, 78, 59, 0.3) 0%, rgba(5, 150, 105, 0.2) 100%);
    }
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--vp-c-gray-1);
}

::-webkit-scrollbar-thumb {
    background: var(--vp-c-gray-3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--vp-c-brand);
}

/* ===== 选中文本样式 ===== */
::selection {
    background-color: rgba(99, 102, 241, 0.2);
    color: var(--vp-c-text-1);
}

/* ===== 辅助功能 ===== */
*:focus-visible {
    outline: 3px solid var(--vp-c-brand);
    outline-offset: 3px;
    border-radius: 4px;
}

.link-card:focus-visible {
    outline-offset: 2px;
}

/* ===== 加载动画 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    animation: fadeIn 0.6s ease-out;
}

/* ===== 打印样式 ===== */
@media print {
    .header-anchor {
        display: none;
    }
    
    .link-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    body::before {
        display: none;
    }
}

/* ===== 页脚样式 ===== */
.footer {
    margin-top: 5rem;
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--vp-c-gray-2);
    background: var(--vp-c-gray-1);
}

.footer-content {
    max-width: 52rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--vp-c-text-1);
    line-height: 1.6;
}

/* ===== 头像展示区域 ===== */
.avatar-section {
    text-align: center;
    padding: 1.5rem 0 1rem;
    animation: fadeIn 0.8s ease-out;
}

.avatar-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    object-fit: cover;
}

.avatar-image:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

@media (max-width: 768px) {
    .avatar-section {
        padding: 1rem 0 0.75rem;
    }
    
    .avatar-image {
        width: 80px;
        height: 80px;
    }
}