/* ==========================================================================
   CD Inmobiliaria - design system
   Loaded AFTER vendor/bootstrap/bootstrap.min.css. Replaces the legacy
   style.css / helper.css / plugins.css / animate.css stack entirely.

   Selector specificity note: Bootstrap ships multi-class selectors such as
   .navbar-expand-lg .navbar-nav .nav-link (0,3,0). A single-class override
   loses silently, so local rules that must win repeat enough classes to
   match or beat the library selector instead of relying on source order.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --brand-primary:       #c49176;  /* terracotta from the logo */
  --brand-primary-dark:  #a9765a;  /* hover/active on decorative surfaces */
  --brand-primary-soft:  #f3e6de;  /* soft backgrounds, chips */
  --brand-dark:          #0c2c3a;  /* petrol blue from the logo: navbar, footer, headings */
  --brand-dark-soft:     #17414f;
  --text:                #333333;
  --text-muted:          #6b7280;
  --bg:                  #ffffff;
  --bg-alt:              #f8f7f5;
  --border:              #e5e1dd;
  --radius:              8px;
  --radius-sm:           4px;
  --shadow:              0 2px 12px rgba(12, 44, 58, .08);
  --shadow-lg:           0 8px 28px rgba(12, 44, 58, .14);

  /* Derived tokens.
     --brand-primary is a light terracotta: 2.74:1 against white, so it can
     never carry text on a light surface. --brand-accent-text is the darkened
     variant used for prices, links and icon accents (5.7:1 on white).
     Text sitting ON --brand-primary must be --brand-dark (5.3:1). */
  --brand-accent-text:   #8a5c42;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
  --navbar-h: 64px;

  /* Bootstrap variable overrides: cheaper and more reliable than fighting
     library selectors for the base typography and link colours. */
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-link-color: var(--brand-accent-text);
  --bs-link-hover-color: var(--brand-dark);
  --bs-emphasis-color: var(--brand-dark);
  --bs-heading-color: var(--brand-dark);
  --bs-primary: #c49176;
  --bs-primary-rgb: 196, 145, 118;
}

/* Bootstrap components that use display:flex/grid on the element itself win
   over the hidden attribute. Without this the form's success and error
   notices both render from first paint. */
[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Minimum 16px side gutter at every viewport width. Bootstrap's own
   container padding is 12px, so it is raised here; full-bleed sections keep
   their own edge-to-edge background and pad their inner container. */
.container,
.container-fluid,
.container-sm, .container-md, .container-lg, .container-xl {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--brand-dark);
  font-weight: 600;
  line-height: 1.25;
}

h1, .h1 { font-size: clamp(1.75rem, 4.2vw, 2.75rem); }
h2, .h2 { font-size: clamp(1.5rem, 3.2vw, 2.125rem); }
h3, .h3 { font-size: clamp(1.15rem, 2.2vw, 1.375rem); }

/* Bootstrap's .lead is font-weight:300; the system stack renders that
   noticeably thinner than the body copy, so it is pinned to 400. */
.lead { font-weight: 400; font-size: 1.0625rem; line-height: 1.65; }

/* Bootstrap's .small is sized in em and therefore inherits the container's
   scale. This is the fixed-size small text used across the site. */
.cd-small { font-size: .8125rem; line-height: 1.5; }

.text-muted, .cd-muted { color: var(--text-muted) !important; }
.cd-accent { color: var(--brand-accent-text); }
.cd-dark { color: var(--brand-dark); }
.cd-bg-alt { background-color: var(--bg-alt); }
.cd-bg-soft { background-color: var(--brand-primary-soft); }

a { text-decoration: none; }
a:hover { text-decoration: underline; }

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

