/* TopRank Skills Marketplace - Blog Detail Page Styles */

/* ============================================
   Reading Progress Bar
   ============================================ */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #2b8cee 0%, #7c3aed 100%);
    z-index: 9999;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

/* ============================================
   Utilities
   ============================================ */
html { scroll-behavior: smooth; }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

@media print {
    .sticky, aside, header, footer, nav, #reading-progress { display: none !important; }
}

/* ============================================
   Article Content Typography
   ============================================ */
.article-content {
    font-size: 1.0625rem;
    line-height: 1.85;
    color: #374151;
}
.dark .article-content { color: #d1d5db; }

/* Lead paragraph */
.article-lead {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #111418;
    border-left: 3px solid #2b8cee;
    padding: 1.125rem 1.375rem;
    margin-bottom: 2rem;
    background: rgba(43,140,238,0.04);
    border-radius: 0 0.75rem 0.75rem 0;
    font-weight: 500;
}
.dark .article-lead {
    color: #f3f4f6;
    background: rgba(43,140,238,0.08);
}

/* ---- Headings ---- */
/* H2 - uses padding-left + absolute pseudo bar (avoids flex breaking text flow) */
.article-content h2 {
    font-size: 1.625rem;
    font-weight: 800;
    margin-top: 3rem;
    margin-bottom: 1.125rem;
    color: #111418;
    scroll-margin-top: 88px;
    position: relative;
    padding-left: 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.35;
}
.article-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2em;
    bottom: 0.2em;
    width: 3px;
    background: linear-gradient(180deg, #2b8cee, #7c3aed);
    border-radius: 2px;
}
.dark .article-content h2 {
    color: #f9fafb;
    border-bottom-color: #1f2937;
}

/* Anchor link on h2 hover */
.article-content h2 .anchor-link {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    opacity: 0;
    color: #2b8cee;
    transition: opacity 0.2s;
    font-size: 1rem;
    font-weight: 400;
    vertical-align: middle;
}
.article-content h2:hover .anchor-link { opacity: 1; }

/* H3 */
.article-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #111418;
    scroll-margin-top: 88px;
}
.dark .article-content h3 { color: #f3f4f6; }

/* H4 */
.article-content h4 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.625rem;
    color: #111418;
    scroll-margin-top: 88px;
}
.dark .article-content h4 { color: #f3f4f6; }

/* Paragraphs */
.article-content p { margin-bottom: 1.5rem; }

/* Lists */
.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.75rem;
}
.article-content li { margin-bottom: 0.4rem; }
.article-content ul li { list-style-type: disc; }
.article-content ol li { list-style-type: decimal; }

