/* ─────────────────────────────────────────
   Casa de la Makana — Legado Styles
   Sección 1: Hero "El Legado"
───────────────────────────────────────── */

/* ── Parallax system (replica de home.css) ── */
.parallax-bg {
    transform:
        perspective(1200px)
        translate3d(0, var(--parallax-y, 0), 0)
        rotateX(var(--parallax-rotate-x, 0deg))
        rotateY(var(--parallax-rotate-y, 0deg))
        scale(var(--parallax-scale, 1.0));
    transform-origin: center center;
    will-change: transform;
    transition: none;
    backface-visibility: hidden;
}

/* ── Text Reveal System (Fluidez pura CSS) ── */
[data-split],
[data-reveal] {
    opacity: 0;
    filter: blur(8px);
    transform: translate3d(0, 48px, 0) scale(0.98);
    transition:
        opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
        filter 1.2s cubic-bezier(0.16, 1, 0.3, 1),
        transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--scroll-delay, 0ms);
    will-change: opacity, filter, transform;
}

[data-split].is-visible,
[data-reveal].is-visible {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0) scale(1);
}



/* ═══════════════════════════════════════════════
   SECCIÓN 1: HERO EL LEGADO
════════════════════════════════════════════════ */

main > section {
    position: relative;
    display: block;
}

#nuestra-historia,
#guardianes-oficio,
#legado-fondo-cuatro,
#legado-fondo-cinco {
    content-visibility: auto;
    contain-intrinsic-size: 100vh;
}

#app {
    /* Natural DOM flow is used to avoid layout thrashing */
}

#legado-hero {
    position: relative;
    z-index: 10;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background-color: #000000;
}

/* ── Fondo absoluto puro ─────────────── */
.legado-hero__bg {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 10%;
    z-index: 1;
    display: block;
    backface-visibility: hidden;
}

/* ── Bloque de texto flotante ────────── */
/* Posicionado en la zona inferior-izquierda, tal como el mockup */
.legado-hero__text {
    position: absolute;
    bottom: 39vh;
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    max-width: 42vw;
    padding-left: 8vw;
}

/* Título: Cinzel Decorative, tono dorado/crema cálido */
.legado-hero__title {
    font-family: var(--font-display);
    font-size: clamp(2.3rem, 3.95vw, 5rem);
    font-weight: 400;
    letter-spacing: 0.22em;
    line-height: 1.1;
    color: #f4ad67;
}

/* Párrafo 1: texto corto introductorio */
.legado-hero__p1 {
    font-family: var(--font-primary);
    font-size: clamp(0.78rem, 0.88vw, 0.96rem);
    font-weight: 300;
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: #cccccc;
}

/* Párrafo 2: descripción más larga */
.legado-hero__p2 {
    font-family: var(--font-primary);
    font-size: clamp(0.78rem, 0.88vw, 0.96rem);
    font-weight: 300;
    line-height: 1.9;
    letter-spacing: 0.02em;
    color: #aaaaaa;
}

/* Keyframe propio para no interferir con home.css */
@keyframes lgFadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsivo ──────────────────────── */
@media (max-width: 960px) {
    .parallax-bg {
        will-change: auto;
    }

    .legado-hero__text {
        max-width: 94vw;
        width: 100%;
        padding: 0 3vw;
        left: 50%;
        transform: translateX(-50%);
        bottom: 30vh;
        text-align: center;
        align-items: center;
    }

    .legado-hero__title {
        font-size: clamp(1.87rem, 8.3vw, 2.7rem);
        letter-spacing: 0.16em;
    }

    .legado-hero__p1,
    .legado-hero__p2 {
        font-size: 0.85rem;
    }
}


/* ═══════════════════════════════════════════════
   SECCIÓN 2: NUESTRA HISTORIA
════════════════════════════════════════════════ */

#nuestra-historia {
    position: relative;
    z-index: 20;
    background-color: #000000;
    width: 100vw;
    overflow: hidden;
    isolation: isolate;
    contain: paint;
    transform: translate3d(0, 0, 0);
}

/* Contenedor Hero 100vh del Video */
.historia__hero {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 2rem;
}

/* Video ocupa 100% del fondo absoluto de esta sección */
.historia__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    transform: none;
    display: block;
    backface-visibility: hidden;
}

/* Bloque del Título: Flota en la parte superior, exactamente 5% más arriba */
.historia__header {
    position: absolute;
    left: 0;
    width: 100%;
    top: 8vh;
    text-align: center;
    z-index: 3;
}

.historia__title {
    font-family: var(--font-display);
    font-size: clamp(1.43rem, 2.45vw, 2.86rem);
    font-weight: 400;
    letter-spacing: 0.32em;
    color: #f4ad67;
    margin: 0;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.9);
}

/* Contenedor Negro con la descripción (abajo del video) */
.historia__static-panel {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: auto;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5vh 0;
    margin: 0;
    transform: none;
    will-change: auto;
}

.historia__static-text {
    width: 100%;
    max-width: 68vw;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    position: relative;
    top: -20vh; /* Subido un 20% de la pantalla hacia arriba */
}

