/* ===========================================================================
   fichas · casas — editorial / architectural modernist
   Paleta papel + tinta + terracota. Fraunces (display) + Geist (UI) + Geist Mono.
   =========================================================================== */

:root {
  /* Paleta */
  --paper:        #f4efe2;
  --paper-warm:   #ede5d2;
  --paper-deep:   #e3d9bf;
  --surface:      #fbf7ec;
  --ink:          #1c1916;
  --ink-soft:     #4b463d;
  --ink-mute:     #7a7367;
  --rule:         #c9bea4;
  --rule-soft:    #d9cfb6;
  --accent:       #b94a26;
  --accent-deep:  #8c3818;
  --accent-soft:  #f4d8c8;
  --accent-glow:  #efbb9b;
  --good:         #4b6b3a;
  --warn:         #9b6a18;
  --bad:          #983028;

  /* Tipografia */
  --display: "Fraunces", "Times New Roman", serif;
  --sans:    "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    "Geist Mono", ui-monospace, "SF Mono", monospace;

  /* Espaço */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;

  --max: 760px;
  --hairline: 1px solid var(--rule);
}

* { box-sizing: border-box; }
*::selection { background: var(--accent); color: var(--surface); }

html, body { margin: 0; padding: 0; }

html {
  background: var(--paper);
  /* Subtle paper texture via SVG noise + colour cast */
  background-image:
    radial-gradient(at 20% 0%, rgba(185,74,38,0.05) 0%, transparent 50%),
    radial-gradient(at 80% 100%, rgba(28,25,22,0.04) 0%, transparent 60%);
  background-attachment: fixed;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; }

/* ----- Typography primitives ----- */

.display {
  font-family: var(--display);
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  font-weight: 500;
}

.meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.serif {
  font-family: var(--display);
  font-variation-settings: "opsz" 24, "SOFT" 20;
}

/* ----- Site header ----- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: var(--hairline);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--display);
  font-variation-settings: "opsz" 144, "SOFT" 50;
  font-size: 16px;
  line-height: 1;
  background: var(--surface);
}

.brand-text em {
  font-style: normal;
  color: var(--accent);
  margin: 0 2px;
}

.crumbs {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  overflow: hidden;
  max-width: 60%;
  text-overflow: ellipsis;
}

.crumbs a { color: var(--ink-mute); white-space: nowrap; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--rule); }

/* ----- Main + loading ----- */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-6) var(--s-5) calc(var(--s-8) + 80px);
}

.loading {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-4);
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.loading-mark {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.4); }
}

.empty {
  padding: var(--s-7) var(--s-4);
  text-align: center;
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-mute);
}

/* ----- Page intro (titles, eyebrows) ----- */

.page-intro {
  margin-bottom: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  opacity: 0;
  animation: enter 0.5s ease-out forwards;
}

.page-intro .eyebrow { margin-bottom: var(--s-1); }

.page-title {
  font-family: var(--display);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-weight: 400;
  font-size: clamp(36px, 8vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.page-title em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 80;
  color: var(--accent);
}

.page-sub {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: var(--s-2);
  max-width: 50ch;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ----- Imovel cards (listing) ----- */

.imovel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
  margin-top: var(--s-6);
}

.imovel-card {
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
  animation: enter 0.6s ease-out forwards;
  height: 100%;
}

.imovel-card:nth-child(1) { animation-delay: 0.05s; }
.imovel-card:nth-child(2) { animation-delay: 0.15s; }
.imovel-card:nth-child(3) { animation-delay: 0.25s; }
.imovel-card:nth-child(4) { animation-delay: 0.35s; }

.imovel-hero {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-deep);
  border: var(--hairline);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.imovel-card:hover .imovel-hero { transform: translate(-2px, -2px); }
.imovel-card:hover .imovel-meta-block { transform: translate(2px, 2px); }

.imovel-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.imovel-hero-gradient {
  position: absolute;
  inset: 0;
}

.imovel-hero-gradient::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(at 30% 20%, rgba(255,255,255,0.2) 0%, transparent 40%),
    radial-gradient(at 70% 90%, rgba(0,0,0,0.18) 0%, transparent 50%);
  mix-blend-mode: soft-light;
}

