/**
 * Hero Scroller for Divi - Recreación Fiel de Azure Magazine (https://www.azuremagazine.com/)
 * Sistema scrollytelling con fijación (pinning) progresiva, tarjetas superpuestas y columna lateral.
 */

/* ==========================================================================
   Contenedor Principal y Tokens de Diseño
   ========================================================================== */
.hsd-azure-hero {
    position: relative;
    width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    --hsd-sticky-top: 90px;
    --hsd-slide-distance: 120vh;
    --hsd-accent: #c63c35;
    --hsd-bg: #ffffff;
    --hsd-card-bg: #F0F0F0;
    --hsd-text-title: #111111;
    --hsd-text-deck: #383838;
    --hsd-text-meta: #727279;
    --hsd-border: rgba(0, 0, 0, 0.08);
}

/* Modo Claro (Azure Magazine Original) */
.hsd-azure-hero.hsd-theme-light {
    background-color: #ffffff;
    color: #111111;
    --hsd-bg: #ffffff;
    --hsd-card-bg: #F0F0F0;
    --hsd-text-title: #111111;
    --hsd-text-deck: #383838;
    --hsd-text-meta: #727279;
    --hsd-border: rgba(0, 0, 0, 0.08);
}

/* Modo Oscuro (Sleek Dark) */
.hsd-azure-hero.hsd-theme-dark {
    background-color: #0E0E0E;
    color: #FFFFFF;
    --hsd-bg: #0E0E0E;
    --hsd-card-bg: #1C1C1C;
    --hsd-text-title: #FFFFFF;
    --hsd-text-deck: #CCCCCC;
    --hsd-text-meta: #8E8E93;
    --hsd-border: rgba(255, 255, 255, 0.1);
}

.hsd-azure-hero *,
.hsd-azure-hero *::before,
.hsd-azure-hero *::after {
    box-sizing: border-box;
}

/* Contenedor interior con márgenes editoriales */
.hsd-azure-hero__inner {
    position: relative;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px 3.5vw 0;
}

/* ==========================================================================
   Disposición de Cuadrícula (Grid) y Barra Lateral (Right Rail)
   ========================================================================== */
.hsd-azure-hero__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
    position: relative;
    width: 100%;
}

.hsd-azure-hero__layout.has-rail {
    grid-template-columns: minmax(0, 1fr) 300px;
}

.hsd-azure-hero__slides {
    position: relative;
    width: 100%;
}

/* Barra Lateral Derecha (Anuncio / Contenido Fijo 300x600) */
.hsd-azure-hero__right-rail {
    position: -webkit-sticky;
    position: sticky;
    top: calc(var(--hsd-sticky-top) + 16px);
    height: fit-content;
    z-index: 10;
}

.hsd-azure-hero__right-rail-inner {
    width: 300px;
    margin: 0 auto;
}

.hsd-azure-hero__right-rail img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: cover;
}

.hsd-azure-rail-placeholder {
    width: 300px;
    height: 600px;
    background: #fafafa;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #888888;
    font-size: 14px;
}

.hsd-theme-dark .hsd-azure-rail-placeholder {
    background: #181818;
    border-color: #262626;
    color: #999999;
}

.hsd-azure-rail-placeholder span {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: #aaaaaa;
}

/* ==========================================================================
   Diapositiva Individual (Fijación Progresiva / Sticky Stacking)
   ========================================================================== */
