/* ============================================================
   article.css — Blog article page styles
   Covers: layout, breadcrumb, article header, prose body,
   TOC sidebar, product recommend, prev/next nav,
   related articles, float widget, responsive breakpoints.
   DO NOT redeclare these styles inline in article HTML files.
   ============================================================ */

/* ── Page Layout ── */
.article-page-wrap {
    max-width: 72rem;
    margin: 0 auto;
    padding: 6.5rem 1.5rem 5rem;
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.article-main {
    flex: 1;
    min-width: 0;
}

.article-sidebar {
    width: 13rem;
    flex-shrink: 0;
    position: sticky;
    top: 6rem;
    align-self: flex-start;
}

/* ── TOC Card ── */
.toc-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    padding: 1.125rem 1rem 1rem;
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.toc-list a {
    font-size: 0.8125rem;
    color: #71717a;
    display: block;
    padding: 4px 10px;
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: color .15s, border-color .15s;
    line-height: 1.5;
}

.toc-list a:hover {
    color: #18181b;
    border-left-color: #a1a1aa;
}

.toc-list a.toc-active {
    color: #4f46e5;
    border-left-color: #4f46e5;
    font-weight: 600;
}

.toc-back-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: #71717a;
    text-decoration: none;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f4f4f5;
    transition: color .15s;
}

.toc-back-link:hover { color: #3f3f46; }

/* ── Breadcrumb (injected by article-recommend.js) ── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #a1a1aa;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: #a1a1aa;
    text-decoration: none;
    transition: color .15s;
}

.breadcrumb a:hover { color: #52525b; }

.breadcrumb-sep {
    font-size: 0.75rem;
    color: #d4d4d8;
}

.breadcrumb-current {
    color: #52525b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}

/* ── Article Header Block (injected by article-recommend.js) ── */
.article-header-block {
    margin-bottom: 2rem;
}

.article-cover {
    height: 12rem;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    margin-bottom: 1.75rem;
    display: flex;
    align-items: flex-end;
    padding: 1.5rem 2rem;
}

.article-cover-inner { width: 100%; }

.article-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: 8px;
    background: rgba(255,255,255,.2);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
}

.article-title-h1 {
    font-size: 1.625rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.article-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: #71717a;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid #e4e4e7;
    margin-bottom: 1.75rem;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.article-meta-tags {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.article-meta-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    background: #f4f4f5;
    color: #52525b;
    font-size: 0.75rem;
    font-weight: 600;
}

.article-latest-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    background: #ecfdf5;
    color: #059669;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ── Prose (article body typography) ── */
.prose h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #18181b;
    margin: 2.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f4f4f5;
    scroll-margin-top: 5.5rem;
}

.prose h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #27272a;
    margin: 1.75rem 0 0.5rem;
    scroll-margin-top: 5.5rem;
}

.prose p {
    font-size: 0.9375rem;
    color: #52525b;
    line-height: 1.85;
    margin-bottom: 0.9rem;
}

