/**
 * VIBA Hero Animation — estilos del hero scroll-driven
 * z-order: Sky(0) → Content(1) → Building(2) → Composite(3) → Outline(4) → Smoke(5)
 *
 * Colores y máscara controlados por CSS variables (editables desde Personalizar VIBA):
 *   --hero-anim-title-color, --hero-anim-subtitle-color, --hero-anim-strong-color,
 *   --hero-anim-stroke-color, --hero-anim-cta-bg, --hero-anim-cta-color,
 *   --hero-anim-mask-url
 */

.viba-hero-anim {
    position: relative;
    height: 100vh;
    background-color: var(--background, #dad6c8);
    /* z-index bajo y explícito: al pinear, GSAP pone este elemento en
       position:fixed por inline style. Un z-index fijo (en vez de auto)
       crea su propio contexto de apilamiento y lo mantiene SIEMPRE por
       debajo del navbar (z-index:1000, position:sticky), sin depender del
       orden en el DOM ni de cómo GSAP manipule el posicionamiento. */
    z-index: 1;
}

.viba-hero-anim__stage {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* En móvil 100vh incluye la barra de URL del navegador y corta el contenido;
   svh = viewport pequeño (siempre visible) */
@supports (height: 100svh) {
    .viba-hero-anim,
    .viba-hero-anim__stage {
        height: 100svh;
    }
}

/* ── Capa 0: Cielo ─────────────────────────────────────────── */
.viba-hero-anim__sky {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.viba-hero-anim__sky-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--hero-anim-sky-position, center bottom);
}

.viba-hero-anim[data-sky-pos="top-left"] .viba-hero-anim__sky-img { object-position: left top; }
.viba-hero-anim[data-sky-pos="top-center"] .viba-hero-anim__sky-img { object-position: center top; }
.viba-hero-anim[data-sky-pos="top-right"] .viba-hero-anim__sky-img { object-position: right top; }
.viba-hero-anim[data-sky-pos="center-left"] .viba-hero-anim__sky-img { object-position: left center; }
.viba-hero-anim[data-sky-pos="center"] .viba-hero-anim__sky-img { object-position: center center; }
.viba-hero-anim[data-sky-pos="center-right"] .viba-hero-anim__sky-img { object-position: right center; }
.viba-hero-anim[data-sky-pos="bottom-left"] .viba-hero-anim__sky-img { object-position: left bottom; }
.viba-hero-anim[data-sky-pos="bottom-center"] .viba-hero-anim__sky-img { object-position: center bottom; }
.viba-hero-anim[data-sky-pos="bottom-right"] .viba-hero-anim__sky-img { object-position: right bottom; }

/* Nubes flotantes */
.viba-hero-anim__clouds {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.viba-hero-anim__cloud {
    position: absolute;
    pointer-events: none;
    opacity: 0.45;
    filter: blur(1.5px);
}

.viba-hero-anim__cloud img {
    width: 100%;
    height: auto;
}

.viba-hero-anim__cloud--1 {
    top: 10vh;
    left: -40%;
    width: 480px;
    animation: viba-cloud-drift-1 160s linear infinite;
}

.viba-hero-anim__cloud--2 {
    top: 25vh;
    left: -30%;
    width: 320px;
    opacity: 0.35;
    animation: viba-cloud-drift-2 120s linear infinite;
    animation-delay: -40s;
}

.viba-hero-anim__cloud--3 {
    top: 40vh;
    left: -20%;
    width: 200px;
    opacity: 0.25;
    animation: viba-cloud-drift-3 80s linear infinite;
    animation-delay: -20s;
}

@keyframes viba-cloud-drift-1 {
    0%   { transform: translateX(0); }
    100% { transform: translateX(180vw); }
}

@keyframes viba-cloud-drift-2 {
    0%   { transform: translateX(0); }
    100% { transform: translateX(160vw); }
}

@keyframes viba-cloud-drift-3 {
    0%   { transform: translateX(0); }
    100% { transform: translateX(140vw); }
}

@media (prefers-reduced-motion: reduce) {
    .viba-hero-anim__cloud { animation: none; }
}

/* ── Capa 1: Contenido (detrás del edificio, zona superior) ── */
/* El PNG del edificio es opaco: el texto vive SOLO en el cielo
   (aprox. el 45% superior). padding-bottom empuja el bloque hacia arriba. */
.viba-hero-anim__content {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8vh var(--viba-gutter, 1.5rem) 52vh;
    pointer-events: none;
}

.viba-hero-anim__content a {
    pointer-events: auto;
}

.viba-hero-anim__eyebrow {
    font-family: var(--font-secondary, 'Century Gothic Pro'), sans-serif;
    font-size: clamp(11px, 1.4vw, 14px);
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--hero-anim-eyebrow-color, var(--accent, #c0b5a5));
    margin: 0 0 18px;
}

.viba-hero-anim__title {
    font-family: var(--font-primary, 'Century Gothic Pro'), sans-serif;
    font-size: clamp(42px, 8.5vw, 96px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--hero-anim-title-color, #000);
    margin: 0 0 15px;
    text-wrap: balance;
}

.viba-hero-anim__subtitle {
    font-family: var(--font-secondary, 'Century Gothic Pro'), sans-serif;
    font-size: clamp(14px, 1.8vw, 19px);
    line-height: 1.6;
    color: var(--hero-anim-subtitle-color, #fff);
    max-width: 560px;
    margin: 0 0 25px;
}

.viba-hero-anim__subtitle strong {
    color: var(--hero-anim-strong-color, #000);
    font-weight: 600;
}

.viba-hero-anim__cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 40px;
    background-color: var(--hero-anim-cta-bg, var(--viba-btn-bg, #454139));
    color: var(--hero-anim-cta-color, var(--viba-btn-fg, #dad6c8));
    border: none;
    border-radius: 9999px;
    font-family: var(--font-primary, "Century Gothic Pro", system-ui, sans-serif);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.25s ease, transform 0.2s ease, color 0.25s ease;
}

.viba-hero-anim__cta:hover {
    filter: brightness(1.08);
    color: var(--hero-anim-cta-color, var(--viba-btn-fg, #dad6c8));
    text-decoration: none;
}

.viba-hero-anim__cta:active {
    filter: brightness(0.88);
    transform: scale(0.98);
}

.viba-hero-anim__cta:focus-visible {
    outline: 2px solid var(--viba-btn-border, #454139);
    outline-offset: 3px;
}

.viba-hero-anim__cta-arrow {
    transition: transform 0.3s ease;
}

.viba-hero-anim__cta:hover .viba-hero-anim__cta-arrow {
    transform: translateX(4px);
}

/* ── Capa 2: Edificio (sobre el texto) ─────────────────────── */
/* Capa a pantalla completa. GSAP la inicia bajada (y > 0) para dejar
   cielo al copy. auto/contain: PNG completo sentado abajo (no recorta).
   cover: llena el viewport y sí recorta. */
.viba-hero-anim__building {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    will-change: transform;
    overflow: hidden;
}

.viba-hero-anim__building img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center bottom;
    max-width: none;
}

/* ── Capa 3: Composite enmascarado (revelado por el logo) ──── */
.viba-hero-anim__composite {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transform-origin: center center;
    -webkit-mask-image: var(--hero-anim-mask-url);
    mask-image: var(--hero-anim-mask-url);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center center;
    mask-position: center center;
    -webkit-mask-size: min(82vw, 340px) auto;
    mask-size: min(82vw, 340px) auto;
    -webkit-mask-mode: alpha;
    mask-mode: alpha;
}

@media (min-width: 768px) {
    .viba-hero-anim__composite {
        -webkit-mask-size: min(58vw, 640px) auto;
        mask-size: min(58vw, 640px) auto;
    }
}

.viba-hero-anim__composite-building {
    position: absolute;
    inset: 0;
    will-change: transform;
    overflow: hidden;
}

.viba-hero-anim__composite-building img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 32%;
    max-width: none;
}

/* ── Capa 4: Logo outline (stroke-draw) ────────────────────── */
.viba-hero-anim__outline {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
}

.viba-hero-anim__outline-svg {
    width: min(82vw, 340px);
    height: auto;
}

@media (min-width: 768px) {
    .viba-hero-anim__outline-svg {
        width: min(58vw, 640px);
    }
}

.viba-hero-anim__outline-svg path,
.viba-hero-anim__outline-svg polygon,
.viba-hero-anim__outline-svg rect {
    fill: none;
    stroke: var(--hero-anim-stroke-color, #c0b5a5);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* ── Breakpoints: composición del edificio ─────────────────── */
/* auto (default) y contain: fachada completa sentada abajo.
   cover: encuadre cinematográfico que recorta (PNG con transparencia). */
@media (min-width: 1024px) {
    /* El PNG es 1100×821, más alto que 16:9. contain al 100% de altura
       taparía el CTA; lo sentamos en la mitad inferior. */
    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__building img {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 66%;
        margin-left: 0;
        object-fit: contain;
        object-position: center bottom;
    }
}

.viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__building img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin-left: 0;
    object-fit: cover;
    object-position: center 32%;
}

@media (max-width: 1023px) {
    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__building img,
    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__composite-building img {
        width: 100%;
        height: 100%;
        margin-left: 0;
        object-fit: contain;
        object-position: center bottom;
    }

    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__content {
        justify-content: flex-start;
        padding: max(5.5rem, 10vh) var(--viba-gutter, 1.5rem) 38vh;
    }
}

.viba-hero-anim[data-building-fit="contain"] .viba-hero-anim__building img,
.viba-hero-anim[data-building-fit="contain"] .viba-hero-anim__composite-building img {
    margin-left: 0;
    object-fit: contain;
    object-position: center bottom;
}

@media (max-width: 767px) {
    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__building img,
    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__composite-building img {
        width: 180%;
        height: 100%;
        margin-left: -40%;
        object-fit: cover;
        object-position: center 28%;
    }

    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__content {
        padding: 10vh var(--viba-gutter, 1.5rem) 55vh;
    }

    .viba-hero-anim__content::before {
        content: "";
        position: absolute;
        inset: 0 0 36% 0;
        background: linear-gradient(180deg, rgba(8, 16, 28, 0.46) 0%, rgba(8, 16, 28, 0.16) 62%, transparent 100%);
        pointer-events: none;
        z-index: 0;
    }

    .viba-hero-anim__content > * {
        position: relative;
        z-index: 1;
    }

    .viba-hero-anim__title,
    .viba-hero-anim__subtitle,
    .viba-hero-anim__eyebrow {
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.42), 0 10px 28px rgba(0, 0, 0, 0.28);
    }

    .viba-hero-anim__cloud--1 { width: 280px; }
    .viba-hero-anim__cloud--2 { width: 200px; }
    .viba-hero-anim__cloud--3 { width: 140px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__building img,
    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__composite-building img {
        width: 130%;
        height: 100%;
        margin-left: -15%;
    }
}

/*
 * Desktop bajo (p. ej. 1280×665 del cliente): auto/contain reduce la
 * fachada para dejar cielo al copy. cover sigue ampliando (recorta).
 */
@media (min-width: 1024px) and (max-height: 750px) {
    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__building img {
        height: 50%;
    }

    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__content {
        justify-content: flex-start;
        padding: max(4.75rem, 7vh) var(--viba-gutter, 1.5rem) 46vh;
    }

    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__building img,
    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__composite-building img {
        width: 142%;
        height: 115%;
        margin-left: -21%;
        object-fit: cover;
        object-position: center 40%;
    }

    .viba-hero-anim[data-building-fit="cover"] .viba-hero-anim__content {
        padding-bottom: 48vh;
    }
}

/* Wide but short viewports: visual-editor preview, landscape phones and
   compact laptops. Preserve a clean text zone above a smaller building. */
@media (max-height: 500px) and (min-width: 600px) {
    .viba-hero-anim__content {
        justify-content: flex-start;
        padding: clamp(1.25rem, 6vh, 2rem) var(--viba-gutter, 1.5rem) 48%;
    }

    .viba-hero-anim__eyebrow {
        margin-bottom: 8px;
        font-size: 10px;
    }

    .viba-hero-anim__title {
        max-width: 90%;
        margin-bottom: 7px;
        font-size: clamp(2rem, 5.6vw, 2.75rem);
        line-height: 1;
    }

    .viba-hero-anim__subtitle {
        max-width: min(90%, 520px);
        margin-bottom: 10px;
        font-size: 12px;
        line-height: 1.35;
    }

    .viba-hero-anim__cta {
        padding: 9px 24px;
        font-size: 12px;
    }

    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__building img,
    .viba-hero-anim:not([data-building-fit="cover"]) .viba-hero-anim__composite-building img,
    .viba-hero-anim[data-building-fit="contain"] .viba-hero-anim__building img,
    .viba-hero-anim[data-building-fit="contain"] .viba-hero-anim__composite-building img {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 58%;
        object-fit: contain;
        object-position: center bottom;
    }

    .viba-hero-anim__outline-svg {
        width: min(48vw, 270px);
    }

    .viba-hero-anim__composite {
        -webkit-mask-size: min(48vw, 270px) auto;
        mask-size: min(48vw, 270px) auto;
    }

    .viba-hero-anim__smoke {
        height: 54px;
    }
}

/* ── Capa 5: Humo / nubes inferiores ───────────────────────── */
/* Altura ~50% menos que antes (200→100 / 350→175). */
.viba-hero-anim__smoke {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    height: 100px;
    pointer-events: none;
}

@media (min-width: 768px) {
    .viba-hero-anim__smoke {
        height: 175px;
    }
}

@media (min-width: 1024px) and (max-height: 750px) {
    .viba-hero-anim__smoke {
        height: 140px;
    }
}

.viba-hero-anim__smoke img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

/* ── Estado estático (sin JS / reduced motion) ─────────────── */
.viba-hero-anim--static .viba-hero-anim__outline,
.viba-hero-anim--static .viba-hero-anim__composite {
    display: none;
}

/* ── Integración Lenis ─────────────────────────────────────── */
html.lenis,
html.lenis body {
    height: auto;
}

.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis-smooth [data-lenis-prevent] {
    overscroll-behavior: contain;
}

.lenis-stopped {
    overflow: hidden;
}

.lenis-scrolling iframe {
    pointer-events: none;
}
