:root {
    /* Paleta de colores */
    --primary: #4b4c3c;
    --dark: #332f2e;
    --light: #FFFFFF;
    --accent: #4b4c3c; /* Usado en footer */
    --gray-bg: #F9F9F9;
    --text-light: #f7e7ce;
    
    /* Efectos y transiciones */
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s ease-in-out;
    --border-radius: 10px;
}

/* Reset Básico y configuración global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Montserrat', Arial, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Accesibilidad: Enlace para saltar contenido */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary);
    color: var(--text-light);
    padding: 10px 15px;
    text-decoration: none;
    z-index: 10001;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Pantalla de carga */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--light);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--gray-bg);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tipografía */
h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    color: var(--dark);
}

h1 { font-size: clamp(2.5rem, 5vw, 3.6rem); font-weight: 700; line-height: 1.1; }
h2 { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.2; }
h3 { font-size: clamp(1.5rem, 3vw, 1.8rem); font-weight: 600; }
p { font-size: 1.06rem; color: #333; }

/* Contenedor principal */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Encabezado */
#header {
    position: fixed;
    width: 100%;
    z-index: 1000;
    transition: all var(--transition-speed);
    padding: 20px 0;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#header.scrolled {
    padding: 10px 0;
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 48px;
    width: auto;
    transition: height var(--transition-speed);
}

#header.scrolled .logo img {
    height: 40px;
}

nav ul {
    display: flex;
    list-style: none;
    align-items: center;
}

nav ul li { margin-left: 2.5rem; }
nav ul li a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    padding: 10px 0;
    transition: color var(--transition-speed);
    position: relative;
}
nav ul li a:hover, nav ul li a.active { color: var(--primary); }
nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    transition: width var(--transition-speed);
}
nav ul li a:hover::after, nav ul li a.active::after { width: 100%; }

.header-cta {
    background-color: var(--primary);
    color: var(--text-light) !important;
    padding: 10px 20px !important;
    border-radius: 6px;
    font-weight: 600 !important;
    transition: all var(--transition-speed);
    margin-left: 2rem !important;
}
.header-cta:hover { background-color: var(--dark); transform: translateY(-2px); }
.header-cta::after { display: none !important; }

/* Menú Móvil */
.mobile-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}
.mobile-menu span { width: 30px; height: 3px; background-color: var(--dark); margin: 3px 0; transition: all 0.3s; border-radius: 3px; }
.mobile-menu.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu.active span:nth-child(2) { opacity: 0; }
.mobile-menu.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 998; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.overlay.active { opacity: 1; visibility: visible; }

/* Estilos de Secciones */
.section { padding: 100px 0; }
.section.alt-bg { background-color: var(--gray-bg); }
.section-title { text-align: center; margin-bottom: 80px; }
.section-title h2 { position: relative; display: inline-block; padding-bottom: 25px; }
.section-title h2::after { content: ''; position: absolute; width: 100px; height: 4px; background-color: var(--primary); bottom: 0; left: 50%; transform: translateX(-50%); border-radius: 2px; }

/* Hero Section */
.hero {
    height: 100vh;
    min-height: 600px;
    background-position: center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
    position: relative;
}
.hero::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.4) 100%); z-index: 1; }
.hero-content { max-width: 900px; margin: 0 auto; padding: 20px; position: relative; z-index: 3; }
.hero h1 { color: var(--text-light); margin-bottom: 20px; }
.hero p { color: rgba(255, 255, 255, 0.95); margin-bottom: 40px; }
.btn { display: inline-block; padding: 16px 40px; background-color: var(--primary); color: var(--text-light); text-decoration: none; border-radius: 6px; transition: all var(--transition-speed); font-weight: 600; text-transform: uppercase; border: 2px solid var(--primary); }
.btn:hover { background-color: var(--dark); border-color: var(--dark); transform: translateY(-3px); }
.btn-outline { background-color: transparent; color: var(--primary); }
.btn-outline:hover { background-color: var(--primary); color: var(--text-light); }

.hero-stats { display: flex; justify-content: center; gap: 50px; margin-top: 50px; flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-number { font-size: 3rem; font-weight: 700; color: var(--text-light); font-family: 'Playfair Display', serif; display: block; }
.stat-label { font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; }

/* About Section */
.about-content { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 60px; }
.about-text p { margin-bottom: 25px; }
.about-highlights { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 30px; }
.highlight-item { display: flex; align-items: center; gap: 15px; }
.highlight-icon { width: 50px; height: 50px; background-color: var(--primary); color: var(--text-light); display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.25rem; flex-shrink: 0; }
.about-image img { width: 100%; height: auto; display: block; border-radius: var(--border-radius); box-shadow: 0 15px 40px var(--shadow-medium); }

/* Features Section */
.features-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }
.feature-card { background-color: var(--light); padding: 40px; border-radius: var(--border-radius); box-shadow: 0 10px 30px var(--shadow-light); transition: all var(--transition-speed); text-align: center; border: 1px solid #EEE; }
.feature-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px var(--shadow-medium); }
.feature-icon { font-size: 3.5rem; color: var(--primary); margin-bottom: 25px; }

