/* ============================================================
   Article page common styles
   Covers: layout, breadcrumb, article header, article body,
   code blocks, callouts, sidebar TOC, product recommend,
   prev/next navigation, related articles, float widget,
   and responsive breakpoints.
   DO NOT redeclare any of these styles inline in article HTML.
   ============================================================ */

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

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

/* ------------------------------------------------------------
   Breadcrumb
   ------------------------------------------------------------ */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    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-brand-blue);
}

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

.breadcrumb .current {
    color: var(--color-text-main);
    font-weight: 500;
}

/* ------------------------------------------------------------
   Article header (injected by article-recommend.js)
   ------------------------------------------------------------ */
.article-header {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--color-border);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.article-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #f1f5f9;
    color: #475569;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
}

.article-tag.tag-latest {
    background: linear-gradient(135deg, var(--color-primary-hover), var(--color-primary));
    color: #fff;
}

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

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

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

.article-summary {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    line-height: 1.7;
    border-left: 3px solid var(--color-brand-blue);
    padding-left: 16px;
    margin: 0;
}

/* ------------------------------------------------------------
   Article body
   ------------------------------------------------------------ */
.article-body {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #374151;
}

.article-body h2 {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin: 2.5rem 0 1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
    letter-spacing: -0.01em;
}

.article-body h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text-main);
    margin: 2rem 0 0.75rem;
}

.article-body h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-main);
    margin: 1.5rem 0 0.5rem;
}

.article-body p {
    font-size: 1.05rem;
    color: #374151;
    margin-bottom: 1.25rem;
    line-height: 1.85;
}

.article-body ul,
.article-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
    list-style: revert;
}

.article-body li {
    color: #374151;
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
    line-height: 1.75;
}

.article-body a {
    color: var(--color-brand-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-body a:hover {
    color: #0369a1;
}

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

.article-body em {
    font-style: italic;
    color: #4b5563;
}

.article-body blockquote {
    margin: 1.5rem 0;
    padding: 16px 20px;
    border-left: 4px solid var(--color-brand-blue);
    background: #f0f9ff;
    border-radius: 0 8px 8px 0;
    color: #374151;
    font-style: italic;
}

.article-body blockquote p {
    margin-bottom: 0;
    color: #374151;
}

/* Inline code */
.article-body code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
    font-size: 0.88em;
    background: #f1f5f9;
    color: #e11d48;
    padding: 2px 6px;
    border-radius: 4px;
    overflow-wrap: break-word;
}

/* Code block */
.article-body pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
    font-size: 0.9rem;
    line-height: 1.7;
}

.article-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    overflow-wrap: normal;
}

/* Tables */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    overflow-x: auto;
    display: block;
}

.article-body th {
    background: #f8fafc;
    color: var(--color-text-main);
    font-weight: 600;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}

.article-body td {
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    color: #374151;
    vertical-align: top;
}

.article-body tr:nth-child(even) td {
    background: #fafbfc;
}

/* Callout / Tip boxes */
.callout {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    margin: 1.5rem 0;
    font-size: 0.98rem;
    line-height: 1.65;
}

.callout-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.callout p {
    margin: 0;
    font-size: 0.98rem;
    color: inherit;
}

.callout.tip {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    color: #166534;
}

