/* ============================================================
   Article Detail Page Styles — zh-CN
   Shares CSS variables and base reset from main.css
   All article UI components (breadcrumb, header, recommend,
   prev/next, related, float-widget) are styled here.
   ============================================================ */

/* ---- Article Page Layout ---- */
.article-page-wrap {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    align-items: start;
}

/* Prevent grid blowout: wide pre/table/code blocks inside article-main
   must not force the grid cell wider than the viewport */
.article-main {
    min-width: 0;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 28px;
}
.breadcrumb a {
    color: var(--color-text-muted);
    transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb .sep {
    color: rgba(0,0,0,0.2);
    font-size: 12px;
}
.breadcrumb .current {
    color: var(--color-text-dark);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}

/* ---- Article Header (injected by article-recommend.js) ---- */
.article-header {
    margin-bottom: 36px;
}
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.article-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 50px;
    background: rgba(217,70,239,0.1);
    color: var(--color-accent);
    border: 1px solid rgba(217,70,239,0.2);
    letter-spacing: 0.3px;
}
.article-tag.tag-latest {
    background: linear-gradient(135deg, #7c3aed, #d946ef);
    color: #fff;
    border-color: transparent;
}
.article-header h1 {
    font-size: clamp(24px, 4vw, 38px);
    font-weight: 800;
    color: var(--color-text-dark);
    line-height: 1.25;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}
.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}
.article-meta span { display: flex; align-items: center; gap: 5px; }
.article-summary {
    font-size: 16px;
    color: #4a3860;
    background: rgba(109,40,217,0.04);
    border-left: 3px solid var(--color-primary);
    padding: 16px 20px;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    line-height: 1.7;
}

/* ---- Article Body ---- */
.article-body {
    font-size: 16px;
    line-height: 1.85;
    color: #1a1030;
    overflow-wrap: break-word;
    word-break: break-word;
}
.article-body h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin: 48px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(217,70,239,0.15);
    letter-spacing: -0.3px;
}
.article-body h3 {
    font-size: 19px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin: 36px 0 12px;
}
.article-body h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin: 28px 0 8px;
}
.article-body p {
    margin-bottom: 20px;
}
.article-body a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}
.article-body a:hover { opacity: 0.75; }
.article-body ul,
.article-body ol {
    margin: 0 0 20px 24px;
    list-style: revert;
}
.article-body li { margin-bottom: 8px; }
.article-body strong { font-weight: 700; color: var(--color-text-dark); }
.article-body em { font-style: italic; }

/* Code blocks */
.article-body code {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: 0.88em;
    background: rgba(109,40,217,0.07);
    color: #7c3aed;
    padding: 2px 6px;
    border-radius: 4px;
}
.article-body pre {
    background: #0f0030;
    color: #e2d9f3;
    border-radius: var(--border-radius-sm);
    padding: 20px 24px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 14px;
    line-height: 1.7;
    border: 1px solid rgba(217,70,239,0.15);
}
.article-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* Callout / tip boxes */
.callout {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    margin: 24px 0;
    font-size: 15px;
    line-height: 1.7;
}
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.callout.tip {
    background: rgba(0,182,122,0.08);
    border-left: 3px solid #00b67a;
    color: #065f46;
}
.callout.warning {
    background: rgba(234,88,12,0.08);
    border-left: 3px solid #ea580c;
    color: #7c2d12;
}
.callout.info {
    background: rgba(37,99,235,0.08);
    border-left: 3px solid #2563eb;
    color: #1e3a8a;
}

/* Tables */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
    overflow-x: auto;
    display: block;
}
.article-body th {
    background: linear-gradient(135deg, #6d28d9, #a855f7);
    color: #fff;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
}
.article-body td {
    padding: 11px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    vertical-align: top;
}
.article-body tr:nth-child(even) td { background: rgba(109,40,217,0.03); }
.article-body tr:hover td { background: rgba(217,70,239,0.05); }

/* Download CTA inside article body */
.article-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 28px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #d946ef 100%);
    border-radius: var(--border-radius-md);
    margin: 32px 0;
    text-decoration: none !important;
    color: #fff !important;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: opacity 0.3s, transform 0.2s;
    box-shadow: 0 8px 30px rgba(168,85,247,0.35);
}
.article-cta:hover { opacity: 0.9; transform: translateY(-1px); }
.article-cta svg { flex-shrink: 0; }

/* ---- Sidebar TOC ---- */
.article-sidebar {
    position: sticky;
    top: 90px;
}
.toc-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.07);
    border-radius: var(--border-radius-md);
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.toc-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc-list li { margin: 0; }
.toc-list a {
    display: block;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--color-text-muted);
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: all 0.2s;
    line-height: 1.4;
}
.toc-list a:hover {
    color: var(--color-accent);
    background: rgba(109,40,217,0.05);
    border-left-color: rgba(109,40,217,0.3);
}
.toc-list a.active {
    color: var(--color-accent);
    font-weight: 600;
    background: rgba(109,40,217,0.08);
    border-left-color: var(--color-accent);
}

