/*
 * Blog do site — estilos das páginas /blog, /blog/categoria/{slug} e /blog/{slug}.
 *
 * Arquivo próprio (não Tailwind) de propósito: o output.css é compilado e não tem
 * o plugin de tipografia, e o corpo do artigo vem da API como HTML sem classe
 * nenhuma. Tudo usa as variáveis do tema (--primary, --foreground, --card...),
 * então acompanha as cores de cada imobiliária e o modo escuro sem rebuild.
 */

.blog-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}
.blog-wrap--estreito {
    max-width: 780px;
}

/* ---------- Cabeçalho da página ---------- */
.blog-topo {
    background: hsl(var(--muted));
    border-bottom: 1px solid hsl(var(--border));
    padding: 40px 0 32px;
}
.blog-topo h1 {
    font-size: 2rem;
    line-height: 1.2;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 8px 0 0;
}
.blog-topo p {
    color: hsl(var(--muted-foreground));
    margin: 8px 0 0;
    font-size: 1.05rem;
}
@media (min-width: 768px) {
    .blog-topo { padding: 56px 0 40px; }
    .blog-topo h1 { font-size: 2.5rem; }
}

/* ---------- Breadcrumb ---------- */
.blog-trilha {
    font-size: .875rem;
    color: hsl(var(--muted-foreground));
}
.blog-trilha ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.blog-trilha li + li::before {
    content: "›";
    margin-right: 6px;
    opacity: .6;
}
.blog-trilha a {
    color: inherit;
    text-decoration: none;
}
.blog-trilha a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}
.blog-trilha [aria-current] {
    color: hsl(var(--foreground));
}

/* ---------- Filtros: categorias + busca ---------- */
.blog-filtros {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 32px 0 8px;
}
@media (min-width: 768px) {
    .blog-filtros {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}
.blog-categorias {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.blog-chip {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-size: .875rem;
    text-decoration: none;
    transition: border-color .15s, color .15s;
}
.blog-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.blog-chip--ativo,
.blog-chip--ativo:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: hsl(var(--primary-foreground));
}
.blog-busca {
    display: flex;
    gap: 8px;
    width: 100%;
}
@media (min-width: 768px) {
    .blog-busca { width: 320px; }
}
/* Rótulo só para leitor de tela (o output.css não tem .sr-only) */
.blog-busca .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.blog-busca input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius, .5rem);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 1rem; /* 16px: evita zoom automático no iPhone */
}
.blog-busca button {
    padding: 10px 16px;
    border: 0;
    border-radius: var(--radius, .5rem);
    background: var(--color-primary);
    color: hsl(var(--primary-foreground));
    font-weight: 600;
    cursor: pointer;
}

/* ---------- Grade de artigos ---------- */
.blog-grade {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 24px 0 48px;
}
@media (min-width: 640px) {
    .blog-grade { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .blog-grade { grid-template-columns: repeat(3, 1fr); }
}
.blog-card {
    display: flex;
    flex-direction: column;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: hsl(var(--card-foreground));
    transition: box-shadow .2s, transform .2s;
}
.blog-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.blog-card__capa {
    aspect-ratio: 16 / 9;
    background: hsl(var(--muted));
    overflow: hidden;
}
.blog-card__capa img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Artigo sem capa: bloco de cor no lugar da imagem (nunca <img src="">) */
.blog-card__capa--vazia {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, hsl(var(--muted)), hsl(var(--border)));
    color: hsl(var(--muted-foreground));
    font-size: 2.5rem;
}
.blog-card__corpo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    flex: 1;
}
.blog-meta {
    font-size: .8125rem;
    color: hsl(var(--muted-foreground));
}
.blog-card__titulo {
    font-size: 1.125rem;
    line-height: 1.35;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 0;
}
.blog-card:hover .blog-card__titulo {
    color: var(--color-primary);
}
.blog-card__resumo {
    font-size: .9375rem;
    line-height: 1.55;
    color: hsl(var(--muted-foreground));
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card__mais {
    margin-top: auto;
    padding-top: 8px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--color-primary);
}

.blog-vazio {
    text-align: center;
    padding: 64px 16px;
    color: hsl(var(--muted-foreground));
}
.blog-vazio a {
    color: var(--color-primary);
}

/* ---------- Paginação ---------- */
.blog-paginacao {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 56px;
}
.blog-paginacao a,
.blog-paginacao span {
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius, .5rem);
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    text-decoration: none;
    font-size: .9375rem;
}
.blog-paginacao a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.blog-paginacao [aria-current="page"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: hsl(var(--primary-foreground));
}

