/* =============================================================
   base.css — fundacao compartilhada por todos os temas:
   reset, acessibilidade, formularios, flash, galeria, paginacao.
   A identidade visual fica em cada theme.css.
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-b, system-ui, sans-serif);
    color: var(--c-text, #1f2937);
    background: var(--c-bg, #fff);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { font-family: var(--font-h, inherit); line-height: 1.25; margin: 0 0 .5em; }

a { color: var(--c-primary, #1d4ed8); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1180px, 92%); margin-inline: auto; }
.content-narrow { width: min(760px, 92%); margin-inline: auto; }

/* Acessibilidade */
.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;
}
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 1000;
    background: var(--c-secondary, #0f172a); color: #fff; padding: .6rem 1rem;
}
.skip-link:focus { left: 0; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--c-primary, #1d4ed8);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Botoes */
.btn {
    display: inline-block; padding: .7rem 1.4rem; border: 2px solid transparent;
    border-radius: 6px; font-weight: 600; cursor: pointer; text-align: center;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    font-size: 1rem; line-height: 1.2;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--c-primary, #1d4ed8); color: #fff; }
.btn-outline { border-color: var(--c-primary, #1d4ed8); color: var(--c-primary, #1d4ed8); background: transparent; }
.btn-ghost { color: var(--c-text, #1f2937); background: transparent; }
.btn-lg { padding: .9rem 1.8rem; font-size: 1.1rem; }
.btn-block { display: block; width: 100%; }
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }

/* Flash messages */
.flash { padding: .9rem 1.2rem; border-radius: 8px; margin: 1rem 0; font-weight: 500; }
.flash-success { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.flash-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; }

/* Formularios */
.field { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .3rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field select, .field textarea {
    padding: .65rem .8rem; border: 1px solid #c7ccd4; border-radius: 6px;
    font: inherit; color: inherit; background: #fff; width: 100%;
}
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-consent .checkbox { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; font-size: .9rem; }
.field-consent input { width: auto; margin-top: .25rem; }
.hp-field { position: absolute; left: -10000px; top: -10000px; height: 0; overflow: hidden; }

/* Barra de previa de tema */
.preview-bar {
    background: #f59e0b; color: #422006; padding: .5rem 1rem;
    text-align: center; font-size: .9rem; position: sticky; top: 0; z-index: 999;
}
.preview-bar a { color: #422006; font-weight: 700; text-decoration: underline; }

/* Logo da imobiliaria: proporcional, sem distorcer, em todos os temas */
.site-logo { display: inline-flex; align-items: center; }
.site-logo img { height: 44px; width: auto; max-width: 220px; object-fit: contain; display: block; }
@media (max-width: 560px) { .site-logo img { height: 34px; max-width: 160px; } }

/* Header base */
.site-header { border-bottom: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .8rem; }
.site-logo-text { font-family: var(--font-h); font-size: 1.35rem; font-weight: 700; color: var(--c-text); }
.site-nav ul { list-style: none; display: flex; gap: 1.2rem; margin: 0; padding: 0; align-items: center; }
.site-nav a { color: var(--c-text); font-weight: 600; padding: .3rem 0; }
.site-nav a.is-active { color: var(--c-primary); border-bottom: 2px solid var(--c-primary); }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: .5rem; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
    display: block; width: 24px; height: 2px; background: var(--c-text); content: "";
    transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle-bar::before { transform: translateY(-7px); }
.nav-toggle-bar::after { transform: translateY(5px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: rotate(-45deg) translateY(-1px); }

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none; position: absolute; inset: 100% 0 auto 0; z-index: 500;
        background: var(--c-bg); border-bottom: 1px solid color-mix(in srgb, var(--c-text) 15%, transparent);
        padding: 1rem 4%;
    }
    .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: .4rem; }
    .site-header { position: relative; }
}

/* Hero base */
.hero { padding: 3rem 0; }
.hero-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.hero-subtitle { font-size: 1.15rem; opacity: .85; }
.hero-media img { border-radius: 12px; width: 100%; object-fit: cover; }
@media (max-width: 860px) { .hero-inner { grid-template-columns: 1fr; } }

/* Secoes */
.section { padding: 3rem 0; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-header h2 { margin: 0; font-size: 1.7rem; }
.section-more { font-weight: 600; }

/* Busca */
.search-form { background: color-mix(in srgb, var(--c-bg) 80%, var(--c-text) 5%); border: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); border-radius: 12px; padding: 1.2rem; }
.search-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; align-items: end; }
.field-actions { display: flex; gap: .5rem; }
@media (max-width: 960px) { .search-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .search-grid, .field-row { grid-template-columns: 1fr; } }

/* Grid e cards de imoveis (estrutura base; cada tema restiliza) */
.property-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 960px) { .property-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .property-grid { grid-template-columns: 1fr; } }

.property-card { border: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); border-radius: 12px; overflow: hidden; background: var(--c-bg); }
.property-card-link { color: inherit; display: block; }
.property-card-link:hover { text-decoration: none; }
.property-card-media { margin: 0; position: relative; aspect-ratio: 4/3; background: color-mix(in srgb, var(--c-text) 8%, transparent); }
.property-card-media img { width: 100%; height: 100%; object-fit: cover; }
.property-card-nophoto { position: absolute; inset: 0; display: grid; place-items: center; color: color-mix(in srgb, var(--c-text) 55%, transparent); font-size: .95rem; }
.property-card-badges { position: absolute; top: .7rem; left: .7rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.badge { background: var(--c-secondary); color: #fff; font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge-purpose { background: var(--c-primary); }
.badge-reserved { background: #b45309; }
.property-card-body { padding: 1rem 1.1rem 1.2rem; }
.property-card-title { font-size: 1.1rem; margin-bottom: .2rem; }
.property-card-location { font-size: .9rem; opacity: .75; margin: 0 0 .5rem; }
.property-card-specs { list-style: none; display: flex; gap: .9rem; flex-wrap: wrap; padding: 0; margin: 0 0 .6rem; font-size: .88rem; opacity: .85; }
.property-card-price { font-family: var(--font-h); font-size: 1.25rem; font-weight: 700; color: var(--c-primary); margin: 0; }
.property-card-price small { font-size: .8rem; font-weight: 400; opacity: .7; }

/* Listagem */
.page-head { padding: 2.5rem 0 1.5rem; }
.page-head h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin-bottom: .2rem; }
.page-subtitle { opacity: .8; margin: 0; }
.listing-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.4rem 0; flex-wrap: wrap; }
.listing-count { font-weight: 600; margin: 0; }
.sort-form { display: flex; align-items: center; gap: .5rem; }
.sort-form select { padding: .45rem .6rem; border: 1px solid #c7ccd4; border-radius: 6px; font: inherit; }
.empty-state { text-align: center; padding: 3rem 1rem; background: color-mix(in srgb, var(--c-bg) 85%, var(--c-text) 4%); border-radius: 12px; }

/* Paginacao */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
.pagination-link { padding: .45rem .85rem; border: 1px solid color-mix(in srgb, var(--c-text) 20%, transparent); border-radius: 6px; color: var(--c-text); }
.pagination-link:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }
.pagination-link.is-current { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 700; }

/* Detalhe do imovel */
.breadcrumbs { font-size: .9rem; margin: 1.2rem 0; opacity: .8; }
.property-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.property-detail-head h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: .3rem; }
.property-detail-meta { opacity: .75; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.property-detail-price { font-family: var(--font-h); font-size: 1.9rem; font-weight: 700; color: var(--c-primary); margin: 0; }
.property-detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 960px) { .property-detail-grid { grid-template-columns: 1fr; } }
.spec-list { list-style: none; display: flex; gap: 1.2rem; flex-wrap: wrap; padding: 1rem 0; margin: 0; border-block: 1px solid color-mix(in srgb, var(--c-text) 15%, transparent); }
.spec-list li { text-align: center; }
.spec-list strong { display: block; font-size: 1.25rem; font-family: var(--font-h); }
.spec-list span { font-size: .82rem; opacity: .7; }
.cost-list { list-style: none; padding: .6rem 0; margin: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.content-block { margin-top: 1.8rem; }
.feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.feature-list li { background: color-mix(in srgb, var(--c-text) 8%, transparent); padding: .35rem .8rem; border-radius: 999px; font-size: .9rem; }
.rich-content { line-height: 1.75; }
.rich-content img { border-radius: 8px; }
.rich-content h2, .rich-content h3, .rich-content h4 { margin-top: 1.4em; }
.muted { opacity: .7; }
.agent-box, .interest-box { border: 1px solid color-mix(in srgb, var(--c-text) 14%, transparent); border-radius: 12px; padding: 1.2rem; margin-bottom: 1.4rem; background: var(--c-bg); }
.agent-box { text-align: center; }
.agent-box-photo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto .6rem; }
.agent-box-name { font-size: 1.15rem; margin-bottom: 0; }
.agent-box-creci { font-size: .85rem; opacity: .7; margin: .2rem 0 0; }

/* Galeria */
.gallery-stage { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 3/2; background: color-mix(in srgb, var(--c-text) 8%, transparent); }
.gallery-slide { display: none; margin: 0; height: 100%; }
.gallery-slide.is-active { display: block; }
.gallery-slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,.45); color: #fff; border: 0; border-radius: 50%;
    width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer;
}
.gallery-prev { left: .8rem; } .gallery-next { right: .8rem; }
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .6rem; overflow-x: auto; padding-bottom: .3rem; }
.gallery-thumb { border: 2px solid transparent; border-radius: 8px; padding: 0; cursor: pointer; background: none; flex: 0 0 auto; }
.gallery-thumb.is-active { border-color: var(--c-primary); }
.gallery-thumb img { border-radius: 6px; width: 96px; height: 66px; object-fit: cover; }
.gallery-empty { border-radius: 12px; }

