/* Jorge Osuna Inmobiliaria — catálogo público, experiencia tipo app móvil.
   Sistema visual derivado del canvas "Osuna App": crema + terracota + pizarra,
   Newsreader para títulos, DM Sans para cuerpo. */

:root {
  --page: #ede7dc;
  --surface: #f7f3ec;
  --card: #ffffff;
  --ink: #16212a;
  --muted: #6b7780;
  --muted-2: #48545c;
  --line: rgba(22, 33, 42, 0.1);
  --terra: #a5632b;
  --terra-dark: #8a5122;
  --slate: #264054;
  --green: #2e7d4f;
  --danger: #b23b3b;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --app-w: 460px;
  --tabbar-h: 74px;
  --shadow-card: 0 8px 20px rgba(22, 33, 42, 0.06);
  --shadow-pop: 0 12px 30px rgba(22, 33, 42, 0.18);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--terra); text-decoration: none; }
a:hover { color: var(--terra-dark); }

img { max-width: 100%; display: block; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; }

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

/* ---------- app frame ---------- */

.app {
  position: relative;
  max-width: var(--app-w);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(22, 33, 42, 0.08);
}

.screen { display: none; padding-bottom: calc(var(--tabbar-h) + 24px); }
.screen.is-active { display: block; animation: rise 260ms ease both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .screen.is-active, .sheet__panel, .toast, .detail.is-active { animation: none; }
}

.pad { padding-left: 20px; padding-right: 20px; }

/* ---------- shared bits ---------- */

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

.chip {
  flex: none;
  padding: 10px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--slate); color: #fff; border-color: transparent; }

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tag--op { background: rgba(165, 99, 43, 0.12); color: var(--terra); }
.tag--cat { background: rgba(38, 64, 84, 0.1); color: var(--slate); }
.tag--disponible { background: rgba(46, 125, 79, 0.12); color: var(--green); }
.tag--apartada { background: rgba(165, 99, 43, 0.14); color: var(--terra); }
.tag--vendida, .tag--rentada { background: rgba(22, 33, 42, 0.09); color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 18px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1;
  text-align: center;
}
.btn--wa { background: var(--green); color: #fff; width: 100%; }
.btn--slate { background: var(--slate); color: #fff; }
.btn--ghost { border: 1px solid var(--line); color: var(--slate); }
.btn:active { transform: translateY(1px); }

.photo {
  background: repeating-linear-gradient(135deg, #e4daca 0 9px, #ede5d8 9px 18px);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(22, 33, 42, 0.42);
  font: 400 9px/1.3 ui-monospace, Menlo, monospace;
  text-align: center;
}

.icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top of a screen ---------- */

.screen__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 34px 20px 14px;
}
.screen__title { font-size: 27px; line-height: 1.15; margin-top: 5px; }
.brandmark {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  padding: 4px;
  box-shadow: 0 6px 16px rgba(22, 33, 42, 0.14);
}

/* ---------- search ---------- */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}
.search input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font: inherit;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }
.search__dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--terra); flex: none; }

.filters {
  display: flex;
  gap: 8px;
  padding: 0 20px 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

/* ---------- section label ---------- */

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 20px 8px;
}
.section-label h2 { font-size: 17px; }
.section-label button { font-size: 12px; color: var(--terra); font-weight: 500; }

/* ---------- featured rail ---------- */

.rail {
  display: flex;
  gap: 14px;
  padding: 6px 20px 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.pcard {
  flex: none;
  width: 250px;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  text-align: left;
}
.pcard__img { height: 150px; position: relative; }
.pcard__op {
  position: absolute; left: 12px; top: 12px;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--terra);
}
.pcard__body { padding: 14px 15px 16px; }
.pcard__price { font-family: var(--serif); font-size: 17px; }
.pcard__title { font-size: 13px; color: var(--muted); margin-top: 5px; }
.pcard__meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 11px; font-size: 11px; }

/* ---------- vertical list ---------- */

.list { display: flex; flex-direction: column; gap: 12px; padding: 6px 20px 8px; }

