/* =========================================================
   Next Viviendas — Design System
   Paleta derivada del isotipo de marca (verde salvia + teal).
   ========================================================= */

:root {
  --ink:        #1B3038;   /* texto principal, derivado del teal de marca */
  --teal-deep:  #16323C;   /* secciones oscuras / footer */
  --teal:       #265160;   /* marca — detalles, bordes activos */
  --sage:       #4F8F5F;   /* marca — acento principal (CTA, links, números) */
  --sage-dark:  #3B7049;   /* hover / active */
  --paper:      #F6F4EE;   /* fondo principal */
  --paper-alt:  #EFEBDF;   /* fondo alterno (secciones, cards) */
  --line:       #DEDACC;   /* bordes / divisores */
  --muted:      #656B62;   /* texto secundario */
  --white:      #FFFFFF;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Archivo", Helvetica, Arial, sans-serif;

  --container: 1200px;
  --gap: clamp(1.25rem, 2vw, 2rem);
  --radius: 3px;
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ---------- Reset base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
p { margin: 0 0 1.1em; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 3px; }
svg { display: block; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 760px; }

/* ---------- Type scale ---------- */
.eyebrow {
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--sage);
  display: inline-block;
  margin-bottom: .9em;
}
h1, .h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); }
h2, .h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); }
h3, .h3 { font-size: clamp(1.2rem, 1.05rem + .6vw, 1.45rem); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  padding: .9em 1.7em;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn-sage { background: var(--sage); color: var(--white); }
.btn-sage:hover { background: var(--sage-dark); transform: translateY(-1px); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn-white { background: var(--white); color: var(--ink); }
.btn-white:hover { background: var(--paper); }
.btn-ghost-light { background: transparent; color: var(--white); border-color: rgba(255,255,255,.55); }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); border-color: var(--white); }
.btn-row { display: flex; flex-wrap: wrap; gap: .9rem; }
.link-arrow { display: inline-flex; align-items: center; gap: .4em; font-weight: 700; color: var(--sage); }
.link-arrow svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---------- Header ---------- */
#site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(246,244,238,.92);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { display: flex; align-items: center; }
.brand img { height: 46px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 2.1rem; }
.nav-links a {
  font-size: .92rem; font-weight: 600; color: var(--ink);
  padding: 6px 0; border-bottom: 2px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--sage-dark); border-color: var(--sage); }
.nav-cta { margin-left: .4rem; }
.nav-toggle {
  display: none; background: none; border: none; padding: 8px; cursor: pointer; color: var(--ink);
}
.nav-toggle svg { width: 24px; height: 24px; }
.nav-toggle .icon-close { display: none; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: 75px 0 auto 0; z-index: 99;
    max-height: calc(100vh - 75px);
    background: var(--paper);
    flex-direction: column; align-items: flex-start; 
    gap: 1.5rem; /* <-- SOLUCIÓN: Gap válido para espaciar los items */
    padding: 24px 24px 32px; /* <-- SOLUCIÓN: Mejor padding superior */
    box-shadow: 0 16px 28px -12px rgba(27,48,56,.22);
    transform: translateY(-8px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
    overflow-y: auto;
  }
  .nav-links.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
  
  .nav-links a { 
    width: fit-content; /* <-- SOLUCIÓN: Hace que la línea mida lo mismo que el texto */
    padding: 4px 0; /* <-- SOLUCIÓN: Reducimos padding para que el gap haga el trabajo */
    font-size: 1.1rem; 
  }
  .nav-cta { margin: 18px 0 0; }
  body.nav-open { overflow: hidden; }
}

/* ---------- Hero (home) ---------- */
.hero {
  position: relative; color: var(--white);
  min-height: min(86vh, 720px);
  display: flex; align-items: flex-end;
  overflow: hidden;
}
.hero picture, .hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(0deg, rgba(15,26,30,.82) 0%, rgba(15,26,30,.35) 52%, rgba(15,26,30,.15) 100%);
}
.hero-content { position: relative; z-index: 2; padding-bottom: clamp(2.5rem, 6vw, 5rem); width: 100%; }
.hero-content .eyebrow { color: #C9E4CC; }
.hero-content h1 { color: var(--white); max-width: 16ch; }
.hero-content .lede { color: rgba(255,255,255,.86); margin-bottom: 1.6em; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  position: relative; color: var(--white);
  padding: clamp(6.5rem, 14vw, 9.5rem) 0 clamp(2.5rem, 6vw, 4rem);
  overflow: hidden;
}
.page-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.page-hero::after { content:""; position:absolute; inset:0; z-index:1; background: linear-gradient(180deg, rgba(16,32,38,.72), rgba(16,32,38,.6)); }
.page-hero .container { position: relative; z-index: 2; }
.page-hero .eyebrow { color: #C9E4CC; }
.page-hero h1 { color: var(--white); max-width: 24ch; }
.page-hero.no-image { background: var(--teal-deep); }
.page-hero.no-image::after { display: none; }

/* ---------- Sections ---------- */
section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.section-alt { background: var(--paper-alt); }
.section-tight { padding: clamp(2.5rem, 5vw, 4rem) 0; }
.section-head { max-width: 700px; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Feature grid ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.feature {
  padding-top: 1.6rem; border-top: 1px solid var(--line);
}
.feature .num { font-family: var(--font-display); font-size: 1.6rem; color: var(--sage); display:block; margin-bottom: .5rem; }
.feature h3 { margin-bottom: .4rem; }
.feature p { color: var(--muted); font-size: .96rem; margin-bottom: 0; }

/* ---------- Media + text split ---------- */
.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.split img { border-radius: var(--radius); }
.split.reverse .split-media { order: 2; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split.reverse .split-media { order: 0; }
}
.split-copy h2 { margin-bottom: .6rem; }

.stack-rows { display: flex; flex-direction: column; gap: clamp(2.5rem, 5vw, 4rem); }
.stack-row { display: grid; grid-template-columns: .9fr 1.6fr; gap: clamp(1.5rem, 4vw, 3rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.stack-row:last-child { border-bottom: none; padding-bottom: 0; }
.stack-row h3 { color: var(--sage-dark); }
@media (max-width: 720px) { .stack-row { grid-template-columns: 1fr; } }

/* ---------- Process timeline ---------- */
.timeline { counter-reset: step; }
.timeline-item {
  position: relative;
  display: grid; grid-template-columns: 90px 1fr; gap: 1.5rem;
  padding: clamp(1.6rem, 3vw, 2.4rem) 0;
  border-top: 1px solid var(--line);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .step-num {
  font-family: var(--font-display); font-size: 2.4rem; color: var(--sage); line-height: 1;
}
.timeline-item h3 { margin-bottom: .4rem; }
.timeline-item p:last-child { margin-bottom: 0; }
@media (max-width: 620px) { .timeline-item { grid-template-columns: 1fr; gap: .4rem; } }

/* ---------- Image trio (gallery / social replacement) ---------- */
.gallery-3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.gallery-3 img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.gallery-3 .g-tall { grid-row: span 2; aspect-ratio: 3/4; }
.gallery-3 .g-a { aspect-ratio: 4/3; }
@media (max-width: 720px) { .gallery