/* ============================================
   1630.top 技术博客 - 统一样式文件
   主题色: #2563eb (蓝色)
   现代简洁技术博客风格
   ============================================ */

/* ===== CSS 变量定义 ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-lighter: #eff6ff;
    --text-main: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --bg-main: #ffffff;
    --bg-soft: #f8fafc;
    --bg-code: #1e293b;
    --border: #e2e8f0;
    --border-dark: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --max-width: 1200px;
    --header-height: 64px;
}

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
        sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-main);
    background-color: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul,
ol {
    list-style-position: inside;
}

/* ===== 通用容器 ===== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== 顶部导航栏 ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo:hover {
    text-decoration: none;
    color: var(--primary-dark);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 700;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-links a:hover {
    color: var(--primary);
    background-color: var(--primary-lighter);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

/* 移动端菜单按钮 */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 22px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
}

/* ===== Hero 区域 ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-lighter) 0%, #ffffff 100%);
    padding: 72px 0 64px;
    border-bottom: 1px solid var(--border);
}

.hero-content {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.hero h1 {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-main);
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.hero h1 .accent {
    color: var(--primary);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-lighter);
    text-decoration: none;
}

/* ===== 统计数据 ===== */
.stats {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 48px;
    flex-wrap: wrap;
}

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

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

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

/* ===== 主内容区 ===== */
.main-content {
    padding: 64px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    position: relative;
    padding-left: 16px;
}

.section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background-color: var(--primary);
    border-radius: 2px;
}

.section-more {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 500;
}

/* ===== 分类导航 ===== */
.categories {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background-color: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.category-tag:hover,
.category-tag.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
    text-decoration: none;
}

.category-tag .count {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ===== 文章卡片网格 ===== */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}

.article-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.card-banner {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #fff;
    font-weight: 700;
    position: relative;
}

.card-banner.docker {
    background: linear-gradient(135deg, #2496ed 0%, #0db7ed 100%);
}

.card-banner.nginx {
    background: linear-gradient(135deg, #009639 0%, #00b341 100%);
}

.card-banner.git {
    background: linear-gradient(135deg, #f1502f 0%, #e8431f 100%);
}

.card-banner.default {
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
}

.card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-category {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    background-color: var(--primary-light);
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    align-self: flex-start;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    line-height: 1.4;
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: var(--primary);
    text-decoration: none;
}

.card-excerpt {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 16px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card-meta .meta-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-meta .read-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 文章详情页 ===== */
.article-header {
    padding: 48px 0 32px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.article-breadcrumb {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.article-breadcrumb a {
    color: var(--text-muted);
}

.article-breadcrumb a:hover {
    color: var(--primary);
}

.article-breadcrumb .sep {
    margin: 0 8px;
}

.article-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.article-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta .tag {
    display: inline-block;
    padding: 3px 10px;
    background-color: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 500;
}

/* 文章正文容器 */
.article-content {
    max-width: 820px;
    margin: 0 auto;
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--text-main);
}

.article-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 48px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
    position: relative;
}

.article-content h2::before {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background-color: var(--primary);
}

.article-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 36px 0 16px;
}

.article-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 28px 0 12px;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
    margin: 0 0 20px 0;
    padding-left: 24px;
    list-style-position: outside;
}

.article-content ul li,
.article-content ol li {
    margin-bottom: 10px;
    padding-left: 4px;
}

.article-content ul li::marker {
    color: var(--primary);
}

.article-content ol li::marker {
    color: var(--primary);
    font-weight: 600;
}

.article-content strong {
    font-weight: 700;
    color: var(--text-main);
}

.article-content blockquote {
    margin: 24px 0;
    padding: 16px 24px;
    background-color: var(--primary-lighter);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
}

.article-content blockquote p {
    margin-bottom: 0;
}

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.92rem;
    overflow: hidden;
    border-radius: var(--radius);
}

.article-content th,
.article-content td {
    padding: 12px 16px;
    text-align: left;
    border: 1px solid var(--border);
}

.article-content th {
    background-color: var(--bg-soft);
    font-weight: 600;
    color: var(--text-main);
}

.article-content tr:nth-child(even) td {
    background-color: var(--bg-soft);
}

/* ===== 代码高亮 ===== */
.article-content pre {
    margin: 24px 0;
    padding: 20px 24px;
    background-color: var(--bg-code);
    border-radius: var(--radius);
    overflow-x: auto;
    position: relative;
    line-height: 1.6;
}

.article-content pre code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
        monospace;
    font-size: 0.9rem;
    color: #e2e8f0;
    background: none;
    padding: 0;
    border-radius: 0;
    white-space: pre;
}