.prow {
  display: flex;
  gap: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 11px;
  text-align: left;
  width: 100%;
}
.prow__img { width: 96px; height: 88px; flex: none; border-radius: 13px; }
.prow__body { flex: 1; min-width: 0; padding: 3px 4px 0 0; }
.prow__tags { display: flex; align-items: center; gap: 7px; }
.prow__op { font: 700 9px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--terra); }
.prow__price { font-family: var(--serif); font-size: 16px; margin-top: 6px; }
.prow__title { font-size: 12.5px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow__meta { display: flex; gap: 10px; margin-top: 9px; font-size: 11px; }

.state {
  margin: 8px 20px 0;
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed rgba(22, 33, 42, 0.2);
  border-radius: 18px;
  font-size: 13px;
}

/* ---------- map ---------- */

.map {
  position: relative;
  height: calc(100vh - var(--tabbar-h));
  min-height: 560px;
  background: #ede6d9;
  overflow: hidden;
}

/* Leaflet overrides */
.leaflet-container {
  font-family: var(--sans);
}
.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
}

/* ---------- carousel (scroll snap) ---------- */

.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
}
.carousel::-webkit-scrollbar {
  display: none;
}
.carousel__item {
  flex: 0 0 100%;
  scroll-snap-align: center;
  position: relative;
}
.carousel__item img, .carousel__item .photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pin {
  position: absolute;
  padding: 9px 13px;
  border-radius: 999px;
  font: 700 12px/1 var(--sans);
  box-shadow: 0 6px 18px rgba(22, 33, 42, 0.2);
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  transform: translate(-50%, -50%);
  transition: transform 140ms ease;
}
.pin[aria-pressed="true"] { background: var(--terra); color: #fff; border-color: transparent; transform: translate(-50%, -50%) scale(1.08); z-index: 2; }

.map__card {
  position: absolute; left: 16px; right: 16px; bottom: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px;
  display: flex; gap: 13px;
  box-shadow: 0 -8px 30px rgba(22, 33, 42, 0.12);
  text-align: left;
  width: calc(100% - 32px);
}
.map__card .photo { width: 92px; height: 80px; flex: none; border-radius: 15px; }
.map__card-body { flex: 1; min-width: 0; }
.map__card-op { font: 700 9px/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--terra); }
.map__card-price { font-family: var(--serif); font-size: 17px; margin-top: 6px; }
.map__card-title { font-size: 12.5px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map__card-cta { margin-top: 9px; display: inline-flex; padding: 8px 14px; border-radius: 999px; background: var(--slate); color: #fff; font: 700 11.5px/1 var(--sans); }

/* ---------- avisos ---------- */

.notif-list { display: flex; flex-direction: column; gap: 10px; padding: 0 20px; }
.notif {
  display: flex; gap: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 16px;
  text-align: left;
  width: 100%;
}
.notif__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 5px; background: var(--terra); }
.notif--read { opacity: 0.72; }
.notif--read .notif__dot { background: rgba(22, 33, 42, 0.18); }
.notif__title { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.notif__body { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.notif__time { font-size: 11px; color: rgba(22, 33, 42, 0.42); margin-top: 8px; }

/* ---------- cuenta ---------- */

.card {
  margin: 0 20px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}
.acct-head { display: flex; gap: 13px; align-items: center; }
.acct-head img { width: 52px; height: 52px; border-radius: 16px; background: #fff; object-fit: contain; padding: 5px; box-shadow: 0 8px 18px rgba(22, 33, 42, 0.12); }
.acct-head h3 { font-size: 17px; }
.acct-head p { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; }
.acct-actions { display: flex; gap: 10px; margin-top: 16px; }
.acct-actions .btn { flex: 1; padding: 12px; font-size: 12.5px; }
.acct-actions .btn--wa-soft { background: rgba(46, 125, 79, 0.1); color: var(--green); }
.acct-actions .btn--slate-soft { background: rgba(38, 64, 84, 0.08); color: var(--slate); }

.menu {
  margin: 0 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}
.menu__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  font-size: 15px;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid rgba(22, 33, 42, 0.08);
}
.menu__row:last-child { border-bottom: 0; }
.menu__row--accent { font-weight: 700; color: var(--terra); }
.menu__row .caret { color: rgba(22, 33, 42, 0.3); font-size: 18px; }
.menu__row small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }

.legal { padding: 18px 24px 8px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ---------- detail ---------- */

.detail {
  position: fixed;
  inset: 0;
  max-width: var(--app-w);
  margin: 0 auto;
  background: var(--surface);
  overflow-y: auto;
  z-index: 40;
  display: none;
}
.detail.is-active { display: block; animation: rise 220ms ease both; }

.detail__hero { position: relative; height: 320px; }
.detail__nav {
  position: absolute; top: 44px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(22, 33, 42, 0.16);
}
.detail__back { left: 16px; font-size: 19px; }
.detail__fav { right: 16px; }
.detail__fav.is-on { background: var(--terra); color: #fff; }

.detail__sheet {
  margin-top: -24px;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 22px 20px 0;
  position: relative;
}
.detail__tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail__title { font-size: 24px; line-height: 1.2; margin-top: 13px; }
.detail__loc { font-size: 13px; color: var(--muted); margin-top: 6px; }
.detail__price { font-family: var(--serif); font-size: 30px; color: var(--terra); margin-top: 16px; }

.specs { display: flex; gap: 9px; margin-top: 20px; }
.spec { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 13px 8px; text-align: center; }
.spec b { font-family: var(--serif); font-weight: 500; font-size: 17px; }
.spec span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 6px; }

.detail h3 { font-size: 17px; margin-top: 26px; }
.detail__desc { font-size: 14px; line-height: 1.6; color: var(--muted-2); margin-top: 9px; text-wrap: pretty; }

.features { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.feature { padding: 9px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; }

.agent {
  margin-top: 24px;
  background: var(--slate);
  border-radius: 22px;
  padding: 18px;
  color: #fff;
  display: flex; gap: 13px; align-items: center;
}
.agent img { width: 48px; height: 48px; border-radius: 15px; background: #fff; object-fit: contain; padding: 4px; }
.agent b { font-family: var(--serif); font-weight: 500; font-size: 16px; }
.agent span { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.7); margin-top: 3px; }

.detail__spacer { height: 40px; }

.detail__bar {
  position: sticky;
  bottom: 0;
  display: flex; gap: 10px; align-items: center;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 12px));
  background: rgba(247, 243, 236, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.detail__bar-price small { font-size: 10.5px; color: var(--muted); display: block; }
.detail__bar-price b { font-family: var(--serif); font-weight: 500; font-size: 18px; }

/* ---------- whatsapp sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  max-width: var(--app-w);
  margin: 0 auto;
  background: rgba(22, 33, 42, 0.42);
  display: none;
  align-items: flex-end;
  z-index: 60;
}
.sheet.is-active { display: flex; }
.sheet__scrim { position: absolute; inset: 0; }
.sheet__panel {
  position: relative;
  width: 100%;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 14px 20px calc(30px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 260ms ease;
  max-height: 90vh;
  overflow-y: auto;
}
.sheet__grip { width: 44px; height: 4px; border-radius: 99px; background: rgba(22, 33, 42, 0.18); margin: 0 auto 16px; }
.sheet h3 { font-size: 21px; }
.sheet p.hint { font-size: 13px; color: var(--muted); margin: 7px 0 0; }
.field {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 11px 15px;
  margin-top: 10px;
}
.field label { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.field input, .field textarea {
  width: 100%; border: 0; background: none; outline: none;
  font: inherit; color: var(--ink); margin-top: 8px; resize: none;
}
.sheet .notice {
  margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  font-size: 12.5px; font-weight: 600;
}
.notice--error { background: rgba(178, 59, 59, 0.1); color: var(--danger); }
.notice--ok { background: rgba(46, 125, 79, 0.1); color: var(--green); }

.sheet__done { text-align: center; padding: 14px 0 6px; }
.sheet__check {
  width: 62px; height: 62px; border-radius: 50%;
  background: rgba(46, 125, 79, 0.14);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.sheet__check div { width: 22px; height: 22px; border-radius: 50%; background: var(--green); }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-w);
  display: flex;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 12px));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(22, 33, 42, 0.09);
  backdrop-filter: blur(14px);
  z-index: 30;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  position: relative;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
}
.tab[aria-selected="true"] { color: var(--terra); font-weight: 700; }
.tab__badge {
  position: absolute; top: 2px; right: calc(50% - 16px);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  display: none;
}
.tab__badge.is-on { display: block; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(var(--tabbar-h) + 16px);
  max-width: calc(var(--app-w) - 32px);
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: var(--shadow-pop);
  z-index: 80;
  animation: rise 240ms ease both;
}
.toast[hidden] { display: none; }
