/* ==========================================================================
   components.css — 全站组件补丁
   必须在所有内联 <style> 之后加载（37 个文章页把主样式内联在页面里，
   只有加载顺序排在最后的样式表才能稳定覆盖它们）。
   内容：
     1. 导航：6 项统一 + 移动端下拉面板
     2. 下载弹窗：二维码栅格与尺寸
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 导航
   -------------------------------------------------------------------------- */
.navbar {
    gap: 16px;
}

.nav-links {
    gap: 30px;
}

/* 当前页高亮 */
.nav-links a[aria-current="page"] {
    color: #E96E4B;
}

.nav-links a[aria-current="page"]::after {
    width: 100%;
}

/* 导航锚点跳转时给固定 header 留出空间，避免标题被盖住 */
#features,
#highlights,
#comparison,
#install {
    scroll-margin-top: 92px;
}

/* 中等宽度：收紧间距，避免 6 项 + CTA 挤行 */@media (max-width: 1180px) {
    .nav-links { gap: 20px; }
    .nav-links a { font-size: 0.94rem; }
    .nav-cta { padding: 10px 20px; font-size: 0.88rem; }
}

@media (max-width: 900px) {
    .nav-links { gap: 14px; }
    .nav-links a { font-size: 0.88rem; }
}

/* --------------------------------------------------------------------------
   2. 移动端下拉菜单
   原本 .nav-links 在 <=768px 被隐藏，脚本只把 display 改成 flex，
   结果是一行横排、溢出到 header 外面。这里补成真正的下拉面板。
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .navbar {
        position: relative;
    }

    /* 窄屏收紧 logo 与 CTA，避免按钮换行把 header 撑高 */
    .logo {
        font-size: 1.45rem;
        gap: 9px;
    }

    /* 菜单收起后只剩 logo / CTA / 汉堡三项，
       space-between 会把 CTA 挤到正中间，这里让它靠右 */
    .nav-cta {
        margin-left: auto;
        padding: 9px 16px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        right: 0;
        gap: 0;
        padding: 4px 18px;
        background: #FFFFFF;
        border-radius: 16px;
        box-shadow: 0 18px 44px rgba(20, 35, 50, 0.16);
        max-height: 72vh;
        overflow-y: auto;
        z-index: 1002;
    }

    .nav-links.active li {
        border-bottom: 1px solid #EEF2F6;
    }

    .nav-links.active li:last-child {
        border-bottom: 0;
    }

    .nav-links.active a {
        display: block;
        padding: 14px 2px;
        font-size: 1rem;
    }

    .nav-links.active a::after {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   3. 下载弹窗
   原样式：.image-card img 只有 max-width:200px 且没有居中，
   图片缩在卡片左侧、底部边框只画一半；移动端媒体查询写的是
   grid-template-columns 而容器是 flex，完全没生效。
   这里统一成两列等宽栅格，二维码按卡片宽度等比填充。
   -------------------------------------------------------------------------- */
.modal-content {
    display: flex;
    flex-direction: column;
    width: 92%;
    max-width: 496px;
    padding: 22px 22px 18px;
    border-radius: 24px;
    max-height: 92vh;
    overflow-y: auto;
}

.modal .ready-phase {
    text-align: center;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.modal .ready-header {
    text-align: center;
    margin-bottom: 16px;
}

.modal .ready-title {
    font-size: 19px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 6px;
    line-height: 1.4;
}

.modal .ready-sub {
    font-size: 13.5px;
    color: #64748B;
    margin: 0;
}

.modal .image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 0;
    width: 100%;
}

.modal .image-card {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border: 1px solid #E8EEF5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal .image-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 20, 30, 0.08);
}

.modal .image-card img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #FFFFFF;
    /* 二维码需要白色静区才能稳定识别，同时避免图形顶到卡片边框 */
    padding: 12px;
    border-bottom: 1px solid #E8EEF5;
}

.modal .image-caption {
    padding: 12px 10px 14px;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #1E2B3A;
    font-weight: 600;
    background: #FFFFFF;
    border-radius: 0;
}

.modal .image-caption span {
    display: block;
    font-size: 0.82rem;
    color: #5B6F82;
    margin-top: 4px;
    font-weight: 400;
    opacity: 1;
}

.modal .scan-hint {
    text-align: center;
    color: #94A3B8;
    font-size: 13px;
    margin: 14px 0 0;
}

.modal .close-btn {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 28px;
    z-index: 20;
}

/* 窄屏：保持两列（二维码缩到约 150px 仍可扫），但压缩留白与字号，
   让弹窗整体不出滚动条，关闭按钮始终可见 */
