/* ============================================================
   轻语API开放平台 - 技术文章共享样式
   品牌：轻语API开放平台 · 上海栾青网络科技 · 轻语乘风工作室
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #667eea;
    --color-primary-dark: #5a6fd6;
    --color-accent: #764ba2;
    --color-bg: #f5f5f7;
    --color-white: #ffffff;
    --color-text: #1d1d1f;
    --color-text-secondary: #6e6e73;
    --color-text-light: #86868b;
    --color-border: #d2d2d7;
    --color-code-bg: #1e1e2e;
    --color-code-text: #cdd6f4;
    --color-table-stripe: #f8f8fa;
    --color-table-hover: #f0f0f5;
    --max-width-article: 800px;
    --max-width-page: 1200px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, 'Source Code Pro', monospace;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

/* ---------- Header ---------- */
.article-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(102,126,234,0.3);
}

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

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.header-logo:hover {
    color: #fff;
    text-decoration: none;
    opacity: 0.9;
}
.header-logo svg {
    width: 28px;
    height: 28px;
}

.header-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.header-back:hover {
    background: rgba(255,255,255,0.32);
    color: #fff;
    text-decoration: none;
}
.header-back svg {
    width: 16px;
    height: 16px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    max-width: var(--max-width-article);
    margin: 0 auto;
    padding: 20px 20px 0;
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.breadcrumb li {
    display: inline-flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: '›';
    margin: 0 8px;
    color: var(--color-border);
    font-weight: 600;
    font-size: 1rem;
}

.breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.breadcrumb li:last-child {
    color: var(--color-text);
    font-weight: 500;
}

/* ---------- Article Hero ---------- */
.article-hero {
    max-width: var(--max-width-article);
    margin: 0 auto;
    padding: 40px 20px 20px;
    text-align: center;
}

.article-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--color-text);
    margin-bottom: 12px;
}

.article-meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---------- Article Content ---------- */
.article-content {
    max-width: var(--max-width-article);
    margin: 0 auto;
    padding: 0 20px 60px;
}

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 36px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

.article-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 28px 0 10px;
}

.article-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 22px 0 8px;
}

.article-content p {
    margin: 12px 0;
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.article-content blockquote {
    margin: 16px 0;
    padding: 12px 20px;
    border-left: 4px solid var(--color-primary);
    background: rgba(102,126,234,0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text-secondary);
    font-style: italic;
}

.article-content strong {
    color: var(--color-text);
}

.article-content ul,
.article-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.article-content li {
    margin: 6px 0;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* ---------- Code Blocks ---------- */
.article-content pre {
    background: var(--color-code-bg);
    color: var(--color-code-text);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    overflow-x: auto;
    margin: 16px 0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.65;
    box-shadow: var(--shadow-md);
    tab-size: 4;
    -moz-tab-size: 4;
}

.article-content pre code {
    font-family: inherit;
    font-size: inherit;
    background: none;
    padding: 0;
    color: inherit;
}

.article-content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(102,126,234,0.1);
    color: var(--color-primary-dark);
    padding: 2px 6px;
    border-radius: 3px;
    word-break: break-word;
}

/* Syntax Highlighting Classes */
.hljs-keyword { color: #cba6f7; }   /* 关键字 - 紫色 */
.hljs-string  { color: #a6e3a1; }   /* 字符串 - 绿色 */
.hljs-comment { color: #6c7086; font-style: italic; }  /* 注释 - 灰色 */
.hljs-number  { color: #fab387; }   /* 数字 - 橙色 */
.hljs-type    { color: #89b4fa; }   /* 类型 - 蓝色 */
.hljs-meta    { color: #89dceb; }   /* 注解 - 青色 */
.hljs-function{ color: #89b4fa; }   /* 函数名 - 蓝色 */
.hljs-title   { color: #89b4fa; }   /* 方法名 - 蓝色 */
.hljs-attr    { color: #a6e3a1; }   /* 属性 - 绿色 */
.hljs-builtin { color: #f9e2af; }   /* 内置 - 黄色 */
.hljs-literal { color: #fab387; }   /* 字面量 - 橙色 */

/* Language badge on code blocks */
.article-content pre {
    position: relative;
}
.article-content pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 8px;
    right: 16px;
    font-size: 0.7rem;
    color: #6c7086;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- Tables ---------- */
.article-content .table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.6;
}

.article-content thead {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: #fff;
}

.article-content thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.article-content tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.article-content tbody tr:nth-child(even) {
    background: var(--color-table-stripe);
}

.article-content tbody tr:hover {
    background: var(--color-table-hover);
}

.article-content tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- Separator ---------- */
.article-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 40px 0 24px;
}

/* ---------- Related Tools ---------- */
.related-tools {
    max-width: var(--max-width-article);
    margin: 0 auto 60px;
    padding: 0 20px;
}

.related-tools h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-tools h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border-radius: 2px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.tool-card {
    display: block;
    padding: 18px 20px;
    background: var(--color-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.tool-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 16px rgba(102,126,234,0.2);
    transform: translateY(-2px);
    text-decoration: none;
}

.tool-card .tool-name {
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.tool-card .tool-desc {
    font-size: 0.8rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

.tool-card .tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    margin-bottom: 10px;
    font-size: 1rem;
}

/* ---------- Footer ---------- */
.article-footer {
    background: #1d1d1f;
    color: #a1a1a6;
    padding: 24px 20px;
    text-align: center;
    margin-top: auto;
    font-size: 0.8rem;
    line-height: 1.6;
}

.article-footer .brand {
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.article-footer a {
    color: #a1a1a6;
}
.article-footer a:hover {
    color: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .article-hero h1 {
        font-size: 1.5rem;
    }

    .article-content h2 {
        font-size: 1.25rem;
    }

    .article-content h3 {
        font-size: 1.1rem;
    }

    .article-content pre {
        padding: 14px 16px;
        font-size: 0.8rem;
        border-radius: var(--radius-sm);
    }

    .article-content pre::before {
        top: 4px;
        right: 10px;
        font-size: 0.65rem;
    }

    .article-content table {
        font-size: 0.8rem;
    }

    .article-content thead th,
    .article-content tbody td {
        padding: 8px 12px;
    }

    .header-inner {
        padding: 0 12px;
    }

    .header-logo {
        font-size: 0.95rem;
    }

    .header-back {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .article-meta {
        gap: 12px;
        font-size: 0.8rem;
    }

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

@media (max-width: 480px) {
    .article-hero h1 {
        font-size: 1.3rem;
    }

    .breadcrumb {
        font-size: 0.78rem;
        padding-top: 14px;
    }

    .article-content {
        padding: 0 14px 40px;
    }

    .related-tools {
        padding: 0 14px;
        margin-bottom: 40px;
    }
}

/* Print styles */
@media print {
    .article-header,
    .breadcrumb,
    .related-tools,
    .article-footer {
        display: none;
    }

    .article-content {
        max-width: 100%;
    }

    .article-content pre {
        background: #f5f5f5;
        color: #333;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