.cd-section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.cd-section-title { margin-bottom: 1.75rem; }
.cd-section-title .cd-eyebrow {
  display: inline-block;
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--brand-accent-text);
  margin-bottom: .5rem;
}
.cd-rule {
  width: 48px; height: 3px; border: 0; opacity: 1;
  background: var(--brand-primary);
  margin: .75rem 0 0;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   3. Buttons
   -------------------------------------------------------------------------- */
.btn { --bs-btn-border-radius: var(--radius); font-weight: 600; }

/* .btn.btn-primary is 0,2,0 and beats Bootstrap's .btn-primary (0,1,0).
   Text on the terracotta fill is --brand-dark: white would be 2.74:1. */
.btn.btn-primary {
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-color: var(--brand-dark);
  --bs-btn-hover-bg: var(--brand-accent-text);
  --bs-btn-hover-border-color: var(--brand-accent-text);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-active-bg: var(--brand-accent-text);
  --bs-btn-active-border-color: var(--brand-accent-text);
  --bs-btn-active-color: #ffffff;
  --bs-btn-disabled-bg: var(--brand-primary-soft);
  --bs-btn-disabled-border-color: var(--brand-primary-soft);
  --bs-btn-disabled-color: var(--text-muted);
}

.btn.btn-dark {
  --bs-btn-bg: var(--brand-dark);
  --bs-btn-border-color: var(--brand-dark);
  --bs-btn-color: #ffffff;
  --bs-btn-hover-bg: var(--brand-dark-soft);
  --bs-btn-hover-border-color: var(--brand-dark-soft);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-active-bg: var(--brand-dark-soft);
  --bs-btn-active-border-color: var(--brand-dark-soft);
  --bs-btn-active-color: #ffffff;
}

.btn.btn-outline-dark {
  --bs-btn-color: var(--brand-dark);
  --bs-btn-border-color: var(--brand-dark);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-color: #ffffff;
}

/* For use on the dark hero / footer, where an outline needs to stay legible. */
.btn.btn-outline-light {
  --bs-btn-color: #ffffff;
  --bs-btn-border-color: rgba(255, 255, 255, .7);
  --bs-btn-hover-bg: #ffffff;
  --bs-btn-hover-color: var(--brand-dark);
  --bs-btn-hover-border-color: #ffffff;
}

/* --------------------------------------------------------------------------
   4. Navbar
   -------------------------------------------------------------------------- */
.cd-navbar.navbar {
  background-color: var(--brand-dark);
  padding-block: .5rem;
  box-shadow: var(--shadow);
}

.cd-navbar .navbar-brand { padding-block: 0; }

/* The logo file has an opaque #c49176 background, so on the petrol navbar it
   reads as a deliberate plate. The radius keeps that intentional. */
.cd-navbar .navbar-brand img {
  display: block;
  height: 44px;
  width: auto;
  border-radius: var(--radius-sm);
}

/* Matches Bootstrap's .navbar-expand-lg .navbar-nav .nav-link (0,3,0) and
   adds one class, so it wins. Verified with getComputedStyle. */
.cd-navbar.navbar .navbar-nav .nav-link {
  color: rgba(255, 255, 255, .88);
  font-weight: 500;
  font-size: .95rem;
  padding: .55rem .85rem;
  border-radius: var(--radius-sm);
  transition: color .18s ease, background-color .18s ease;
}

.cd-navbar.navbar .navbar-nav .nav-link:hover,
.cd-navbar.navbar .navbar-nav .nav-link:focus-visible {
  color: #ffffff;
  background-color: var(--brand-dark-soft);
  text-decoration: none;
}

.cd-navbar.navbar .navbar-nav .nav-link.active,
.cd-navbar.navbar .navbar-nav .nav-link[aria-current="page"] {
  color: #ffffff;
  background-color: var(--brand-dark-soft);
  box-shadow: inset 0 -2px 0 var(--brand-primary);
}

.cd-navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, .35);
  padding: .35rem .6rem;
}
.cd-navbar .navbar-toggler:focus { box-shadow: 0 0 0 .2rem rgba(196, 145, 118, .5); }

.cd-navbar .cd-navbar-cta { margin-left: .5rem; }

@media (max-width: 991.98px) {
  .cd-navbar .navbar-collapse { padding-top: .5rem; }
  .cd-navbar .cd-navbar-cta { margin: .75rem 0 .25rem; display: block; }
}

/* --------------------------------------------------------------------------
   5. Hero (pure CSS Ken Burns)
   url() inside a stylesheet resolves against the stylesheet, not the
   document. cd-2.css lives in css/, so the path has to climb out with ../
   -------------------------------------------------------------------------- */
.cd-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--brand-dark);
  color: #ffffff;
  padding-block: clamp(3rem, 9vw, 6.5rem);
}

