﻿/* ============================================================
 * PÁGINA DE TEMA (/temas/{slug})
 * Layout consistente entre Conceitos, Artigos e Blog
 * Base: Bootstrap 5 + tokens de cor do projeto LeanWeb
 * ============================================================ */

/* ===== Hero do Tema (topo com introdução) ===== */
.theme-header {
    background: linear-gradient(180deg, #f8f9fc 0%, #eef1ff 100%);
    border-bottom: 1px solid #e5e7eb;
}

.theme-header .badge.bg-primary {
    background-color: #1C004D !important;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    padding: 0.35rem 1rem;
    text-transform: uppercase;
    font-weight: 600;
}

.theme-header h1 {
    color: #1C004D;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.theme-header .lead {
    color: #4b5563;
    font-size: 1.05rem;
    line-height: 1.75;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.theme-header .lead strong,
.theme-header .lead b {
    color: #1C004D;
    font-weight: 700;
}

/* ===== Títulos das seções (Conceitos, Artigos, Blog) =====
   Visual alinhado ao padrão .encontre__title + .encontre__title-underline
   das páginas nativas da central do conhecimento
   ===== */
.theme-section-title {
    font-size: 2.375rem;
    font-weight: 800;
    color: #29235C;
    letter-spacing: normal;
    line-height: normal;
    padding-bottom: 0.75rem;
    margin: 0 0 28px 0;
    position: relative;
    display: block;
}

.theme-section-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 36px;
    height: 3px;
    border-radius: 0;
    background-color: #ff8000;
}

/* ===== news-card (layout consistente Conceitos · Artigos · Blog) ===== */
.tema-news-card {
    position: relative;
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #ececf1;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
    will-change: transform, box-shadow;
}

.tema-news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(28, 0, 77, 0.10);
    border-color: #e5e7ff;
}

.tema-news-card .card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    overflow: hidden;
}

.tema-news-card .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tema-news-card:hover .card-media img {
    transform: scale(1.04);
}

.tema-news-card .card-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.3rem 0.7rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Badges por tipo (cor distinta para cada um) */
.tema-news-card .card-badge.badge-conceito {
    background-color: #ff8000;
    color: #fff;
}

.tema-news-card .card-body {
    padding: 1.25rem 1.3rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.tema-news-card .card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: #111827;
    margin: 0;
    letter-spacing: -0.005em;
}

.tema-news-card .card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

.tema-news-card .card-title a:hover {
    color: #0d47a1;
}

.tema-news-card .card-excerpt {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #4b5563;
    /* Limita em 3 linhas (line-clamp fallback) */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tema-news-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: auto;
    padding-top: 0.25rem;
    border-top: 1px dashed #f3f4f6;
}

