/* ==========================================================================
   Base — tokens, reset, tipografia e componentes compartilhados
   entre o portal e o painel administrativo.

   A paleta sai da logo (telhado vermelho, filete dourado, lettering grafite).
   A tipografia separa três papéis: Fraunces dá o peso de patrimônio nos
   títulos, Inter Tight carrega a interface, e JetBrains Mono trata número
   como número — preço, m², CRECI e código de imóvel são dados tabulares,
   não prosa, e alinham em coluna por causa disso.
   ========================================================================== */

:root {
  /* Marca */
  --brand: #a32b2e;
  --brand-dark: #7f1e21;
  --brand-soft: #f7ecec;
  --gold: #f5c400;
  --gold-deep: #c99e00;

  /* Neutros */
  --ink: #24232a;
  --ink-2: #46444e;
  --muted: #6c6a75;
  --line: #e4e0da;
  --line-strong: #cfcac2;
  --paper: #f6f5f3;
  --paper-2: #efedea;
  --card: #ffffff;

  /* Sinais */
  --ok: #17694a;
  --ok-soft: #e6f2ec;
  --warn: #8a5a00;
  --warn-soft: #fdf3dd;
  --danger: #b3261e;
  --danger-soft: #fbeae9;
  --info: #2b6a92;
  --info-soft: #e7eff5;
  --star: #f2a71b;

  /* Tipografia */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter Tight", "Inter", system-ui, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.83rem);
  --step-0: clamp(0.94rem, 0.92rem + 0.12vw, 1rem);
  --step-1: clamp(1.1rem, 1.04rem + 0.3vw, 1.28rem);
  --step-2: clamp(1.35rem, 1.2rem + 0.7vw, 1.75rem);
  --step-3: clamp(1.7rem, 1.4rem + 1.4vw, 2.6rem);
  --step-4: clamp(2.1rem, 1.5rem + 2.8vw, 3.9rem);

  /* Espaço e forma */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(36, 35, 42, 0.06), 0 2px 8px -4px rgba(36, 35, 42, 0.1);
  --shadow-md: 0 4px 12px -6px rgba(36, 35, 42, 0.16), 0 16px 32px -24px rgba(36, 35, 42, 0.3);
  --shadow-lg: 0 8px 20px -10px rgba(36, 35, 42, 0.2), 0 32px 64px -32px rgba(36, 35, 42, 0.38);

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --wrap: 1220px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 0, "WONK" 0;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection {
  background: var(--gold);
  color: var(--ink);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

.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;
}

/* --------------------------------------------------------------------------
   Dados numéricos
   Preço, área e código do imóvel usam a face mono com numerais tabulares:
   em lista, os dígitos alinham em coluna e ficam comparáveis de relance.
   -------------------------------------------------------------------------- */

.data {
  font-family: var(--font-data);
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
}

.price {
  font-family: var(--font-data);
  font-feature-settings: "tnum" 1;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.price__cents,
.price__unit {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Linha de telhado — o elemento-assinatura
   O filete dourado sobre a cumeeira vermelha da logo, reduzido a um divisor.
   Substitui <hr> e barrinhas decorativas em todo o produto.
   -------------------------------------------------------------------------- */

.roofline {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
}
.roofline::before,
.roofline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}
.roofline::after {
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.roofline--start::before {
  display: none;
}

.roof-mark {
  flex: none;
  width: 30px;
  height: 12px;
  color: var(--brand);
}

/* Versão compacta: só a cumeeira, usada como marcador de eyebrow. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 7px;
  background: currentColor;
  clip-path: polygon(0 100%, 50% 0, 100% 100%, 50% 42%);
}
.eyebrow--gold { color: var(--gold-deep); }
.eyebrow--light { color: var(--gold); }

/* --------------------------------------------------------------------------
   Botões
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 11px 22px;
  border: 1.5px solid transparent;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--step-0);
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn svg { width: 18px; height: 18px; }

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }

.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { background: var(--gold-deep); transform: translateY(-1px); }

.btn--ghost { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

/* Só o ícone é verde (cor oficial do WhatsApp); o botão em si segue a
   linguagem do site — fundo branco, borda e texto na cor da marca. */
.btn--whatsapp { background: var(--card); border-color: var(--brand); color: var(--brand); }
.btn--whatsapp:hover { background: var(--brand-soft); }
.btn--whatsapp svg { color: #25d366; }

.btn--outline { background: rgba(38, 37, 42, 0.3); border-color: rgba(255, 255, 255, 0.65); color: #fff; backdrop-filter: blur(6px); }
.btn--outline:hover { background: rgba(255, 255, 255, 0.14); border-color: #fff; }

.btn--text { background: none; color: var(--muted); padding-inline: var(--sp-3); }
.btn--text:hover { color: var(--brand); }

.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }

.btn--sm { min-height: 36px; padding: 7px 16px; font-size: var(--step--1); }
.btn--lg { min-height: 54px; padding: 15px 32px; font-size: var(--step-1); }
.btn--block { width: 100%; }

.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.6;
  pointer-events: none;
}

/* Estado de carregamento: o botão troca o rótulo por um giro discreto. */
.btn[aria-busy="true"]::after {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Formulários
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink-2);
}
.field__hint {
  font-size: var(--step--1);
  color: var(--muted);
}
.field__error {
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--danger);
}
.field__req { color: var(--danger); font-weight: 700; }

.input,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field textarea { min-height: 88px; resize: vertical; line-height: 1.5; }

.input:hover,
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--line-strong); }

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--danger);
}