.cd-hero__bg {
  position: absolute;
  inset: -6%;
  z-index: -2;
  background-image: url(../images/hero-1-sm.jpg);
  background-size: cover;
  background-position: center 40%;
  animation: cd-kenburns 32s ease-in-out infinite alternate;
  will-change: transform;
}

.cd-hero__overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(12, 44, 58, .82) 0%,
    rgba(12, 44, 58, .62) 45%,
    rgba(12, 44, 58, .88) 100%
  );
}

@keyframes cd-kenburns {
  from { transform: scale(1) translate3d(0, 0, 0); }
  to   { transform: scale(1.09) translate3d(-1.5%, -1.5%, 0); }
}

.cd-hero h1 { color: #ffffff; margin-bottom: .75rem; }
.cd-hero .lead { color: rgba(255, 255, 255, .92); max-width: 46rem; }
.cd-hero__inner { position: relative; }

/* Mobile-first background: only one of the two files is ever fetched. */
@media (min-width: 768px) {
  .cd-hero__bg { background-image: url(../images/hero-1.jpg); }
}

/* --------------------------------------------------------------------------
   6. Search panel
   -------------------------------------------------------------------------- */
.cd-search {
  background-color: rgba(255, 255, 255, .96);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
}

.cd-search--inline {
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  box-shadow: none;
}

.cd-search .form-label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-dark);
  margin-bottom: .3rem;
}

.form-select, .form-control {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.form-select:focus, .form-control:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .2rem rgba(196, 145, 118, .3);
}

/* --------------------------------------------------------------------------
   7. Property card
   -------------------------------------------------------------------------- */
/* position:relative is load bearing: the title anchor carries .stretched-link,
   and its ::after expands to the nearest positioned ancestor. Without it the
   click area escapes the card and spills over the grid gap and its neighbours. */
.cd-card {
  position: relative;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .22s ease, transform .22s ease;
}

.cd-card:hover, .cd-card:focus-within {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.cd-card__media { overflow: hidden; background-color: var(--brand-primary-soft); }

.cd-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .45s ease;
}

.cd-card:hover .cd-card__media img { transform: scale(1.06); }

/* Hover gallery.
   Bootstrap already absolutely positions every direct child of .ratio at
   100%/100%, so the extra photos stack on the cover with no work of our own and
   only opacity has to be animated.
   The cover ships with .is-active straight from the markup: if the script never
   runs, or the fetch fails, the card still shows its photo. Visibility must not
   depend on JavaScript. */
.cd-card__photo {
  opacity: 0;
  transition: opacity .45s ease, transform .45s ease;
}

.cd-card__photo.is-active { opacity: 1; }

/* Decoration, not controls. Without this they sit above the stretched link and
   punch two dead spots into an otherwise clickable card. */
.cd-card__badge { pointer-events: none; }

.cd-card__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--brand-primary-soft);
}
.cd-card__placeholder img { width: 52%; max-width: 160px; height: auto; object-fit: contain; opacity: .85; }

/* Sibling of the .ratio, never a child: Bootstrap stretches every direct
   child of .ratio to 100%/100% and the badge would cover the whole photo. */
.cd-card__badge {
  position: absolute;
  top: .625rem;
  left: .625rem;
  z-index: 2;
  background-color: var(--brand-dark);
  color: #ffffff;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
}

.cd-card__badge--highlight {
  background-color: var(--brand-primary);
  color: var(--brand-dark);
}

.cd-card__body { padding: 1rem 1.05rem 1.15rem; }

.cd-card__title { font-size: 1.05rem; margin-bottom: .3rem; }
.cd-card__title a { color: var(--brand-dark); }
.cd-card__title a:hover { color: var(--brand-accent-text); text-decoration: underline; }

.cd-card__location {
  font-size: .8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .35rem;
}

.cd-card__price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand-accent-text);
  line-height: 1.2;
}