.article-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
        monospace;
    font-size: 0.88em;
    background-color: var(--primary-lighter);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 代码语法高亮颜色 */
.code-comment {
    color: #64748b;
    font-style: italic;
}

.code-keyword {
    color: #c084fc;
    font-weight: 600;
}

.code-string {
    color: #86efac;
}

.code-number {
    color: #fdba74;
}

.code-function {
    color: #93c5fd;
}

.code-tag {
    color: #fca5a5;
}

.code-attr {
    color: #fcd34d;
}

.code-property {
    color: #93c5fd;
}

.code-value {
    color: #86efac;
}

/* 代码块语言标签 */
.code-lang {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: #94a3b8;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 0 var(--radius) 0 var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 文章底部 */
.article-footer {
    max-width: 820px;
    margin: 48px auto 0;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.article-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.article-tags .tag {
    padding: 6px 14px;
    background-color: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.article-tags .tag:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

/* 上一篇/下一篇导航 */
.article-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 32px;
}

.nav-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.nav-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.nav-card.next {
    text-align: right;
}

.nav-card .nav-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.nav-card .nav-title {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-main);
}

.nav-card:hover .nav-title {
    color: var(--primary);
}

/* ===== 关于页面 ===== */
.about-section {
    padding: 64px 0;
}

.about-content {
    max-width: 760px;
    margin: 0 auto;
}

.about-content h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--text-main);
}

.about-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 36px 0 16px;
    color: var(--text-main);
    padding-left: 16px;
    border-left: 4px solid var(--primary);
}

.about-content p {
    margin-bottom: 18px;
    color: var(--text-secondary);
    line-height: 1.85;
}

.about-content ul {
    margin: 16px 0 24px;
    padding-left: 24px;
}

.about-content ul li {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.about-content ul li::marker {
    color: var(--primary);
}

.author-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background-color: var(--bg-soft);
    border-radius: var(--radius-lg);
    margin: 32px 0;
}

.author-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.author-info h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.author-info p {
    margin: 0;
    font-size: 0.92rem;
    color: var(--text-muted);
}

/* ===== 友情链接 ===== */
.friend-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.friend-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.friend-link:hover {
    border-color: var(--primary);
    background-color: var(--primary-lighter);
    text-decoration: none;
    transform: translateY(-2px);
}

.friend-link .fl-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.friend-link .fl-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
}

.friend-link .fl-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== 底部 ===== */
.footer {
    background-color: var(--bg-soft);
    border-top: 1px solid var(--border);
    padding: 48px 0 24px;
    margin-top: 64px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 32px;
}

.footer-brand .logo {
    margin-bottom: 12px;
}

.footer-brand p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 320px;
}

.footer-col h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 16px;
}

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

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-col ul li a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-bottom p {
    font-size: 0.86rem;
    color: var(--text-muted);
}

.footer-bottom .friend-links-mini {
    display: flex;
    gap: 16px;
    font-size: 0.86rem;
}

.footer-bottom .friend-links-mini a {
    color: var(--text-muted);
}

.footer-bottom .friend-links-mini a:hover {
    color: var(--primary);
}

/* ===== 返回顶部按钮 ===== */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background-color: #fff;
        border-bottom: 1px solid var(--border);
        padding: 12px;
        gap: 4px;
        box-shadow: var(--shadow);
        transform: translateY(-150%);
        transition: transform 0.3s ease;
    }

    .nav-links.active {
        transform: translateY(0);
    }

    .nav-links a {
        padding: 12px 16px;
    }

    .hero {
        padding: 48px 0 40px;
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    .hero p {
        font-size: 1.02rem;
    }

    .stats {
        gap: 28px;
        margin-top: 32px;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    .main-content {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.35rem;
    }

    .article-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .article-title {
        font-size: 1.6rem;
    }

    .article-content {
        font-size: 0.98rem;
    }

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

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

    .article-content pre {
        padding: 16px;
        font-size: 0.82rem;
    }

    .article-content pre code {
        font-size: 0.82rem;
    }

    .article-nav {
        grid-template-columns: 1fr;
    }

    .nav-card.next {
        text-align: left;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

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

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .stats {
        gap: 20px;
    }

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

    .article-content pre {
        padding: 12px;
        margin: 16px -16px;
        border-radius: 0;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .navbar,
    .footer,
    .back-to-top,
    .article-nav,
    .hero-buttons {
        display: none;
    }

    body {
        color: #000;
    }

    .article-content pre {
        background-color: #f5f5f5;
        color: #000;
        border: 1px solid #ddd;
    }
}
