/* =========================================================================
   article.css - Estilos ricos para artigos editoriais sabermeuip.com.br
   Cobre: layout do artigo, indice (TOC), callouts, FAQ, tabelas, tipografia,
   cross-links e variantes em modo escuro. Carregado em todas as paginas via
   includes/header.php (algumas classes sao reutilizadas por ferramentas).
   Tokens de cor: usa diretamente o palette do site (primary #0071e3) ja que
   o projeto nao expoe variaveis CSS em :root.
   Anti-IA: zero m-dashes, comentarios em pt-br.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Container e tipografia base do artigo
   ------------------------------------------------------------------------- */
.seo-article-content,
article.tam-article,
article.article-body,
main article {
    max-width: 760px;
    margin: 0 auto;
    color: #334155;
    font-size: 1.05rem;
    line-height: 1.75;
}

.seo-article-content h2,
article.tam-article h2,
main article h2 {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 48px 0 16px;
    color: #0f172a;
    border-bottom: 2px solid #0071e3;
    padding-bottom: 8px;
    line-height: 1.3;
}

.seo-article-content h3,
article.tam-article h3,
main article h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 32px 0 12px;
    color: #1e293b;
    line-height: 1.35;
}

.seo-article-content h4,
article.tam-article h4,
main article h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 24px 0 8px;
    color: #1e293b;
}

.seo-article-content p,
article.tam-article p,
main article p {
    margin: 0 0 16px;
    line-height: 1.75;
}

.seo-article-content ul,
.seo-article-content ol,
article.tam-article ul,
article.tam-article ol,
main article ul,
main article ol {
    margin: 16px 0 16px 24px;
    line-height: 1.7;
}

.seo-article-content li,
article.tam-article li,
main article li {
    margin-bottom: 6px;
}

.seo-article-content strong,
article.tam-article strong,
main article strong {
    font-weight: 700;
    color: #0f172a;
}

.seo-article-content a,
article.tam-article a,
main article a {
    color: #0071e3;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.18s ease;
}

.seo-article-content a:hover,
article.tam-article a:hover,
main article a:hover {
    color: #0058b8;
}

.seo-article-content code,
article.tam-article code,
main article code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.92em;
    color: #d63384;
    word-break: break-word;
}

.seo-article-content pre,
article.tam-article pre,
main article pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 24px 0;
}

.seo-article-content pre code,
article.tam-article pre code,
main article pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.seo-article-content blockquote,
article.tam-article blockquote,
main article blockquote {
    border-left: 4px solid #cbd5e1;
    padding: 8px 16px;
    color: #475569;
    font-style: italic;
    margin: 24px 0;
    background: #f8fafc;
    border-radius: 0 6px 6px 0;
}

.seo-article-content hr,
article.tam-article hr,
main article hr {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 32px 0;
}

/* -------------------------------------------------------------------------
   2. Lede do artigo + drop cap suave
   ------------------------------------------------------------------------- */
.article-intro {
    font-size: 1.15rem;
    line-height: 1.7;
    color: #334155;
    margin-bottom: 32px;
    max-width: 70ch;
}

.article-intro::first-letter {
    font-size: 3rem;
    float: left;
    line-height: 1;
    padding: 4px 10px 0 0;
    color: #0071e3;
    font-weight: 700;
}

/* -------------------------------------------------------------------------
   3. Byline / assinatura
   ------------------------------------------------------------------------- */
.article-byline {
    font-size: 0.85rem;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
    margin-top: 48px;
    font-style: italic;
}

/* -------------------------------------------------------------------------
   4. Passos numerados (.article-steps / .diagnostic-steps)
   ------------------------------------------------------------------------- */
.article-steps,
.diagnostic-steps {
    counter-reset: stepCounter;
    list-style: none;
    padding: 0;
    margin: 24px 0;
}

.article-steps li,
.diagnostic-steps li {
    counter-increment: stepCounter;
    position: relative;
    padding: 16px 16px 16px 64px;
    margin-bottom: 12px;
    border-left: 3px solid #0071e3;
    background: #f8fafc;
    border-radius: 6px;
    line-height: 1.6;
}

.article-steps li::before,
.diagnostic-steps li::before {
    content: counter(stepCounter);
    position: absolute;
    left: 16px;
    top: 14px;
    width: 32px;
    height: 32px;
    background: #0071e3;
    color: #ffffff;
    border-radius: 50%;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(0, 113, 227, 0.25);
}

