/* ==========================================================
   STP Blog — Article Reading Experience
   Applied via .article-body on single.php
========================================================== */

/* --------------------------------------------------------
   Root typography
-------------------------------------------------------- */
.article-body {
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.125rem);
    line-height: 1.85;
    color: #1a2230;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------
   Headings
-------------------------------------------------------- */
.article-body h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: #01251A;
    line-height: 1.25;
    margin: 0 0 1.5rem;
    letter-spacing: -0.02em;
}

.article-body h2 {
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    font-weight: 700;
    color: #01251A;
    line-height: 1.3;
    margin: 2.75rem 0 1rem;
    padding-top: 0.5rem;
    border-top: 2px solid #d1fae5;
}

.article-body h3 {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    font-weight: 700;
    color: #1a4731;
    line-height: 1.35;
    margin: 1.75rem 0 0.75rem;
}

.article-body h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #374151;
    margin: 1.25rem 0 0.5rem;
}

/* --------------------------------------------------------
   Paragraphs and inline
-------------------------------------------------------- */
.article-body p {
    margin: 0 0 1.4rem;
}

.article-body p:last-child {
    margin-bottom: 0;
}

.article-body strong {
    font-weight: 700;
    color: #01251A;
}

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

.article-body a {
    color: #047857;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.15s;
}

.article-body a:hover {
    color: #065f46;
}

/* --------------------------------------------------------
   Table of Contents
-------------------------------------------------------- */
.article-body .toc {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #16a34a;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.75rem 0 2rem;
}

.article-body .toc-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #16a34a;
    margin: 0 0 0.75rem;
}

.article-body .toc ol {
    margin: 0;
    padding-left: 1.25rem;
    counter-reset: toc-counter;
    list-style: none;
}

.article-body .toc ol li {
    counter-increment: toc-counter;
    margin: 0.35rem 0;
    padding: 0;
}

.article-body .toc ol li::before {
    content: counter(toc-counter) ". ";
    color: #16a34a;
    font-weight: 600;
    font-size: 0.875rem;
}

.article-body .toc a {
    color: #166534;
    font-size: 0.925rem;
    font-weight: 500;
    text-decoration: none;
}

.article-body .toc a:hover {
    color: #15803d;
    text-decoration: underline;
}

/* --------------------------------------------------------
   Lists
-------------------------------------------------------- */
.article-body ul,
.article-body ol {
    margin: 0.75rem 0 1.5rem 0;
    padding-left: 1.75rem;
}

.article-body ul {
    list-style: none;
    padding-left: 0;
}

.article-body ul > li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.article-body ul > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 7px;
    height: 7px;
    background: #16a34a;
    border-radius: 50%;
    flex-shrink: 0;
}

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

.article-body ol > li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.article-body li > p {
    margin-bottom: 0.25rem;
}

/* --------------------------------------------------------
   Tables
-------------------------------------------------------- */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-body thead {
    background: #01251A;
    color: #fff;
}

.article-body thead th {
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: left;
    white-space: nowrap;
}

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

.article-body tbody tr:hover {
    background: #f0fdf4;
}

.article-body td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    line-height: 1.6;
}

/* --------------------------------------------------------
   Images & Figures
-------------------------------------------------------- */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
}

.article-figure {
    margin: 2rem 0;
}

.article-figure .article-img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.article-figure figcaption {
    margin-top: 0.6rem;
    font-size: 0.825rem;
    color: #6b7280;
    text-align: center;
    font-style: italic;
    line-height: 1.5;
}

/* --------------------------------------------------------
   Blockquote
-------------------------------------------------------- */
.article-body blockquote {
    border-left: 4px solid #16a34a;
    margin: 1.75rem 0;
    padding: 0.75rem 1.25rem;
    background: #f0fdf4;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #374151;
}

.article-body blockquote p {
    margin: 0;
}

/* --------------------------------------------------------
   FAQ / Details & Summary accordion
-------------------------------------------------------- */
.faq-section {
    margin: 2.5rem 0;
}

.faq-section h2 {
    margin-bottom: 1.25rem;
}

.article-body details {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

.article-body details[open] {
    border-color: #bbf7d0;
}

.article-body summary {
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a4731;
    background: #f9fafb;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: background 0.15s;
}

.article-body summary::-webkit-details-marker { display: none; }

.article-body summary::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    color: #16a34a;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.article-body details[open] summary::after {
    transform: rotate(45deg);
}

.article-body details[open] summary {
    background: #f0fdf4;
    color: #01251A;
}

.article-body details > p,
.article-body details > div {
    padding: 0.75rem 1.25rem 1rem;
    font-size: 0.95rem;
    line-height: 1.75;
    color: #374151;
    border-top: 1px solid #e5e7eb;
}

/* --------------------------------------------------------
   Conclusion section
-------------------------------------------------------- */
.conclusion {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    margin: 2.5rem 0;
    border: 1px solid #bbf7d0;
}

.conclusion h2 {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* --------------------------------------------------------
   Code (if any)
-------------------------------------------------------- */
.article-body code {
    background: #f1f5f9;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'JetBrains Mono', monospace;
    color: #0f172a;
}

.article-body pre {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 1.5rem 0;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* --------------------------------------------------------
   Reading progress bar
-------------------------------------------------------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: #16a34a;
    z-index: 9999;
    transition: width 0.1s linear;
}

/* --------------------------------------------------------
   TOC sidebar (desktop only)
-------------------------------------------------------- */
.toc-sidebar {
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    scrollbar-width: thin;
}

.toc-sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin: 0 0 0.75rem;
}

.toc-sidebar nav a {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: none;
    padding: 0.3rem 0 0.3rem 0.75rem;
    border-left: 2px solid #e5e7eb;
    line-height: 1.4;
    transition: color 0.15s, border-color 0.15s;
}

.toc-sidebar nav a:hover,
.toc-sidebar nav a.active {
    color: #16a34a;
    border-left-color: #16a34a;
}

/* --------------------------------------------------------
   Share buttons
-------------------------------------------------------- */
.share-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.15s;
    color: #fff;
}

.share-btn:hover { opacity: 0.85; color: #fff; text-decoration: none; }
.share-btn-whatsapp { background: #25d366; }
.share-btn-facebook { background: #1877f2; }
.share-btn-twitter  { background: #000; }
.share-btn-copy     { background: #64748b; cursor: pointer; border: none; width: 100%; }

/* --------------------------------------------------------
   Author card
-------------------------------------------------------- */
.author-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    margin: 2.5rem 0;
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-info strong {
    display: block;
    font-size: 0.95rem;
    color: #1d2327;
    margin-bottom: 0.2rem;
}

.author-info span {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* --------------------------------------------------------
   Responsive adjustments
-------------------------------------------------------- */
@media (max-width: 1023px) {
    .toc-sidebar { display: none; }
}

@media (max-width: 767px) {
    .article-body {
        font-size: 1rem;
        line-height: 1.8;
    }

    .article-body h2 {
        font-size: 1.3rem;
        margin: 2rem 0 0.875rem;
    }

    .article-body h3 {
        font-size: 1.1rem;
    }

    .article-figure .article-img {
        border-radius: 8px;
    }

    .conclusion {
        padding: 1.25rem 1.25rem;
    }

    .article-body .toc {
        padding: 1rem;
    }

    .article-body summary {
        font-size: 0.9rem;
        padding: 0.875rem 1rem;
    }
}

@media (max-width: 480px) {
    .article-body {
        font-size: 0.975rem;
    }

    .article-body table {
        font-size: 0.825rem;
    }

    .article-body thead th,
    .article-body td {
        padding: 0.6rem 0.75rem;
    }
}
