/* Blog article detail page styles — aligned with main.css / blog-list.css */

:root {
    --accent:   #0052d9;
    --accent-h: #0041b0;
    --accent-light: #007aff;
    --green:    #22c55e;
    --yellow:   #f59e0b;
    --info-blue: #3b82f6;
    --text:     #111111;
    --text-2:   #666666;
    --text-3:   #999999;
    --bg:       #f5f5f7;
    --bg-card:  #ffffff;
    --border:   rgba(0, 0, 0, 0.08);
    --border-h: #e5e5ea;
    --r:    12px;
    --r-lg: 20px;
    --r-xl: 28px;
}

body {
    background: var(--bg);
    color: var(--text);
}

body:has(.article-page-wrap) {
    overflow-x: clip;
}

/* Article pages have no dark hero — keep header solid (dark text on white) */
body:has(.article-page-wrap) header#main-header {
    background-color: #ffffff;
    color: #111111;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body:has(.article-page-wrap) header#main-header .lang-switch {
    border-left-color: #ccc;
}

body:has(.article-page-wrap) header#main-header .nav-menu-toggle,
body:has(.article-page-wrap) header#main-header .nav-icon-btn {
    color: #111111;
}

/* Two-column page layout */
.article-page-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 272px;
    gap: 44px;
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 100px 28px 88px;
    box-sizing: border-box;
}

.article-main,
.article-sidebar {
    min-width: 0;
    max-width: 100%;
}

/* Breadcrumb navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-3);
    text-decoration: none;
    transition: color 0.2s;
}

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

.breadcrumb .bc-sep {
    font-size: 9px;
    color: var(--text-3);
    opacity: 0.6;
}

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

/* Article header */
.article-header {
    margin-bottom: 40px;
}

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

.article-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: #f0f4ff;
    color: var(--accent-light);
    border: 1px solid rgba(0, 122, 255, 0.15);
    text-decoration: none;
}

.article-tag.tag-latest {
    background: var(--accent-light);
    color: #fff;
    border-color: transparent;
}

h1.article-title {
    font-size: clamp(24px, 3.5vw, 38px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.03em;
    color: var(--text);
    margin: 0 0 20px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 24px;
}

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

.article-meta-item i {
    font-size: 12px;
    color: var(--text-3);
}

p.article-summary {
    background: #eff6ff;
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--r) var(--r) 0;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--text-2);
    margin: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Article body */
.article-body {
    font-size: 15px;
    line-height: 1.9;
    color: var(--text);
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.article-body h2 {
    font-size: clamp(18px, 2.5vw, 24px);
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text);
    margin: 52px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    scroll-margin-top: 90px;
}

.article-body h2:first-child {
    margin-top: 36px;
}

.article-body h3 {
    font-size: clamp(15px, 2vw, 18px);
    font-weight: 700;
    color: var(--text);
    margin: 32px 0 12px;
    scroll-margin-top: 90px;
}

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

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

.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.article-body a:hover {
    color: var(--accent-h);
}

.article-body ol,
.article-body ul {
    padding-left: 24px;
    margin-bottom: 20px;
}

.article-body li {
    margin-bottom: 8px;
    line-height: 1.8;
}

.article-body ul {
    list-style: disc;
}

.article-body ol {
    list-style: decimal;
}

/* Code blocks */
.article-body pre {
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--r);
    padding: 20px 24px;
    margin: 26px 0;
    overflow-x: auto;
    max-width: 100%;
}

.article-body pre > code {
    color: #B8D0F0;
    font-size: 13px;
    line-height: 1.75;
    background: none;
    border: none;
    padding: 0;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Inline code */
.article-body code {
    background: #f3f4f6;
    border: none;
    border-radius: 5px;
    padding: 2px 7px;
    color: var(--accent);
    font-size: 0.87em;
    font-family: 'Courier New', 'Consolas', monospace;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Tables */
.article-body table {
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 24px 0;
}

.article-body th {
    background: rgba(0, 0, 0, 0.04);
    font-weight: 700;
    padding: 10px 14px;
    border: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
    text-align: left;
}

.article-body td {
    padding: 9px 14px;
    border: 1px solid var(--border);
    color: var(--text-2);
    vertical-align: top;
}

.article-body tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

/* Callout boxes */
.callout {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--r);
    margin: 24px 0;
    font-size: 14px;
    line-height: 1.75;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.callout > div {
    flex: 1;
    min-width: 0;
}

.callout-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.callout-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.callout-info .callout-icon {
    color: var(--info-blue);
}

.callout-tip {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.callout-tip .callout-icon {
    color: var(--green);
}

.callout-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #78350f;
}

.callout-warn .callout-icon {
    color: var(--yellow);
}

/* Inline CTA */
.article-body a.inline-cta {
    font-weight: 700;
    font-size: 15px;
}

/* Sidebar TOC */
.article-sidebar {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 108px);
    overflow-y: auto;
    align-self: start;
}

.toc-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--r-lg);
    padding: 20px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
}

