/* ========================================
   字节摆渡人 ByteFerry - 主样式表
   主体色调: 天蓝/浅蓝/青色
   响应式: 移动优先
   ======================================== */

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

:root {
    --primary:       #5DADE2;      /* 天蓝主色 */
    --primary-dark:  #2E86C1;
    --primary-light: #AED6F1;
    --accent:        #48C9B0;      /* 青色点缀 */
    --accent-dark:   #1ABC9C;
    --bg:            #F0F8FF;      /* 浅蓝白背景 */
    --bg-white:      #FFFFFF;
    --text:          #2C3E50;      /* 深蓝灰文字 */
    --text-light:    #5D6D7E;
    --border:        #D4E6F1;
    --shadow:        0 2px 12px rgba(93, 173, 226, 0.12);
    --shadow-hover:  0 6px 24px rgba(93, 173, 226, 0.22);
    --radius:        10px;
    --max-width:     1200px;
    --header-height: 64px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary-dark); transition: color 0.2s; }
a:hover { color: var(--primary); }
ul { list-style: none; }

/* === 响应式容器 === */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   顶部导航栏
   ======================================== */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

/* Logo */
.logo {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-shrink: 0;
}
.logo-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.logo-sub {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

/* 主菜单 */
.main-nav { position: relative; }
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-dark);
}

.nav-list {
    display: flex;
    gap: 4px;
}
.nav-list > li > a {
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    display: block;
    transition: background 0.2s, color 0.2s;
}
.nav-list > li > a:hover,
.nav-list > li > a.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* 下拉菜单 */
.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    padding: 6px 0;
    z-index: 1001;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu li a {
    padding: 8px 16px;
    display: block;
    font-size: 0.9rem;
}
.dropdown-menu li a:hover { background: var(--bg); }

/* 语言切换 */
.lang-switch { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 6px;
    color: var(--text-light);
    border-radius: 4px;
    transition: background 0.2s;
}
.lang-btn.active {
    color: var(--primary-dark);
    font-weight: 700;
}
.lang-btn:hover { background: var(--bg); }
.lang-divider { color: var(--border); font-size: 0.85rem; }

/* ========================================
   Hero 区域
   ======================================== */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent) 100%);
    padding: 60px 20px 50px;
    text-align: center;
    position: relative;
}
.hero-content { position: relative; z-index: 2; }
.hero-title {
    font-size: 2.2rem;
    color: #FFFFFF;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}
.hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.92);
    margin-bottom: 10px;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}
.hero-desc {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.78);
    max-width: 640px;
    margin: 0 auto;
}

/* ========================================
   协议分类卡片
   ======================================== */
.protocol-categories {
    padding: 50px 0 60px;
}
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.category-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px 22px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s, transform 0.2s;
}
.category-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}
.card-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
}
.category-card h2 {
    font-size: 1.15rem;
    color: var(--primary-dark);
    margin-bottom: 8px;
    font-weight: 700;
}
.category-card > p {
    font-size: 0.88rem;
    color: var(--text-light);
    margin-bottom: 14px;
    line-height: 1.5;
}
.protocol-list li {
    border-top: 1px dashed var(--border);
}
.protocol-list li a {
    padding: 8px 0;
    display: block;
    font-size: 0.9rem;
    transition: padding-left 0.2s;
}
.protocol-list li a:hover { padding-left: 6px; }

/* ========================================
   页脚
   ======================================== */
.site-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.85);
    padding: 24px 20px;
}
.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.footer-brand p { font-size: 0.88rem; }
.footer-desc { opacity: 0.7; font-size: 0.8rem; }
.footer-beian a {
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    text-decoration: none;
}
.footer-beian a:hover { color: #fff; text-decoration: underline; }
.beian-icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }

/* ========================================
   协议详情页通用样式
   ======================================== */
.article-page {
    padding: 40px 20px 60px;
    max-width: 900px;
    margin: 0 auto;
}
.article-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    color: #fff;
    padding: 32px 28px;
    border-radius: var(--radius);
    margin-bottom: 32px;
}
.article-header h1 { font-size: 1.8rem; margin-bottom: 8px; }
.article-header .subtitle { opacity: 0.88; }
.breadcrumb {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary-dark); }

/* 内容区 */
.content-section {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.content-section h2 {
    font-size: 1.2rem;
    color: var(--primary-dark);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}
.content-section h3 {
    font-size: 1.05rem;
    color: var(--text);
    margin: 16px 0 10px;
}
.content-section p {
    margin-bottom: 12px;
    line-height: 1.8;
}

/* 代码块 */
.code-block {
    background: #1E272E;
    color: #D6E4F0;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: "Fira Code", "Source Code Pro", "Consolas", "Monaco", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 12px 0 16px;
}

/* 时序图占位 */
.timing-diagram {
    background: var(--bg);
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    color: var(--text-light);
    margin: 14px 0;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 0.9rem;
}
.data-table th, .data-table td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
}
.data-table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}
.data-table tr:nth-child(even) { background: #FAFCFF; }

/* 高亮提示 */
.callout {
    border-left: 4px solid var(--accent);
    background: #E8F8F5;
    padding: 12px 18px;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 14px 0;
    font-size: 0.9rem;
}

/* ========================================
   响应式断点
   ======================================== */

/* 平板 (≤1024px) */
@media (max-width: 1024px) {
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .article-page { padding: 30px 16px 50px; }
}

/* 手机 (≤768px) */
@media (max-width: 768px) {
    .hero-title { font-size: 1.5rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .hero-desc { font-size: 0.85rem; }
    .hero { padding: 40px 16px 36px; }

    /* 导航汉堡菜单 */
    .nav-toggle { display: block; }
    .nav-list {
        display: none;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-white);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        padding: 8px 0;
    }
    .nav-list.show { display: flex; }
    .nav-list > li > a { padding: 10px 20px; border-radius: 0; }
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 16px;
    }

    .category-grid { grid-template-columns: 1fr; }

    .footer-container { flex-direction: column; text-align: center; }

    .content-section { padding: 16px; }
    .article-header { padding: 20px 16px; }
    .article-header h1 { font-size: 1.4rem; }
}

/* 小屏手机 (≤480px) */
@media (max-width: 480px) {
    :root { --header-height: 56px; }
    .logo-text { font-size: 1.1rem; }
}