:root {
    --ink: #1b1f23;
    --muted: #5b6570;
    --line: #dfe3e8;
    --accent: #14532d;
    --surface: #ffffff;
    --page: #f6f7f9;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--page);
}

a { color: var(--accent); }

main {
    max-width: 68rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.site-header,
.site-footer {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.site-header {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
}

.site-brand {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
}

.site-header nav a { margin-right: 1rem; }

.site-footer {
    border-bottom: none;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    padding: 1rem;
}

.site-footer p { max-width: 68rem; margin: 0 auto; }

/* Filtros */

.filters {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.filters-text {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filters-text input { flex: 1; }

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.75rem 1rem;
}

.filters label {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    color: var(--muted);
    gap: 0.25rem;
}

.filters-checkbox {
    flex-direction: row !important;
    align-items: center;
    align-self: end;
    color: var(--ink);
    font-size: 0.9rem;
}

.filters-radius {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-top: 1rem;
    padding: 0.75rem 1rem 1rem;
}

.filters-radius legend {
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0 0.35rem;
}

.localidade-campo { position: relative; display: block; }

.localidade-campo input { width: 100%; box-sizing: border-box; }

.localidade-opcoes {
    position: absolute;
    z-index: 10;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    max-height: 16rem;
    overflow-y: auto;
}

.localidade-opcoes li { padding: 0.4rem 0.6rem; cursor: pointer; }

.localidade-opcoes li.localidade-freguesia { color: var(--muted); }

.localidade-opcoes li[aria-selected="true"], .localidade-opcoes li:hover { background: #eef3f8; color: inherit; }

.filters-note { color: #a33; font-size: 0.8rem; font-style: normal; }

input[type="range"] { padding: 0; }

output[data-raio-output] { font-weight: 600; margin-left: 0.35rem; }

.listing-source {
    display: inline-block;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e6eef7;
    color: #1f4e79;
}

.listing-source-financas { background: #eaf4e6; color: #2f6b1f; }

input, select, button {
    font: inherit;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: inherit;
}

button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    cursor: pointer;
    padding-inline: 1.25rem;
}

/* Resultados */

.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    color: var(--muted);
}

.listings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.listing {
    display: flex;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.listing img,
.listing-noimage {
    width: 10rem;
    height: 7.5rem;
    object-fit: cover;
    flex: none;
    background: #eceff2;
}

.listing-body { padding: 0.75rem 1rem 0.75rem 0; min-width: 0; }

.listing h2 {
    font-size: 1.05rem;
    margin: 0 0 0.35rem;
    line-height: 1.3;
}

.listing h2 a { text-decoration: none; }
.listing h2 a:hover { text-decoration: underline; }

.listing-meta,
.listing-numbers {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.listing-value {
    color: var(--ink);
    font-weight: 600;
}

.pager {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Diretório e detalhe */

.directory {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 0.4rem 1.5rem;
}

.directory li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    border-bottom: 1px solid var(--line);
    padding: 0.35rem 0;
}

.directory-count {
    color: var(--muted);
    font-size: 0.85rem;
    margin-left: auto;
}

.directory-drill { font-size: 0.8rem; }

.detail {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.5rem;
}

.detail h1 { margin-top: 0; font-size: 1.5rem; }

.detail-image {
    max-width: 100%;
    border-radius: 6px;
}

.detail-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1.5rem;
    margin: 1.25rem 0;
}

.detail-facts dt { color: var(--muted); font-size: 0.85rem; }
.detail-facts dd { margin: 0; }

.detail-note { display: block; color: var(--muted); font-size: 0.8rem; }

.detail-description { white-space: pre-line; }

@media (max-width: 34rem) {
    .listing { flex-direction: column; }
    .listing img, .listing-noimage { width: 100%; height: 9rem; }
    .listing-body { padding: 0 1rem 1rem; }
}
