/* ========== 小枫魔方 — 多彩工业风 ========== */

:root {
    --xf-bg: #f8f9fb;
    --xf-surface: #ffffff;
    --xf-border: #e2e5eb;
    --xf-text: #1a1a2e;
    --xf-text-secondary: #64748b;
    --xf-accent: #6366f1;
    --xf-accent-subtle: rgba(99, 102, 241, 0.08);
    --xf-accent-2: #0ea5e9;
    --xf-accent-2-subtle: rgba(14, 165, 233, 0.08);
    --xf-accent-warm: #f59e0b;
    --xf-accent-warm-subtle: rgba(245, 158, 11, 0.08);
    --xf-accent-green: #10b981;
    --xf-accent-green-subtle: rgba(16, 185, 129, 0.08);
    --xf-accent-rose: #f43f5e;
    --xf-accent-rose-subtle: rgba(244, 63, 94, 0.08);
    --xf-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --xf-gradient-warm: linear-gradient(135deg, #6366f1, #0ea5e9);
    --xf-nav-bg: #ffffff;
    --xf-hero-bg: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 50%, #fdf4ff 100%);
    --xf-hero-bg-flat: #eef2ff;
    --xf-code-bg: #f6f8fa;
    --xf-radius: 8px;
    --xf-shadow: 0 1px 3px rgba(99, 102, 241, 0.06);
    --xf-shadow-md: 0 4px 12px rgba(99, 102, 241, 0.1);
    --xf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Helvetica Neue", sans-serif;
    --xf-mono: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
}

[data-bs-theme="dark"] {
    --xf-bg: #0c0f1a;
    --xf-surface: #141827;
    --xf-border: #2a2f45;
    --xf-text: #e6edf3;
    --xf-text-secondary: #8b949e;
    --xf-accent: #818cf8;
    --xf-accent-subtle: rgba(129, 140, 248, 0.12);
    --xf-accent-2: #38bdf8;
    --xf-accent-2-subtle: rgba(56, 189, 248, 0.1);
    --xf-accent-warm: #fbbf24;
    --xf-accent-warm-subtle: rgba(251, 191, 36, 0.1);
    --xf-accent-green: #34d399;
    --xf-accent-green-subtle: rgba(52, 211, 153, 0.1);
    --xf-accent-rose: #fb7185;
    --xf-accent-rose-subtle: rgba(251, 113, 133, 0.1);
    --xf-gradient: linear-gradient(135deg, #818cf8, #a78bfa, #c4b5fd);
    --xf-gradient-warm: linear-gradient(135deg, #818cf8, #38bdf8);
    --xf-nav-bg: #141827;
    --xf-hero-bg: linear-gradient(135deg, #0c0f1a 0%, #141233 50%, #1a0f26 100%);
    --xf-hero-bg-flat: #0c0f1a;
    --xf-code-bg: #1a1f33;
    --xf-shadow: 0 1px 3px rgba(0,0,0,0.4);
    --xf-shadow-md: 0 4px 12px rgba(0,0,0,0.5);
}

/* ---- Container — 加宽内容区域 ---- */
@media (min-width: 1200px) {
    .container { max-width: 1320px; }
}
@media (min-width: 1400px) {
    .container { max-width: 1520px; }
}

/* ---- Reset / Base ---- */
html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--xf-font);
    background: var(--xf-bg);
    color: var(--xf-text);
    line-height: 1.6;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--xf-accent); transition: color 0.15s, opacity 0.15s; }
a:hover { color: var(--xf-accent); opacity: 0.85; }

/* ---- Navbar — 底部渐变线 ---- */
.navbar-main {
    background: var(--xf-nav-bg) !important;
    border-bottom: none;
    padding: 0.5rem 0;
    box-shadow: 0 1px 0 var(--xf-border), 0 2px 8px rgba(99, 102, 241, 0.04);
}

.navbar-main::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--xf-gradient);
    opacity: 0.5;
}

.navbar-main .navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--xf-text) !important;
}

.navbar-main .nav-link {
    color: var(--xf-text-secondary) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--xf-radius);
    transition: background 0.15s, color 0.15s;
}

.navbar-main .nav-link:hover,
.navbar-main .nav-link.active {
    color: var(--xf-accent) !important;
    background: var(--xf-accent-subtle);
}

.navbar-main .navbar-toggler {
    border-color: var(--xf-border);
}