.field select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236c6a75' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

/* Par min–max: quartos, banheiros, vagas, preço e área usam sempre este par. */
.range-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-2);
}
.range-pair__sep {
  color: var(--muted);
  font-size: var(--step--1);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: 7px 0;
  cursor: pointer;
  font-size: var(--step-0);
  line-height: 1.35;
}
.check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.check:hover { color: var(--brand); }

/* Botões de rádio em pílula (finalidade: venda / aluguel / temporada) */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
}
.segmented__opt {
  position: relative;
  display: inline-flex;
}
.segmented__opt input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.segmented__opt span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px é o alvo mínimo de toque; a pílula inteira é clicável. */
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-pill);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--ink-2);
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.segmented__opt input:checked + span {
  background: var(--card);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.segmented__opt input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Selos e chips
   -------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.03em;
}
.tag--venda { background: var(--brand); color: #fff; }
.tag--aluguel { background: var(--ink); color: #fff; }
.tag--temporada { background: var(--ok); color: #fff; }
.tag--launch { background: var(--gold); color: var(--ink); }
.tag--featured { background: var(--card); color: var(--brand); box-shadow: var(--shadow-sm); }
.tag--soft { background: var(--paper-2); color: var(--ink-2); }
.tag--ok { background: var(--ok-soft); color: var(--ok); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 6px 4px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--step--1);
  font-weight: 500;
}
.chip__x {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--ink-2);
  line-height: 1;
}
.chip__x:hover { background: var(--brand); color: #fff; }

/* --------------------------------------------------------------------------
   Mensagens
   -------------------------------------------------------------------------- */

.notice {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: var(--step--1);
  line-height: 1.5;
}
.notice[hidden] { display: none; }
.notice--error { background: var(--danger-soft); color: var(--danger); }
.notice--ok { background: var(--ok-soft); color: var(--ok); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }

.empty-state {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  color: var(--muted);
}
.empty-state h3 { color: var(--ink); margin-bottom: var(--sp-2); }

/* Esqueleto de carregamento: reserva a altura do card e evita o salto
   de layout quando a lista chega. */
.skeleton {
  background: linear-gradient(90deg, var(--paper-2) 25%, #f7f6f4 50%, var(--paper-2) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* --------------------------------------------------------------------------
   Entrada em cena
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