.historia__static-p {
    font-family: var(--font-primary);
    font-size: clamp(0.92rem, 1.1vw, 1.2rem);
    font-weight: 300;
    line-height: 1.9;
    letter-spacing: 0.02em;
    color: #cccccc;
    margin: 0;
    opacity: 1;
    transform: none;
    animation: none;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.75);
}

.historia__static-text--glass {
    position: relative;
    max-width: min(1632px, 96vw);
    padding: clamp(0.95rem, 1.8vw, 1.35rem) clamp(2.2rem, 6.4vw, 6.5rem);
    overflow: hidden;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.025) 36%, rgba(3, 4, 5, 0.26) 100%),
        radial-gradient(120% 150% at 12% 8%, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.035) 36%, transparent 68%),
        rgba(8, 10, 11, 0.36);
    backdrop-filter: blur(16px) saturate(1.18) contrast(1.02);
    -webkit-backdrop-filter: blur(16px) saturate(1.18) contrast(1.02);
    box-shadow:
        0 24px 52px rgba(0, 0, 0, 0.48),
        0 8px 18px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -16px 26px rgba(0, 0, 0, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.055);
}

.historia__static-text--glass::before {
    content: "";
    position: absolute;
    inset: 6px 18px auto 18px;
    height: 26%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.015));
    opacity: 0.34;
    pointer-events: none;
}

/* ── Responsivo ──────────────────────── */
@media (max-width: 960px) {
    .historia__header {
        top: 6vh;
    }

    .historia__title {
        font-size: clamp(1.22rem, 5.6vw, 1.84rem);
        letter-spacing: 0.2em;
    }

    .historia__static-panel {
        padding: 8vh 0;
    }

    .historia__static-text {
        max-width: 94vw;
        width: 100%;
        padding: 0 3vw;
        text-align: center;
        align-items: center;
        margin: 0 auto;
        top: 6vh; /* Bajado en móvil para evitar choque con el título */
    }

    .historia__static-text--glass {
        padding: 2.2rem 1.6rem; /* Aumenta el aire interno en móvil para alejar el texto de los bordes */
    }

    .historia__static-p {
        font-size: 0.95rem;
    }
}


/* ═══════════════════════════════════════════════
   SECCIÓN 3: QUIENES GUARDAN EL OFICIO
════════════════════════════════════════════════ */

#guardianes-oficio {
    position: relative;
    z-index: 30;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background-color: #000000;
    isolation: isolate;
}

#legado-fondo-cuatro {
    position: relative;
    z-index: 40;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #000000;
}

#legado-fondo-cuatro::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45); /* Capa oscura para garantizar legibilidad premium */
    z-index: 2;
    pointer-events: none;
}

.legado-fondo-cuatro__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    z-index: 1;
}

.legado-fondo-cuatro__content {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 8vw;
    transform: translateY(-4vh); /* Desplazamiento hacia arriba reducido al 4% (bajado un 4% más) */
}

.legado-fondo-cuatro__title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.5vw, 3.4rem);
    font-weight: 400;
    letter-spacing: 0.18em;
    color: #f4ad67;
    margin-bottom: 2.2rem;
    line-height: 1.2;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.legado-fondo-cuatro__glass {
    position: relative;
    width: min(1280px, 92vw);
    padding: clamp(1.35rem, 2.4vw, 2rem) clamp(1.6rem, 5vw, 5rem);
    overflow: hidden;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055) 0%, rgba(255, 255, 255, 0.018) 36%, rgba(3, 4, 5, 0.16) 100%),
        radial-gradient(120% 150% at 12% 8%, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.022) 36%, transparent 68%),
        rgba(8, 10, 11, 0.18);
    backdrop-filter: blur(9px) saturate(1.16) contrast(1.02);
    -webkit-backdrop-filter: blur(9px) saturate(1.16) contrast(1.02);
    box-shadow:
        0 26px 58px rgba(0, 0, 0, 0.5),
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -16px 26px rgba(0, 0, 0, 0.18),
        inset 0 0 0 1px rgba(255, 255, 255, 0.045);
    isolation: isolate;
}

.legado-fondo-cuatro__glass::before {
    content: "";
    position: absolute;
    inset: 6px 18px auto 18px;
    height: 25%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.01));
    opacity: 0.24;
    pointer-events: none;
    z-index: 0;
}

.legado-fondo-cuatro__glass > * {
    position: relative;
    z-index: 1;
}

.legado-fondo-cuatro__text {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.legado-fondo-cuatro__p {
    font-family: var(--font-primary);
    font-size: clamp(0.85rem, 0.95vw, 1.1rem);
    font-weight: 300;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: #cccccc;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.85);
}

/* ── Responsivo Bloque 4 ─────────────── */
@media (max-width: 960px) {
    .legado-fondo-cuatro__title {
        font-size: clamp(1.3rem, 6vw, 2rem);
        margin-bottom: 1.6rem;
    }

    .legado-fondo-cuatro__glass {
        width: min(92vw, 720px);
        padding: 1.25rem 1.1rem;
        border-radius: 26px;
    }
    
    .legado-fondo-cuatro__text {
        max-width: 100%;
        gap: 1.2rem;
    }
    
    .legado-fondo-cuatro__p {
        font-size: 0.85rem;
    }
}

#legado-fondo-cinco {
    position: relative;
    z-index: 1;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: transparent; /* Transparent so the fixed BG is visible */
}