.callout.tip .callout-icon { color: #22c55e; }

.callout.warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.callout.warning .callout-icon { color: #f59e0b; }

.callout.info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

.callout.info .callout-icon { color: #3b82f6; }

.callout.danger {
    background: #fff1f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.callout.danger .callout-icon { color: #ef4444; }

/* Step list */
.step-list {
    counter-reset: steps;
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.step-list li {
    counter-increment: steps;
    /* Absolutely-positioned ::before badge keeps it out of normal flow,
       so all inline content (text, <a>, <code>) wraps naturally as a single block. */
    position: relative;
    padding: 14px 16px 14px 56px;
    margin-bottom: 1rem;
    background: #fafbfc;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: #374151;
    font-size: 1.05rem;
    line-height: 1.7;
}

.step-list li::before {
    content: counter(steps);
    position: absolute;
    left: 14px;
    top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-brand-blue);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ------------------------------------------------------------
   Sidebar TOC
   ------------------------------------------------------------ */
.article-sidebar {
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
}

.toc-card {
    background: #fafbfc;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 20px;
}

.toc-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-text-main);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.toc-list a {
    display: block;
    padding: 5px 8px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    border-radius: 6px;
    transition: all 0.15s;
    line-height: 1.4;
    text-decoration: none;
}

.toc-list a:hover,
.toc-list a.toc-active {
    background: #eff6ff;
    color: var(--color-brand-blue);
    font-weight: 500;
}

.toc-list .toc-h3 a {
    padding-left: 18px;
    font-size: 0.82rem;
}

/* ------------------------------------------------------------
   Product recommend section
   ------------------------------------------------------------ */
.product-recommend {
    margin-top: 48px;
    padding: 32px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 20px;
    color: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.product-recommend::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(14,165,233,0.2) 0%, transparent 70%);
    pointer-events: none;
}

.product-recommend-eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-brand-blue);
    margin-bottom: 10px;
}

.product-recommend h3 {
    font-size: 1.45rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 10px;
    line-height: 1.3;
}

.product-recommend p {
    font-size: 0.98rem;
    color: #94a3b8;
    margin-bottom: 20px;
    line-height: 1.65;
}

.product-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.product-features li::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--color-brand-blue);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.product-recommend .btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--color-brand-blue);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.98rem;
    transition: all 0.2s;
    text-decoration: none;
}

.product-recommend .btn-download:hover {
    background: var(--color-brand-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(14,165,233,0.35);
}

/* ------------------------------------------------------------
   Prev / Next navigation
   ------------------------------------------------------------ */
.article-nav-prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 32px;
}

.article-nav-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: #fafbfc;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.article-nav-item:hover {
    border-color: var(--color-brand-blue);
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.12);
}

.article-nav-item.nav-prev {
    align-items: flex-start;
}

.article-nav-item.nav-next {
    align-items: flex-end;
    text-align: right;
}

.article-nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-nav-title {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--color-text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-nav-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

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

.article-nav-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 999px;
}

/* Empty placeholder for single-side nav */
.article-nav-placeholder {
    min-height: 80px;
}

/* ------------------------------------------------------------
   Related articles
   ------------------------------------------------------------ */
.article-related {
    margin-top: 32px;
}

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

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

.related-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #fafbfc;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.related-card:hover {
    border-color: var(--color-brand-blue);
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.1);
}

.related-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
}

.related-card-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 999px;
}

/* ------------------------------------------------------------
   Float widget
   ------------------------------------------------------------ */
.float-widget {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 300px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(14,165,233,0.08);
    padding: 20px;
    z-index: 900;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.float-widget-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 1rem;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.float-widget-close:hover {
    color: var(--color-text-main);
}

.float-widget-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--color-text-main);
    margin-bottom: 8px;
    padding-right: 20px;
}

.float-widget-desc {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.float-widget-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: var(--color-brand-blue);
    color: #fff;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.float-widget-btn:hover {
    background: var(--color-brand-blue);
    transform: translateY(-1px);
}

/* ------------------------------------------------------------
   Responsive breakpoints
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
    .article-page-wrap {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        display: none;
    }

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

    .article-nav-item.nav-next {
        align-items: flex-start;
        text-align: left;
    }

    .article-nav-item.nav-next .article-nav-tags {
        justify-content: flex-start;
    }

    .float-widget {
        width: calc(100vw - 32px);
        left: 16px;
        right: 16px;
        bottom: 16px;
        border-radius: 14px;
    }
}

@media (max-width: 768px) {
    .article-page-wrap {
        padding: 24px 16px 60px;
    }

    .article-header h1 {
        font-size: 1.55rem;
    }

    .article-body h2 {
        font-size: 1.3rem;
    }

    .product-recommend {
        padding: 22px;
    }

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

    .article-nav-prev-next {
        gap: 12px;
    }
}

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

    .article-meta {
        gap: 12px;
    }

    .product-recommend h3 {
        font-size: 1.2rem;
    }
}