/* Blog */
.blog-layout { display: grid; grid-template-columns: 3fr 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .blog-layout { grid-template-columns: 1fr; } }
.blog-search { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.blog-search input { flex: 1; padding: .6rem .8rem; border: 1px solid #c7ccd4; border-radius: 6px; font: inherit; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.blog-main .post-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) { .post-grid, .blog-main .post-grid { grid-template-columns: 1fr; } }
.post-card { border: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); border-radius: 12px; overflow: hidden; background: var(--c-bg); }
.post-card > a { color: inherit; display: block; }
.post-card > a:hover { text-decoration: none; }
.post-card-media { margin: 0; aspect-ratio: 16/10; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 1rem 1.1rem 1.2rem; }
.post-card-body h2, .post-card-body h3 { font-size: 1.1rem; margin: .3rem 0; }
.post-card-body p { font-size: .92rem; opacity: .8; margin: 0 0 .5rem; }
.post-card-body time { font-size: .82rem; opacity: .65; }
.post-card-category { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-primary); }
.category-list { list-style: none; padding: 0; margin: 0; }
.category-list li { padding: .35rem 0; border-bottom: 1px solid color-mix(in srgb, var(--c-text) 10%, transparent); }
.category-count { opacity: .6; font-size: .85rem; }
.post-detail-head { margin-bottom: 1.2rem; }
.post-detail-head h1 { font-size: clamp(1.7rem, 3.5vw, 2.5rem); margin: .3rem 0; }
.post-detail-meta { opacity: .7; }
.post-detail-cover { margin: 0 0 1.6rem; border-radius: 12px; overflow: hidden; }
.tag-list { list-style: none; display: flex; gap: .5rem; flex-wrap: wrap; padding: 0; margin: 1.5rem 0; }
.tag { background: color-mix(in srgb, var(--c-text) 8%, transparent); border-radius: 999px; padding: .25rem .8rem; font-size: .85rem; }
.share-box { display: flex; gap: 1rem; align-items: center; border-top: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); padding-top: 1rem; margin-top: 1.5rem; font-size: .95rem; }
.section-related { margin-top: 2.5rem; }

