/* ==========================================================================
   1. VARIABLES Y REGLAS GLOBALES
   ========================================================================== */
:root {
  --white: #ffffff;
  --ink: #0e0e0e;
  --paper: #f7f7f5;
  --header-bg: rgba(255, 255, 255, 1);
  --overlay: rgba(0, 0, 0, 0.28);
  --overlay-strong: rgba(0, 0, 0, 0.42);
  --whatsapp-border: rgba(255, 255, 255, 0.9);
  --whatsapp-hover: rgba(255, 255, 255, 0.16);
  --title-shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: #ffffff;
  overflow-x: hidden;
}

body {
  padding-bottom: 170px;
}

/* ==========================================================================
   2. HEADER & NAVEGACIÓN
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  background: transparent;
  transition: background-color 260ms ease, box-shadow 260ms ease;
}

.site-header.is-scrolled {
  background: var(--header-bg);
  box-shadow: 0 4px 18px rgba(12, 12, 12, 0.08);
}

.topbar {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
}

.logo {
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.logo-img {
  width: 120px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(0, 0, 0, 0.22));
  transition: filter 220ms ease;
}

.site-header.is-scrolled .logo-img {
  filter: none;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 136px;
  height: 36px;
  border: 1.2px solid var(--whatsapp-border);
  border-radius: 999px;
  color: var(--white);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  backdrop-filter: blur(2px);
  transition: transform 220ms ease, background-color 220ms ease, color 220ms ease, border-color 220ms ease;
}

.btn-whatsapp:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-whatsapp:active {
  transform: translateY(0);
}

.site-header.is-scrolled .btn-whatsapp {
  color: var(--ink);
  border-color: rgba(14, 14, 14, 0.8);
  backdrop-filter: none;
}

/* ==========================================================================
   3. HERO BANNER
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--white);
  background-image: linear-gradient(to bottom, var(--overlay-strong) 0%, var(--overlay) 35%, var(--overlay-strong) 100%);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* Centra el contenedor del título en el hero */
.headline {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 75vh;
  min-height: 75svh;
  display: flex;
  align-items: center;
  justify-content: center; /* Posiciona el bloque en el centro de la pantalla */
  padding: 0 20px;
}

/* El texto dentro del título se mantiene alineado a la izquierda */
.headline h1 {
  font-size: 52px;
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-top: 0;
  max-width: 680px;
  width: fit-content;      /* Hace que el contenedor se ajuste al tamaño del texto */
  text-align: left;         /* Alineación a la izquierda */
  text-shadow: 0 6px 25px var(--title-shadow);
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   4. BIENVENIDA & CARRUSEL DE GALERÍA
   ========================================================================== */
.welcome {
  width: 100%;
  margin: 64px auto 42px;
  color: var(--ink);
}

.welcome-copy {
  width: min(980px, calc(100% - 48px));
  margin: 0 auto 58px;
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(360px, 1.45fr);
  gap: 32px 42px;
  align-items: start;
}

.welcome-title {
  font-size: clamp(1.6rem, 3.3vw, 2.45rem);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.02em;
  max-width: 360px;
}

.welcome-content {
  font-size: 1rem;
  line-height: 1.25;
  max-width: 610px;
}

.welcome-content p {
  margin-bottom: 24px;
}

.welcome-list {
  list-style: none;
  display: grid;
  gap: 1px;
  font-size: 1rem;
  line-height: 1.25;
}

.welcome-list li::before {
  content: "– ";
}

.welcome-image {
  position: relative;
  width: min(980px, calc(100% - 48px));
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e9e9e9;
}

.carousel-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 400ms ease, visibility 400ms ease;
}

.carousel-slide.is-active {
  opacity: 1;
  visibility: visible;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.carousel-arrow {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 44px !important;
  height: 44px !important;
  border: none !important;
  background: rgba(0, 0, 0, 0.25) !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  transition: background-color 200ms ease, transform 200ms ease !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.5) !important;
  transform: translateY(-50%) scale(1.08) !important;
}

.carousel-arrow.prev {
  left: 16px !important;
}

.carousel-arrow.next {
  right: 16px !important;
}

.carousel-arrow svg {
  width: 24px !important;
  height: 24px !important;
  display: block !important;
  stroke: #ffffff !important;
}