.navbar-main .navbar-toggler-icon {
    filter: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%236e7681' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Search in navbar */
.navbar-main .search-input {
    font-size: 0.8125rem;
    border: 1px solid var(--xf-border);
    background: var(--xf-bg);
    color: var(--xf-text);
    border-radius: var(--xf-radius);
}

.navbar-main .search-input:focus {
    border-color: var(--xf-accent);
    box-shadow: 0 0 0 2px var(--xf-accent-subtle);
    background: var(--xf-bg);
    color: var(--xf-text);
}

.navbar-main .search-input::placeholder { color: var(--xf-text-secondary); }

.navbar-main .btn-search {
    border: 1px solid var(--xf-border);
    color: var(--xf-text-secondary);
    background: transparent;
}

.navbar-main .btn-search:hover { color: var(--xf-accent); border-color: var(--xf-accent); }

/* Dark mode button */
.btn-mode {
    border: 1px solid var(--xf-border);
    color: var(--xf-text-secondary);
    background: transparent;
    font-size: 0.875rem;
    border-radius: var(--xf-radius);
    padding: 0.25rem 0.5rem;
}

.btn-mode:hover { color: var(--xf-accent); border-color: var(--xf-accent); }

/* ---- Hero — 渐变背景 ---- */
.hero-section {
    background: var(--xf-hero-bg);
    border-bottom: 1px solid var(--xf-border);
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99,102,241,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-section h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.75px;
    line-height: 1.2;
}

.hero-section .lead {
    color: var(--xf-text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 600px;
}

.hero-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    background: var(--xf-gradient);
    color: #fff;
    letter-spacing: 0.5px;
}

.hero-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.hero-stat-item {
    text-align: center;
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    padding: 1.5rem 2rem;
    min-width: 110px;
    box-shadow: var(--xf-shadow);
}

.hero-stat-num {
    font-size: 2rem;
    font-weight: 800;
    background: var(--xf-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.hero-stat-label {
    font-size: 0.75rem;
    color: var(--xf-text-secondary);
    margin-top: 0.35rem;
    font-weight: 500;
}

/* ---- Section headers ---- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.section-desc {
    font-size: 0.8125rem;
    color: var(--xf-text-secondary);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--xf-text);
}

.section-title .bi {
    background: var(--xf-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-link {
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--xf-text-secondary);
}

.section-link:hover { color: var(--xf-accent); }

/* ---- Cards — 多彩悬浮 ---- */
.card-clean {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    box-shadow: var(--xf-shadow);
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    position: relative;
}

.card-clean:hover {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
    border-color: color-mix(in srgb, var(--xf-accent) 30%, var(--xf-border));
    transform: translateY(-3px);
}

.card-clean .card-img-top {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--xf-hero-bg-flat);
    border-bottom: 1px solid var(--xf-border);
}

.card-clean .card-img-placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--xf-hero-bg-flat);
    border-bottom: 1px solid var(--xf-border);
    color: var(--xf-text-secondary);
    font-size: 3rem;
}

/* Article detail cover image */
.article-cover {
    width: 100%;
    object-fit: cover;
    border-bottom: 1px solid var(--xf-border);
    border-radius: var(--xf-radius) var(--xf-radius) 0 0;
}

@media (max-width: 767.98px) {
    .card-clean .card-img-top,
    .card-clean .card-img-placeholder {
        height: 160px;
    }

    .article-cover {
        max-height: 220px;
    }
}

/* Featured article card (home page) */
.card-featured {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    box-shadow: var(--xf-shadow);
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.card-featured:hover {
    box-shadow: var(--xf-shadow-md);
    transform: translateY(-2px);
}

.card-featured-img {
    height: 240px;
    overflow: hidden;
    background: var(--xf-hero-bg-flat);
    border-bottom: 1px solid var(--xf-border);
}

.card-featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-featured-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--xf-text-secondary);
    font-size: 3.5rem;
}

.card-featured-body {
    padding: 1.25rem 1.5rem;
    flex: 1;
}

/* Compact article card (home page sidebar) */
.card-compact {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    padding: 0.875rem;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    position: relative;
    flex: 1;
}

.card-compact:hover {
    box-shadow: var(--xf-shadow-md);
    transform: translateY(-1px);
}

.card-compact-img {
    width: 72px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--xf-border);
    flex-shrink: 0;
}