/* -------------------------------------------------------------------------
   5. Indice (Table of Contents)
   ------------------------------------------------------------------------- */
.article-toc {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 32px 0;
}

.article-toc h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin: 0 0 12px;
    font-weight: 700;
    border-bottom: 0;
    padding-bottom: 0;
}

.article-toc ol {
    counter-reset: tocCounter;
    list-style: decimal;
    padding-left: 24px;
    margin: 0;
}

.article-toc li {
    padding: 4px 0;
    line-height: 1.5;
    margin-bottom: 0;
}

.article-toc a {
    color: #0071e3;
    text-decoration: none;
    transition: color 0.18s ease;
}

.article-toc a:hover {
    text-decoration: underline;
    color: #0058b8;
}

/* -------------------------------------------------------------------------
   6. Callouts / infoboxes
   ------------------------------------------------------------------------- */
.callout {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 10px;
    margin: 24px 0;
    border-left: 4px solid #94a3b8;
    background: #f8fafc;
    align-items: flex-start;
    line-height: 1.6;
}

.callout > i,
.callout > .fas,
.callout > .fa-solid,
.callout > svg {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
    line-height: 1;
}

.callout p {
    margin: 0 0 8px;
}

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

.callout strong {
    color: #0f172a;
}

.callout-info {
    background: #eff6ff;
    border-left-color: #0071e3;
}
.callout-info > i,
.callout-info > svg {
    color: #0071e3;
}

.callout-warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}
.callout-warning > i,
.callout-warning > svg {
    color: #d97706;
}