/* ==========================================================================
   5. SECCIÓN DE PLANOS (TIPOLOGÍAS)
   ========================================================================== */
.plans {
  width: min(980px, calc(100% - 48px));
  margin: 74px auto 64px;
  color: var(--ink);
}

.plans-title {
  font-size: clamp(2rem, 3.9vw, 3rem);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.plans-subtitle {
  font-size: 1.06rem;
  margin-bottom: 38px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px 20px;
}

.plan-item {
  background: transparent;
  border: none;
  text-align: left;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.plan-code {
  font-size: 40px;
  line-height: 0.95;
  letter-spacing: -0.03em;
  padding-bottom: 8px;
  border-bottom: 1.6px solid #202020;
  margin-bottom: 10px;
  transition: transform 200ms ease, letter-spacing 200ms ease;
}

.plan-item:hover .plan-code {
  transform: translateX(2px);
  letter-spacing: -0.01em;
}

.plan-meta {
  font-size: 0.9rem;
  line-height: 1.4;
}

.plan-meta strong {
  font-weight: 600;
}

/* ==========================================================================
   6. VENTANAS EMERGENTES (MODALES: TIPOLOGÍA & WHATSAPP)
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 30;
}

.modal.is-open {
  display: flex;
}

.whatsapp-modal {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 14px 28px 14px 14px;
  background: transparent;
}

.modal-panel {
  width: min(1280px, 96vw);
  max-height: 94vh;
  background: #EDEDEF;
  padding: 30px 30px 30px 40px;
  position: relative;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1px minmax(380px, 1fr);
  gap: 20px;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: #60758a;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: auto;
}

.modal-close svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}

.whatsapp-panel {
  width: min(380px, 100%);
  background: #ffffff;
  border-radius: 18px;
  padding: 34px 30px 28px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.whatsapp-title {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  padding-right: 18px;
  margin-bottom: 22px;
  color: var(--ink);
}

.whatsapp-form {
  display: grid;
  gap: 20px;
}

.whatsapp-field input {
  width: 100%;
  border: none;
  border-bottom: 1.2px solid #181818;
  background: transparent;
  padding: 5px 0 4px;
  font-size: 0.85rem !important;
  outline: none;
  font-family: inherit;
  color: #111;
}

.whatsapp-field input::placeholder {
  color: #111;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 0.75rem !important;
}

.whatsapp-field input:focus {
  border-bottom-color: #000;
  border-bottom-width: 2px;
}

.whatsapp-submit {
  margin-top: 6px;
  border: 1.2px solid #111;
  background: transparent;
  color: #111;
  border-radius: 999px;
  min-width: 120px;
  height: 32px;
  padding: 0 14px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  justify-self: start;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.whatsapp-submit:hover {
  background: #FFCD57;
  border-color: #FFCD57;
}

.modal-left {
  padding: 40px 8px 8px 8px;
  overflow: auto;
}

.modal-plan-code {
  font-size: 3.1rem;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  font-weight: 100;
}

.modal-status {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0px;
}

.modal-view {
  font-size: 0.85rem;
  margin-bottom: 22px;
}

.modal-specs {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2px 10px;
  font-size: 0.85rem;
  max-width: 290px;
  margin-bottom: 30px;
}

.modal-divider {
  border: none;
  border-top: 1px solid #d9d9d9;
  margin: 0 0 28px 0;
}

.modal-switcher-label {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  display: block;
}

.modal-switcher {
  width: 150px;
  font-size: 0.95rem;
  border: none;
  border-bottom: 2px solid #1c1c1c;
  background: transparent;
  padding: 2px 0;
  font-family: inherit;
}

.modal-separator {
  background: #171717;
  opacity: 0.75;
}

.modal-right {
  position: relative;
  padding: 40px 20px 24px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  column-gap: 14px;
  align-items: start;
  overflow: hidden;
}

.modal-plan-stage {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 320px;
  overflow: hidden;
  user-select: none;
}

.modal-plan-image {
  width: 100%;
  height: auto;
  transform-origin: center;
  transition: transform 180ms ease;
  user-select: none;
}

.modal-tools {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: start;
  justify-self: end;
  display: grid;
  gap: 10px;
}

.tool-btn {
  width: 42px;
  height: 42px;
  border: none;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  font-size: 1.62rem;
  line-height: 1;
  cursor: pointer;
  color: #111;
  font-family: inherit;
}

.tool-btn:last-child {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

#downloadBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#downloadBtn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   7. UBICACIÓN & MAPA
   ========================================================================== */
.location {
  width: min(980px, calc(100% - 48px));
  margin: 40px auto 12px;
  color: var(--ink);
  border-top: 1px solid #000000;
  padding-top: 30px;
}

.location-header {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1.2fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 30px;
}

.location-title {
  font-size: 45px;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.location-address,
.location-contact {
  font-size: 0.98rem;
  line-height: 1.35;
}

.location-map {
  width: 100%;
  height: 320px;
  border: 0;
  display: block;
  background: #dde7ec;
}

/* ==========================================================================
   8. FORMULARIO DOCK DE CONTACTO (PIE DE PÁGINA)
   ========================================================================== */
.contact-dock {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 160px;
  background: #ffffff;
  border-top: 1px solid #969696;
  z-index: 18;
  overflow: hidden;
}

.contact-dock-inner {
  width: min(1280px, calc(100% - 24px));
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) minmax(280px, 1.7fr);
  gap: 16px;
  align-items: center;
  padding: 20px 20px 20px 0px;
}

.contact-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.contact-title {
  font-size: 66px;
  line-height: 0.95;
  font-weight: 500;
  margin-bottom: 15px;
  color: var(--ink);
  text-align: center;
}

.contact-meta {
  display: flex;
  width: 75%;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #222;
}

.contact-form {
  display: grid;
  gap: 12px;
  width: 100%;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
}

.contact-field {
  display: grid;
  gap: 4px;
}

.contact-field input {
  width: 100%;
  border: none;
  border-bottom: 1.2px solid #181818;
  background: transparent;
  padding: 5px 0 4px;
  font-size: 0.85rem !important;
  outline: none;
  font-family: inherit;
  color: #111;
}

.contact-field input::placeholder {
  color: #111;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  font-size: 0.75rem !important;
}

.contact-field input:focus {
  border-bottom-color: #000;
  border-bottom-width: 2px;
}

.contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
  align-items: center;
  margin-top: 8px;
  padding-top: 0;
}

.contact-terms {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.74rem;
  color: #111;
}

.contact-terms input {
  width: 16px;
  height: 16px;
  accent-color: #111;
}

.contact-submit {
  border: 1.2px solid #111;
  background: transparent;
  border-radius: 999px;
  min-width: 80px;
  height: 26px;
  padding: 0 8px;
  font-size: 0.82rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  justify-self: start;
  transition: background-color 180ms ease, color 180ms ease;
}

.contact-submit:hover {
  background: #FFCD57;
  border-color: #FFCD57;
}

/* ==========================================================================
   9. BOTÓN VOLVER ARRIBA
   ========================================================================== */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 0;
  color: #000000;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
  transition: opacity 220ms ease, transform 220ms ease;
}