@media (max-width: 600px) {
    .modal-content {
        width: 94%;
        max-width: 420px;
        padding: 20px 14px 16px;
        border-radius: 20px;
    }

    .modal .ready-header {
        margin-bottom: 12px;
        padding-right: 34px;
    }

    .modal .ready-title {
        font-size: 16px;
    }

    .modal .ready-sub {
        font-size: 12px;
    }

    .modal .image-grid {
        gap: 10px;
    }

    /* 窄屏下卡片本就小，静区收窄以保留扫码面积 */
    .modal .image-card img {
        padding: 8px;
    }

    .modal .image-caption {
        padding: 9px 6px 11px;
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .modal .image-caption span {
        font-size: 0.72rem;
        margin-top: 3px;
    }

    .modal .scan-hint {
        font-size: 12px;
        margin-top: 10px;
    }

    .modal .close-btn {
        top: 8px;
        right: 8px;
        width: 34px;
        height: 34px;
        font-size: 24px;
    }
}

/* --------------------------------------------------------------------------
   4. 首页区块底部的「查看完整说明」引导链接
   -------------------------------------------------------------------------- */
.section-more {
    text-align: center;
    margin-top: 32px;
}

.section-more a {
    display: inline-block;
    color: #E96E4B;
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.6;
    text-decoration: none;
    padding: 10px 22px;
    border: 1px solid rgba(233, 110, 75, 0.35);
    border-radius: 50px;
    background: rgba(233, 110, 75, 0.06);
    transition: all 0.25s ease;
}

.section-more a:hover {
    background: rgba(233, 110, 75, 0.12);
    border-color: #E96E4B;
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   5. 窄屏表格
   hub 内联样式写死了 table.spec{min-width:620px}，手机上必然横向溢出。
   2 列表格改为自适应铺满；3 列及以上的对比表保留横向滚动（这类表本就是横向阅读）。
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap table.spec {
        min-width: 0;
        width: 100%;
        font-size: 0.88rem;
    }

    .table-wrap table.spec th,
    .table-wrap table.spec td {
        padding: 11px 11px;
        line-height: 1.65;
    }

    .table-wrap table.spec td:first-child {
        width: 38%;
        max-width: none;
    }

    /* 3 列及以上的表格：保留最小宽度，改为横向滚动 */
    .table-wrap:has(table.spec thead th:nth-child(3)) table.spec {
        min-width: 520px;
    }

    .table-wrap:has(table.spec thead th:nth-child(3)) table.spec td:first-child {
        width: 110px;
    }
}

/* ==========================================================================
   6. 文章正文排版（news1–news39）
   目标：官方文档观感 —— 层级清楚、可扫读、段落不拥挤。
   用 h2/h3/p 的通用选择器，避免逐篇加 class。
   ========================================================================== */
article.content-gap {
    max-width: 820px;
    margin: 0 auto;
}

article.content-gap h1 {
    font-size: 2.05rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin: 0 0 18px;
    font-weight: 800;
}

/* 元信息条 */
.art-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 26px;
    font-size: 0.82rem;
    color: #6C757D;
}

.art-meta span {
    display: inline-block;
    padding: 4px 12px;
    background: #F5F6F8;
    border: 1px solid #E9ECEF;
    border-radius: 20px;
}

/* 导语 */
article.content-gap .art-lead {
    font-size: 1.06rem;
    line-height: 1.85;
    color: #2C2F33;
    background: #FBFBF7;
    border-left: 3px solid #E96E4B;
    border-radius: 0 10px 10px 0;
    padding: 16px 20px;
    margin: 0 0 30px;
}

/* 目录 */
.art-toc {
    background: #F8F9FA;
    border: 1px solid #E9ECEF;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 0 0 34px;
    font-size: 0.93rem;
}

.art-toc strong {
    display: block;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: #6C757D;
    margin-bottom: 8px;
    font-weight: 700;
}

.art-toc a {
    display: inline-block;
    margin: 0 18px 6px 0;
    color: #3D404B;
    text-decoration: none;
    border-bottom: 1px dashed #C9CFD8;
}