.card-compact-img-placeholder {
    width: 72px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: var(--xf-hero-bg-flat);
    color: var(--xf-text-secondary);
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Software card (home page grid) */
.card-software {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    box-shadow: var(--xf-shadow);
    padding: 1.25rem;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.card-software:hover {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
    border-color: color-mix(in srgb, var(--xf-accent) 30%, var(--xf-border));
    transform: translateY(-3px);
}

.card-software-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-software-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: var(--xf-radius);
    border: 1px solid var(--xf-border);
}

.card-software-icon-fallback {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--xf-radius);
    background: var(--xf-accent-subtle);
    color: var(--xf-accent);
    font-size: 1.5rem;
}

/* Tech grid small cards */
.tech-card {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    padding: 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--xf-text);
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
    display: block;
}

.tech-card:hover {
    border-color: var(--xf-accent);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
    color: var(--xf-text);
    transform: translateY(-3px);
}

.tech-card .tech-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.tech-card .tech-icon-fallback {
    font-size: 2rem;
    color: var(--xf-accent);
    margin-bottom: 0.5rem;
}

/* Software card image */
.sw-screenshot {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--xf-radius);
    border: 1px solid var(--xf-border);
    flex-shrink: 0;
}

.sw-icon-fallback {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--xf-radius);
    background: var(--xf-accent-subtle);
    color: var(--xf-accent);
    font-size: 1.75rem;
    flex-shrink: 0;
}

/* ---- Tags / Badges — 多彩 ---- */
.tag {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    background: var(--xf-accent-subtle);
    color: var(--xf-accent);
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.tag:nth-child(4n+2) { background: var(--xf-accent-2-subtle); color: var(--xf-accent-2); }
.tag:nth-child(4n+3) { background: var(--xf-accent-green-subtle); color: var(--xf-accent-green); }
.tag:nth-child(4n+4) { background: var(--xf-accent-warm-subtle); color: var(--xf-accent-warm); }

.tag-neutral {
    background: var(--xf-hero-bg-flat);
    color: var(--xf-text-secondary);
}

.version-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

/* ---- Meta line ---- */
.meta {
    font-size: 0.8125rem;
    color: var(--xf-text-secondary);
}

.meta .bi { font-size: 0.75rem; }

/* ---- Buttons — 渐变主按钮 ---- */
.btn-accent {
    background: var(--xf-gradient);
    color: #fff;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--xf-radius);
    padding: 0.4rem 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
}

.btn-accent:hover {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--xf-text-secondary);
    border: 1px solid var(--xf-border);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--xf-radius);
    padding: 0.35rem 0.75rem;
    transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn-ghost:hover {
    border-color: var(--xf-accent);
    color: var(--xf-accent);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

/* Filter pills */
.filter-pill {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--xf-border);
    border-radius: 20px;
    color: var(--xf-text-secondary);
    text-decoration: none;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
    transition: all 0.15s;
}

.filter-pill:hover { border-color: var(--xf-accent); color: var(--xf-accent); }
.filter-pill.active { background: var(--xf-gradient); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25); }

/* ---- Article content ---- */
.article-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--xf-border);
}

.article-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
}

.article-content h4 { font-size: 1rem; font-weight: 600; }

.article-content pre {
    background: var(--xf-code-bg);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.article-content code {
    font-family: var(--xf-mono);
    font-size: 0.875em;
}

.article-content p code {
    background: var(--xf-code-bg);
    color: var(--xf-accent);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85em;
}

/* 隐藏 Quill 编辑器在展示模式下的 UI 控件（如代码块语言下拉框） */
.article-content .ql-ui,
.article-content select.ql-ui {
    display: none !important;
}

/* Quill 对齐样式在展示模式下生效 */
.article-content .ql-align-center { text-align: center; }
.article-content .ql-align-right { text-align: right; }
.article-content .ql-align-justify { text-align: justify; }
.article-content img.ql-align-center,
.article-content .ql-align-center img {
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.article-content img.ql-align-right {
    display: block;
    margin-left: auto;
    margin-right: 0;
}

/* Quill 代码块容器在展示模式下的样式 */
.article-content .ql-code-block-container {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--xf-radius);
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    font-family: var(--xf-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    border: 1px solid #30363d;
}

.article-content .ql-code-block {
    font-family: var(--xf-mono);
    font-size: 0.85rem;
    color: #cdd6f4;
}

/* Quill 图片在展示模式下 */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--xf-radius);
    margin: 0.75rem 0;
}

/* Quill 引用块在展示模式下 */
.article-content blockquote {
    border-left: 3px solid var(--xf-accent);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    color: var(--xf-text-secondary);
    background: var(--xf-accent-subtle);
    border-radius: 0 var(--xf-radius) var(--xf-radius) 0;
}