.tema-news-card .card-meta .card-authors {
    font-weight: 500;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

/* ===== Empty state (sem conteúdos) ===== */
.theme-empty {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 1rem;
    padding: 3rem 1.5rem;
    text-align: center;
}

.theme-empty .empty-icon {
    font-size: 3rem;
    color: #9ca3af;
    opacity: 0.55;
    margin-bottom: 1rem;
}

.theme-empty h4 {
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.75rem;
    font-size: 1.15rem;
}

.theme-empty p {
    color: #6b7280;
    max-width: 520px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

/* ===== CTA final da página ===== */
.theme-cta {
    background: #f8fafc;
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.theme-cta h3 {
    color: #1C004D;
    font-weight: 800;
    letter-spacing: -0.015em;
    margin-bottom: 0.5rem;
}

.theme-cta p {
    color: #4b5563;
    margin-bottom: 1.25rem;
}

/* ====== Responsividade ===== */
@media (max-width: 768px) {
    .theme-header { padding: 3rem 0; }
    .theme-header h1 { font-size: 2rem; }
    .theme-section-title { font-size: 1.3rem; }
    .tema-news-card .card-title { font-size: 1rem; }
    .tema-news-card .card-body { padding: 1rem 1.05rem 1.1rem; }
}

@media (max-width: 576px) {
    .theme-counters { gap: 0.5rem; }
    .theme-counters .counter-pill {
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
    }
    .theme-cta { padding: 1.75rem 1rem; }
}

/* ============================================================
   INTEGRAÇÃO COM blog.css & artigos-e-colunas.css
   ------------------------------------------------------------
   A página /temas/{slug} é HÍBRIDA: combina os wrappers
   .artigos-page e .blog-page NA MESMA página, carregando
   simultaneamente blog.css e artigos-e-colunas.css.

   Estratégia (arquitetura validada runtime 3 telas):
   [BLOCO 1] Aliasing cross-wrapper de CSS Variables → reaproveita
             tokens de ambos design-systems automaticamente.
   [BLOCO 2] Scoping 3 classes por wrapper → vence regras globais
             (1 classe) por especificidade (min-height, padding tags).
   [BLOCO 3] Responsividade mobile < 670px → zera altura mínima fixa,
             idêntico aos arquivos nativos.
   [BLOCO 4] Anti-FOUC mg-btn (especificidade 3 classes > 2 globais)
             e scoped section-title fw800.
   ============================================================ */

/* BLOCO 1 — ALIASING CROSS-WRAPPER DE CSS VARIABLES */
.artigos-page {
    /* Mapeia tokens de blog.css para os equivalentes de artigos */
    --busque-card-border: var(--color-border-card, #e2e0f0);
    --color-card-bg: var(--color-section-bg, #ffffff);
    --fw-bold: var(--font-weight-bold, 700);
    --fw-extrabold: var(--font-weight-extrabold, 800);
    --fw-regular: var(--font-weight-regular, 400);
}

.blog-page {
    /* Mapeia tokens de artigos-e-colunas.css para os equivalentes de blog */
    --color-border-card: var(--busque-card-border, #e2e0f0);
    --color-section-bg: var(--color-card-bg, #fcf8fe);
    --font-weight-bold: var(--fw-bold, 700);
    --font-weight-extrabold: var(--fw-extrabold, 800);
    --font-weight-regular: var(--fw-regular, 400);
}

/* BLOCO 2 — SCOPING POR WRAPPER (valores literais hardcoded) */
/* --- Cards de Artigos (artigos-e-colunas.css) --- */
.theme-content .artigos-page .post-card {
    min-height: 462px;
    background-color: var(--color-section-bg);
    border: 1px solid var(--color-border-card);
}
.theme-content .artigos-page .post-card__tag {
    height: 19px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    font-weight: var(--font-weight-bold);
}
.theme-content .artigos-page .post-card__title {
    font-weight: var(--font-weight-extrabold);
}

/* --- Cards de Blog (blog.css) --- */
.theme-content .blog-page .post-card {
    min-height: 425px;
    background-color: var(--color-card-bg);
    border: 1px solid var(--busque-card-border);
}
.theme-content .blog-page .post-card__tag {
    padding: 4px 10px;
    align-self: flex-start;
    font-weight: var(--fw-bold);
    /* Espaçamento tag → título igual ao wrapper .post-card__tags de Artigos: 10px */
    margin-bottom: 10px;
}
.theme-content .blog-page .post-card__title {
    font-weight: var(--fw-extrabold);
}

/* BLOCO 3 — RESPONSIVIDADE MOBILE (< 670px) */
@media (max-width: 669.98px) {
    .theme-content .artigos-page .post-card,
    .theme-content .blog-page .post-card {
        min-height: 0;
    }
    .theme-content .artigos-page .post-card__title,
    .theme-content .blog-page .post-card__title {
        min-height: 0;
    }
}

/* BLOCO 4 — ANTI-FOUC + TÍTULO DE SEÇÃO SCOPED */
/* Override de FOUC: na página de Tema, o upgrade do mg-btn roda
   em script inline (fim do body), então desativamos o anti-FOUC
   global (de artigos-e-colunas.css / blog.css) que deixaria os
   CTAs invisíveis por alguns ms. */
.theme-content .artigos-page .mg-btn-auto:not(.mg-btn),
.theme-content .blog-page .mg-btn-auto:not(.mg-btn) {
    color: inherit !important;
}
.theme-content .artigos-page .mg-btn-auto:not(.mg-btn) > svg,
.theme-content .artigos-page .mg-btn-auto:not(.mg-btn) > img,
.theme-content .artigos-page .mg-btn-auto:not(.mg-btn) > span:not(.mg-btn__inner):not(.mg-btn__swap):not(.mg-btn__swap-text):not(.mg-btn__icon-wrap):not(.mg-btn__icon),
.theme-content .blog-page .mg-btn-auto:not(.mg-btn) > svg,
.theme-content .blog-page .mg-btn-auto:not(.mg-btn) > img,
.theme-content .blog-page .mg-btn-auto:not(.mg-btn) > span:not(.mg-btn__inner):not(.mg-btn__swap):not(.mg-btn__swap-text):not(.mg-btn__icon-wrap):not(.mg-btn__icon) {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Garante que o título das seções (Conceitos / Artigos / Blog)
   permaneça em negrito extra-forte (scoped > temas.css base por
   especificidade). */
.theme-content .theme-section-title {
    font-weight: 800;
}

/* "Ver mais" das seções do tema (Detalhes.cshtml) e cards sem foto cadastrada. */
.theme-content .is-tema-oculto {
    display: none !important;
}

.tema-mais:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: -24px 0 48px;
}

.tema-mais__status {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.tema-mais__btn {
    width: 100%;
    max-width: 340px;
    min-height: 48px;
    border: 1px solid #29235c;
    border-radius: 6px;
    background: #fff;
    color: #29235c;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    transition: background-color .2s, color .2s;
}

.tema-mais__btn:hover,
.tema-mais__btn:focus-visible {
    background: #29235c;
    color: #fff;
}

/* Sem foto: em vez da ilustração padrão repetida, uma faixa laranja no topo do card. */
.theme-content .post-card.post-card--sem-imagem,
.theme-content .artigos-page .post-card.post-card--sem-imagem,
.theme-content .blog-page .post-card.post-card--sem-imagem {
    border-top: 4px solid #ff8000;
}

.theme-content .post-card--sem-imagem .post-card__body {
    padding-top: 20px;
}

.tema-news-card .card-media--sem-imagem {
    aspect-ratio: auto;
    height: 56px;
    background: linear-gradient(120deg, #29235c 0%, #394195 100%);
}