.toc-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-3);
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}

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

.toc-list a {
    display: block;
    font-size: 13px;
    color: var(--text-2);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 7px;
    border-left: 2px solid transparent;
    transition: all 0.2s;
    line-height: 1.5;
}

.toc-list a:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}

.toc-list a.toc-active {
    background: #eff6ff;
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}

/* Product recommend card */
.product-recommend {
    position: relative;
    background: linear-gradient(135deg,
        rgba(0, 82, 217, 0.06) 0%,
        rgba(255, 255, 255, 0.98) 50%,
        rgba(0, 122, 255, 0.05) 100%);
    border: 1px solid rgba(0, 82, 217, 0.15);
    border-radius: var(--r-xl);
    padding: 36px 40px;
    margin-top: 64px;
    overflow: hidden;
}

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

.pr-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 100px;
    background: #eff6ff;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
}

.pr-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.pr-desc {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.7;
    max-width: 520px;
    margin-bottom: 20px;
}

.pr-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pr-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-2);
}

.pr-check-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: rgba(34, 197, 94, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pr-check-icon::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: solid var(--green);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.pr-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 100px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 4px 16px rgba(0, 82, 217, 0.25);
}

.pr-cta:hover {
    background: var(--accent-h);
    transform: translateY(-1px);
}

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

.nav-pn-item {
    background: #fff;
    border-radius: var(--r-lg);
    padding: 18px 20px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid var(--border);
}

.nav-pn-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.nav-pn-dir {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-pn-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.nav-pn-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 100px;
    background: #f0f4ff;
    color: var(--accent-light);
}

/* Related articles */
.article-related {
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.related-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-title i {
    color: var(--accent);
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.related-card {
    background: #fff;
    border-radius: var(--r-lg);
    padding: 16px 18px;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.related-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-card-tag {
    font-size: 10.5px;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-3);
    display: inline-block;
    align-self: flex-start;
}

/* Floating widget */
.float-widget {
    position: fixed;
    right: 28px;
    bottom: 80px;
    width: 284px;
    background: #fff;
    border-radius: var(--r-xl);
    box-shadow: 0 16px 56px rgba(0, 0, 0, 0.18);
    padding: 22px 22px 18px;
    z-index: 9000;
    transform: translateX(calc(100% + 40px));
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.float-widget.visible {
    transform: translateX(0);
}

.fw-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.fw-close::before,
.fw-close::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 2px;
    background: var(--text-3);
    border-radius: 1px;
}

.fw-close::before {
    transform: rotate(45deg);
}

.fw-close::after {
    transform: rotate(-45deg);
}

.fw-close:hover {
    background: rgba(0, 0, 0, 0.12);
}

.fw-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    margin-bottom: 6px;
}

.fw-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.3;
}

.fw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 20px;
    border-radius: 100px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s;
    box-shadow: 0 4px 14px rgba(0, 82, 217, 0.22);
}

.fw-btn:hover {
    background: var(--accent-h);
}

/* Responsive breakpoints */
@media (max-width: 1100px) {
    .article-page-wrap {
        grid-template-columns: minmax(0, 1fr) 240px;
        gap: 30px;
    }
}

@media (max-width: 900px) {
    .article-page-wrap {
        grid-template-columns: minmax(0, 1fr);
        padding: 80px 18px 60px;
    }

    .article-sidebar {
        order: -1;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

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

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

    .product-recommend {
        padding: 26px 24px;
    }

    .float-widget {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        border-radius: var(--r-lg) var(--r-lg) 0 0;
        transform: translateY(calc(100% + 10px));
    }

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

@media (max-width: 480px) {
    .article-page-wrap {
        padding: 76px 14px 52px;
    }

    .product-recommend {
        padding: 20px 16px;
    }

    h1.article-title {
        font-size: clamp(22px, 6vw, 28px);
    }
}