.article-content p {
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

/* TOC sidebar */
.toc-card {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
}

.toc-card .list-group-item {
    border: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--xf-text-secondary);
    background: transparent;
}

.toc-card .list-group-item:hover { color: var(--xf-accent); }

/* ---- Footer — 渐变顶线 ---- */
.footer-main {
    background: var(--xf-surface);
    border-top: none;
    padding: 2rem 0;
    margin-top: auto;
    color: var(--xf-text-secondary);
    font-size: 0.8125rem;
    position: relative;
}

.footer-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--xf-gradient);
    opacity: 0.4;
}

.footer-main a { color: var(--xf-text-secondary); text-decoration: none; }
.footer-main a:hover { color: var(--xf-accent); }

/* ---- Breadcrumb ---- */
.breadcrumb-item a { text-decoration: none; color: var(--xf-accent); }

/* ---- Table ---- */
.table th { font-weight: 600; white-space: nowrap; }

/* ---- Info stat box — 彩色边框 ---- */
.stat-box {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    padding: 0.75rem;
    text-align: center;
    border-top: 2px solid var(--xf-accent);
}

.stat-box:nth-child(2) { border-top-color: var(--xf-accent-2); }
.stat-box:nth-child(3) { border-top-color: var(--xf-accent-green); }
.stat-box:nth-child(4) { border-top-color: var(--xf-accent-warm); }

.stat-box .stat-label { font-size: 0.75rem; color: var(--xf-text-secondary); }
.stat-box .stat-value { font-size: 1.1rem; font-weight: 700; color: var(--xf-text); }

/* ---- Focus ring ---- */
.btn:focus, .form-control:focus, .form-check-input:focus, .form-select:focus {
    box-shadow: 0 0 0 2px var(--xf-accent-subtle);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ---- Empty state ---- */
.empty-state {
    padding: 3rem 0;
    text-align: center;
    color: var(--xf-text-secondary);
}

.empty-state .bi { font-size: 3rem; opacity: 0.3; }

/* ---- Pagination ---- */
.pagination .page-link {
    font-size: 0.8125rem;
    border-color: var(--xf-border);
    color: var(--xf-text-secondary);
}

.pagination .page-item.active .page-link {
    background: var(--xf-gradient);
    border-color: transparent;
}

/* ---- Typography — 标题层级 ---- */
h1, .h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; }
h2, .h2 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; }
h3, .h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.2px; line-height: 1.35; }
h4, .h4 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
h5, .h5 { font-size: 0.95rem; font-weight: 600; line-height: 1.45; }
h6, .h6 { font-size: 0.875rem; font-weight: 600; line-height: 1.5; color: var(--xf-text-secondary); }

p { line-height: 1.75; margin-bottom: 0.75rem; }

small, .small { font-size: 0.8125rem; }

.text-display {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
}

/* ---- Editor Toolbar — Markdown编辑器工具栏 ---- */
/* (Legacy toolbar styles removed — now using Quill.js rich text editor) */

/* ---- Quill.js 富文本编辑器 — 工业简约风适配 ---- */
.quill-wrap {
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
    overflow: visible;
    background: var(--xf-surface);
    position: relative;
}

/* Quill link tooltip — 防止被裁剪 */
.quill-wrap .ql-tooltip {
    left: 0 !important;
    right: auto;
    max-width: 100%;
    z-index: 10;
}

.quill-wrap .ql-tooltip input[type="text"] {
    width: 220px;
    max-width: 60vw;
}

.quill-wrap .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--xf-border);
    background: var(--xf-hero-bg-flat);
    padding: 6px 8px;
    font-family: var(--xf-font);
}

.quill-wrap .ql-container.ql-snow {
    border: none;
    font-family: var(--xf-font);
    font-size: 0.9375rem;
    color: var(--xf-text);
    overflow: hidden;
    border-radius: 0 0 var(--xf-radius) var(--xf-radius);
}

.quill-wrap .ql-editor {
    min-height: 400px;
    padding: 1.25rem;
    line-height: 1.8;
    color: var(--xf-text);
}

.quill-wrap .ql-editor.ql-blank::before {
    color: var(--xf-text-secondary);
    font-style: normal;
}

/* 工具栏按钮适配 */
.quill-wrap .ql-toolbar .ql-stroke {
    stroke: var(--xf-text-secondary);
}