.hsd-azure-slide {
    position: -webkit-sticky;
    position: sticky;
    top: var(--hsd-sticky-top, 90px);
    width: 100%;
    background-color: var(--hsd-bg, #ffffff);
    margin-bottom: var(--hsd-slide-distance, 120vh);
    padding: 0 0 2.5rem;
    box-sizing: border-box;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Ocultar completamente diapositivas anteriores cuando han sido cubiertas por el slide actual */
.hsd-azure-slide.hsd-slide--covered {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.hsd-azure-slide:last-child {
    margin-bottom: 12vh;
}

/* Contenedor Multimedia Panorámico (16:9) */
.hsd-azure-slide__media-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000000;
    overflow: hidden;
}

.hsd-azure-slide__media-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

.hsd-azure-slide__media-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hsd-azure-slide__media-link:hover .hsd-azure-slide__media-element.hsd-img {
    transform: scale(1.02);
}

.hsd-azure-slide__media-element.hsd-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Fila Inferior: Tarjeta Editorial + Área de Contador */
.hsd-azure-slide__bottom-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-top: -6rem;
    z-index: 5;
    padding-bottom: 3rem;
    background-color: var(--hsd-bg, #ffffff);
    width: 100%;
}

/* ==========================================================================
   Tarjeta Editorial Superpuesta (Estilo Azure Magazine)
   ========================================================================== */
.hsd-azure-slide__card {
    position: relative;
    width: 68%;
    max-width: 660px;
    background-color: var(--hsd-card-bg, #F0F0F0);
    padding: 2.4rem 2.8rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border-radius: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hsd-theme-dark .hsd-azure-slide__card {
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.45);
}

/* Kicker / Tag */
.hsd-azure-slide__tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hsd-accent, #c63c35);
    margin-bottom: 12px;
}

/* Titular / Headline */
.hsd-azure-slide__headline {
    font-family: FreightTextPro, Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 2.5vw, 36px);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.015em;
    margin: 0 0 14px 0;
    color: var(--hsd-text-title, #111111);
}

.hsd-azure-slide__headline a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hsd-azure-slide__headline a:hover {
    color: var(--hsd-accent, #c63c35);
}

/* Bajada / Deck */
.hsd-azure-slide__deck {
    font-size: 15px;
    line-height: 1.55;
    color: var(--hsd-text-deck, #383838);
    margin: 0 0 22px 0;
}

/* Metadatos (Words & From) */
.hsd-azure-slide__meta {
    display: grid;
    grid-template-columns: 75px 1fr;
    row-gap: 8px;
    font-size: 13px;
    line-height: 1.4;
    border-top: 1px solid var(--hsd-border, rgba(0, 0, 0, 0.08));
    padding-top: 16px;
    margin: 0;
}

.hsd-meta-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hsd-text-meta, #727279);
    font-size: 11px;
}

.hsd-meta-value {
    font-weight: 500;
    color: var(--hsd-text-title, #111111);
    margin: 0;
}

.hsd-meta-value a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hsd-meta-value a:hover {
    color: var(--hsd-accent, #c63c35);
    text-decoration: underline;
}

/* ==========================================================================
   Contador Lateral y Botón "Skip" (Signature Azure Magazine)
   ========================================================================== */
.hsd-azure-slide__counter-side {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: 6.8rem;
    padding-right: 0.5rem;
    font-size: 15px;
    color: var(--hsd-text-meta, #727279);
    font-weight: 500;
    user-select: none;
}

.hsd-count {
    font-weight: 700;
    color: var(--hsd-text-title, #111111);
    margin-right: 4px;
}

.hsd-counter-sep {
    margin-right: 4px;
}

.hsd-total {
    font-weight: 600;
    color: var(--hsd-text-meta, #727279);
    margin-right: 12px;
}

.hsd-skip-link {
    color: var(--hsd-text-title, #111111);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--hsd-accent, #c63c35);
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.hsd-skip-link:hover {
    color: var(--hsd-accent, #c63c35);
}

.hsd-skip-arrow-mobile {
    display: none;
}

.hsd-hide-skip .hsd-skip-link,
.hsd-hide-skip .hsd-skip-arrow-mobile {
    display: none !important;
}

/* Ancla de Salto */
.hsd-azure-hero__skip-anchor {
    position: relative;
    display: block;
    height: 1px;
    width: 100%;
}

/* ==========================================================================
   Adaptación Responsiva (Tablets y Smartphones - Idéntico a Azure)
   ========================================================================== */
@media screen and (max-width: 991px) {
    .hsd-azure-hero__layout.has-rail {
        grid-template-columns: minmax(0, 1fr);
    }

    .hsd-azure-hero__right-rail {
        display: none;
    }

    .hsd-azure-slide__card {
        width: 78%;
        margin-top: -4.5rem;
        padding: 2rem 2.2rem;
    }

    .hsd-azure-slide__counter-side {
        padding-top: 5.2rem;
    }
}

@media screen and (max-width: 640px) {
    .hsd-azure-hero {
        --hsd-sticky-top: 60px;
        --hsd-slide-distance: 100vh;
    }

    .hsd-azure-hero__inner {
        padding: 10px 16px 0;
    }

    .hsd-azure-slide__bottom-row {
        margin-top: -2.5rem;
        padding-bottom: 1.5rem;
    }

    .hsd-azure-slide__card {
        width: calc(100% - 48px);
        max-width: none;
        padding: 1.4rem 1.4rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    }

    .hsd-azure-slide__headline {
        font-size: 20px;
        line-height: 1.25;
        margin-bottom: 10px;
    }

    .hsd-azure-slide__deck {
        font-size: 13.5px;
        line-height: 1.5;
        margin-bottom: 16px;
    }

    .hsd-azure-slide__meta {
        grid-template-columns: 65px 1fr;
        font-size: 12px;
        padding-top: 12px;
    }

    /* Contador vertical en el margen derecho con flecha roja */
    .hsd-azure-slide__counter-side {
        position: relative;
        flex: none;
        width: 48px;
        padding-top: 1.5rem;
        padding-right: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        font-size: 14px;
    }

    .hsd-counter-sep,
    .hsd-skip-link {
        display: none;
    }

    .hsd-count {
        margin: 0;
    }

    .hsd-total {
        margin: 0 0 8px 0;
    }

    .hsd-count::after {
        content: "/";
    }

    .hsd-skip-arrow-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        color: var(--hsd-accent, #c63c35);
        cursor: pointer;
        transition: transform 0.2s ease;
    }

    .hsd-skip-arrow-mobile:hover {
        transform: translateY(3px);
    }

    .hsd-skip-arrow-mobile svg {
        width: 24px;
        height: 24px;
        stroke: var(--hsd-accent, #c63c35);
    }
}

/* ==========================================================================
   Compatibilidad y Previsualización en Divi Visual Builder
   ========================================================================== */
body.et-fb .hsd-azure-slide,
body.et-fb-app-frame .hsd-azure-slide,
.et-fb-app-frame .hsd-azure-slide,
.hsd-builder-slide-item {
    position: relative !important;
    top: auto !important;
    margin-bottom: 3.5rem !important;
    z-index: 1 !important;
}

body.et-fb .hsd-azure-hero__right-rail,
body.et-fb-app-frame .hsd-azure-hero__right-rail,
.et-fb-app-frame .hsd-azure-hero__right-rail {
    position: relative !important;
    top: auto !important;
}

/* Banner de Modo Constructor Visual */
.hsd-builder-preview-banner {
    position: relative;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--hsd-accent, #c63c35);
    padding: 1.4rem 1.8rem;
    margin-bottom: 2.2rem;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.hsd-theme-dark .hsd-builder-preview-banner {
    background: #181818;
    border-color: rgba(255, 255, 255, 0.12);
    border-left-color: var(--hsd-accent, #c63c35);
}

.hsd-builder-preview-badge {
    display: inline-block;
    background: var(--hsd-accent, #c63c35);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 3px 8px;
    margin-bottom: 8px;
    border-radius: 2px;
}

.hsd-builder-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.hsd-builder-preview-title {
    font-family: FreightTextPro, Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-weight: 700;
    margin: 0;
    color: var(--hsd-text-title, #111111);
}

.hsd-builder-preview-desc {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--hsd-text-deck, #444444);
    margin: 0 0 12px 0;
}

.hsd-builder-preview-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hsd-builder-pill {
    display: inline-flex;
    align-items: center;
    background: #f0f0f0;
    color: #222222;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.hsd-theme-dark .hsd-builder-pill {
    background: #282828;
    color: #e0e0e0;
}

/* Marcador de posición multimedia cuando aún no se ha subido imagen */
.hsd-slide-media-placeholder {
    width: 100%;
    height: 100%;
    min-height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #6b7280;
    padding: 24px;
    text-align: center;
    box-sizing: border-box;
}

.hsd-theme-dark .hsd-slide-media-placeholder {
    background: #1e1e1e;
    color: #9ca3af;
}

.hsd-placeholder-icon {
    margin-bottom: 10px;
    opacity: 0.65;
}

.hsd-placeholder-icon svg {
    stroke: currentColor;
}

.hsd-placeholder-text {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}