/* ==========================================================================
   VAIRO PROPIEDADES — Terracotta Editorial
   Design system + shared components.
   Page-specific styles live in their respective HTML files.
   ========================================================================== */

:root {
  /* ---- Brand palette (Vairo) ---- */
  --terracotta:       #D9622E;
  --terracotta-deep:  #B84F22;
  --terracotta-soft:  #E8845A;
  --terracotta-tint:  rgba(217, 98, 46, 0.08);

  --sand:             #E8DDC9;
  --sand-soft:        #F2EAD9;
  --bone:             #F9F4E8;
  --paper:            #FBF7EC;

  --ink:              #1A1410;
  --ink-soft:         #3A2F25;
  --ink-mute:         #6B5D4F;
  --ash:              #B8AC9C;
  --line:             #E0D2BC;
  --line-strong:      #C9B89E;

  --accent-gold:      #C39A3D;

  /* ---- Legacy aliases used by app.js + existing markup ---- */
  --primary-color: var(--terracotta);
  --primary-dark:  var(--terracotta-deep);
  --gray-50:  var(--paper);
  --gray-100: var(--sand-soft);
  --gray-200: var(--sand);
  --gray-300: var(--line);
  --gray-400: var(--ash);
  --gray-500: var(--ink-mute);
  --gray-600: #4F4338;
  --gray-700: var(--ink-soft);
  --gray-800: var(--ink);
  --gray-900: #0E0A07;
  --white:    #ffffff;
  --cream:    var(--paper);
  --gold-accent: var(--accent-gold);

  /* Status */
  --success: #4F8A5E;
  --warning: #C68A2C;
  --error:   #B84F4F;

  /* ---- Typography ---- */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'JetBrains Mono', ui-monospace, Consolas, monospace;

  /* ---- Spacing ---- */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
  --space-4xl: 7rem;

  /* ---- Radius ---- */
  --radius-xs:   2px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* ---- Shadows (warm, low-contrast) ---- */
  --shadow-xs:   0 1px 2px rgba(26, 20, 16, 0.05);
  --shadow-sm:   0 2px 4px rgba(26, 20, 16, 0.06);
  --shadow-md:   0 6px 16px rgba(26, 20, 16, 0.08), 0 2px 4px rgba(26, 20, 16, 0.04);
  --shadow-lg:   0 16px 40px rgba(26, 20, 16, 0.12), 0 4px 12px rgba(26, 20, 16, 0.06);
  --shadow-xl:   0 28px 60px rgba(26, 20, 16, 0.18), 0 10px 20px rgba(26, 20, 16, 0.08);
  --shadow-card: 0 1px 3px rgba(26, 20, 16, 0.06), 0 0 0 1px rgba(26, 20, 16, 0.03);

  /* ---- Motion ---- */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-slow:   500ms var(--ease-out);

  /* ---- Z-index ---- */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-fixed:    300;
  --z-modal-backdrop: 400;
  --z-modal:    500;
  --z-tooltip:  600;

  /* ---- Layout ---- */
  --container-max: 1280px;
  --header-height: 76px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "kern";
  overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img { height: auto; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea, button { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--terracotta); }

ul, ol { list-style: none; }

::selection { background: var(--terracotta); color: var(--bone); }

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   Container
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

@media (min-width: 768px) { .container { padding: 0 2rem; } }
@media (min-width: 1280px) { .container { padding: 0 2.5rem; } }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-full);
  transition: all var(--t-base);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--terracotta);
  color: var(--bone);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn--primary:hover {
  background: var(--terracotta-deep);
  color: var(--bone);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--ink {
  background: var(--ink);
  color: var(--bone);
}
.btn--ink:hover { background: #2A2018; color: var(--bone); transform: translateY(-1px); }

.btn--outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--outline:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
  background: var(--terracotta-tint);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  padding: 0.5rem 0.75rem;
}
.btn--ghost:hover { color: var(--terracotta); }

.btn--lg { padding: 1.05rem 1.875rem; font-size: 1rem; }
.btn--block { width: 100%; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form__group { margin-bottom: 1.25rem; }

.form__label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-tint);
  background: #fff;
}

.form__textarea { resize: vertical; min-height: 110px; line-height: 1.55; }

.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B5D4F' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--terracotta);
  color: var(--bone);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--t-base);
}
.form__submit:hover { background: var(--terracotta-deep); transform: translateY(-1px); }