/* Availability & Tour Section */
.availability-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 30px; }
.tab-btn { padding: 12px 30px; border: 2px solid var(--primary); background: transparent; color: var(--primary); border-radius: 6px; cursor: pointer; transition: all var(--transition-speed); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.tab-btn:hover, .tab-btn.active { background: var(--primary); color: var(--text-light); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.map-tour-iframe { width: 100%; height: 600px; border-radius: var(--border-radius); overflow: hidden; box-shadow: 0 15px 40px var(--shadow-medium); background-color: #eee; }
.availability-info { margin-top: 30px; text-align: center; }

/* Apartments Section */
.apartments-filters { display: flex; justify-content: center; gap: 20px; margin-bottom: 50px; flex-wrap: wrap; }
.filter-btn { padding: 10px 25px; border: 2px solid var(--primary); background: transparent; color: var(--primary); border-radius: 30px; cursor: pointer; transition: all var(--transition-speed); font-weight: 600; }
.filter-btn:hover, .filter-btn.active { background: var(--primary); color: var(--text-light); }
.apartments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 40px; }
.apartment-card { background-color: var(--light); border-radius: var(--border-radius); overflow: hidden; box-shadow: 0 10px 30px var(--shadow-light); transition: all var(--transition-speed); }
.apartment-card:hover { transform: translateY(-10px); box-shadow: 0 15px 35px var(--shadow-medium); }
.apartment-image { height: 300px; overflow: hidden; }
.apartment-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.apartment-card:hover .apartment-image img { transform: scale(1.1); }
.apartment-details { padding: 30px; }
.apartment-features { display: flex; justify-content: space-between; margin-bottom: 30px; flex-wrap: wrap; gap: 15px; }
.apartment-features span { display: flex; align-items: center; font-weight: 600; }
.apartment-features i { margin-right: 10px; color: var(--primary); font-size: 1.25rem; }

/* Amenities Section */
.amenities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 35px; }
.amenity-item { display: flex; flex-direction: column; align-items: center; text-align: center; background-color: var(--light); padding: 28px; border-radius: var(--border-radius); box-shadow: 0 8px 20px var(--shadow-light); transition: all var(--transition-speed); }
.amenity-item:hover { transform: translateY(-8px); box-shadow: 0 12px 25px var(--shadow-medium); }
.amenity-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 15px; }
.amenity-item span { font-weight: 500; }

/* Gallery Section */
.gallery-filters { display: flex; justify-content: center; gap: 20px; margin-bottom: 50px; flex-wrap: wrap; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px;  justify-content:center; align-content:start;  justify-content:center; align-content:start; }
.gallery-item { height: 250px; overflow: hidden; border-radius: var(--border-radius); box-shadow: 0 8px 20px var(--shadow-light); cursor: pointer; transition: transform var(--transition-speed); position: relative; }
.gallery-item:hover { transform: scale(1.02); box-shadow: 0 12px 25px var(--shadow-medium); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease, filter 0.3s ease; }
.gallery-item:hover img { transform: scale(1.1); filter: brightness(0.7); }

/* Location Section */
.location-container { display: grid; grid-template-columns: 2fr 1fr; gap: 60px; align-items: start; }
.location-map { height: 500px; border-radius: var(--border-radius); overflow: hidden; box-shadow: 0 15px 40px var(--shadow-medium); }
.location-info h3 { margin-bottom: 30px; }
.location-points { list-style: none; padding-left: 0; }
.location-points li { margin-bottom: 20px; font-weight: 500; }
.location-points i { margin-right: 15px; color: var(--primary); font-size: 1.2rem; }