.quill-wrap .ql-toolbar .ql-fill {
    fill: var(--xf-text-secondary);
}

.quill-wrap .ql-toolbar .ql-picker-label {
    color: var(--xf-text-secondary);
}

.quill-wrap .ql-toolbar button:hover .ql-stroke,
.quill-wrap .ql-toolbar .ql-picker-label:hover .ql-stroke {
    stroke: var(--xf-accent);
}

.quill-wrap .ql-toolbar button:hover .ql-fill,
.quill-wrap .ql-toolbar .ql-picker-label:hover .ql-fill {
    fill: var(--xf-accent);
}

.quill-wrap .ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--xf-accent);
}

.quill-wrap .ql-toolbar button.ql-active .ql-fill {
    fill: var(--xf-accent);
}

.quill-wrap .ql-toolbar .ql-picker-options {
    background: var(--xf-surface);
    border-color: var(--xf-border);
    box-shadow: var(--xf-shadow-md);
    border-radius: var(--xf-radius);
}

/* 编辑器内图片样式 */
.quill-wrap .ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: var(--xf-radius);
    margin: 0.75rem 0;
    border: 1px solid var(--xf-border);
}

/* 编辑器内代码块 — 深色背景，等宽字体 */
.quill-wrap .ql-editor pre.ql-syntax,
.quill-wrap .ql-editor .ql-code-block-container {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: var(--xf-radius);
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    font-family: var(--xf-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
    border: 1px solid #30363d;
}

.quill-wrap .ql-editor code {
    font-family: var(--xf-mono);
    font-size: 0.85em;
    background: var(--xf-code-bg);
    color: var(--xf-accent);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* 编辑器内引用块 */
.quill-wrap .ql-editor blockquote {
    border-left: 3px solid var(--xf-accent);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    color: var(--xf-text-secondary);
    background: var(--xf-accent-subtle);
    border-radius: 0 var(--xf-radius) var(--xf-radius) 0;
}

/* 编辑器内标题样式 */
.quill-wrap .ql-editor h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--xf-border);
}

.quill-wrap .ql-editor h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.quill-wrap .ql-editor h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-top: 1rem;
}

/* 编辑器内链接 */
.quill-wrap .ql-editor a {
    color: var(--xf-accent);
    text-decoration: underline;
}

/* 编辑器紧凑模式（用于技术栈Description等短内容） */
.quill-wrap-compact .ql-editor {
    min-height: 200px;
}

/* 深色模式适配 */
[data-bs-theme="dark"] .quill-wrap .ql-toolbar.ql-snow {
    background: var(--xf-hero-bg-flat);
}

[data-bs-theme="dark"] .quill-wrap .ql-editor pre.ql-syntax,
[data-bs-theme="dark"] .quill-wrap .ql-editor .ql-code-block-container {
    background: #0d1117;
    border-color: #30363d;
}

[data-bs-theme="dark"] .quill-wrap .ql-toolbar .ql-picker-options {
    background: var(--xf-surface);
    border-color: var(--xf-border);
}

[data-bs-theme="dark"] .quill-wrap .ql-snow .ql-picker-label {
    color: var(--xf-text-secondary);
}

[data-bs-theme="dark"] .quill-wrap .ql-editor.ql-blank::before {
    color: var(--xf-text-secondary);
}

/* ---- Cover / Icon Adjust Controls ---- */
.cover-adjust {
    padding: 0.5rem 0.75rem;
    background: var(--xf-hero-bg-flat);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
}

.cover-adjust .form-range {
    width: 120px;
}

/* ---- Package Upload UI ---- */
.package-upload-zone {
    border: 2px dashed var(--xf-border);
    border-radius: var(--xf-radius);
    padding: 1.25rem;
    text-align: center;
    background: var(--xf-hero-bg-flat);
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.package-upload-zone:hover,
.package-upload-zone.dragover {
    border-color: var(--xf-accent);
    background: var(--xf-accent-subtle);
}

.package-upload-zone .bi {
    font-size: 2rem;
    color: var(--xf-text-secondary);
    margin-bottom: 0.5rem;
}

.package-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: var(--xf-radius);
}

.package-info .bi-file-earmark-zip {
    font-size: 1.75rem;
    color: var(--xf-accent);
}

.package-info .file-name {
    font-weight: 600;
    font-size: 0.875rem;
    word-break: break-all;
}

.package-info .file-size {
    font-size: 0.75rem;
    color: var(--xf-text-secondary);
}

