/* =========================================
   LES HISTOIRES DE LEA
========================================= */

.lea-histoires,
.lea-personnages,
.lea-modal {
/*    --lea-accent: #B3408C;*/
    --lea-accent: var(--primary-700);
    --lea-text: #151515;
    --lea-muted: #777777;
    --lea-border: #e5e5e5;
    --lea-bg-soft: #faf5f8;
    --lea-radius: 6px;
}


/* =========================================
   HISTORIAS - CABECERA
========================================= */

.lea-histoires {
    width: 100%;
    margin-top: 30px;
    margin-bottom: 50px;
}

.lea-histoires__header {
    margin-bottom: 30px;
}

.lea-histoires__header h2 {
    margin: 0 0 10px;
    color: var(--lea-accent);
    font-size: clamp(25px, 3vw, 38px);
    font-weight: 600;
    line-height: 1.2;
}

.lea-histoires__header p {
    margin: 0;
    color: var(--lea-muted);
    font-size: 15px;
    line-height: 1.6;
}


/* =========================================
   HISTORIAS - GRID
========================================= */

.lea-histoires__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 34px 24px;
}


/* =========================================
   TARJETA DE HISTORIA
========================================= */

.lea-story-card {
    position: relative;
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.lea-story-card__media {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--lea-bg-soft);
    border-radius: var(--lea-radius);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .08);
    transition: box-shadow .3s ease;
}

.lea-story-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .4s ease;
}

.lea-story-card__count {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(179, 64, 140, .94);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}


/* EFECTO HOVER */

.lea-story-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(
        to top,
        rgba(80, 20, 60, .80) 0%,
        rgba(80, 20, 60, .10) 35%,
        transparent 65%
    );
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity .25s ease;
}

.lea-story-card:hover .lea-story-card__image,
.lea-story-card:focus-visible .lea-story-card__image {
    transform: scale(1.035);
}

.lea-story-card:hover .lea-story-card__overlay,
.lea-story-card:focus-visible .lea-story-card__overlay {
    opacity: 1;
}

.lea-story-card:hover .lea-story-card__media {
    box-shadow: 0 8px 24px rgba(179, 64, 140, .20);
}


/* TEXTO INFERIOR */

.lea-story-card__body {
    padding-top: 14px;
}

.lea-story-card__title {
    margin: 0;
    color: var(--lea-text);
    font-size: clamp(16px, 1.3vw, 22px);
    font-weight: 600;
    line-height: 1.3;
    transition: color .2s ease;
}

.lea-story-card:hover .lea-story-card__title {
    color: var(--lea-accent);
}

.lea-story-card__date {
    margin: 6px 0 0;
    color: var(--lea-muted);
    font-size: 12px;
    line-height: 1.4;
}


/* =========================================
   PERSONAJES - SECCION
========================================= */

.lea-personnages {
    width: 100%;
    box-sizing: border-box;
    margin-top: 65px;
    margin-bottom: 45px;
    padding: 38px 30px 25px;
    background: var(--lea-bg-soft);
    border-top: 3px solid var(--lea-accent);
    border-radius: var(--lea-radius);
}

.lea-personnages__header {
    text-align: center;
    margin-bottom: 30px;
}

.lea-personnages__header h2 {
    margin: 0 0 10px;
    color: var(--lea-accent);
    font-size: clamp(25px, 3vw, 36px);
    font-weight: 600;
}

.lea-personnages__header p {
    margin: 0;
    color: var(--lea-muted);
    font-size: 15px;
    line-height: 1.6;
}


/* =========================================
   PERSONAJES - CARRUSEL HORIZONTAL
========================================= */

.lea-personnages__carousel {
    position: relative;
    min-width: 0;
}

.lea-personnages__track {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 26px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 12px 5px 22px;

    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
    scrollbar-color: #B3408C #eadce5;
}


/* BARRA DE DESPLAZAMIENTO */

.lea-personnages__track::-webkit-scrollbar {
    height: 5px;
}

.lea-personnages__track::-webkit-scrollbar-track {
    background: #eadce5;
    border-radius: 10px;
}

.lea-personnages__track::-webkit-scrollbar-thumb {
    background: var(--lea-accent);
    border-radius: 10px;
}


/* =========================================
   PERSONAJE INDIVIDUAL
========================================= */

.lea-personnage {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    scroll-snap-align: start;
}

.lea-personnage__media {
    width: 120px;
    height: 120px;
    box-sizing: border-box;
    overflow: hidden;
    border: 3px solid var(--lea-accent);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 12px rgba(179, 64, 140, .12);
    transition:
        transform .25s ease,
        box-shadow .25s ease;
}