/* Equipe */
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 900px) { .agent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .agent-grid { grid-template-columns: 1fr; } }
.agent-card { border: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); border-radius: 12px; overflow: hidden; background: var(--c-bg); }
.agent-card-photo { width: 100%; aspect-ratio: 1; object-fit: cover; }
.agent-card-body { padding: 1rem 1.1rem 1.2rem; }
.agent-card-body h2 { font-size: 1.15rem; margin-bottom: .1rem; }
.agent-card-role { font-weight: 600; margin: 0; }
.agent-card-creci { font-size: .82rem; opacity: .65; margin: 0 0 .4rem; }
.agent-card-bio { font-size: .92rem; opacity: .85; }
.agent-card-contacts { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .9rem; }

/* Tipos */
.type-list { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 0; margin: 0; }
@media (max-width: 860px) { .type-list { grid-template-columns: repeat(2, 1fr); } }
.type-card { display: block; padding: 1.2rem; border: 1px solid color-mix(in srgb, var(--c-text) 14%, transparent); border-radius: 10px; color: var(--c-text); }
.type-card:hover { border-color: var(--c-primary); text-decoration: none; }
.type-name { display: block; font-weight: 700; }
.type-count { font-size: .85rem; opacity: .7; }

/* CTA */
.cta-box { text-align: center; padding: 2.5rem 1rem; background: color-mix(in srgb, var(--c-text) 6%, transparent); border-radius: 16px; }
.cta-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

/* Sobre / contato */
.about-teaser-text p { opacity: .85; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2.5rem; align-items: start; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { padding: .5rem 0; border-bottom: 1px solid color-mix(in srgb, var(--c-text) 10%, transparent); }

/* Rodape */
.site-footer { margin-top: 3rem; border-top: 1px solid color-mix(in srgb, var(--c-text) 12%, transparent); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; padding-block: 2.5rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-title { font-size: 1rem; margin-bottom: .7rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { padding: .2rem 0; }
.footer-links a { color: inherit; opacity: .85; }
.footer-slogan { opacity: .75; font-size: .92rem; }
.footer-bottom { border-top: 1px solid color-mix(in srgb, var(--c-text) 10%, transparent); padding: 1rem 0; font-size: .85rem; opacity: .7; }

/* WhatsApp flutuante */
.whatsapp-float {
    position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 800;
    width: 54px; height: 54px; border-radius: 50%; background: #16a34a; color: #fff;
    display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.25);
    transition: transform .15s ease;
}
.whatsapp-float:hover { transform: scale(1.07); text-decoration: none; }

/* Pagina de erro */
.error-page { display: grid; place-items: center; min-height: 100vh; text-align: center; }
.error-box h1 { font-size: 4rem; margin-bottom: .3rem; }
.error-box nav { display: flex; gap: .8rem; justify-content: center; margin-top: 1.2rem; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn, .whatsapp-float { transition: none; }
}