#legado-fondo-cinco::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 6; /* Over the fixed BG, behind the content */
    pointer-events: none;
}

.legado-fondo-cinco__bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center center;
    display: block;
    backface-visibility: hidden;
    z-index: 5; /* Pinned permanently in the background */
}

.legado-fondo-cinco__content {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 8vw;
    transform: translateY(-18vh); /* Desplazamiento hacia arriba del 18% */
}

.legado-fondo-cinco__title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.5vw, 3.4rem);
    font-weight: 400;
    letter-spacing: 0.18em;
    color: #f4ad67;
    margin-bottom: 2.2rem;
    line-height: 1.2;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.legado-fondo-cinco__glass {
    position: relative;
    width: min(1480px, 96vw);
    padding: clamp(1.35rem, 2.4vw, 2rem) clamp(1.6rem, 5vw, 5rem);
    overflow: hidden;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055) 0%, rgba(255, 255, 255, 0.018) 36%, rgba(3, 4, 5, 0.16) 100%),
        radial-gradient(120% 150% at 12% 8%, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.022) 36%, transparent 68%),
        rgba(8, 10, 11, 0.18);
    backdrop-filter: blur(9px) saturate(1.16) contrast(1.02);
    -webkit-backdrop-filter: blur(9px) saturate(1.16) contrast(1.02);
    box-shadow:
        0 26px 58px rgba(0, 0, 0, 0.5),
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        inset 0 -16px 26px rgba(0, 0, 0, 0.18),
        inset 0 0 0 1px rgba(255, 255, 255, 0.045);
    isolation: isolate;
}

.legado-fondo-cinco__glass::before {
    content: "";
    position: absolute;
    inset: 6px 18px auto 18px;
    height: 25%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.01));
    opacity: 0.24;
    pointer-events: none;
    z-index: 0;
}

.legado-fondo-cinco__glass > * {
    position: relative;
    z-index: 1;
}

.legado-fondo-cinco__text {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.legado-fondo-cinco__p {
    font-family: var(--font-primary);
    font-size: clamp(0.85rem, 0.95vw, 1.1rem);
    font-weight: 300;
    line-height: 1.85;
    letter-spacing: 0.02em;
    color: #cccccc;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.85);
}

/* ── Responsivo Bloque 5 ─────────────── */
@media (max-width: 960px) {
    #legado-fondo-cinco {
        background-color: #000000;
    }

    #legado-fondo-cinco::after {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .legado-fondo-cinco__bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }

    .legado-fondo-cinco__title {
        font-size: clamp(1.3rem, 6vw, 2rem);
        margin-bottom: 1.6rem;
    }

    .legado-fondo-cinco__glass {
        width: min(92vw, 720px);
        padding: 1.25rem 1.1rem;
        border-radius: 26px;
    }
    
    .legado-fondo-cinco__text {
        max-width: 100%;
        gap: 1.2rem;
    }
    
    .legado-fondo-cinco__p {
        font-size: 0.85rem;
    }
}

/* Imagen de fondo absoluta pura (sin overlays) */
.guardianes__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    z-index: 1;
    display: block;
    backface-visibility: hidden;
}

/* Bloque de texto flotante: superior-izquierda según mockup */
.guardianes__text {
    position: absolute;
    top: 10vh;
    left: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    max-width: 40vw;
    padding-left: 8vw;
    padding-right: 2rem;
}

/* Título: Cinzel Decorative, crema cálida */
.guardianes__title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.2vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.14em;
    line-height: 1.2;
    color: #f4ad67;
    margin: 0;
}

/* Párrafos: Poppins ligero, gris claro */
.guardianes__p1,
.guardianes__p2 {
    font-family: var(--font-primary);
    font-size: clamp(0.78rem, 0.85vw, 0.95rem);
    font-weight: 300;
    line-height: 1.9;
    letter-spacing: 0.02em;
    color: #cccccc;
}

.guardianes__name {
    color: #f4ad67;
    font-weight: 500;
    text-decoration-line: underline;
    text-decoration-color: #f4ad67;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.24em;
    text-decoration-skip-ink: auto;
}

/* ── Responsivo ──────────────────────── */
@media (max-width: 960px) {
    .guardianes__text {
        max-width: 94vw;
        width: 100%;
        padding: 0 3vw;
        left: 50%;
        transform: translateX(-50%);
        top: 10vh;
        text-align: center;
        align-items: center;
    }

    .guardianes__title {
        font-size: clamp(1.2rem, 6vw, 2rem);
    }

    .guardianes__p1,
    .guardianes__p2 {
        font-size: 0.84rem;
    }
}