.imovel-hero-num {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--surface);
  text-transform: uppercase;
  background: rgba(28,25,22,0.55);
  padding: 4px 10px;
  border-radius: 2px;
  backdrop-filter: blur(8px);
}

.imovel-hero-initials {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-variation-settings: "opsz" 144, "SOFT" 0;
  font-weight: 300;
  font-size: clamp(72px, 18vw, 140px);
  color: rgba(255,255,255,0.85);
  letter-spacing: -0.04em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.15);
  pointer-events: none;
}

.imovel-meta-block {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: var(--hairline);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.imovel-meta-block > :first-child { align-self: start; }
.imovel-meta-block > :last-child  { align-self: end; }

.imovel-name {
  font-family: var(--display);
  font-variation-settings: "opsz" 60, "SOFT" 40;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-1);
  color: var(--ink);
}

.imovel-spec {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin-bottom: var(--s-1);
}

.imovel-address {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
  max-width: 36ch;
}

.imovel-mediadora {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  margin-top: var(--s-3);
}

.imovel-price {
  text-align: right;
  font-family: var(--display);
  font-variation-settings: "opsz" 36;
  font-weight: 400;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}

.imovel-price-mono {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  margin-top: var(--s-2);
}

.imovel-visits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-top: var(--s-2);
  white-space: nowrap;
}

.imovel-visits .num { color: var(--ink); font-weight: 600; }

/* ----- Actions ----- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  text-decoration: none;
}

.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn-danger {
  background: transparent;
  color: var(--bad);
  border-color: var(--bad);
}
.btn-danger:hover { background: var(--bad); color: var(--surface); }

.btn-arrow::after {
  content: "→";
  font-family: var(--mono);
  margin-left: 4px;
}

/* ----- Imovel detail (fichas list) ----- */

.imovel-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
  opacity: 0;
  animation: enter 0.5s ease-out forwards;
}

.imovel-head-hero {
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border: var(--hairline);
  position: relative;
}

.imovel-head-hero img,
.imovel-head-hero .imovel-hero-gradient {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.imovel-head-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
}

.imovel-head-title { margin: 0; }

.imovel-head-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: baseline;
  padding-top: var(--s-3);
  border-top: var(--hairline);
}

.imovel-head-row > * { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

.imovel-head-price {
  font-family: var(--display) !important;
  font-variation-settings: "opsz" 36;
  font-size: 22px !important;
  color: var(--ink) !important;
  letter-spacing: -0.01em;
}

/* ----- Section: visitas list ----- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-6) 0 var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: var(--hairline);
}

.section-head .eyebrow span { color: var(--accent); margin-right: 6px; }

.ficha-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-4);
  align-items: center;
  padding: var(--s-4) 0;
  border-bottom: var(--hairline);
  cursor: pointer;
  transition: background 0.15s;
}

.ficha-card:hover {
  background: linear-gradient(90deg, transparent 0%, var(--paper-warm) 50%, transparent 100%);
  padding-left: var(--s-3);
}

.ficha-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  padding: 6px 0;
  border: var(--hairline);
  background: var(--surface);
}

.ficha-date-day {
  font-family: var(--display);
  font-variation-settings: "opsz" 36;
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}

.ficha-date-month {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  margin-top: 4px;
}

.ficha-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ficha-info-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.ficha-info-decision {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ficha-info-decision.empty-state { color: var(--ink-mute); font-style: italic; }

.ficha-scores {
  display: flex;
  gap: var(--s-3);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.ficha-scores .score-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: var(--hairline);
  background: var(--surface);
}

.ficha-scores .score-pill strong {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
}

/* ----- Form (ficha + imovel) ----- */

.form {
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
  margin-top: var(--s-6);
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--ink);
  cursor: pointer;
  user-select: none;
}