/* Links */
.article-content a {
    color: #2b8cee;
    text-decoration: underline;
    text-decoration-color: rgba(43,140,238,0.35);
    text-underline-offset: 3px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.article-content a:hover {
    color: #1e6dbb;
    text-decoration-color: #1e6dbb;
}

/* Inline code */
.article-content code {
    background-color: #f0f2f4;
    padding: 0.15rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.875em;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    color: #d63384;
}
.dark .article-content code {
    background-color: #1f2937;
    color: #f472b6;
}

/* Code blocks */
.article-content pre {
    background-color: #0d1117;
    color: #e6edf3;
    padding: 1.375rem 1.5rem;
    border-radius: 0.875rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875em;
    border: 1px solid #30363d;
    position: relative;
}
.article-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Blockquote */
.article-content blockquote {
    border-left: 3px solid #2b8cee;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: rgba(43,140,238,0.04);
    border-radius: 0 0.75rem 0.75rem 0;
    color: #617589;
    font-style: italic;
}
.dark .article-content blockquote {
    background: rgba(43,140,238,0.07);
    color: #9ca3af;
}

/* Images */
.article-content img {
    width: 100%;
    height: auto;
    border-radius: 0.875rem;
    margin: 1.75rem 0;
    box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.article-content table th,
.article-content table td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    text-align: left;
}
.dark .article-content table th,
.dark .article-content table td { border-color: #374151; }
.article-content table th {
    background-color: #f8fafc;
    font-weight: 700;
    color: #111418;
}
.dark .article-content table th {
    background-color: #1e293b;
    color: #f3f4f6;
}
.article-content table tr:hover td { background: rgba(43,140,238,0.025); }

/* ============================================
   Tags
   ============================================ */
.article-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem 0.8rem;
    background: #f0f2f4;
    color: #617589;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.dark .article-tag { background: #1f2937; color: #9ca3af; }
.article-tag:hover {
    background: rgba(43,140,238,0.1);
    color: #2b8cee;
    border-color: rgba(43,140,238,0.25);
    transform: translateY(-1px);
}
.tag-hash { color: #2b8cee; font-weight: 700; }

/* ============================================
   Author Bio Card
   ============================================ */
.author-bio-card {
    border-radius: 1.25rem;
    border: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    overflow: hidden;
}
.dark .author-bio-card {
    background: linear-gradient(135deg, #111827 0%, #0f172a 100%);
    border-color: #1f2937;
}
.author-bio-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
    text-align: center;
}
@media (min-width: 640px) {
    .author-bio-inner {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
    }
}

/* ============================================
   FAQ / Q&A Section
   ============================================ */
.faq-section {
    border-radius: 1.25rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.dark .faq-section {
    background: #0f172a;
    border-color: #1f2937;
}

.faq-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
}
.dark .faq-header { border-bottom-color: #1f2937; }

.faq-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(43,140,238,0.1);
    border-radius: 0.75rem;
    color: #2b8cee;
    flex-shrink: 0;
}

.faq-list { padding: 1rem; }

.faq-item {
    border-radius: 0.75rem;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.dark .faq-item { background: #111827; border-color: #1f2937; }
.faq-item + .faq-item { margin-top: 0.5rem; }
.faq-item.open { border-color: rgba(43,140,238,0.3); box-shadow: 0 2px 12px rgba(43,140,238,0.07); }

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #111418;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}
.dark .faq-question { color: #f3f4f6; }
.faq-question:hover { color: #2b8cee; }
.faq-question.open { color: #2b8cee; }

.faq-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    background: #f0f2f4;
    color: #617589;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.dark .faq-num { background: #1f2937; }
.faq-question.open .faq-num { background: rgba(43,140,238,0.12); color: #2b8cee; }

.faq-icon {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    color: #617589;
    font-size: 1.25rem !important;
}
.faq-question.open .faq-icon { transform: rotate(180deg); color: #2b8cee; }

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.faq-answer.open { max-height: 500px; }

.faq-answer-inner {
    padding: 0 1.25rem 1.125rem;
    border-top: 1px solid #f0f2f4;
    color: #617589;
    font-size: 0.9375rem;
    line-height: 1.75;
    margin-top: 0;
    padding-top: 0.875rem;
}
.dark .faq-answer-inner {
    color: #9ca3af;
    border-top-color: #1f2937;
}

/* ============================================
   Related Card
   ============================================ */
.related-card {
    display: block;
    border-radius: 1rem;
    padding: 0.375rem;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.25s ease;
}
.related-card:hover {
    border-color: #e5e7eb;
    background: #f8fafc;
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
    transform: translateY(-3px);
}
.dark .related-card:hover {
    background: #111827;
    border-color: #1f2937;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.dark .sidebar-card {
    background: #111827;
    border-color: #1f2937;
    box-shadow: none;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #617589;
    margin-bottom: 0.875rem;
}

/* TOC */
.toc-nav {
    max-height: 26rem;
    overflow-y: auto;
}
.toc-nav a {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
    color: #617589;
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 0.5rem 0.5rem 0;
    transition: all 0.18s;
    line-height: 1.45;
    margin-bottom: 1px;
}
.toc-nav a:hover {
    color: #2b8cee;
    background: rgba(43,140,238,0.06);
    border-left-color: rgba(43,140,238,0.35);
}
.toc-nav a.active {
    color: #2b8cee;
    font-weight: 600;
    background: rgba(43,140,238,0.08);
    border-left-color: #2b8cee;
}
.toc-nav a .toc-num {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: #2b8cee;
    opacity: 0.65;
    margin-top: 0.18rem;
    min-width: 1.25rem;
}

/* Share buttons */
.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.625rem 0.5rem;
    background: #f0f2f4;
    color: #617589;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}
.dark .share-btn { background: #1f2937; color: #9ca3af; }
.share-btn:hover {
    background: rgba(43,140,238,0.1);
    color: #2b8cee;
    transform: translateY(-1px);
}

/* CTA */
.sidebar-cta {
    background: linear-gradient(135deg, #2b8cee 0%, #1e6dbb 55%, #7c3aed 100%);
    padding: 1.75rem 1.375rem;
    border-radius: 1rem;
    color: white;
    position: relative;
    overflow: hidden;
}
.sidebar-cta::before {
    content: '';
    position: absolute;
    top: -24px; right: -24px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}
.sidebar-cta::after {
    content: '';
    position: absolute;
    bottom: -16px; left: -16px;
    width: 70px; height: 70px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.sidebar-cta-icon {
    display: inline-flex;
    padding: 0.5rem;
    background: rgba(255,255,255,0.15);
    border-radius: 0.625rem;
    margin-bottom: 0.75rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .article-content { font-size: 1rem; }
    .article-content h2 { font-size: 1.375rem; }
    .article-content h3 { font-size: 1.125rem; }
    .faq-header { padding: 1.25rem 1.5rem; }
    .faq-list { padding: 0.75rem; }
    .author-bio-inner { padding: 1.5rem; }
}
