/* ============================================================
   Landing del cliente y detalle de propiedad (/c/{slug})
   Mismo sistema que la landing comercial y la app (DESIGN.md):
   Geist, neutros fríos y un solo acento cobalto. La identidad es
   del agente; Homes4you queda discreto al pie.
   ============================================================ */
:root {
  --bg: #fcfcfd;
  --surface: #ffffff;
  --sunken: #f5f6f8;
  --ink: #0e1116;
  --ink-2: #2f3541;
  --muted: #5a6170;
  --faint: #6b7280;
  --line: #e6e8ec;
  --line-soft: #eef0f3;
  --line-strong: #d6d9df;
  --accent: #2b50e8;
  --accent-hover: #1f3fcc;
  --accent-soft: #eef2ff;
  --accent-ink: #1c34a8;
  --wa: #0f7a41;
  --danger: #b42318;
  --shadow-float: 0 1px 2px rgba(14, 17, 22, .05), 0 12px 24px -12px rgba(14, 17, 22, .14), 0 40px 80px -32px rgba(14, 17, 22, .28);
  --shadow-pop: 0 1px 2px rgba(14, 17, 22, .06), 0 12px 32px -12px rgba(14, 17, 22, .24);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(16px, 4vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}
::selection { background: #d9e1ff; color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.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; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn .ico { width: 17px; height: 17px; }
.btn:disabled { cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--sunken); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
/* Estado "Te interesa": el mismo botón, ya confirmado */
.btn.is-interested { background: var(--accent-soft); color: var(--accent-ink); }
.btn.is-interested .ico { fill: currentColor; }
/* Estado "No te interesa": la propiedad que el cliente descarto */
.btn.is-rejected { background: #fdecee; color: #8f1d1d; }
.btn.just-liked { animation: liked .35s var(--ease-out); }
.btn.just-liked .ico { animation: liked-heart .45s var(--ease-out); }
@keyframes liked { from { transform: scale(.97); } to { transform: none; } }
@keyframes liked-heart { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: none; } }
.btn-wa .ico { color: var(--wa); }

/* ---------- Barra del agente ---------- */
.agent-bar { border-bottom: 1px solid var(--line); background: var(--surface); }
.agent-bar .wrap { display: flex; align-items: center; gap: 12px; min-height: 68px; padding-top: 10px; padding-bottom: 10px; }
.agent-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: var(--sunken); }
.agent-initials { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 16px; }
.agent-name { font-weight: 600; font-size: 15px; line-height: 1.25; }
.agent-meta { font-size: 13px; color: var(--muted); line-height: 1.3; }
.agent-logo { margin-left: auto; max-height: 36px; max-width: 140px; object-fit: contain; }
/* Acceso del agente en las selecciones que arma un comprador */
.agent-login { margin-left: auto; flex: none; font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; white-space: nowrap; }
.agent-login:hover { color: var(--ink); text-decoration-color: currentColor; }
.agent-logo + .agent-login { margin-left: 18px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; margin-right: auto; padding: 6px 8px 6px 0; }
.back-link:hover { color: var(--ink); }

/* ---------- Encabezado de la selección ---------- */
.intro { padding: clamp(28px, 6vw, 56px) 0 clamp(20px, 4vw, 32px); }
.intro h1 { font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.08; letter-spacing: -0.03em; }
.intro .lead { margin-top: 10px; font-size: clamp(1rem, 1.6vw, 1.125rem); color: var(--muted); max-width: 60ch; }
.search-box { margin-top: 20px; max-width: 640px; border-radius: 14px; background: var(--sunken); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.search-box dt { color: var(--muted); }
.search-box dd { margin: 0; color: var(--ink-2); }
.summary { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 18px; font-size: 14px; color: var(--muted); }
.summary strong { color: var(--ink); font-weight: 600; }
/* Filtros de la grilla: chips que se prenden (aria-pressed) */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.chip:hover { background: var(--sunken); }
.chip .num { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: 12px; display: inline-grid; place-items: center; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .num { background: rgba(255, 255, 255, .18); color: #fff; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grilla de propiedades ---------- */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding-bottom: 56px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s var(--ease-out), border-color .2s; }
.card:hover { border-color: var(--line-strong); box-shadow: 0 1px 2px rgba(14, 17, 22, .04), 0 12px 28px -18px rgba(14, 17, 22, .3); }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--sunken); display: block; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.card:hover .card-media img { transform: scale(1.025); }
.card.is-off .card-media img { filter: grayscale(1); opacity: .7; }
.card-badges { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.photo-count { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: rgba(14, 17, 22, .72); color: #fff; font-size: 13px; font-weight: 500; }
.photo-count .ico { width: 14px; height: 14px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface); color: var(--ink-2); box-shadow: 0 1px 2px rgba(14, 17, 22, .12); }
.badge-accent { background: var(--accent); color: #fff; }
.badge-muted { background: var(--sunken); color: var(--muted); box-shadow: none; }
.badge-soft { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.price { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card-title { margin-top: 4px; font-size: 16px; font-weight: 500; line-height: 1.35; color: var(--ink); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-link { position: relative; display: block; text-decoration: none; color: inherit; }
.loc { margin-top: 6px; display: flex; gap: 6px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.loc .ico { width: 16px; height: 16px; margin-top: 2px; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.note { margin-top: 12px; border-radius: 10px; background: var(--sunken); padding: 10px 12px; font-size: 14px; color: var(--ink-2); }
.note-who { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; padding-top: 16px; }
.empty { padding: 64px 0 96px; text-align: center; color: var(--muted); }
.empty h2 { font-size: 20px; color: var(--ink); }
.empty p { margin-top: 6px; }

.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 13px; color: var(--faint); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; justify-content: space-between; }
.foot a { color: var(--muted); text-decoration: none; font-weight: 500; }
.foot a:hover { color: var(--ink); }

/* ---------- Detalle de propiedad ---------- */
.detail { padding-top: 20px; padding-bottom: 64px; }
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: clamp(320px, 42vw, 500px); border-radius: 14px; overflow: hidden; position: relative; }
.gallery .g { position: relative; overflow: hidden; background: var(--sunken); border: 0; padding: 0; cursor: zoom-in; }
.gallery .g img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.gallery .g:hover img { transform: scale(1.03); }
.gallery .g-main { grid-row: 1 / 3; }
.gallery.n1 { grid-template-columns: 1fr; }
.gallery.n1 .g-main { grid-row: auto; }
.gallery.n3 { grid-template-columns: 2fr 1fr; }
.gallery.n2 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr; }
.gallery.n2 .g-main { grid-row: auto; }
.gallery-all { position: absolute; right: 14px; bottom: 14px; }
.img-broken { display: grid; place-items: center; color: var(--faint); font-size: 13px; background: var(--sunken); width: 100%; height: 100%; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; margin-top: 28px; align-items: start; }
.detail h1 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.15; letter-spacing: -0.025em; }
.detail .loc { font-size: 15px; margin-top: 8px; }
.key-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.key-facts div { min-width: 0; }
.key-facts dt { font-size: 13px; color: var(--muted); }
.key-facts dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.section { margin-top: 36px; }
.section h2 { font-size: 18px; letter-spacing: -0.015em; margin-bottom: 12px; }
.desc { white-space: pre-wrap; color: var(--ink-2); line-height: 1.65; max-width: 72ch; }
.map { height: 300px; border-radius: 14px; overflow: hidden; background: var(--sunken); border: 1px solid var(--line); }
.map iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-top: 20px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 0 0 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.poi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding-top: 18px; }
.poi-grid h3 { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.poi-list { list-style: none; margin: 0; padding: 0; }
.poi-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.poi-list li span:last-child { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.poi-empty { padding: 24px 0; color: var(--muted); font-size: 14px; }

.action-card { position: sticky; top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.action-card .label { font-size: 13px; color: var(--muted); }
.action-card .price { font-size: 30px; margin-top: 2px; }
.action-card .expenses { font-size: 14px; color: var(--muted); margin-top: 2px; }
.actions { display: grid; gap: 10px; margin-top: 20px; }
.agent-mini { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.agent-mini img, .agent-mini .agent-initials { width: 36px; height: 36px; font-size: 13px; }
.feedback { border-radius: 14px; background: var(--sunken); padding: 14px; display: grid; gap: 10px; }
.feedback p { font-size: 14px; font-weight: 500; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason { height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; cursor: pointer; }
.reason:hover { background: #fafbfc; }
.reason.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 500; }
.textarea { width: 100%; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); padding: 10px 12px; font-size: 15px; resize: none; }
.textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43, 80, 232, .15); }

/* Barra de acción fija en el celular (detalle) */
.mobile-bar { display: none; }
.mobile-only { display: none; }
/* Atajo a "No me convence" en el celular: texto accionable alineado con los datos */
.feedback-link { border: 0; background: none; padding: 4px 0; margin: -8px 0 12px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); cursor: pointer; }
.feedback-link:hover { color: var(--ink); }
.bar-status { font-size: 14px; color: var(--muted); }
/* Aviso de error: siempre a la vista (en el celular, arriba de la barra) */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: var(--shadow-pop); text-align: center; }

/* Galería a pantalla completa */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(8, 10, 14, .96); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: calc(100% - 32px); max-height: calc(100% - 120px); object-fit: contain; }
.lb-btn { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-btn .ico { width: 22px; height: 22px; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #e6e8ec; font-size: 14px; font-variant-numeric: tabular-nums; }
.lightbox .img-broken { background: #151a23; color: #a3aab8; width: min(640px, 90vw); height: 50vh; border-radius: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .action-card { position: static; margin-top: 28px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .agent-logo { max-height: 28px; max-width: 96px; }
  .gallery { grid-template-columns: 1fr !important; grid-template-rows: 1fr; height: auto; aspect-ratio: 4 / 3; border-radius: 14px; }
  .gallery .g:not(.g-main) { display: none; }
  .gallery .g-main { grid-row: auto; }
  .key-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .poi-grid { grid-template-columns: minmax(0, 1fr); }
  body.has-bar { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .mobile-only { display: inline-flex; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
  }
  .mobile-bar .price { font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bar .btn { flex: none; }
  .lb-prev, .lb-next { top: auto; bottom: 12px; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