/* ---------- Artigo ---------- */
.post {
    padding: 32px 0 56px;
}
.post__cabeca h1 {
    font-size: 1.875rem;
    line-height: 1.2;
    font-weight: 800;
    color: hsl(var(--foreground));
    margin: 16px 0 12px;
}
@media (min-width: 768px) {
    .post__cabeca h1 { font-size: 2.5rem; }
}
.post__resumo {
    font-size: 1.15rem;
    line-height: 1.6;
    color: hsl(var(--muted-foreground));
    margin: 0 0 16px;
}
.post__capa {
    margin: 24px 0 32px;
    border-radius: 12px;
    overflow: hidden;
    background: hsl(var(--muted));
}
.post__capa img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 520px;
    object-fit: cover;
}

/* Corpo do artigo: HTML sanitizado da API, sem classes (p, h2-h4, listas, citação, figura, link, img) */
.post-corpo {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: hsl(var(--foreground));
    overflow-wrap: break-word;
}
.post-corpo > * + * {
    margin-top: 1.1em;
}
.post-corpo h2 {
    font-size: 1.5rem;
    line-height: 1.3;
    font-weight: 700;
    margin-top: 1.8em;
}
.post-corpo h3 {
    font-size: 1.25rem;
    line-height: 1.35;
    font-weight: 700;
    margin-top: 1.6em;
}
.post-corpo h4 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin-top: 1.4em;
}
.post-corpo strong { font-weight: 700; }
.post-corpo em { font-style: italic; }
.post-corpo ul,
.post-corpo ol {
    padding-left: 1.5em;
}
.post-corpo ul { list-style: disc; }
.post-corpo ol { list-style: decimal; }
.post-corpo li + li { margin-top: .4em; }
.post-corpo a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.post-corpo blockquote {
    border-left: 4px solid var(--color-primary);
    background: hsl(var(--muted));
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}
.post-corpo img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}
.post-corpo figure { margin-left: 0; margin-right: 0; }
.post-corpo figcaption {
    font-size: .875rem;
    color: hsl(var(--muted-foreground));
    text-align: center;
    margin-top: .5em;
}

.post__categorias {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid hsl(var(--border));
}

/* ---------- Imóveis relacionados ---------- */
.post-imoveis {
    background: hsl(var(--muted));
    padding: 48px 0 56px;
}
.post-imoveis h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin: 0 0 24px;
}
.imovel-mini {
    display: flex;
    flex-direction: column;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: hsl(var(--card-foreground));
    transition: box-shadow .2s, transform .2s;
}
.imovel-mini:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.imovel-mini__foto {
    position: relative;
    aspect-ratio: 4 / 3;
    background: hsl(var(--muted));
    overflow: hidden;
}
.imovel-mini__foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.imovel-mini__tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}
.imovel-mini__corpo {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.imovel-mini__tipo {
    font-weight: 700;
    color: hsl(var(--foreground));
}
.imovel-mini__local {
    font-size: .9rem;
    color: hsl(var(--muted-foreground));
}
.imovel-mini__preco {
    margin-top: 8px;
    font-size: 1.25rem;
    font-weight: 800;
    color: hsl(var(--foreground));
}

/* ---------- Compartilhar ---------- */
.post-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 20px;
}
.post-corpo + .post-share {
    margin-top: 40px;
    padding: 20px;
    border-radius: 12px;
    background: hsl(var(--muted));
}
.post-share__rotulo {
    font-size: .875rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
}
.post-share__botoes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.post-share__btn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 1.25rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s, filter .15s;
}
.post-share__btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}
.post-share__btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.post-share__btn i { color: #fff !important; }
.post-share__btn--whatsapp { background: #25d366; }
.post-share__btn--facebook { background: #1877f2; }
.post-share__btn--linkedin { background: #0a66c2; }
.post-share__btn--x        { background: #000; }
.post-share__btn--telegram { background: #229ed9; }
.post-share__btn--email    { background: #6b7280; }
.post-share__btn--copiar   { background: #374151; }
.post-share__btn--nativo {
    width: auto;
    padding: 0 16px;
    background: var(--color-primary);
    font-size: 1rem;
    font-weight: 600;
}
.post-share__btn--nativo span { font-size: .9375rem; }
.post-share__btn[hidden] { display: none; }
.post-share__aviso {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 80;
    background: #111827;
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: .9375rem;
    box-shadow: var(--shadow-lg);
}
.post-share__aviso[hidden] { display: none; }

.post-voltar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
}
.post-voltar:hover { text-decoration: underline; }
