/**
 * 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, #E6DCC6);
}

.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: center 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) ───────────────── */
.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: 0 20px 32vh;
}

.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;
}

.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: 14px 34px;
    background-color: var(--hero-anim-cta-bg, #454331);
    color: var(--hero-anim-cta-color, #fbfaf7);
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(21, 23, 23, 0.15);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.viba-hero-anim__cta:hover {
    background-color: var(--accent, #C5B59B);
    color: var(--hero-anim-cta-color, #fbfaf7);
    transform: translateY(-2px);
}

.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) ─────────────────────── */
.viba-hero-anim__building {
    position: absolute;
    left: 0;
    right: 0;
    top: 55%;
    z-index: 2;
    pointer-events: none;
    will-change: transform;
}

.viba-hero-anim__building img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Capa 3: Composite enmascarado (revelado por el logo) ──── */
.viba-hero-anim__composite {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    -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;
    mask-position: center;
    -webkit-mask-size: 280px auto;
    mask-size: 280px auto;
}

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

.viba-hero-anim__composite-building {
    position: absolute;
    left: 0;
    right: 0;
    top: 55%;
    will-change: transform;
}

.viba-hero-anim__composite-building img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── 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: 280px;
    height: auto;
}

@media (min-width: 768px) {
    .viba-hero-anim__outline-svg {
        width: 550px;
    }
}

.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, #C5B59B);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* ── Breakpoints: composición del edificio ─────────────────── */
/* El ancho/centrado se aplica al IMG (no al wrapper) porque GSAP anima
   el transform del wrapper — un translateX en CSS sería sobreescrito. */
@media (max-width: 767px) {
    .viba-hero-anim__building img,
    .viba-hero-anim__composite-building img {
        width: 180%;
        max-width: none; /* el preflight de Tailwind pone max-width:100% */
        margin-left: -40%;
    }

    .viba-hero-anim__building,
    .viba-hero-anim__composite-building {
        top: 50%;
    }

    .viba-hero-anim__content {
        padding-bottom: 36vh;
    }

    .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__building img,
    .viba-hero-anim__composite-building img {
        width: 130%;
        max-width: none;
        margin-left: -15%;
    }
}

/* ── Capa 5: Humo inferior ─────────────────────────────────── */
.viba-hero-anim__smoke {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    height: 200px;
    pointer-events: none;
}

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

.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;
}