.upload-progress {
    height: 3px;
    background: var(--xf-border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.upload-progress-bar {
    height: 100%;
    background: var(--xf-gradient);
    width: 0;
    transition: width 0.3s ease;
}

/* ---- Page Effects — 渐入动画 ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    opacity: 0;
    transform: translateY(16px);
}

.fade-in-up.visible {
    animation: fadeInUp 0.5s ease forwards;
}

/* Stagger delays for card grids */
.fade-in-up.visible:nth-child(2) { animation-delay: 0.06s; }
.fade-in-up.visible:nth-child(3) { animation-delay: 0.12s; }
.fade-in-up.visible:nth-child(4) { animation-delay: 0.18s; }
.fade-in-up.visible:nth-child(5) { animation-delay: 0.24s; }
.fade-in-up.visible:nth-child(6) { animation-delay: 0.30s; }

/* Subtle section divider */
.section-divider {
    border: none;
    height: 1px;
    background: var(--xf-border);
    margin: 2rem 0;
}

/* Smooth link underline effect */
.link-underline {
    text-decoration: none;
    background-image: linear-gradient(var(--xf-accent), var(--xf-accent));
    background-size: 0% 1px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.25s ease;
}

.link-underline:hover {
    background-size: 100% 1px;
}

/* ---- Tech Showcase Page ---- */
.tech-page-header {
    background: var(--xf-hero-bg);
    border-bottom: 1px solid var(--xf-border);
    padding: 2.5rem 0 2rem;
    position: relative;
    overflow: hidden;
}

.tech-page-header::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99,102,241,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.tech-page-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.tech-page-header .lead {
    font-size: 0.875rem;
    color: var(--xf-text-secondary);
    max-width: 480px;
}

.tech-page-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 1.25rem;
}

/* Showcase card — vertical, centered, refined */
.tech-showcase {
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    border-radius: 10px;
    padding: 1.5rem 1.25rem 1.25rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    height: 100%;
}

.tech-showcase:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.07);
    border-color: color-mix(in srgb, var(--xf-accent) 40%, var(--xf-border));
    transform: translateY(-3px);
}

.tech-showcase-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--xf-border);
    background: var(--xf-bg);
    padding: 6px;
    margin-bottom: 0.875rem;
}

.tech-showcase-icon-fallback {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--xf-accent-subtle);
    color: var(--xf-accent);
    font-size: 1.75rem;
    margin-bottom: 0.875rem;
    border: 1px solid color-mix(in srgb, var(--xf-accent) 15%, transparent);
}

.tech-showcase-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--xf-text);
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.tech-showcase-category {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--xf-accent);
    background: var(--xf-accent-subtle);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    margin-bottom: 0.625rem;
}

.tech-showcase-desc {
    font-size: 0.8rem;
    color: var(--xf-text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tech-showcase-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    margin-bottom: 0.875rem;
}

.tech-showcase-tags .tag {
    font-size: 0.625rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.tech-showcase-actions {
    display: flex;
    gap: 0.375rem;
    width: 100%;
    justify-content: center;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--xf-border);
}

.tech-showcase-actions .btn-ghost {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
}

/* Accent line on hover */
.tech-showcase::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--xf-gradient);
    border-radius: 2px 2px 0 0;
    transition: width 0.3s ease;
}

.tech-showcase:hover::after {
    width: 60%;
}

/* Stats in page header */
.tech-page-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--xf-text-secondary);
    background: var(--xf-surface);
    border: 1px solid var(--xf-border);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
}

.tech-page-stat .bi {
    color: var(--xf-accent);
    font-size: 0.75rem;
}

.tech-page-stat strong {
    color: var(--xf-text);
    font-weight: 700;
}

/* ---- Responsive typography ---- */
@media (max-width: 767.98px) {
    h1, .h1 { font-size: 1.6rem; }
    h2, .h2 { font-size: 1.3rem; }
    h3, .h3 { font-size: 1.1rem; }
    .hero-section h1 { font-size: 1.75rem; }
    .hero-section { padding: 2.5rem 0; }
    .text-display { font-size: 2rem; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .card-featured-img { height: 180px; }
    .tech-page-header { padding: 1.75rem 0 1.5rem; }
    .tech-page-header h2 { font-size: 1.25rem; }
    .tech-showcase { padding: 1.25rem 1rem 1rem; }
    .tech-showcase-icon, .tech-showcase-icon-fallback { width: 52px; height: 52px; }
}