/* ---- Product Recommend Section (injected after article body) ---- */
.product-recommend {
    margin: 56px 0 40px;
    background: linear-gradient(135deg, #0e0020 0%, #1a0035 40%, #2d0060 70%, #3a0070 100%);
    border-radius: var(--border-radius-md);
    padding: 40px;
    position: relative;
    overflow: hidden;
    color: #fff;
}
.product-recommend::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(217,70,239,0.2) 0%, transparent 65%);
    pointer-events: none;
}
.product-recommend-inner {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 36px;
    align-items: flex-start;
}
.product-recommend-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(168,85,247,0.4);
}
.product-recommend-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-recommend-content { flex: 1; }
.product-recommend-content h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}
.product-recommend-content p {
    font-size: 15px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 20px;
    line-height: 1.6;
}
.product-recommend-points {
    list-style: none;
    margin: 0 0 28px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}
.product-recommend-points li {
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.product-recommend-points li::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #d946ef;
    border-radius: 50%;
    flex-shrink: 0;
}
.product-recommend-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #a855f7, #d946ef);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 13px 28px;
    border-radius: var(--border-radius-pill);
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 6px 24px rgba(168,85,247,0.45);
    text-decoration: none;
}
.product-recommend-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ---- Prev / Next Article Navigation ---- */
.article-nav-prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 40px 0;
}
.article-nav-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 22px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--border-radius-md);
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
}
.article-nav-item:hover {
    border-color: rgba(109,40,217,0.3);
    box-shadow: 0 4px 20px rgba(109,40,217,0.08);
}
.article-nav-item.next { text-align: right; }
.article-nav-dir {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.article-nav-item.next .article-nav-dir { justify-content: flex-end; }
.article-nav-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-dark);
    line-height: 1.4;
}
.article-nav-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.article-nav-item.next .article-nav-tags { justify-content: flex-end; }
.article-nav-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 50px;
    background: rgba(109,40,217,0.07);
    color: var(--color-accent);
}

/* ---- Related Articles ---- */
.article-related {
    margin: 40px 0;
}
.article-related-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.article-related-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--gradient-purple);
    border-radius: 2px;
}
.article-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.article-related-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--border-radius-md);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    text-decoration: none;
}
.article-related-card:hover {
    border-color: rgba(109,40,217,0.3);
    box-shadow: 0 4px 20px rgba(109,40,217,0.1);
    transform: translateY(-2px);
}
.article-related-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-dark);
    line-height: 1.4;
    flex: 1;
}
.article-related-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.article-related-card-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 50px;
    background: rgba(109,40,217,0.07);
    color: var(--color-accent);
}
.article-related-card-date {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ---- Float Widget ---- */
.float-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 300px;
    background: linear-gradient(135deg, #1a0035 0%, #2d0060 100%);
    border-radius: var(--border-radius-md);
    padding: 24px;
    box-shadow: 0 16px 50px rgba(0,0,0,0.35);
    z-index: 9999;
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    border: 1px solid rgba(217,70,239,0.2);
}
.float-widget.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.float-widget-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}
.float-widget-close:hover { color: rgba(255,255,255,0.9); }
.float-widget-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}
.float-widget-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.float-widget h4 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.2px;
}
.float-widget p {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    line-height: 1.5;
    margin-bottom: 16px;
}
.float-widget-btn {
    display: block;
    text-align: center;
    background: linear-gradient(135deg, #a855f7, #d946ef);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 11px 20px;
    border-radius: var(--border-radius-pill);
    text-decoration: none;
    transition: opacity 0.2s;
    box-shadow: 0 4px 16px rgba(168,85,247,0.4);
}
.float-widget-btn:hover { opacity: 0.9; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .article-page-wrap {
        grid-template-columns: 1fr;
    }
    .article-sidebar {
        display: none;
    }
    .product-recommend-inner {
        flex-direction: column;
    }
    .product-recommend-points {
        grid-template-columns: 1fr;
    }
    .article-related-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .article-page-wrap {
        padding: 24px 16px 60px;
    }
    .product-recommend {
        padding: 28px 22px;
    }
    .article-nav-prev-next {
        grid-template-columns: 1fr;
    }
    .article-related-grid {
        grid-template-columns: 1fr;
    }
    .float-widget {
        width: calc(100% - 32px);
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    .article-body h2 { font-size: 20px; }
    .article-body h3 { font-size: 17px; }
}
