/**
 * 2PX Elementor Suite - Hero Widget Styles
 * BEM Methodology Used
 */

/* =========================================================================
   Elementor Wrapper – Herencia de altura
   Elementor envuelve el widget en capas que por defecto no propagan la
   altura de la sección. Estas reglas permiten que el widget llene el
   100% del alto de su columna/sección cuando ésta tiene altura definida.
   ========================================================================= */
.elementor-widget-2px-hero,
.elementor-widget-2px-hero .elementor-widget-container {
    height: 100%;
}

/* =========================================================================
   Base Layout & Grid
   ========================================================================= */
.twopx-hero {
    position: relative;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap; /* Allows stacking mechanism */
}

/* Common resets inside the widget */
.twopx-hero * {
    box-sizing: border-box;
}

/* Row wrapping inside elementor handles */
.twopx-hero__media-col,
.twopx-hero__content-col {
    width: 100%; /* Default mobile behavior: Stacked vertically */
}

.twopx-hero__media-col {
    position: relative;
    display: flex;
}

/* =========================================================================
   Media Wrapper (Optimized for LCP to act as backgrounds)
   ========================================================================= */
.twopx-hero__media-wrapper {
    position: relative;
    width: 100%;
    min-height: 300px; /* Minimal height so it doesn't collapse if no content provides height */
    overflow: hidden;
}

/* Position image and video as background replacements */
.twopx-hero__image,
.twopx-hero__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0; 
    border: none;
}

/* Media Overlay (Transparent layer) */
.twopx-hero__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1; /* Below content, above video/image */
    transition: background-color 0.3s ease;
}

/* =========================================================================
   Content Styles
   ========================================================================= */
.twopx-hero__content-col {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically center content */
    padding: 40px 20px; /* Native padding, user can overwrite in Advanced tab */
    z-index: 2; /* Content must be above everything */
}

.twopx-hero__content-wrapper {
    position: relative;
    max-width: 100%;
}

/* Typography base margins */
.twopx-hero__subtitle {
    margin: 0 0 10px 0;
    text-transform: uppercase;
}
.twopx-hero__title {
    margin: 0 0 20px 0;
    line-height: 1.2;
}
.twopx-hero__description {
    margin: 0 0 30px 0;
    line-height: 1.6;
}

/* Actions block */
.twopx-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Spacing between buttons */
}
.twopx-hero--layout-media_right .twopx-hero__actions,
.twopx-hero--layout-media_left .twopx-hero__actions {
    /* If content align changes based on parent CSS from Elementor Control we inherit */
    justify-content: inherit;
}

/* Buttons — solo estructura base, colores controlados desde Elementor */
.twopx-hero__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 15px 30px; /* Fallback; el control "Relleno" lo sobreescribe */
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 600;
}
.twopx-hero__btn--primary {
    background-color: #000; /* Fallback */
    color: #fff;             /* Fallback */
}
.twopx-hero__btn--secondary {
    background-color: transparent; /* Fallback */
    color: #000;                   /* Fallback */
    border: 1px solid #000;        /* Fallback */
}

/* =========================================================================
   Layout Variants (Desktop / Tablet)
   ========================================================================= */

/* Default Stacked for Mobile (Already defined above with width: 100%) */

/* Layout 1: Background Full (Global / Mobile & Desktop)
   Media-col es absolutamente posicionado para que sea el content-col
   quien defina la altura total del widget, sin espacio muerto.
   min-height garantiza que la imagen de fondo sea visible incluso
   con poco contenido en móvil. */
.twopx-hero.twopx-hero--layout-background {
    position: relative;
    display: block;
    min-height: 380px; /* Fallback cuando la sección no tiene altura definida */
    height: 100%;      /* Llena la sección cuando sí tiene altura definida */
}
.twopx-hero.twopx-hero--layout-background .twopx-hero__media-col {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}
.twopx-hero.twopx-hero--layout-background .twopx-hero__content-col {
    position: relative;
    width: 100%;
    z-index: 2;
}
.twopx-hero.twopx-hero--layout-background .twopx-hero__media-wrapper {
    position: relative;
    height: 100%;
    min-height: 0;
}
.twopx-hero.twopx-hero--layout-background .twopx-hero__image,
.twopx-hero.twopx-hero--layout-background .twopx-hero__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Tablet (768px – 1024px): lado a lado con padding reducido */
@media (min-width: 768px) {

    /* Layout 2: Media Right, Text Left */
    /* By default the media col is first in DOM, so we must reorder */
    .twopx-hero.twopx-hero--layout-media_right .twopx-hero__media-col {
        order: 2;
        width: 70%;
    }
    .twopx-hero.twopx-hero--layout-media_right .twopx-hero__content-col {
        order: 1;
        width: 30%;
        padding: 40px 24px; /* Más compacto en tablet */
    }

    /* Layout 3: Media Left, Text Right */
    .twopx-hero.twopx-hero--layout-media_left .twopx-hero__media-col {
        order: 1;
        width: 70%;
    }
    .twopx-hero.twopx-hero--layout-media_left .twopx-hero__content-col {
        order: 2;
        width: 30%;
        padding: 40px 24px; /* Más compacto en tablet */
    }

    /* Layouts lado a lado: el media-wrapper debe llenar el 100%
       de la altura de su columna para que la imagen/video no quede corta */
    .twopx-hero.twopx-hero--layout-media_left .twopx-hero__media-wrapper,
    .twopx-hero.twopx-hero--layout-media_right .twopx-hero__media-wrapper {
        height: 100%;
        min-height: 0;
        align-self: stretch;
        flex: 1;
    }

}

/* Desktop (1025px+): padding generoso en la columna de texto */
@media (min-width: 1025px) {

    .twopx-hero.twopx-hero--layout-media_right .twopx-hero__content-col,
    .twopx-hero.twopx-hero--layout-media_left .twopx-hero__content-col {
        padding: 60px 40px;
    }

}

/* =========================================================================
   Effects & Animations
   ========================================================================= */

@keyframes twopxKenBurns {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

.twopx-hero--ken-burns .twopx-hero__image {
    animation: twopxKenBurns 12s ease-out alternate infinite;
}