.callout-br {
    background: linear-gradient(135deg, #f0fdf4 0%, #fef9e7 100%);
    border-left-color: #00a859;
}
.callout-br > i,
.callout-br > svg {
    color: #00a859;
}

.callout-tip {
    background: #f0fdf4;
    border-left-color: #10b981;
}
.callout-tip > i,
.callout-tip > svg {
    color: #059669;
}

.callout-danger {
    background: #fef2f2;
    border-left-color: #dc2626;
}
.callout-danger > i,
.callout-danger > svg {
    color: #dc2626;
}

/* -------------------------------------------------------------------------
   7. FAQ (details/summary)
   ------------------------------------------------------------------------- */
.faq-section {
    margin-top: 48px;
}

.faq-section h2 {
    border-bottom: 2px solid #0071e3;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 16px 20px;
    background: #ffffff;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.faq-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
    list-style: none;
    position: relative;
    padding-right: 32px;
    line-height: 1.45;
    outline: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    color: #0071e3;
    transition: transform 0.2s ease;
    line-height: 1;
    font-weight: 400;
}

.faq-item[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

.faq-item[open] summary {
    margin-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.faq-item p {
    margin: 8px 0;
    line-height: 1.65;
    color: #475569;
}

.faq-item p:last-child {
    margin-bottom: 0;
}

/* -------------------------------------------------------------------------
   8. Tabelas dentro de artigos
   ------------------------------------------------------------------------- */
.article-table,
article.tam-article table,
main article table,
.seo-article-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
    font-size: 0.95rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.article-table thead th,
article.tam-article table thead th,
main article table thead th,
.seo-article-content table thead th {
    background: #f1f5f9;
    font-weight: 700;
    color: #334155;
    text-align: left;
    padding: 12px 16px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.article-table tbody td,
article.tam-article table tbody td,
main article table tbody td,
.seo-article-content table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    vertical-align: top;
}

.article-table tbody tr:last-child td,
article.tam-article table tbody tr:last-child td,
main article table tbody tr:last-child td,
.seo-article-content table tbody tr:last-child td {
    border-bottom: 0;
}

.article-table tbody tr:nth-child(even) td,
article.tam-article table tbody tr:nth-child(even) td,
main article table tbody tr:nth-child(even) td,
.seo-article-content table tbody tr:nth-child(even) td {
    background: rgba(241, 245, 249, 0.4);
}

.article-table tbody tr:hover td,
article.tam-article table tbody tr:hover td,
main article table tbody tr:hover td,
.seo-article-content table tbody tr:hover td {
    background: #f8fafc;
}

.article-table caption,
article.tam-article table caption,
main article table caption,
.seo-article-content table caption {
    font-size: 0.85rem;
    color: #64748b;
    padding: 8px 0;
    text-align: left;
    font-style: italic;
    caption-side: bottom;
}

/* Wrapper para scroll horizontal em mobile */
.table-responsive {
    overflow-x: auto;
    margin: 24px 0;
    border-radius: 8px;
}

.table-responsive table {
    margin: 0;
    min-width: 480px;
}

/* -------------------------------------------------------------------------
   9. Cross-links / ferramentas relacionadas
   ------------------------------------------------------------------------- */
.article-related-tools {
    margin: 40px 0;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
    border: 1px solid #dbeafe;
    border-radius: 12px;
}

.article-related-tools h2,
.article-related-tools h3 {
    margin-top: 0;
    border-bottom: 0;
    color: #0f172a;
    font-size: 1.15rem;
}

.article-related-tools .related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.article-related-tools .related-grid a {
    display: block;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.article-related-tools .related-grid a:hover {
    border-color: #0071e3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.12);
    color: #0071e3;
}

/* -------------------------------------------------------------------------
   10. Responsivo (mobile-first refinement)
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .seo-article-content h2,
    article.tam-article h2,
    main article h2 {
        font-size: 1.35rem;
    }

    .seo-article-content h3,
    article.tam-article h3,
    main article h3 {
        font-size: 1.1rem;
    }

    .article-intro {
        font-size: 1.05rem;
    }

    .article-intro::first-letter {
        font-size: 2.4rem;
    }

    .article-toc {
        padding: 16px;
    }

    .callout {
        flex-direction: row;
        gap: 10px;
        padding: 14px 16px;
        align-items: flex-start;
    }

    .callout > i,
    .callout > svg,
    .callout > .fas,
    .callout > .fa-solid {
        font-size: 1.2rem;
        flex: 0 0 auto;
        margin-top: 2px;
    }

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

    .article-steps li,
    .diagnostic-steps li {
        padding: 14px 14px 14px 56px;
    }

    .article-steps li::before,
    .diagnostic-steps li::before {
        left: 12px;
        top: 12px;
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .article-table,
    article.tam-article table,
    main article table {
        font-size: 0.85rem;
    }

    .article-table thead th,
    article.tam-article table thead th,
    main article table thead th {
        padding: 10px 12px;
    }

    .article-table tbody td,
    article.tam-article table tbody td,
    main article table tbody td {
        padding: 10px 12px;
    }
}

/* -------------------------------------------------------------------------
   11. Modo escuro (body.dark-mode)
   ------------------------------------------------------------------------- */
body.dark-mode .seo-article-content,
body.dark-mode article.tam-article,
body.dark-mode main article {
    color: #cbd5e1;
}

body.dark-mode .seo-article-content h2,
body.dark-mode article.tam-article h2,
body.dark-mode main article h2 {
    color: #f1f5f9;
    border-bottom-color: #3b82f6;
}

body.dark-mode .seo-article-content h3,
body.dark-mode .seo-article-content h4,
body.dark-mode article.tam-article h3,
body.dark-mode article.tam-article h4,
body.dark-mode main article h3,
body.dark-mode main article h4 {
    color: #e2e8f0;
}

body.dark-mode .seo-article-content strong,
body.dark-mode article.tam-article strong,
body.dark-mode main article strong {
    color: #f8fafc;
}

body.dark-mode .seo-article-content a,
body.dark-mode article.tam-article a,
body.dark-mode main article a {
    color: #60a5fa;
}

body.dark-mode .seo-article-content a:hover,
body.dark-mode article.tam-article a:hover,
body.dark-mode main article a:hover {
    color: #93c5fd;
}

body.dark-mode .seo-article-content code,
body.dark-mode article.tam-article code,
body.dark-mode main article code {
    background: #1e293b;
    color: #f9a8d4;
}

body.dark-mode .seo-article-content blockquote,
body.dark-mode article.tam-article blockquote,
body.dark-mode main article blockquote {
    background: #1e293b;
    border-left-color: #475569;
    color: #cbd5e1;
}

body.dark-mode .article-intro {
    color: #cbd5e1;
}

body.dark-mode .article-intro::first-letter {
    color: #60a5fa;
}

body.dark-mode .article-byline {
    color: #94a3b8;
    border-top-color: #334155;
}

body.dark-mode .article-steps li,
body.dark-mode .diagnostic-steps li {
    background: #1e293b;
    border-left-color: #3b82f6;
    color: #cbd5e1;
}

body.dark-mode .article-steps li::before,
body.dark-mode .diagnostic-steps li::before {
    background: #3b82f6;
}

body.dark-mode .article-toc {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

body.dark-mode .article-toc h2 {
    color: #94a3b8;
}

body.dark-mode .article-toc a {
    color: #60a5fa;
}

body.dark-mode .callout {
    background: #1e293b;
    color: #cbd5e1;
}

body.dark-mode .callout strong {
    color: #f1f5f9;
}

body.dark-mode .callout-info {
    background: rgba(59, 130, 246, 0.12);
}

body.dark-mode .callout-warning {
    background: rgba(245, 158, 11, 0.12);
}

body.dark-mode .callout-br {
    background: linear-gradient(135deg, rgba(0, 168, 89, 0.14) 0%, rgba(245, 158, 11, 0.10) 100%);
}

body.dark-mode .callout-tip {
    background: rgba(16, 185, 129, 0.12);
}

body.dark-mode .callout-danger {
    background: rgba(220, 38, 38, 0.12);
}

body.dark-mode .faq-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .faq-item:hover {
    border-color: #475569;
}

body.dark-mode .faq-item summary {
    color: #f1f5f9;
}

body.dark-mode .faq-item summary::after {
    color: #60a5fa;
}

body.dark-mode .faq-item[open] summary {
    border-bottom-color: #334155;
}

body.dark-mode .faq-item p {
    color: #cbd5e1;
}

body.dark-mode .article-table,
body.dark-mode article.tam-article table,
body.dark-mode main article table,
body.dark-mode .seo-article-content table {
    border-color: #334155;
}

body.dark-mode .article-table thead th,
body.dark-mode article.tam-article table thead th,
body.dark-mode main article table thead th,
body.dark-mode .seo-article-content table thead th {
    background: #1e293b;
    color: #e2e8f0;
    border-bottom-color: #334155;
}

body.dark-mode .article-table tbody td,
body.dark-mode article.tam-article table tbody td,
body.dark-mode main article table tbody td,
body.dark-mode .seo-article-content table tbody td {
    color: #cbd5e1;
    border-bottom-color: #334155;
}

body.dark-mode .article-table tbody tr:nth-child(even) td,
body.dark-mode article.tam-article table tbody tr:nth-child(even) td,
body.dark-mode main article table tbody tr:nth-child(even) td,
body.dark-mode .seo-article-content table tbody tr:nth-child(even) td {
    background: rgba(30, 41, 59, 0.55);
}

body.dark-mode .article-table tbody tr:hover td,
body.dark-mode article.tam-article table tbody tr:hover td,
body.dark-mode main article table tbody tr:hover td,
body.dark-mode .seo-article-content table tbody tr:hover td {
    background: rgba(51, 65, 85, 0.55);
}

body.dark-mode .article-related-tools {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.10) 0%, #0f172a 100%);
    border-color: #334155;
}

body.dark-mode .article-related-tools h2,
body.dark-mode .article-related-tools h3 {
    color: #f1f5f9;
}

body.dark-mode .article-related-tools .related-grid a {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .article-related-tools .related-grid a:hover {
    border-color: #60a5fa;
    color: #93c5fd;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.18);
}

/* -------------------------------------------------------------------------
   12. Figuras com SVG e imagens inline
   ------------------------------------------------------------------------- */
.article-figure {
    margin: 32px auto;
    max-width: 100%;
    text-align: center;
}

.article-figure svg,
.article-figure img {
    max-width: 100%;
    height: auto;
}

.article-figure figcaption {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 8px;
    font-style: italic;
}

/* -------------------------------------------------------------------------
   13. Donut charts (CSS conic-gradient)
   ------------------------------------------------------------------------- */
.donut-chart-wrapper {
    display: flex;
    gap: 24px;
    align-items: center;
    margin: 24px 0;
    flex-wrap: wrap;
}

.donut-chart {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    flex-shrink: 0;
    mask: radial-gradient(circle, transparent 55%, black 56%);
    -webkit-mask: radial-gradient(circle, transparent 55%, black 56%);
}

.donut-legend {
    list-style: none;
    padding: 0;
    margin: 0;
}

.donut-legend li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.92rem;
    color: #334155;
}

.donut-legend .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

body.dark-mode .donut-legend li {
    color: #cbd5e1;
}

body.dark-mode .article-figure figcaption {
    color: #94a3b8;
}