.section-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.1em;
  font-weight: 500;
  min-width: 30px;
}

.section-title {
  font-family: var(--display);
  font-variation-settings: "opsz" 36;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--ink);
  flex: 1;
  margin: 0;
}

.section-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.section-toggle {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-mute);
  transition: transform 0.25s ease;
}

.section.collapsed .section-toggle { transform: rotate(-90deg); }
.section.collapsed .section-body { display: none; }

.section-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-top: var(--s-3);
}

/* ----- Form fields ----- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-mute);
  font-weight: 500;
}

.field-input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface);
  border: var(--hairline);
  border-radius: 0;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.field-input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--ink);
  background: var(--paper);
}

.field textarea {
  min-height: 60px;
  resize: vertical;
}

.field-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s-3);
}

.field-inline .field-label { line-height: 1.6; }

/* Rating (1-5 + N/A) */

.cotavel {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
  padding: var(--s-3) 0;
  border-top: var(--hairline);
}

.cotavel:first-child { border-top: none; padding-top: 0; }

.cotavel-label {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.4;
}

.rating {
  display: flex;
  gap: 0;
  border: var(--hairline);
  background: var(--surface);
  width: fit-content;
}

.rating label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 38px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  border-right: var(--hairline);
  transition: background 0.15s, color 0.15s;
}

.rating label:last-child { border-right: none; }
.rating input { display: none; }
.rating label:hover { background: var(--paper-warm); color: var(--ink); }
.rating input:checked + span { background: var(--ink); color: var(--surface); }

.rating label span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 12px;
}

.cotavel-nota {
  width: 100%;
  padding: 6px 10px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: var(--hairline);
  outline: none;
  resize: none;
  min-height: 28px;
  transition: border-color 0.15s, background 0.15s;
}

.cotavel-nota:focus {
  border-bottom-color: var(--ink);
  background: var(--surface);
}

.cotavel-nota::placeholder { color: var(--ink-mute); font-style: italic; }

/* Checkbox items */

.checkitem {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px dashed var(--rule-soft);
}

.checkitem:last-child { border-bottom: none; }

.checkitem input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--ink);
  cursor: pointer;
}

.checkitem-label {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

.checkitem-detail {
  flex: 0 1 200px;
  padding: 4px 8px;
  border: var(--hairline);
  background: var(--surface);
  font-size: 12px;
  font-family: var(--mono);
}

/* Quartos / WC blocks */

.block {
  padding: var(--s-3) 0;
  border-top: var(--hairline);
}

.block:first-child { border-top: none; padding-top: 0; }

.block-label {
  font-family: var(--display);
  font-variation-settings: "opsz" 24;
  font-style: italic;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: var(--s-2);
}

/* Sticky save bar */

.sticky-save {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-top: var(--hairline);
  padding: var(--s-3) var(--s-5);
}

.sticky-save-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  gap: var(--s-3);
  align-items: center;
  justify-content: flex-end;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(28,25,22,0.18);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footer */

.site-footer {
  text-align: center;
  padding: var(--s-6) var(--s-5) calc(var(--s-7) + 80px);
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  display: flex;
  justify-content: center;
  gap: var(--s-3);
  align-items: center;
}

.site-footer .dot { color: var(--rule); }

/* ----- Responsive ----- */

@media (min-width: 720px) {
  main { padding: var(--s-7) var(--s-6) calc(var(--s-8) + 80px); }

  .imovel-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-7) var(--s-5);
  }

  .imovel-name { font-size: 30px; }

  .imovel-head {
    grid-template-columns: 5fr 4fr;
    gap: var(--s-6);
  }

  .imovel-head-hero { aspect-ratio: 4 / 3; }

  .section-title { font-size: 26px; }

  .ficha-card { grid-template-columns: 64px 1fr auto; }
  .ficha-date { width: 64px; }
}

/* Reduce motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