.lea-personnage__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.lea-personnage:hover .lea-personnage__media {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(179, 64, 140, .25);
}

.lea-personnage__name {
    display: block;
    margin-top: 13px;
    color: var(--lea-accent);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.lea-personnage__role {
    display: block;
    margin-top: 5px;
    color: var(--lea-muted);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.lea-personnages__hint {
    margin: 16px 0 0;
    color: var(--lea-muted);
    font-size: 12px;
    text-align: center;
}


/* ACCESIBILIDAD */

.lea-story-card:focus-visible,
.lea-personnage:focus-visible {
    outline: 3px solid rgba(179, 64, 140, .35);
    outline-offset: 4px;
    border-radius: var(--lea-radius);
}


/* =========================================
   RESPONSIVE - TABLET
========================================= */

@media (max-width: 980px) {

    .lea-histoires__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 28px 18px;
    }

    .lea-personnage {
        flex-basis: 125px;
    }

    .lea-personnage__media {
        width: 110px;
        height: 110px;
    }

    .lea-personnages__track {
        gap: 20px;
    }

}


/* =========================================
   RESPONSIVE - MOVIL
========================================= */

@media (max-width: 640px) {

    .lea-histoires {
        margin-top: 20px;
        margin-bottom: 30px;
    }

    .lea-histoires__header {
        margin-bottom: 22px;
    }

    .lea-histoires__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 25px 12px;
    }

    .lea-story-card__body {
        padding-top: 10px;
    }

    .lea-story-card__title {
        font-size: 15px;
    }

    .lea-story-card__date {
        font-size: 11px;
    }

    .lea-story-card__count {
        top: 7px;
        right: 7px;
        padding: 5px 8px;
        font-size: 10px;
    }

    .lea-story-card__overlay {
        display: none;
    }

    .lea-personnages {
        margin-top: 40px;
        margin-bottom: 30px;
        padding: 28px 15px 20px;
    }

    .lea-personnages__header {
        margin-bottom: 20px;
    }

    .lea-personnages__header p {
        font-size: 13px;
    }

    .lea-personnages__track {
        gap: 15px;
    }

    .lea-personnage {
        flex-basis: 100px;
    }

    .lea-personnage__media {
        width: 90px;
        height: 90px;
    }

    .lea-personnage__name {
        font-size: 15px;
    }

    .lea-personnage__role {
        font-size: 11px;
    }

}


/* =========================================
   REDUCCION DE MOVIMIENTO
========================================= */

@media (prefers-reduced-motion: reduce) {

    .lea-story-card__image,
    .lea-story-card__media,
    .lea-story-card__overlay,
    .lea-story-card__title,
    .lea-personnage__media {
        transition: none;
    }

    .lea-personnages__track {
        scroll-behavior: auto;
    }

}

/* =====================================================
   LEA - MODAL
===================================================== */

body.has-lea-modal {
    overflow: hidden;
}

.lea-modal {
    --lea-accent: #B3408C;
    --lea-text: #151515;
    --lea-muted: #777;

    position: fixed;
    inset: 0;
    z-index: 10000;

    display: grid;
    place-items: center;

    padding: 24px;
    box-sizing: border-box;
}

.lea-modal[hidden] {
    display: none !important;
}

.lea-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(5px);
}


/* =====================================================
   VENTANA PRINCIPAL
===================================================== */

.lea-modal__dialog {
    position: relative;

    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .7fr);

    width: min(1100px, 100%);

    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);

    background: #fff;
    border-radius: 8px;
    overflow: hidden;

    box-shadow: 0 15px 60px rgba(0, 0, 0, .3);
}


/* =====================================================
   BOTÓN CERRAR
===================================================== */

.lea-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;

    display: grid;
    place-items: center;

    width: 42px;
    height: 42px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(20, 20, 20, .85);
    color: #fff;

    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.lea-modal__close:hover {
    background: var(--lea-accent);
}


/* =====================================================
   IMAGEN PRINCIPAL
===================================================== */

.lea-modal__media {
    position: relative;

    display: grid;
    place-items: center;

    min-width: 0;
    min-height: 0;

    background: #181518;

    touch-action: pan-y pinch-zoom;
}

.lea-modal__image {
    display: block;

    width: 100%;

    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);

    object-fit: contain;
    object-position: center;
}

.lea-modal__image:not([src]) {
    visibility: hidden;
}


/* =====================================================
   FLECHAS DE NAVEGACIÓN
===================================================== */

