/* ===== CSS变量和基础样式 ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #7c3aed;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-dark: #0f172a;
    --background-medium: #1e293b;
    --background-light: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --card-bg: #1e293b;
    --code-bg: #0f172a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans SC', sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== 导航栏 ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-brand i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.nav-menu a:hover {
    color: var(--text-primary);
    background: var(--background-light);
}

.nav-menu a.active {
    color: var(--primary-light);
    background: rgba(37, 99, 235, 0.1);
}

.nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* ===== Hero区域 ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 100px 5% 60px;
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-medium) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    max-width: 650px;
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

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

.hero-buttons {
    display: flex;
    gap: 1rem;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--border-radius-md);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

.btn-secondary:hover {
    background: var(--background-light);
    border-color: var(--primary-color);
}

/* 动画效果 */
.hero-visual {
    position: relative;
    width: 400px;
    height: 400px;
}

.pcie-lane-animation {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lane-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lane {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 200px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.lane::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% { left: 100%; }
}

/* ===== 主要内容区域 ===== */
.main-content {
    background: var(--background-dark);
}

.section {
    padding: 5rem 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* ===== 概述部分 ===== */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.overview-text p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.highlight-box {
    background: var(--background-medium);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.highlight-box h4 {
    color: var(--primary-light);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.highlight-box ul {
    list-style: none;
}

.highlight-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.highlight-box li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* 协议栈架构图 */
.architecture-diagram {
    background: var(--background-medium);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.architecture-diagram h4 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.protocol-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layer {
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform var(--transition-fast);
    cursor: pointer;
}

.layer:hover {
    transform: translateX(10px);
}

.layer[data-layer="transaction"] {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.3), rgba(37, 99, 235, 0.1));
    border-left: 4px solid var(--primary-color);
}

.layer[data-layer="data link"] {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(124, 58, 237, 0.1));
    border-left: 4px solid var(--secondary-color);
}

.layer[data-layer="physical"] {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(6, 182, 212, 0.1));
    border-left: 4px solid var(--accent-color);
}

.layer-name {
    font-weight: 600;
    color: var(--text-primary);
}

.layer-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== 代际对比表格 ===== */
.generations {
    background: var(--background-medium);
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--background-light);
    font-weight: 600;
    color: var(--text-primary);
}

.data-table td {
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

.version-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.version-badge.gen1 { background: rgba(107, 114, 128, 0.3); color: #9ca3af; }
.version-badge.gen2 { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.version-badge.gen3 { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.version-badge.gen4 { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.version-badge.gen5 { background: rgba(236, 72, 153, 0.2); color: #ec4899; }
.version-badge.gen6 { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }

/* 带宽计算器 */
.bandwidth-calculator {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin-top: 2rem;
}

.bandwidth-calculator h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calc-controls {
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.calc-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.calc-group label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.calc-group select {
    padding: 0.75rem 1rem;
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 180px;
    cursor: pointer;
}

.calc-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.calc-result {
    display: flex;
    gap: 2rem;
    margin-left: auto;
}

.result-item {
    text-align: center;
}

.result-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.result-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-value.highlight {
    color: var(--primary-light);
}

/* ===== 内容导航卡片 ===== */
.content-nav {
    background: var(--background-dark);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-decoration: none;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.content-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
}

.content-card.special {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.1));
    border-color: var(--primary-color);
}

.card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 1.25rem;
}

.content-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.content-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.card-topics {
    list-style: none;
    font-size: 0.85rem;
}

.card-topics li {
    padding: 0.35rem 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.card-topics li:first-child {
    border-top: none;
}

/* ===== Tab组件 ===== */
.concept-tabs {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: var(--background-light);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(37, 99, 235, 0.05);
}

.tab-btn.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.tab-contents {
    padding: 2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-content h4 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tab-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* 图表框 */
.diagram-box {
    background: var(--background-dark);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

/* TLP结构图 */
.tlp-structure {
    display: flex;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.tlp-field {
    padding: 1rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tlp-field span {
    font-weight: 600;
}

.tlp-field small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tlp-field.header {
    background: rgba(37, 99, 235, 0.3);
    flex: 1;
}

.tlp-field.data {
    background: rgba(16, 185, 129, 0.3);
    flex: 3;
}

.tlp-field.ecrc {
    background: rgba(124, 58, 237, 0.3);
    flex: 0.5;
}

/* DLLP结构图 */
.dllp-structure {
    display: flex;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.dllp-field {
    padding: 1rem;
    text-align: center;
    background: rgba(6, 182, 212, 0.3);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dllp-field span {
    font-weight: 600;
}

.dllp-field small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Lane结构图 */
.lane-structure {
    padding: 1rem;
}

.lane-pair {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.diff-pair {
    display: flex;
    gap: 0.5rem;
}

.diff-pair span {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
}

.diff-pair.tx span {
    background: rgba(37, 99, 235, 0.3);
}

.diff-pair.rx span {
    background: rgba(16, 185, 129, 0.3);
}

/* VC图 */
.vc-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.vc-queues {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.vc-queue {
    padding: 0.5rem 1rem;
    background: rgba(37, 99, 235, 0.3);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
}

.vc-arbiter,
.vc-link {
    padding: 0.75rem 2rem;
    border-radius: var(--border-radius-sm);
}

.vc-arbiter {
    background: rgba(124, 58, 237, 0.3);
}

.vc-link {
    background: rgba(16, 185, 129, 0.3);
    width: 100%;
    text-align: center;
}

/* 信息表格 */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.info-table th,
.info-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.info-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.info-table td {
    color: var(--text-secondary);
}

/* ===== 应用场景 ===== */
.applications {
    background: var(--background-medium);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition-normal);
}

.app-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.app-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
}

.app-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

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

/* ===== 页脚 ===== */
.footer {
    background: var(--background-medium);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0 1.5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-section a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .app-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 100px;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-visual {
        display: none;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--background-dark);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        display: none;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .calc-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .calc-result {
        margin-left: 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .app-grid {
        grid-template-columns: 1fr;
    }
    
    .tab-buttons {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 50%;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}
