/* =========================================================
   NovaStor Propiedades — Motion layer (oct-2026)
   Se carga DESPUÉS de styles.css. Respeta prefers-reduced-motion.
   ========================================================= */

:root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Barra de progreso de scroll ---------- */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-primary));
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 1100;
    pointer-events: none;
}

/* ---------- Navbar ---------- */
.navbar { animation: navDrop 0.8s var(--ease-out) backwards; }
.navbar.nav-hidden { transform: translateY(-100%); }
.nav-link.is-current { color: var(--color-primary); }
.nav-link.is-current::after { width: 100%; }

.mobile-toggle span { transform-origin: center; }
.mobile-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@keyframes navDrop {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ---------- Hero: Ken Burns + entrada escalonada ---------- */
.hero {
    background: #0b0b0b;
    overflow: hidden;
    isolation: isolate;
}

.hero::before {
    content: '';
    position: absolute;
    inset: -4%;
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)),
                url('../image/photo-1600596542815-ffad4c1539a9.jpg') center / cover no-repeat;
    transform: scale(1.08);
    animation: kenBurns 22s ease-in-out infinite alternate;
    z-index: -1;
    will-change: transform;
}

.hero-overlay { z-index: 0; }
.hero > .container { position: relative; z-index: 1; will-change: transform, opacity; }
.hero .stats-bar { z-index: 1; }

/* Brillo sutil que recorre el hero */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mx, 70%) var(--my, 30%), rgba(168, 28, 72, 0.22), transparent 60%);
    z-index: 0;
    pointer-events: none;
    transition: background 0.2s linear;
}

@keyframes kenBurns {
    from { transform: scale(1.08); }
    to   { transform: translate3d(-1.5%, 1%, 0) scale(1.18); }
}

.hero-content > * {
    animation: heroIn 0.9s var(--ease-out) backwards;
}
.hero-content > *:nth-child(1) { animation-delay: 0.25s; }
.hero-content > *:nth-child(2) { animation-delay: 0.40s; }
.hero-content > *:nth-child(3) { animation-delay: 0.60s; }
.hero-content > *:nth-child(4) { animation-delay: 0.80s; }

@keyframes heroIn {
    from { opacity: 0; transform: translateY(28px); }
}

/* Subrayado animado bajo "hogar ideal" */
.hero h1 .text-accent {
    position: relative;
    display: inline-block;
    color: #d33a68;
}
.hero h1 .text-accent::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.04em;
    height: 0.12em;
    background: currentColor;
    border-radius: 99px;
    transform: scaleX(0);
    transform-origin: left;
    animation: underline 0.9s 1.2s var(--ease-out) forwards;
    opacity: 0.55;
}
@keyframes underline { to { transform: scaleX(1); } }

/* Badge con pulso */
.hero .badge {
    position: relative;
    padding-left: 32px;
}
.hero .badge::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--color-primary-light);
    box-shadow: 0 0 0 0 rgba(168, 28, 72, 0.7);
    animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
    0%   { box-shadow: 0 0 0 0 rgba(168, 28, 72, 0.7); }
    70%  { box-shadow: 0 0 0 10px rgba(168, 28, 72, 0); }
    100% { box-shadow: 0 0 0 0 rgba(168, 28, 72, 0); }
}

/* Stats bar sube al final */
.hero .stats-bar {
    animation: statsIn 0.9s 1s var(--ease-out) backwards;
}
@keyframes statsIn { from { opacity: 0; transform: translateY(100%); } }

.stat-item { transition: transform 0.4s var(--ease-spring); }
.stat-item:hover { transform: translateY(-4px); }