.art-toc a:hover { color: #E96E4B; border-bottom-color: #E96E4B; }

/* 分节标题 */
article.content-gap h2 {
    font-size: 1.42rem;
    font-weight: 800;
    line-height: 1.5;
    margin: 44px 0 16px;
    padding-left: 14px;
    border-left: 4px solid #E96E4B;
    color: #2C2F33;
}

article.content-gap h2:first-of-type { margin-top: 0; }

/* 功能点小标题 */
article.content-gap h3 {
    font-size: 1.08rem;
    font-weight: 800;
    margin: 26px 0 8px;
    color: #2C2F33;
    line-height: 1.55;
}

article.content-gap p {
    color: #3D404B;
    line-height: 1.9;
    margin: 0 0 15px;
    font-size: 1rem;
}

article.content-gap strong { color: #2C2F33; font-weight: 700; }

article.content-gap code {
    background: #F3F4F6;
    border: 1px solid #E9ECEF;
    border-radius: 5px;
    padding: 1px 6px;
    font-size: 0.88em;
    font-family: ui-monospace, Consolas, monospace;
    color: #B8461F;
}

/* 要点列表 */
ul.art-list {
    margin: 0 0 18px;
    padding-left: 0;
    list-style: none;
}

ul.art-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 9px;
    line-height: 1.85;
    color: #3D404B;
}

ul.art-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #E96E4B;
}

/* 表格 */
.art-table-wrap {
    overflow-x: auto;
    margin: 0 0 22px;
    border: 1px solid #E9ECEF;
    border-radius: 12px;
}

table.art-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

table.art-table th,
table.art-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #E9ECEF;
    line-height: 1.7;
    vertical-align: top;
}

table.art-table thead th {
    background: #F8F9FA;
    font-weight: 700;
    font-size: 0.86rem;
    color: #3D404B;
    white-space: nowrap;
}

table.art-table tbody tr:last-child td { border-bottom: none; }

table.art-table td:first-child {
    font-weight: 600;
    color: #2C2F33;
}

/* 提示框 */
.art-note,
.art-warn {
    border-radius: 10px;
    padding: 14px 18px;
    margin: 0 0 20px;
    font-size: 0.94rem;
    line-height: 1.8;
}

.art-note {
    background: #F4F8FB;
    border-left: 3px solid #5B8DB8;
    color: #2F4A5F;
}

.art-warn {
    background: #FDF6F1;
    border-left: 3px solid #E96E4B;
    color: #6B3A25;
}

