/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--hueso); color: var(--verde-oscuro);
  font-family: var(--f-cuerpo); font-weight: 300; font-size: var(--fs-cuerpo); line-height: 1.8;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--verde); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 100; background: var(--verde-oscuro); color: var(--hueso); padding: .6em 1em; font-family: var(--f-ui); }
.skip:focus { top: 8px; }
section[id] { scroll-margin-top: var(--header-h); }
.wrap { padding-inline: var(--gutter); }

/* ---------- Tipografía ---------- */
.h-display, h1, h2 { font-family: var(--f-titulo); font-weight: 300; line-height: 1.08; letter-spacing: -0.005em; }
h2 { font-size: var(--fs-h2); color: var(--verde); }
h1 { font-size: var(--fs-hero); }
h1 em, h2 em, .cita em { font-style: italic; font-weight: 300; }
h3 { font-family: var(--f-cuerpo); font-weight: 500; font-size: var(--fs-h3); line-height: 1.4; }
.lead { font-size: var(--fs-lead); font-weight: 300; line-height: 1.8; }
.eyebrow, .cta, .ui {
  font-family: var(--f-ui); text-transform: uppercase; letter-spacing: var(--tracking);
}
.eyebrow { font-size: var(--fs-eyebrow); font-weight: 300; letter-spacing: .24em; }
.cta {
  display: inline-block; font-size: var(--fs-ui); font-weight: 400; line-height: 1.6; padding-bottom: .4em; cursor: pointer; text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor), linear-gradient(rgb(128 128 110 / .55), rgb(128 128 110 / .55));
  background-repeat: no-repeat; background-position: left bottom; background-size: 0 1px, 100% 1px;
  transition: background-size .5s var(--ease);
}
button.cta { font-family: var(--f-ui); text-transform: uppercase; letter-spacing: var(--tracking); }
a.cta:hover, button.cta:hover, a.cta:focus-visible, button.cta:focus-visible { background-size: 100% 1px, 100% 1px; }
/* Enlaces de texto: la línea se dibuja al pasar el cursor */
.ul {
  text-decoration: none; padding-bottom: .3em;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  transition: background-size .5s var(--ease);
}
a:hover > .ul, a:focus-visible > .ul, a.ul:hover, a.ul:focus-visible { background-size: 100% 1px; }

/* ---------- Header (transparente; logo blanco/negro según sección) ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h);
  display: flex; justify-content: space-between; align-items: center; padding-inline: var(--gutter);
  color: var(--hueso); --veil: rgb(47 47 34 / .55);
}
.header[data-tema="claro"] { color: var(--verde-oscuro); --veil: rgb(225 223 216 / .55); }
.header { background: transparent; }
.header.is-scrolled { background: var(--veil); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.header { transition: background-color .5s ease, color .5s ease; }
.header__logo { display: block; position: relative; }
.header__logo img { height: clamp(24px, 1.6vw + 14px, 34px); width: auto; transition: opacity .5s ease; }
.header .logo-negro { position: absolute; left: 0; top: 0; opacity: 0; }
.header[data-tema="claro"] .logo-blanco { opacity: 0; }
.header[data-tema="claro"] .logo-negro { opacity: 1; }
.header__right { display: flex; justify-content: flex-end; margin-left: auto; }
.burger { width: 44px; height: 44px; display: grid; place-content: center; gap: 6px; }
.burger span { display: block; width: 26px; height: 1px; background: currentColor; }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: var(--verde-oscuro); color: var(--hueso);
  display: flex; flex-direction: column; padding: var(--gutter);
  visibility: hidden; opacity: 0; filter: blur(10px);
  transition: opacity .6s var(--ease), filter .6s var(--ease), visibility 0s linear .6s;
}
.overlay.is-open { visibility: visible; opacity: 1; filter: none; transition-delay: 0s; }
.overlay__top { display: flex; justify-content: flex-end; height: calc(var(--header-h) - var(--gutter)); min-height: 44px; }
.overlay__close { font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: var(--tracking); text-transform: uppercase; padding: 0 .5em; }
.overlay__nav { margin: auto; text-align: center; }
.overlay__nav a {
  display: table; margin: 0 auto; font-family: var(--f-titulo); font-weight: 300; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.6rem); line-height: 1.5; text-decoration: none; padding-bottom: .05em;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  opacity: 0; transform: translateY(12px);
  transition: background-size .5s var(--ease), opacity .7s var(--ease), transform .7s var(--ease);
}
.overlay.is-open .overlay__nav a { opacity: 1; transform: none; transition-delay: 0s, calc(var(--i, 0) * 70ms + 150ms), calc(var(--i, 0) * 70ms + 150ms); }
.overlay__nav a:hover, .overlay__nav a:focus-visible { background-size: 100% 1px; }
.overlay__foot { text-align: center; font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: .05em; padding-bottom: 1rem; }

/* ---------- Hero ---------- */
.hero { padding-top: 0; }
.hero__media {
  position: relative; height: 100svh; min-height: 560px; max-height: 1000px;
  color: var(--hueso); display: grid; place-items: center; text-align: center; overflow: hidden;
}
.hero__media > picture, .hero__media > img { position: absolute; inset: 0; }
.hero__media img.bg { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.hero__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgb(20 20 14 / .3), rgb(20 20 14 / .14) 45%, rgb(20 20 14 / .34)); }
.hero__content { position: relative; z-index: 1; padding: var(--header-h) var(--gutter) 0; display: flex; flex-direction: column; align-items: center; gap: clamp(16px, 2vw, 28px); }
.hero h1 { max-width: 11.5em; font-weight: 300; }
.hero__sub { font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: .22em; text-transform: uppercase; font-weight: 300; }
.hero__sub i { text-transform: none; font-style: normal; letter-spacing: .08em; }
.hero__nav { display: grid; grid-template-columns: repeat(4, 1fr); margin: clamp(28px, 4vw, 56px) var(--gutter); border-top: var(--hairline); border-bottom: var(--hairline); }
.hero__nav a { display: block;
  font-family: var(--f-ui); font-size: var(--fs-ui); font-weight: 300; text-transform: uppercase; letter-spacing: .18em; text-align: center; text-decoration: none;
  padding: 1.6em .5em; border-left: var(--hairline);
}
.hero__nav a:first-child { border-left: 0; }
@media (max-width: 720px) {
  .hero__nav { grid-template-columns: 1fr 1fr; }
  .hero__nav a:nth-child(odd) { border-left: 0; }
  .hero__nav a:nth-child(-n+2) { border-bottom: var(--hairline); }
}