.prose ul,
.prose ol {
    padding-left: 1.4rem;
    margin-bottom: 0.9rem;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

.prose li {
    font-size: 0.9375rem;
    color: #52525b;
    line-height: 1.85;
    margin-bottom: 0.25rem;
}

.prose strong { color: #27272a; font-weight: 700; }

.prose a {
    color: #6366f1;
    text-decoration: underline;
    transition: color .15s;
}

.prose a:hover { color: #4f46e5; }

.prose code {
    background: #f4f4f5;
    color: #e11d48;
    font-size: 0.8125rem;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: ui-monospace, monospace;
}

.prose pre {
    background: #0d1117;
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.prose pre code {
    background: none;
    color: #c9d1d9;
    font-size: 0.8125rem;
    padding: 0;
}

/* Safety rule: code inside any dark pre block must never show a background */
pre code {
    background: none !important;
    padding: 0;
}

/* Prevent prose media & tables from overflowing on narrow screens */
.prose img,
.prose video,
.prose iframe {
    max-width: 100%;
    height: auto;
}

.prose table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.prose p,
.prose li {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Step Numbers ── */
.step-num {
    min-width: 26px;
    height: 26px;
    border-radius: 9999px;
    background: #18181b;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ── Callout Boxes ── */
.box-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 0.875rem 1.125rem;
    margin: 1rem 0;
}

.box-tip {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    padding: 0.875rem 1.125rem;
    margin: 1rem 0;
}

/* ── Product Recommend (injected by article-recommend.js) ── */
.product-recommend {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
    border-radius: 1.25rem;
}

.pr-inner {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.pr-logo {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    object-fit: contain;
    flex-shrink: 0;
    background: #fff;
    padding: 0.375rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.pr-body { flex: 1; min-width: 0; }

.pr-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.pr-title {
    font-size: 1.0625rem;
    font-weight: 800;
    color: #18181b;
    margin-bottom: 0.375rem;
}

.pr-desc {
    font-size: 0.875rem;
    color: #52525b;
    line-height: 1.7;
    margin-bottom: 0.875rem;
}

.pr-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.pr-features li {
    font-size: 0.8125rem;
    color: #3f3f46;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.6;
}

.pr-features li::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #7c3aed;
    flex-shrink: 0;
    margin-top: 0.45rem;
}

.pr-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #18181b;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: background .2s, transform .15s;
}

.pr-btn:hover {
    background: #3f3f46;
    transform: translateY(-1px);
    color: #fff;
}

/* ── Prev / Next Navigation (injected by article-recommend.js) ── */
.article-nav-prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.anpn-item {
    display: block;
    padding: 1.125rem 1.25rem;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}

.anpn-item:hover {
    border-color: #c4b5fd;
    box-shadow: 0 2px 12px rgba(99,102,241,.08);
}

.anpn-direction {
    font-size: 0.7rem;
    font-weight: 700;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.anpn-item.anpn-next .anpn-direction { justify-content: flex-end; }

.anpn-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #18181b;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.anpn-item.anpn-next .anpn-title { text-align: right; }

.anpn-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.anpn-item.anpn-next .anpn-tags { justify-content: flex-end; }

.anpn-tag {
    font-size: 0.6875rem;
    padding: 0.1rem 0.4rem;
    border-radius: 5px;
    background: #f4f4f5;
    color: #71717a;
    font-weight: 500;
}

/* ── Related Articles (injected by article-recommend.js) ── */
.article-related {
    margin-top: 2rem;
}

.article-related-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #a1a1aa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.related-item {
    display: block;
    padding: 1rem 1.125rem;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}

.related-item:hover {
    border-color: #c4b5fd;
    box-shadow: 0 2px 10px rgba(99,102,241,.07);
}

.related-category {
    font-size: 0.7rem;
    color: #a1a1aa;
    font-weight: 600;
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.related-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #18181b;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.related-tag {
    font-size: 0.6875rem;
    padding: 0.1rem 0.4rem;
    border-radius: 5px;
    background: #f4f4f5;
    color: #71717a;
    font-weight: 500;
}

/* ── Float Widget (injected by article-recommend.js) ── */
.float-widget {
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    width: 14rem;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 18px;
    padding: 1.25rem 1.125rem 1rem;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    z-index: 200;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}

.float-widget.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fw-close {
    position: absolute;
    top: 0.625rem;
    right: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: #f4f4f5;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875rem;
    color: #71717a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
}

.fw-close:hover { background: #e4e4e7; color: #18181b; }

.fw-logo {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.625rem;
    object-fit: contain;
    background: #f5f3ff;
    padding: 0.3rem;
    margin-bottom: 0.625rem;
}

.fw-body {
    flex: 1;
    min-width: 0;
}

.fw-title {
    font-size: 0.875rem;
    font-weight: 800;
    color: #18181b;
    margin-bottom: 0.25rem;
}

.fw-desc {
    font-size: 0.75rem;
    color: #71717a;
    line-height: 1.5;
    margin-bottom: 0.875rem;
}

.fw-btn {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity .2s, transform .15s;
}

.fw-btn:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }

/* ── Responsive ── */
@media (max-width: 1279px) {
    .article-sidebar { display: none; }
    .article-page-wrap { gap: 0; }
}

@media (max-width: 767px) {
    .article-page-wrap {
        padding: 5.5rem 1rem 3.5rem;
    }

    .article-main {
        overflow-x: hidden;
    }

    .article-cover {
        height: 9rem;
        padding: 1rem 1.25rem;
    }

    .article-title-h1 { font-size: 1.25rem; }

    .prose pre {
        border-radius: 10px;
        padding: 1rem 1.125rem;
        margin-left: -0.125rem;
        margin-right: -0.125rem;
    }

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

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

    .product-recommend {
        padding: 1.375rem 1.125rem;
    }

    .pr-inner {
        flex-direction: column;
        gap: 0.875rem;
    }

    .float-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 18px 18px 0 0;
        display: flex;
        align-items: center;
        gap: 0.875rem;
        padding: 0.875rem 1.25rem;
    }

    .fw-logo { margin-bottom: 0; flex-shrink: 0; }

    .fw-body { flex: 1; min-width: 0; }

    .fw-title {
        font-size: 0.8125rem;
        margin-bottom: 0.125rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .fw-desc {
        font-size: 0.65rem;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .fw-btn {
        white-space: nowrap;
        padding: 0.5rem 0.875rem;
        flex-shrink: 0;
    }

    .fw-close { top: 0.5rem; right: 0.75rem; }
}