/* 步骤 */
ol.art-steps {
    counter-reset: st;
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

ol.art-steps li {
    counter-increment: st;
    position: relative;
    padding-left: 40px;
    margin-bottom: 14px;
    line-height: 1.85;
    color: #3D404B;
}

ol.art-steps li::before {
    content: counter(st);
    position: absolute;
    left: 0;
    top: 3px;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: #2C2F33;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 配图：内联 SVG，无水印、无外链 */
.art-figure {
    margin: 0 0 26px;
    border: 1px solid #E9ECEF;
    border-radius: 12px;
    background: #FCFCFD;
    padding: 20px 16px 12px;
    text-align: center;
}

.art-figure svg {
    width: 100%;
    max-width: 620px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.art-figure figcaption {
    margin-top: 12px;
    font-size: 0.82rem;
    color: #6C757D;
    line-height: 1.6;
}

@media (max-width: 640px) {
    article.content-gap h1 { font-size: 1.5rem; }
    article.content-gap h2 { font-size: 1.2rem; margin-top: 34px; }
    article.content-gap h3 { font-size: 1.02rem; }
    article.content-gap p { font-size: 0.97rem; line-height: 1.85; }
    article.content-gap .art-lead { font-size: 1rem; padding: 14px 16px; }
    table.art-table th, table.art-table td { padding: 10px 11px; font-size: 0.86rem; }
}

/* --------------------------------------------------------------------------
   7. 文章页附属区块对齐
   正文被限制在 820px，但作者栏 / FAQ / 相关推荐是 body 直接子元素、占满全宽，
   视觉上会跳。这里统一收进同一栏宽，并在窄屏补内边距避免贴边。
   -------------------------------------------------------------------------- */
.author-box,
.faq-section,
.related-section {
    max-width: 868px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 900px) {
    .author-box,
    .faq-section,
    .related-section {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* FAQ 卡片：原样式边框过淡，几乎看不出层次 */
.faq-section h2 {
    font-size: 1.42rem;
    font-weight: 800;
    color: #2C2F33;
    margin: 0 0 18px;
    padding-left: 14px;
    border-left: 4px solid #E96E4B;
}

.faq-item {
    border: 1px solid #E9ECEF;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 12px;
    background: #FFFFFF;
    box-shadow: none;
}

.faq-item h3 {
    font-size: 1.02rem;
    font-weight: 700;
    color: #2C2F33;
    margin: 0 0 8px;
    line-height: 1.6;
}

.faq-item p {
    margin: 0;
    color: #3D404B;
    font-size: 0.96rem;
    line-height: 1.85;
}

@media (max-width: 640px) {
    .faq-section h2 { font-size: 1.2rem; }
    .faq-item { padding: 15px 17px; }
    .faq-item h3 { font-size: 0.98rem; }
    .faq-item p { font-size: 0.93rem; }
}

/* --------------------------------------------------------------------------
   8. 平台卡片：FreeBSD/OpenSolaris 这类无空格长词会顶出卡片，允许断行并压字号
   -------------------------------------------------------------------------- */
.platform-card h4 {
    font-size: 1.32rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

/* ==========================================================================
   9. 教程索引页（news.html）
   原页面：H1 排在 7 个主题 H3 之后、卡片只有标题、导语是产品介绍。
   这里补页面头部、紧凑卡片与摘要排版。
   ========================================================================== */
.list-hero {
    padding: 128px 0 32px;
    background: linear-gradient(180deg, #FAFAF7 0%, #FFFFFF 100%);
    border-bottom: 1px solid #EDEFF2;
}

.list-hero .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    color: #8A9199;
    margin-bottom: 16px;
}

.list-hero .breadcrumb a {
    color: #8A9199;
    text-decoration: none;
}

.list-hero .breadcrumb a:hover { color: #E96E4B; }

.list-hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.01em;
    color: #2C2F33;
    margin: 0 0 14px;
}

.list-lead {
    font-size: 1rem;
    line-height: 1.9;
    color: #4A5158;
    max-width: 780px;
    margin: 0 0 20px;
}

.list-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.list-stats span {
    font-size: 0.82rem;
    color: #5B6470;
    background: #FFFFFF;
    border: 1px solid #E9ECEF;
    border-radius: 20px;
    padding: 5px 14px;
}

.list-stats strong {
    color: #2C2F33;
    font-weight: 800;
}

/* 索引卡片：首页特色卡 padding 45px、标题 1.6rem，用在 39 张列表上过于松散 */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.tutorial-grid .feature-card {
    padding: 20px 22px;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(45, 52, 64, 0.04);
}

.tutorial-grid .feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 26px rgba(45, 52, 64, 0.09);
}

.tutorial-grid .feature-card h3 {
    font-size: 1.02rem;
    line-height: 1.55;
    margin: 10px 0 8px;
}

.tutorial-grid .feature-card h3 a { color: #2C2F33; }

.tutorial-grid .feature-card p {
    font-size: 0.85rem;
    line-height: 1.72;
    color: #6C757D;
    margin: 0;
}

.tutorial-grid .feature-card .tag {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 700;
    color: #E96E4B;
    background: rgba(233, 110, 75, 0.09);
    border-radius: 20px;
    padding: 3px 10px;
}

@media (max-width: 900px) {
    .list-hero { padding: 108px 0 26px; }
    .list-hero h1 { font-size: 1.85rem; }
}

@media (max-width: 640px) {
    .list-hero { padding: 100px 0 24px; }
    .list-hero h1 { font-size: 1.55rem; }
    .list-lead { font-size: 0.94rem; line-height: 1.85; }
    .tutorial-grid { grid-template-columns: 1fr; gap: 12px; }
    .tutorial-grid .feature-card { padding: 17px 18px; }
    .tutorial-grid .feature-card h3 { font-size: 0.99rem; }
}

/* 索引卡片：改为左对齐、等高，避免长标题把卡片撑得不齐 */
.tutorial-grid .feature-card {
    position: relative;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.tutorial-grid .feature-card h3 { margin-top: 0; }

.tutorial-grid .feature-card p { flex: 1 1 auto; }

.tutorial-grid .feature-card .tag { align-self: flex-start; }

/* 主题卡片在手机上单列会拉很长，改为两列（内联 grid 需 !important 覆盖） */
@media (max-width: 640px) {
    .hub-index .hub-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .hub-index .hub-card {
        padding: 14px 14px !important;
    }

    .hub-index .hub-card h3 {
        font-size: 0.95rem !important;
        line-height: 1.45;
    }
}

/* --------------------------------------------------------------------------
   10. 相关推荐栅格
   卡片数量固定为 4，容器宽 868px。原 auto-fit/minmax(220px) 在 868px 下
   只能排 3 列，第 4 张单独换行。改为 2 列，正好 2×2，标题一行放得下。
   -------------------------------------------------------------------------- */
.related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (max-width: 700px) {
    .related-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}