.back-to-top svg {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

.back-to-top.visible {
  display: flex;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0);
}

/* ==========================================================================
   10. ADAPTACIÓN MÓVIL (MEDIA QUERY COMPACTA)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding-bottom: 220px;
  }

  .site-header {
    position: fixed;
  }

  .topbar {
    padding: 12px 18px;
  }

  .logo-img {
    width: 126px;
  }

  .btn-whatsapp {
    min-width: 112px;
    height: 32px;
    font-size: 0.74rem;
  }

  .hero,
  .headline {
    min-height: 50vh;
    min-height: 50svh;
  }

  .headline {
    align-items: center;
    justify-content: center;
    padding: 0 28px;
    min-height: 66vh;
    min-height: 66svh;
  }

  .headline h1 {
    font-size: clamp(2.2rem, 9vw, 3.2rem);
    max-width: none;
    width: fit-content;
    text-align: left;
  }

  .welcome {
    margin: 38px auto 30px;
  }

  .welcome-copy {
    width: calc(100% - 56px);
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 30px;
  }

  .welcome-title {
    max-width: none;
    font-size: 2rem;
    margin-bottom: 30px;
  }

  .welcome-content {
    max-width: none;
    margin-bottom: 30px;
  }

  .plans {
    width: calc(100% - 56px);
    margin: 52px auto 56px;
  }

  .plans-subtitle {
    margin-bottom: 26px;
  }

  .plans-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  /* MODAL COMPACTA EN MÓVIL (SIN SCROLL EXCESIVO) */
  .modal {
    padding: 10px;
  }

  .modal-panel {
    display: flex !important;
    flex-direction: column !important;
    max-height: 92vh !important;
    padding: 16px 14px 14px 14px !important;
    gap: 10px !important;
  }

  /* 1. SECCIÓN DE TEXTO (Aumenta sutilmente su espacio disponible) */
  .modal-left {
    flex: 0 0 auto !important;
    max-height: 42vh !important; /* Le da hasta un 42% del alto visible */
    padding: 0 0 6px 0 !important;
    overflow-y: auto !important; /* Permite scroll fluido en celulares con pantallas muy pequeñas */
  }

  /* 2. SECCIÓN DEL PLANO (Se ajusta al 58% restante de la modal) */
  .modal-right {
    position: relative !important;
    flex: 1 1 50vh !important;
    min-height: 180px !important; /* Mínimo ajustado para dar espacio arriba */
    height: 100% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    background: #e5e5e7;
    border-radius: 8px;
  }

  .modal-plan-code {
    font-size: 2.2rem !important;
    line-height: 1 !important;
    margin-bottom: 6px !important;
  }

  .modal-status,
  .modal-view {
    font-size: 0.78rem !important;
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
  }

  .modal-view {
    margin-bottom: 10px !important;
  }

  .modal-specs {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    gap: 2px 8px !important;
    font-size: 0.76rem !important;
    line-height: 1.25 !important;
    max-width: 100% !important;
    margin-bottom: 10px !important;
  }

  .modal-specs dt {
    font-weight: 600;
  }

  .modal-divider {
    margin: 6px 0 10px 0 !important;
  }

  .modal-switcher-label {
    font-size: 0.8rem !important;
    margin-bottom: 4px !important;
  }

  .modal-switcher {
    width: 100% !important;
    font-size: 0.82rem !important;
    padding: 2px 0 !important;
  }

  .modal-separator {
    display: none !important;
  }

  /* PLANO FLOTANTE MÓVIL */
  .modal-right {
    position: relative !important;
    flex: 1 1 auto !important;
    min-height: 220px !important;
    height: 100% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    background: #e5e5e7;
    border-radius: 8px;
  }

  .modal-plan-stage {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    touch-action: none;
  }

  .modal-plan-image {
    max-height: 100% !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }

  .modal-tools {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 10 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .tool-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.2rem !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(4px) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  }

  /* UBICACIÓN MÓVIL */
  .location {
    width: calc(100% - 56px);
    margin: 20px auto 28px;
    padding-top: 24px;
  }

  .location-title {
    font-size: 38px;
  }

  .location-header {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 18px;
  }

  .location-map {
    height: 240px;
  }

  /* CONTACT DOCK MÓVIL */
  .contact-dock {
    height: 230px;
  }

  .contact-dock-inner {
    width: calc(100% - 56px);
    grid-template-columns: 1fr;
    gap: 0px;
    align-items: start;
    padding: 5px 0;
  }

  .contact-title {
    font-size: 44px;
    margin-top: 14px;
    margin-bottom: 0px;
  }

  .contact-meta {
    display: none;
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px 10px;
  }

  .contact-field input {
    padding: 4px 0 3px;
    font-size: 0.85rem !important;
    height: 28px;
  }

  .contact-field input::placeholder {
    font-size: 0.72rem !important;
  }

  .contact-actions {
    gap: 8px;
    margin-top: 15px;
  }

  .contact-terms {
    font-size: 0.68rem;
  }

  .contact-submit {
    min-width: 88px;
    height: 31px;
    font-size: 0.9rem;
  }

  .whatsapp-panel {
    padding: 30px 22px 24px;
  }

  .whatsapp-modal {
    padding: 12px 18px 14px;
  }

  .whatsapp-title {
    font-size: 1rem;
  }

  .back-to-top {
    bottom: 16px;
    right: 16px;
    width: 26px;
    height: 26px;
  }
}