/* Contact Section */
.contact-container { display: grid; grid-template-columns: 2fr 1fr; gap: 60px; }
.contact-form { background-color: var(--gray-bg); padding: 50px; border-radius: var(--border-radius); }
.form-group { margin-bottom: 25px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; }
.form-control { width: 100%; padding: 15px; border: 1px solid #CCC; border-radius: 6px; font-size: 1rem; background-color: var(--light); transition: border-color var(--transition-speed), box-shadow var(--transition-speed); font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(75, 76, 60, 0.15); }
textarea.form-control { height: 150px; resize: vertical; }
.form-message { padding: 15px; border-radius: 6px; margin-bottom: 20px; display: none; }
.form-message.success { background-color: #d4edda; color: #155724; }
.form-message.error { background-color: #f8d7da; color: #721c24; }

.contact-info-item { margin-bottom: 30px; }
.contact-info-item h4 { margin-bottom: 10px; color: var(--primary); }
.contact-info-item p, .contact-info-item a { color: #333; text-decoration: none; }
.contact-info-item i { margin-right: 12px; color: var(--primary); }

/* Footer */
footer { background-color: var(--accent); color: var(--text-light); padding: 80px 0 40px; }
.footer-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 50px; margin-bottom: 60px; }
.footer-col h3 { margin-bottom: 25px; color: var(--text-light); }
.footer-col p { color: rgba(255, 255, 255, 0.8); }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 15px; }
.footer-links a { color: rgba(255, 255, 255, 0.8); text-decoration: none; transition: color var(--transition-speed); }
.footer-links a:hover { color: var(--light); }
.social-links { display: flex; margin-top: 25px; gap: 15px; }
.social-links a { display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; background-color: rgba(255, 255, 255, 0.1); border-radius: 50%; color: var(--text-light); transition: all var(--transition-speed); font-size: 1.2rem; }
.social-links a:hover { background-color: var(--text-light); color: var(--primary); transform: translateY(-5px); }
.copyright { text-align: center; padding-top: 40px; border-top: 1px solid rgba(255, 255, 255, 0.15); font-size: 0.9rem; color: rgba(255, 255, 255, 0.7); }
.copyright a { color: var(--text-light); text-decoration: none; font-weight: bold; }

/* Botones Flotantes */
.whatsapp-float, .back-to-top { position: fixed; bottom: 30px; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); z-index: 100; transition: all var(--transition-speed); text-decoration: none; }
.whatsapp-float { right: 30px; background-color: #25D366; color: white; font-size: 2rem; }
.whatsapp-float:hover { transform: scale(1.1); }
.back-to-top { right: 90px; background-color: var(--primary); color: var(--text-light); font-size: 1.25rem; opacity: 0; visibility: hidden; }
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background-color: var(--dark); }

/* Media Queries (Responsive) */
@media (max-width: 992px) {
    nav {
        position: fixed; top: 0; right: -100%; width: 80%; max-width: 400px;
        height: 100vh; background-color: var(--light); box-shadow: -5px 0 15px var(--shadow-medium);
        transition: right 0.3s ease-in-out; overflow-y: auto; z-index: 999;
    }
    nav.active { right: 0; }
    nav ul { flex-direction: column; padding: 100px 30px 30px; align-items: flex-start; }
    nav ul li { margin: 15px 0; width: 100%; }
    .mobile-menu { display: flex; }
    
    .about-content, .location-container, .contact-container { grid-template-columns: 1fr; }
    .location-map { height: 400px; }
}

@media (max-width: 768px) {
    .section { padding: 80px 0; }
    .hero h1 { font-size: 2.5rem; }
    .apartments-grid, .features-container { grid-template-columns: 1fr; }
    .footer-container { grid-template-columns: 1fr; text-align: center; }
    .social-links { justify-content: center; }
    .back-to-top { bottom: 20px; right: 80px; }
    .whatsapp-float { bottom: 20px; right: 20px; }
}

/* --- Form status styles (added) --- */
#form-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  display: none;
}
#form-status.is-loading,
#form-status.is-success,
#form-status.is-error {
  display: block;
}
#form-status.is-loading {
  background: #f0f0f0;
  color: #333;
  position: relative;
  padding-left: 2.5rem;
}
#form-status.is-success {
  background: #e6f9ed;
  color: #1d7a34;
  border: 1px solid #1d7a34;
}
#form-status.is-error {
  background: #ffe6e6;
  color: #b30000;
  border: 1px solid #b30000;
}
#form-status.is-loading::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid #999;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
/* --- end added --- */


/* ========= Responsive Enhancements (added) ========= */

/* Fluid typography for headings */
h1 { font-size: clamp(2rem, 3.5vw + 1rem, 3.25rem); line-height: 1.15; }
h2 { font-size: clamp(1.5rem, 2.2vw + 0.75rem, 2.25rem); line-height: 1.2; }
h3 { font-size: clamp(1.1rem, 1.2vw + 0.75rem, 1.5rem); }

/* Safer container width */
.container { width: min(1200px, 92vw); margin-inline: auto; padding-inline: 16px; }

/* Media assets always scale down */
img, video, canvas, svg { max-width: 100%; height: auto; }

/* Responsive grids fallback */
.apartments-grid,
.features-container,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(16px, 2vw, 28px);
 justify-content:center; align-content:start;  justify-content:center; align-content:start; }

/* Location / Contact split stacks at tablet already (covered), tighten at big screens */
.location-map { height: clamp(320px, 50vh, 520px); }
.contact-form { padding: clamp(24px, 4vw, 50px); }