.cd-card__features {
  list-style: none;
  margin: 0;
  padding: .7rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .85rem;
  font-size: .8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.cd-card__features li { display: inline-flex; align-items: center; gap: .3rem; }
.cd-card__features .bi { color: var(--brand-accent-text); }

.cd-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background-color: var(--brand-primary-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .75rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   8. Feature blocks
   -------------------------------------------------------------------------- */
.cd-feature {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  height: 100%;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.cd-feature:hover { box-shadow: var(--shadow); border-color: var(--brand-primary); }

.cd-feature__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background-color: var(--brand-primary-soft);
  color: var(--brand-dark);
  font-size: 1.35rem;
  margin-bottom: .85rem;
}

.cd-feature h3 { font-size: 1.05rem; }

/* --------------------------------------------------------------------------
   9. Contact form
   -------------------------------------------------------------------------- */
.cd-form-wrap {
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.15rem, 3vw, 2rem);
}

/* Honeypot: hidden through CSS on purpose. A type="hidden" input gets filled
   by bots just the same, which defeats the trap. */
.cd-honeypot {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.cd-alert { border-radius: var(--radius-sm); border: 1px solid transparent; padding: .75rem 1rem; }
.cd-alert--ok { background-color: #e7f4ec; border-color: #b4dcc4; color: #17492c; }
.cd-alert--err { background-color: #fbeaea; border-color: #eec4c4; color: #7a2020; }

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */
.cd-footer {
  background-color: var(--brand-dark);
  color: rgba(255, 255, 255, .82);
  padding-top: clamp(2.25rem, 5vw, 3.5rem);
}

.cd-footer h2, .cd-footer h3 { color: #ffffff; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
.cd-footer a { color: rgba(255, 255, 255, .82); }
.cd-footer a:hover { color: #ffffff; text-decoration: underline; }

.cd-footer__brand img {
  height: 56px;
  width: auto;
  border-radius: var(--radius-sm);
  display: block;
}

.cd-footer__list { list-style: none; margin: 0; padding: 0; }
.cd-footer__list li + li { margin-top: .45rem; }
.cd-footer__list .bi { color: var(--brand-primary); margin-right: .4rem; }

.cd-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #ffffff;
  font-size: 1.15rem;
  transition: background-color .18s ease, border-color .18s ease;
}
.cd-social:hover { background-color: var(--brand-primary); border-color: var(--brand-primary); color: var(--brand-dark); text-decoration: none; }

.cd-footer__bottom {
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, .16);
  padding-block: 1rem;
  font-size: .8125rem;
  color: rgba(255, 255, 255, .7);
}
.cd-footer__bottom a { color: rgba(255, 255, 255, .7); }

/* --------------------------------------------------------------------------
   11. Floating WhatsApp button
   Stays under Bootstrap's modal layer (1055).
   -------------------------------------------------------------------------- */
.cd-wa {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1030;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background-color: #1d9e52;
  color: #ffffff;
  font-size: 1.6rem;
  box-shadow: var(--shadow-lg);
  transition: transform .18s ease, background-color .18s ease;
}
.cd-wa:hover, .cd-wa:focus-visible { background-color: #157a3f; color: #ffffff; transform: scale(1.06); text-decoration: none; }

@media (min-width: 992px) {
  .cd-wa { right: 24px; bottom: 24px; width: 58px; height: 58px; font-size: 1.75rem; }
}

/* --------------------------------------------------------------------------
   12. Scroll reveal
   The hidden state is gated behind .js-anim, which the script adds to <html>.
   With JS off or broken, nothing is ever invisible.
   -------------------------------------------------------------------------- */
.js-anim [data-animate] {
  opacity: 0;
  transform: translateY(18px);
}

.js-anim [data-animate].is-visible {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease, transform .55s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js-anim [data-animate],
  .js-anim [data-animate].is-visible { opacity: 1; transform: none; transition: none; }
  .cd-hero__bg { animation: none; }
  .cd-card, .cd-card__media img, .cd-wa, .cd-feature { transition: none; }
  .cd-card:hover { transform: none; }
  .cd-card:hover .cd-card__media img { transform: none; }
  /* The script also bails out on this preference, so no rotation starts. The
     rule is the backstop for a card already mid-crossfade when it changes. */
  .cd-card__photo { transition: none; }
  .cd-wa:hover { transform: none; }
}

/* --------------------------------------------------------------------------
   13. Misc utilities
   -------------------------------------------------------------------------- */
.cd-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1060;
  background-color: var(--brand-dark);
  color: #ffffff;
  padding: .6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.cd-skip:focus { left: 0; text-decoration: none; }

.cd-spinner-wrap { min-height: 180px; display: grid; place-items: center; }

.cd-empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  background-color: var(--bg-alt);
}