/* ---------- Intro ---------- */
.intro { display: grid; grid-template-columns: 1.15fr 1fr; min-height: min(100svh, 900px); }
.intro__text { padding: var(--sec-y) var(--gutter); display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }
.intro__text h2 { margin-top: 1.4rem; max-width: 11em; }
.intro__body { max-width: 34em; display: grid; gap: 1.2rem; justify-items: start; }
.intro__img { position: relative; overflow: hidden; }
.intro__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
  .intro__img { aspect-ratio: 4 / 5; }
}

/* ---------- Residencias (selector) ---------- */
.res { background: var(--verde-oscuro); color: var(--hueso); padding: var(--sec-y) var(--gutter); }
.res h2 { color: var(--hueso); margin-top: 1.2rem; }
.res__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 110px); margin-top: clamp(40px, 6vw, 88px); align-items: start; }
.res__plano { min-width: 0; }
.plano { width: 100%; height: auto; overflow: visible; }
.plano .unidad { cursor: pointer; outline: none; }
.plano .unidad polygon { transition: fill .6s ease, stroke-opacity .6s ease; fill: transparent; stroke: var(--hueso); stroke-opacity: .85; stroke-width: 1.25px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.plano .unidad.is-on polygon { fill: var(--verde); stroke-opacity: 1; }
.plano .unidad:focus-visible polygon { stroke: #fff; stroke-width: 3px; }
.plano .nucleo { fill: none; stroke: var(--hueso); stroke-opacity: .45; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.plano text { fill: var(--hueso); pointer-events: none; }
.svg-letra { font-family: var(--f-titulo); font-weight: 300; font-size: 46px; }
.svg-torre { font-family: var(--f-titulo); font-style: italic; font-weight: 300; font-size: 54px; }
.svg-ctx { font-family: var(--f-titulo); font-style: italic; font-weight: 300; font-size: 30px; fill-opacity: .8; }
@media (max-width: 720px) { .svg-letra { font-size: 64px; } .svg-torre { font-size: 70px; } .svg-ctx { font-size: 40px; } }
.res__detalle { margin-top: clamp(20px, 3vw, 36px); display: grid; gap: 20px; }
.res__desc { font-size: var(--fs-cuerpo); max-width: 38em; min-height: 3.5em; }
.res__btns { display: flex; flex-wrap: wrap; gap: 12px 36px; }
.res__nota { font-family: var(--f-ui); font-size: .78rem; opacity: .8; }
.res__lista { border-top: var(--hairline-claro); }
.res__item { border-bottom: var(--hairline-claro); }
.res__item > button { transition: opacity .6s ease; width: 100%; display: flex; align-items: baseline; gap: clamp(16px, 2vw, 32px); padding: clamp(16px, 1.6vw, 22px) 0; text-align: left; opacity: .6; }
.res__item > button:hover, .res__item > button:focus-visible { opacity: 1; }
.res__item.is-on > button { opacity: 1; }
.res__num { font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: var(--tracking); min-width: 2.2em; }
.res__tipo { font-family: var(--f-titulo); font-weight: 300; font-size: clamp(1.3rem, 1.1rem + .7vw, 1.8rem); line-height: 1.15; }
.res__item.is-on .res__tipo { font-style: italic; }
.res__datos { display: none; padding: 0 0 clamp(20px, 2.4vw, 32px) calc(2.2em + clamp(16px, 2vw, 32px)); }
.res__item.is-on .res__datos { display: block; animation: datos-in .7s var(--ease) both; }
@keyframes datos-in { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
.swap { transition: opacity .3s ease, filter .3s ease; }
.swap.is-out { opacity: 0; filter: blur(4px); }
.res__datos dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1.6rem; font-size: var(--fs-cuerpo); }
.res__datos dt { font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: var(--tracking); text-transform: uppercase; opacity: .8; align-self: center; }
@media (max-width: 860px) { .res__grid { grid-template-columns: 1fr; } }

/* ---------- Amenidades ---------- */
.amen { background: var(--hueso-claro); display: grid; grid-template-columns: 1.1fr 1fr; }
.amen__text { padding: var(--sec-y) var(--gutter); }
.amen__text h2 { margin: 1.2rem 0 clamp(24px, 3vw, 40px); max-width: 12em; }
.amen__text .lead { max-width: 34em; margin-bottom: clamp(36px, 5vw, 64px); }
.amen__cols { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); }
.amen__cols h3 { font-family: var(--f-ui); text-transform: uppercase; letter-spacing: .24em; font-size: var(--fs-eyebrow); font-weight: 400; color: var(--verde-oscuro); padding-bottom: 14px; border-bottom: var(--hairline); }
.amen__cols li { display: grid; grid-template-columns: 2.4em 1fr; gap: 0 .4em; padding: .85em 0; border-bottom: var(--hairline); line-height: 1.4; }
.amen__n { font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: .08em; padding-top: .15em; }
.amen__d { grid-column: 2; font-size: .85em; font-weight: 300; margin-top: .3em; line-height: 1.55; }
.amen__img { position: relative; min-height: 420px; }
.amen__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 960px) { .amen { grid-template-columns: 1fr; } .amen__img { aspect-ratio: 16 / 10; min-height: 0; order: -1; } }
@media (max-width: 540px) { .amen__cols { grid-template-columns: 1fr; } }

/* ---------- Cita ---------- */
.cita-band { background: var(--verde); color: var(--texto-sobre-verde); padding: clamp(96px, 14vw, 220px) var(--gutter); text-align: center; }
.cita { font-family: var(--f-titulo); font-weight: 300; font-size: var(--fs-cita); line-height: 1.22; max-width: 22em; margin-inline: auto; }

/* ---------- Ubicación ---------- */
.ubi { background: var(--hueso-claro); padding: var(--sec-y) var(--gutter); }
.ubi h2 { margin-bottom: clamp(28px, 4vw, 56px); }
.ubi iframe { display: block; width: 100%; aspect-ratio: 21 / 9; border: 0; filter: grayscale(1) sepia(.15) contrast(.95); }
@media (max-width: 720px) { .ubi iframe { aspect-ratio: 4 / 5; } }

/* ---------- Formulario ---------- */
.contacto {
  position: relative; color: var(--hueso); padding: var(--sec-y) var(--gutter); text-align: center;
  background-color: var(--verde-oscuro);
  background-image:
    radial-gradient(120% 90% at 15% 0%, rgb(120 120 89 / .28), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, rgb(0 0 0 / .28), transparent 65%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .88  0 0 0 0 .87  0 0 0 0 .85  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.contacto h2 { color: var(--hueso); }
.contacto__sub { margin: clamp(16px, 2vw, 28px) auto clamp(36px, 5vw, 64px); max-width: 32em; }
.form { max-width: 1040px; margin-inline: auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(20px, 3vw, 36px) clamp(20px, 3vw, 40px); text-align: left; }
.field { grid-column: span 2; position: relative; }
.field--wide { grid-column: span 3; }
.field label { display: block; font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: .08em; opacity: .9; margin-bottom: .2rem; }
.field input, .field select {
  width: 100%; font: inherit; font-family: var(--f-ui); font-weight: 300; font-size: .95rem; color: var(--hueso);
  background: transparent; border: 0; border-bottom: 1px solid rgb(225 223 216 / .7); border-radius: 0; padding: .55em 0; appearance: none;
}
.field select { padding-right: 1.6em; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23E1DFD8'><path d='M1 1.5l5 5 5-5'/></svg>") no-repeat right .2em center; }
.field select option { color: var(--verde-oscuro); background: var(--hueso); }
.field input:focus, .field select:focus { outline: none; border-bottom-color: #fff; box-shadow: 0 1px 0 #fff; }
.field.has-error input, .field.has-error select { border-bottom-color: #f1c7b8; }
.field .err { display: none; font-family: var(--f-ui); font-size: .78rem; color: #f3cdbf; margin-top: .3rem; }
.field.has-error .err { display: block; }
.form__actions { grid-column: 1 / -1; text-align: center; margin-top: 12px; display: grid; justify-items: center; gap: 18px; }
.form__msg { min-height: 1.5em; font-family: var(--f-ui); font-size: .95rem; }
.form__msg a { text-underline-offset: .3em; }
.form__alt { font-family: var(--f-ui); letter-spacing: var(--tracking); text-transform: uppercase; }
@media (max-width: 860px) { .field, .field--wide { grid-column: span 3; } }
@media (max-width: 540px) { .form { grid-template-columns: 1fr; } .field, .field--wide { grid-column: auto; } }

/* ---------- Footer ---------- */
.footer { background: var(--hueso-claro); padding: clamp(64px, 8vw, 120px) var(--gutter) 40px; text-align: center; }
.footer__logo { width: clamp(120px, 12vw, 180px); height: auto; margin-inline: auto; }
.footer__info { margin-top: clamp(36px, 5vw, 64px); display: grid; gap: .5rem; font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: .08em; text-transform: uppercase; }
.footer__info a { text-decoration: none; }
.footer__info a:hover { text-decoration: underline; }
.footer__devs { margin-top: clamp(32px, 4vw, 52px); display: flex; justify-content: center; align-items: center; gap: clamp(32px, 5vw, 64px); }
.footer__devs:empty { display: none; }
.footer__devs .dev { width: auto; }
.dev--marjalizo { height: clamp(26px, 2.2vw, 34px); }
.dev--living { height: clamp(32px, 2.8vw, 42px); }
.footer__legal { margin: clamp(40px, 5vw, 64px) auto 0; max-width: 52em; padding-top: 24px; border-top: var(--hairline); font-size: .78rem; line-height: 1.7; }
.footer__copy { margin-top: 16px; font-family: var(--f-ui); font-size: .75rem; letter-spacing: .06em; }

/* ---------- Movimiento (Fase 2) ---------- */
.js .hero__media img.bg { transform: scale(1.08); }
.js .hero.is-ready .hero__media img.bg { transform: none; transition: transform 2.5s var(--ease); }

.js .reveal {
  opacity: 0; filter: blur(12px); transform: translateY(24px); will-change: opacity, filter, transform;
  transition: opacity 1.2s var(--ease) var(--d, 0s), filter 1.2s var(--ease) var(--d, 0s), transform 1.2s var(--ease) var(--d, 0s);
}
.js .reveal--soft { filter: none; transition: opacity 1.2s var(--ease) var(--d, 0s), transform 1.2s var(--ease) var(--d, 0s); }
.js .reveal-img { opacity: 0; transform: scale(1.05); will-change: opacity, transform; transition: opacity 1.4s var(--ease) var(--d, 0s), transform 1.8s var(--ease) var(--d, 0s); }
.js .reveal-fade { opacity: 0; transition: opacity 1.4s var(--ease) var(--d, 0s); }
.js .reveal.is-in, .js .reveal-img.is-in, .js .reveal-fade.is-in { opacity: 1; filter: none; transform: none; }
.amen__img { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .js .hero__media img.bg, .js .hero.is-ready .hero__media img.bg { transform: none; transition: none; }
  .js .reveal, .js .reveal--soft, .js .reveal-img, .js .reveal-fade { filter: none; transform: none; transition: opacity .4s ease; }
  .overlay { filter: none; transition: opacity .3s ease, visibility 0s linear .3s; }
  .overlay__nav a { transform: none; transition: opacity .3s ease; }
  .swap, .swap.is-out { filter: none; }
  .res__item.is-on .res__datos { animation: none; }
  .cta, .ul, .overlay__nav a { transition: none; }
}

/* ---------- Fase 3: idioma, foco, honeypot ---------- */
.lang { display: flex; justify-content: center; align-items: center; gap: .9em; font-family: var(--f-ui); font-size: var(--fs-ui); letter-spacing: var(--tracking); }
.lang button { font: inherit; letter-spacing: inherit; padding: .5em .2em; }
.lang button[aria-pressed="true"] { background-size: 100% 1px; }
.footer .lang { margin-top: 28px; }
.overlay .lang { padding-bottom: 1.2rem; }
.field--trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
[data-tema="oscuro"] :focus-visible, .overlay :focus-visible, .contacto :focus-visible { outline-color: var(--hueso); }
