/* ==========================================================================
   OkraLinux 文档页 — 专用样式
   依赖 style.css（玻璃质感、渐变文字、焦点样式等基础规则）
   ========================================================================== */

/* ---------- 侧边栏目录 ---------- */
.docs-sidebar {
    scrollbar-width: thin;
}

.toc-link {
    display: block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #4b5563;
    border-left: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.dark .toc-link {
    color: #9ca3af;
}
.toc-link:hover {
    color: #16a34a;
    background: rgba(34, 197, 94, 0.06);
}
.dark .toc-link:hover {
    color: #4ade80;
}

/* 当前阅读位置高亮 */
.toc-link.active {
    color: #16a34a;
    border-left-color: #16a34a;
    background: rgba(34, 197, 94, 0.08);
    font-weight: 600;
}
.dark .toc-link.active {
    color: #4ade80;
    border-left-color: #4ade80;
    background: rgba(34, 197, 94, 0.12);
}

/* 二级条目缩进 */
.toc-link.sub {
    padding-left: 1.75rem;
    font-size: 0.8125rem;
}

/* ---------- 正文排版 ---------- */
.doc-body {
    font-size: 1rem;
    line-height: 1.75;
    color: #374151;
}
.dark .doc-body {
    color: #d1d5db;
}

.doc-body > section {
    scroll-margin-top: 5rem;
    margin-bottom: 3.5rem;
}

.doc-body h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}
.dark .doc-body h2 {
    color: #f9fafb;
    border-bottom-color: #1f2937;
}

.doc-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}
.dark .doc-body h3 {
    color: #f3f4f6;
}

.doc-body p {
    margin-bottom: 1rem;
}

.doc-body a:not(.toc-link) {
    color: #16a34a;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.doc-body a:not(.toc-link):hover {
    color: #15803d;
}
.dark .doc-body a:not(.toc-link) {
    color: #4ade80;
}
.dark .doc-body a:not(.toc-link):hover {
    color: #86efac;
}

/* 列表 */
.doc-body ul,
.doc-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}
.doc-body ul {
    list-style: disc;
}
.doc-body ol {
    list-style: decimal;
}
.doc-body li {
    margin-bottom: 0.5rem;
}
.doc-body li::marker {
    color: #16a34a;
}

/* 行内代码 */
.doc-body :not(pre) > code {
    background: #f3f4f6;
    color: #be185d;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    word-break: break-word;
}
.dark .doc-body :not(pre) > code {
    background: #1f2937;
    color: #f9a8d4;
}

/* ---------- 代码块 ---------- */
.code-block {
    position: relative;
    margin-bottom: 1.25rem;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #111827;
    border: 1px solid #1f2937;
}

.code-block .code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    background: #1f2937;
    border-bottom: 1px solid #374151;
}

.code-block .code-lang {
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #9ca3af;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-block pre {
    margin: 0;
    padding: 1rem 1.125rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e5e7eb;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
.code-block pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* 复制按钮 */
.copy-btn {
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    transition: color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}
.copy-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.copy-btn.copied {
    color: #4ade80;
}

/* ---------- 提示框 ---------- */
.callout {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.125rem;
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    border-left: 4px solid;
    font-size: 0.9375rem;
}
.callout-warn {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: #f59e0b;
}
.dark .callout-warn {
    background: rgba(245, 158, 11, 0.12);
}
.callout-info {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: #3b82f6;
}
.dark .callout-info {
    background: rgba(59, 130, 246, 0.12);
}
.callout-safe {
    background: rgba(34, 197, 94, 0.08);
    border-left-color: #22c55e;
}
.dark .callout-safe {
    background: rgba(34, 197, 94, 0.12);
}
.callout strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #111827;
}
.dark .callout strong {
    color: #f9fafb;
}

/* ---------- 步骤列表 ---------- */
.step-list {
    counter-reset: step;
    list-style: none;
    padding-left: 0;
}
.step-list > li {
    counter-increment: step;
    position: relative;
    padding-left: 3rem;
    padding-bottom: 1.75rem;
    margin-bottom: 0;
}
/* 连接线 */
.step-list > li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0.9375rem;
    top: 2.25rem;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, rgba(34, 197, 94, 0.4), rgba(34, 197, 94, 0.1));
}
/* 序号圆点 */
.step-list > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #16a34a, #0d9488);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.step-list > li > strong {
    display: block;
    margin-bottom: 0.375rem;
    color: #111827;
}
.dark .step-list > li > strong {
    color: #f9fafb;
}

/* ---------- 表格 ---------- */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}
.doc-table th,
.doc-table td {
    padding: 0.625rem 0.875rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.dark .doc-table th,
.dark .doc-table td {
    border-bottom-color: #1f2937;
}
.doc-table th {
    font-weight: 600;
    color: #111827;
    background: #f9fafb;
}
.dark .doc-table th {
    color: #f9fafb;
    background: #111827;
}
.doc-table tbody tr:hover {
    background: rgba(34, 197, 94, 0.04);
}

/* 移动端目录：横向滚动 */
@media (max-width: 1023px) {
    .docs-sidebar {
        position: static;
        max-height: none;
    }
}