/* Tighten section spacing on small screens */
@media (max-width: 576px) {
  .section { padding: 60px 0; }
  header .container { padding-block: 10px; }
  .hero h1 { font-size: clamp(1.9rem, 6vw, 2.3rem); }
  .hero p { font-size: clamp(0.95rem, 3.5vw, 1.05rem); }
  .btn, .header-cta { padding: 10px 16px; font-size: 0.95rem; }
  nav { width: 100%; max-width: none; }
}

/* Prevent layout shifts caused by large images */
.hero img, .gallery-item img { aspect-ratio: auto; }

/* Lock scroll when nav open */
body.menu-open { overflow: hidden; }

/* Improve footer stacking on small screens (already partially covered) */
@media (max-width: 768px) {
  .footer-container { display: grid; gap: 24px; }
}

/* Make iframes responsive when inside responsive wrapper */
.responsive-embed { position: relative; width: 100%; padding-top: 56.25%; }
.responsive-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }


/* --- AOS progressive enhancement fallback (added) --- */
html.no-aos [data-aos] { 
  opacity: 1 !important; 
  transform: none !important; 
  transition: none !important;
}


/* --- Header / Menu tweaks (added) --- */
header { position: sticky; top: 0; z-index: 1000; background: rgba(255,255,255,0.98); backdrop-filter: saturate(120%) blur(4px); }
header .logo img { height: auto; max-height: 46px; width: auto; object-fit: contain; }
nav ul li a { display: inline-block; padding: 14px 12px; }
header.scrolled { box-shadow: 0 4px 18px rgba(0,0,0,0.06); }
@media (max-width: 992px){
  header .logo img { max-height: 40px; }
}

/* --- Nav list-style reset (Safari fix) --- */
nav ul,nav li{list-style:none}nav li::marker{content:none}nav ul{margin:0;padding:0}

/* --- Always-burger navigation (final) --- */
.mobile-menu{display:flex;flex-direction:column;cursor:pointer;padding:6px;z-index:1001}
.mobile-menu span{width:30px;height:3px;background:var(--dark);margin:4px 0;transition:all .3s;border-radius:3px}
.mobile-menu.active span:nth-child(1){transform:rotate(45deg) translate(5px,5px)}
.mobile-menu.active span:nth-child(2){opacity:0}
.mobile-menu.active span:nth-child(3){transform:rotate(-45deg) translate(7px,-6px)}
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);opacity:0;visibility:hidden;transition:opacity .3s,visibility .3s;z-index:998}
.overlay.active{opacity:1;visibility:visible}
nav{position:fixed;top:0;right:-100%;width:min(420px,85vw);height:100vh;background:#fff;box-shadow:-5px 0 15px rgba(0,0,0,.15);transition:right .3s ease;overflow-y:auto;z-index:999}
nav.active{right:0}
nav ul{display:flex;flex-direction:column;gap:12px;padding:90px 24px 24px}
.header-cta{margin-left:0}
body.menu-open{overflow:hidden}
header{position:sticky;top:0;z-index:1000;background:rgba(255,255,255,.98);backdrop-filter:saturate(120%) blur(4px)}
header.scrolled{box-shadow:0 4px 18px rgba(0,0,0,.06)}
header .logo img{max-height:46px;width:auto;object-fit:contain}
@media (max-width:992px){header .logo img{max-height:40px}}

/* Hero background image-set (progressive enhancement) */
.hero{ --hero-bg: url('imagenes/FACHADA_HERO-w1920.webp'); background-image: var(--hero-bg); }
@supports (background-image: image-set(url('x') 1x)) {
  .hero{ background-image: image-set(
    url('imagenes/FACHADA_HERO-w960.webp') 1x,
    url('imagenes/FACHADA_HERO-w1920.webp') 2x
  ); }
}

/* Features/Experiencia centering */
.features-container{
  justify-content: center;
  align-content: start;
  margin-inline: auto;
}
.features-container .feature{
  flex: 1 1 260px;
  max-width: 320px;
}

/* Gallery centering fix */
.gallery-grid{
  justify-content: center;
  align-content: start;
  margin-inline: auto;
 justify-content:center; align-content:start; }
.gallery-grid .gallery-item{
  flex: 1 1 280px;
  max-width: 400px;
}


/* --- Centering for 'Experiencia en cada detalle' cards (final) --- */
.features-container, .features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  justify-content: center;   /* center the last row */
  align-content: start;
}
.feature-card, .features-card {
  max-width: 360px;
  width: 100%;
  margin-inline: auto;       /* center individual cards */
}
@media (min-width: 1200px){
  .feature-card, .features-card { max-width: 380px; }
}