/* ---------- Botones: brillo al pasar ---------- */
.btn-primary,
.btn-white {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.btn-primary::after,
.btn-white::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(110deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.7s var(--ease-out);
    z-index: -1;
    pointer-events: none;
}
.btn-primary:hover::after,
.btn-white:hover::after { left: 140%; }

/* ---------- Reveals al hacer scroll ---------- */
.slide-up {
    transform: translateY(40px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
    transition-delay: var(--d, 0s);
}

.reveal-left  { transform: translateX(-50px); }
.reveal-right { transform: translateX(50px); }
.reveal-zoom  { transform: scale(0.94); }

.slide-up.active,
.reveal-left.active,
.reveal-right.active,
.reveal-zoom.active { transform: none; }

/* Etiqueta de sección con línea que se dibuja */
.section-label {
    position: relative;
    padding-left: 0;
    transition: padding-left 0.6s var(--ease-out) 0.2s;
}
.section-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.6s var(--ease-out) 0.2s;
}
.active .section-label,
.section-label.active { padding-left: 36px; }
.active .section-label::before,
.section-label.active::before { width: 24px; }

/* ---------- Nosotros ---------- */
.image-wrapper img {
    transform: scale(1.12);
    transition: transform 1.6s var(--ease-out);
}
.about-image.active .image-wrapper img { transform: scale(1); }

.experience-badge {
    animation: floatY 5s ease-in-out infinite;
    z-index: 2;
}
@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.feature-icon { transition: transform 0.5s var(--ease-spring), background 0.3s, color 0.3s; }
.feature:hover .feature-icon {
    transform: rotate(360deg) scale(1.1);
    background: var(--color-primary);
    color: #fff;
}

/* ---------- Servicios: tilt 3D + glow ---------- */
.services-grid { perspective: 1000px; }

.service-card {
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: transform 0.5s var(--ease-out), box-shadow 0.4s, border-color 0.4s, opacity 0.9s var(--ease-out);
    transition-delay: var(--d, 0s);
}
.service-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(300px circle at var(--cx, 50%) var(--cy, 0%), rgba(139, 21, 56, 0.09), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.service-card:hover::before { opacity: 1; }

.service-card.active:hover {
    transform: translateY(-10px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}

.service-card:hover .service-icon {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 12px 24px rgba(139, 21, 56, 0.25);
}
.service-icon { transition: transform 0.5s var(--ease-spring), background 0.3s, color 0.3s, box-shadow 0.3s; }

.service-icon svg path {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    transition: stroke-dashoffset 1.6s var(--ease-out) calc(var(--d, 0s) + 0.3s);
}
.service-card.active .service-icon svg path { stroke-dashoffset: 0; }

/* ---------- Propiedades ---------- */
.carousel-track { transition: transform 0.7s var(--ease-out); }

.property-card { transition: transform 0.5s var(--ease-out), box-shadow 0.5s; }
.property-card:hover { transform: translateY(-8px); }
.property-image img { transition: transform 1.2s var(--ease-out); }
.property-card:hover .property-image img { transform: scale(1.08); }

.property-tag {
    transition: transform 0.4s var(--ease-spring);
}
.property-card:hover .property-tag { transform: translateY(-2px) scale(1.05); }

.property-price { transition: padding-bottom 0.4s var(--ease-out); }
.property-card:hover .property-price { padding-bottom: 26px; }

.carousel-dots button.carousel-dot {
    border: 0;
    padding: 0;
}

/* ---------- CTA: patrón en movimiento + orbes ---------- */
.cta::before { animation: dotsDrift 30s linear infinite; }
@keyframes dotsDrift {
    from { background-position: 0 0; }
    to   { background-position: 400px 400px; }
}

.cta::after {
    content: '';
    position: absolute;
    width: 520px;
    height: 520px;
    right: -160px;
    top: -200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.14), transparent 65%);
    animation: orb 12s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes orb {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(-220px, 160px) scale(1.25); }
}

/* ---------- Contacto ---------- */
.info-item { transition: transform 0.4s var(--ease-out); }
.info-item:hover { transform: translateX(6px); }
.info-icon { transition: transform 0.5s var(--ease-spring), background 0.3s; }
.info-item:hover .info-icon { transform: scale(1.12) rotate(-6deg); background: rgba(139, 21, 56, 0.18); }

.contact-form-wrapper {
    border: 1px solid transparent;
    transition: box-shadow 0.4s, border-color 0.4s, opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.contact-form-wrapper:focus-within {
    box-shadow: 0 20px 60px rgba(139, 21, 56, 0.12);
    border-color: rgba(139, 21, 56, 0.15);
}

/* Honeypot */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Consentimientos */
.form-consents {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--color-gray-200);
    border-radius: 12px;
}

.check {
    position: relative;
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 12px;
    align-items: start;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-gray-600);
}
.check input {
    position: absolute;
    opacity: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
}
.check-box {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border: 2px solid #c9c9c9;
    border-radius: 6px;
    background: #fff;
    display: grid;
    place-items: center;
    transition: background 0.25s, border-color 0.25s, transform 0.3s var(--ease-spring);
}
.check-box::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    margin-top: -2px;
    transition: transform 0.3s var(--ease-spring);
}
.check input:checked + .check-box {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: scale(1.06);
}
.check input:checked + .check-box::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.25); }
.check-text a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.check-text em { color: var(--color-primary); font-style: normal; font-weight: 700; }

/* Errores */
.form-group .field-error,
.check .field-error {
    font-size: 0.8rem;
    color: #c0392b;
    font-weight: 500;
}
.check .field-error { grid-column: 2; }
.form-group input.invalid,
.form-group select.invalid,
.form-group textarea.invalid {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}
.check.invalid .check-box { border-color: #c0392b; }
.shake { animation: shake 0.45s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%  { transform: translateX(-6px); }
    40%  { transform: translateX(6px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); }
}

/* Botón enviar con spinner */
#formSubmit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
#formSubmit.loading { pointer-events: none; opacity: 0.85; }
#formSubmit.loading .btn-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-status {
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 10px;
    padding: 0 14px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s var(--ease-out);
}
.form-status.show { max-height: 200px; opacity: 1; padding: 12px 14px; }
.form-status.ok  { background: #e8f6ee; color: #1e7b45; }
.form-status.err { background: #fdecea; color: #a93226; }

.form-note {
    font-size: 0.78rem;
    color: var(--color-gray-600);
    line-height: 1.5;
}
.form-note a { color: var(--color-primary); }

/* ---------- WhatsApp flotante ---------- */
.whatsapp-float {
    animation: waIn 0.6s 1.6s var(--ease-spring) backwards;
}
.whatsapp-float::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #25D366;
    z-index: -1;
    animation: waRing 2.4s 2.4s ease-out infinite;
}
@keyframes waIn {
    from { transform: scale(0) rotate(-45deg); opacity: 0; }
    to   { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes waRing {
    0%   { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* Footer */
.social-links a { transition: transform 0.4s var(--ease-spring), background 0.3s; }
.social-links a:hover { transform: translateY(-4px); }

/* ---------- Accesibilidad: sin movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        transition-delay: 0s !important;
    }
    .slide-up, .reveal-left, .reveal-right, .reveal-zoom,
    .hero-content > *, .hero .stats-bar { opacity: 1 !important; transform: none !important; }
}

@media (max-width: 768px) {
    .reveal-left, .reveal-right { transform: translateY(40px); }
    .cta::after { width: 320px; height: 320px; }
}