.lea-modal__arrow {
    position: absolute;
    top: 50%;
    z-index: 5;

    transform: translateY(-50%);

    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;
    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(179, 64, 140, .92);
    color: #fff;

    font-size: 34px;
    line-height: 1;

    cursor: pointer;
    transition: background .2s ease;
}

.lea-modal__arrow:hover {
    background: #91316f;
}

.lea-modal__arrow--prev {
    left: 12px;
}

.lea-modal__arrow--next {
    right: 12px;
}


/* =====================================================
   CONTADOR DE VIÑETAS
===================================================== */

.lea-modal__counter {
    position: absolute;
    right: 15px;
    bottom: 15px;
    z-index: 5;

    padding: 7px 12px;

    border-radius: 20px;

    background: rgba(0, 0, 0, .75);
    color: #fff;

    font-size: 13px;
    font-weight: 500;
}


/* =====================================================
   CONTENIDO LATERAL
===================================================== */

.lea-modal__content {
    min-width: 0;
    min-height: 0;

    padding: 55px 28px 30px;

    overflow-y: auto;
}

.lea-modal__category {
    margin: 0 0 10px;

    color: var(--lea-accent);

    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.lea-modal__title {
    margin: 0 0 20px;

    color: var(--lea-text);

    font-size: clamp(24px, 2.5vw, 36px);
    font-weight: 600;
    line-height: 1.2;
}

.lea-modal__description {
    color: #666;

    font-size: 14px;
    line-height: 1.7;

    white-space: pre-line;
}


/* =====================================================
   MINIATURAS
===================================================== */

.lea-modal__thumbnails {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 9px;
    margin-top: 25px;
}

.lea-modal__thumbnail {
    display: block;

    aspect-ratio: 3 / 4;

    padding: 2px;

    overflow: hidden;

    border: 2px solid transparent;
    border-radius: 4px;

    background: #f6f6f6;

    cursor: pointer;
    opacity: .65;

    transition: opacity .2s, border-color .2s;
}

.lea-modal__thumbnail img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}

.lea-modal__thumbnail:hover,
.lea-modal__thumbnail.is-active {
    opacity: 1;
    border-color: var(--lea-accent);
}


/* =====================================================
   ELEMENTOS OCULTOS POR JAVASCRIPT
===================================================== */

.lea-modal [hidden] {
    display: none !important;
}


/* =====================================================
   MODAL PERSONAJES
===================================================== */

.lea-modal.is-personnage .lea-modal__dialog {
    display: block;

    width: min(650px, 100%);

    background: #181518;
}

.lea-modal.is-personnage .lea-modal__content {
    position: absolute;

    width: 1px;
    height: 1px;
    padding: 0;

    overflow: hidden;
    clip-path: inset(50%);
}

.lea-modal.is-personnage .lea-modal__arrow,
.lea-modal.is-personnage .lea-modal__counter {
    display: none;
}


/* =====================================================
   TABLET
===================================================== */

@media (max-width: 980px) {

    .lea-modal__dialog {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .lea-modal__image {
        height: auto;
        max-height: 70vh;
        max-height: 70dvh;
    }

    .lea-modal__content {
        padding: 25px;
        overflow: visible;
    }

    .lea-modal.is-personnage .lea-modal__image {
        max-height: calc(100dvh - 48px);
    }

}


/* =====================================================
   MÓVIL
===================================================== */

@media (max-width: 640px) {

    .lea-modal {
        padding: 0;
    }

    .lea-modal__dialog {
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;

        border-radius: 0;
    }

    .lea-modal__media {
        min-height: 40vh;
        min-height: 40dvh;
    }

    .lea-modal__image {
        height: auto;
        max-height: 78vh;
        max-height: 78dvh;
    }

    .lea-modal__content {
        padding: 22px 18px 30px;
    }

    .lea-modal__title {
        font-size: 24px;
    }

    .lea-modal__arrow {
        width: 38px;
        height: 38px;

        font-size: 28px;
    }

    .lea-modal__arrow--prev {
        left: 6px;
    }

    .lea-modal__arrow--next {
        right: 6px;
    }

    .lea-modal__thumbnails {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
    }

    .lea-modal.is-personnage .lea-modal__dialog {
        width: 100%;
        min-height: 100dvh;

        display: grid;
        place-items: center;
    }

    .lea-modal.is-personnage .lea-modal__image {
        max-height: 100dvh;
    }

}


/* =====================================================
   ACCESIBILIDAD
===================================================== */

.lea-modal button:focus-visible {
    outline: 3px solid var(--lea-accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {

    .lea-modal__arrow,
    .lea-modal__thumbnail {
        transition: none;
    }

}