/* ==========================================================================
   Header / Navigation
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  background: rgba(251, 247, 236, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  z-index: var(--z-fixed);
  transition: background var(--t-base), border-color var(--t-base);
}
.header.scrolled {
  background: rgba(251, 247, 236, 0.96);
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(26, 20, 16, 0.04);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  gap: 1.5rem;
}
@media (min-width: 768px) { .header__inner { padding: 0 2rem; } }
@media (min-width: 1280px) { .header__inner { padding: 0 2.5rem; } }

.header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.header__brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.header__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 2px;
}
.header__brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.header__brand-tagline {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav__link {
  position: relative;
  padding: 0.5rem 0.875rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color var(--t-fast);
}
.nav__link:hover { color: var(--terracotta); }
.nav__link::after {
  content: '';
  position: absolute;
  left: 0.875rem;
  right: 0.875rem;
  bottom: 0.25rem;
  height: 1px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-base);
}
.nav__link:hover::after,
.nav__link.active::after { transform: scaleX(1); }

.nav__cta {
  margin-left: 0.75rem;
  padding: 0.55rem 1.1rem;
  background: var(--ink);
  color: var(--bone);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--t-base);
}
.nav__cta:hover { background: var(--terracotta); color: var(--bone); }

.header__menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border-radius: 6px;
}
.header__menu-btn span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: all var(--t-base);
}
.header__menu-btn.active span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.header__menu-btn.active span:nth-child(2) { opacity: 0; }
.header__menu-btn.active span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 900px) {
  .header__menu-btn { display: inline-flex; }
  .nav {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--paper);
    padding: 2rem 1.5rem;
    gap: 0.25rem;
    transform: translateY(-100%);
    visibility: hidden;
    transition: transform var(--t-slow), visibility 0s linear var(--t-slow);
    z-index: var(--z-fixed);
  }
  .nav.active {
    transform: translateY(0);
    visibility: visible;
    transition: transform var(--t-slow), visibility 0s linear 0s;
  }
  .nav__link {
    padding: 1.1rem 0;
    font-size: 1.5rem;
    font-family: var(--font-display);
    border-bottom: 1px solid var(--line);
  }
  .nav__link::after { display: none; }
  .nav__cta {
    margin-top: 1rem;
    margin-left: 0;
    padding: 1rem 1.5rem;
    text-align: center;
  }
}

/* ==========================================================================
   Properties — shared property card
   (Used by index.html and search results — markup matches app.js render.)
   ========================================================================== */
.properties__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .properties__grid { gap: 2rem; }
}

.property-card {
  position: relative;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) var(--ease-out),
              border-color var(--t-base);
}
.property-card:hover {
  transform: translateY(-4px);
  border-color: var(--terracotta-soft);
  box-shadow: var(--shadow-lg);
}

.property-card__image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--sand);
}
.property-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.property-card:hover .property-card__img { transform: scale(1.04); }

.property-card__badge {
  position: absolute;
  top: 0.875rem;
  left: 0.875rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  background: var(--ink);
  border-radius: var(--radius-full);
  z-index: 2;
}
.property-card__badge--venta { background: var(--terracotta); }
.property-card__badge--alquiler { background: var(--ink); }
.property-card__badge--vendido,
.property-card__badge--alquilado { background: var(--ink-mute); }
.property-card__badge--reservado { background: var(--accent-gold); color: var(--ink); }

.property-card__favorite {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 247, 236, 0.94);
  backdrop-filter: blur(6px);
  border-radius: 50%;
  color: var(--ink-mute);
  z-index: 2;
  transition: color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.property-card__favorite:hover { color: var(--terracotta); transform: scale(1.06); }
.property-card__favorite.active { color: var(--terracotta); background: var(--bone); }

.property-card__content {
  padding: 1.25rem 1.25rem 1.5rem;
}
.property-card__price {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}
.property-card__title {
  font-family: var(--font-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.property-card__location {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--ink-mute);
  margin-bottom: 1rem;
}
.property-card__location svg { color: var(--terracotta); flex-shrink: 0; }

.property-card__features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.property-card__feature {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.property-card__feature svg { color: var(--ink-mute); }

/* Properties section helpers */
.properties__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--ink-mute);
}
.properties__empty svg { margin: 0 auto 1rem; color: var(--terracotta); }
.properties__empty-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.properties__empty-text { margin-bottom: 1.5rem; }

.properties__load-more {
  display: flex;
  justify-content: center;
  margin-top: 3rem;
}
.load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: var(--radius-full);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--t-base);
}
.load-more-btn:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
  background: var(--terracotta-tint);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.active { display: flex; animation: modalIn var(--t-base) var(--ease-out); }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 20, 16, 0.55);
  backdrop-filter: blur(4px);
}
.modal__content {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--bone);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.modal__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
}
.modal__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ink-mute);
  transition: background var(--t-fast), color var(--t-fast);
}
.modal__close:hover { background: var(--sand); color: var(--ink); }
.modal__body { padding: 1.5rem; overflow-y: auto; }

@keyframes modalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Notifications + reveal animations
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.reveal.visible { opacity: 1; transform: translateY(0); }

@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==========================================================================
   Footer (shared)
   ========================================================================== */
.footer {
  background: var(--ink);
  color: var(--sand);
  padding: 4.5rem 0 2rem;
  margin-top: 6rem;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2.5rem;
}
@media (max-width: 900px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 540px) {
  .footer__grid { grid-template-columns: 1fr; }
}
.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.footer__brand img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}
.footer__brand-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--bone);
  letter-spacing: 0.02em;
}
.footer__about {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: rgba(232, 221, 201, 0.72);
  max-width: 320px;
}
.footer__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--terracotta-soft);
  margin-bottom: 1rem;
}
.footer__list { display: flex; flex-direction: column; gap: 0.6rem; }
.footer__list a { color: rgba(232, 221, 201, 0.78); font-size: 0.9375rem; transition: color var(--t-fast); }
.footer__list a:hover { color: var(--bone); }

.footer__social {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.footer__social a {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(232, 221, 201, 0.06);
  color: var(--sand);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.footer__social a:hover { background: var(--terracotta); color: var(--bone); transform: translateY(-2px); }

.footer__bottom {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(232, 221, 201, 0.08);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: rgba(232, 221, 201, 0.55);
}

/* ==========================================================================
   Section title (editorial)
   ========================================================================== */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 1rem;
}
.section-eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: currentColor;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: 1rem;
}
.section-title em {
  font-style: italic;
  color: var(--terracotta);
}
.section-lede {
  font-size: 1.0625rem;
  color: var(--ink-mute);
  line-height: 1.65;
  max-width: 560px;
}

/* ==========================================================================
   Helpers
   ========================================================================== */
.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;
}
