/* =========================================
   PÁGINA PÚBLICA DE PERSONAJES
========================================= */

.personajes-publicos {
    width: min(1200px, calc(100% - 32px));
    margin: 220px auto 60px;
}

.encabezado-personajes {
    max-width: 900px;
    margin: 0 auto 36px;
    text-align: center;
}

.encabezado-personajes h2 {
    margin: 0 0 14px;
    color: #14552f;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
}

.encabezado-personajes p {
    margin: 0;
    color: #555;
    font-size: 1.08rem;
    line-height: 1.7;
}

/* =========================================
   BÚSQUEDA Y FILTROS
========================================= */

.barra-personajes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.65fr);
    gap: 16px;
    margin-bottom: 34px;
}

.barra-personajes input,
.barra-personajes select {
    width: 100%;
    min-height: 54px;
    padding: 0 17px;
    border: 1px solid #d4d9d5;
    border-radius: 13px;
    background: #fff;
    color: #333;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.barra-personajes input:focus,
.barra-personajes select:focus {
    border-color: #287449;
    box-shadow: 0 0 0 4px rgba(40, 116, 73, 0.12);
}

/* =========================================
   ESTADO DE CARGA
========================================= */

#estado-personajes {
    padding: 45px 20px;
    text-align: center;
    color: #666;
    font-size: 1.05rem;
}

/* =========================================
   CUADRÍCULA
========================================= */

.grid-personajes-publicos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 28px;
}

/* =========================================
   TARJETAS
========================================= */

.tarjeta-personaje-publico {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(20, 85, 47, 0.12);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(27, 51, 36, 0.09);
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.tarjeta-personaje-publico:hover {
    transform: translateY(-7px);
    border-color: rgba(20, 85, 47, 0.28);
    box-shadow: 0 18px 38px rgba(27, 51, 36, 0.15);
}

/* =========================================
   IMAGEN
========================================= */

.imagen-personaje-publico {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            #edf4ef,
            #dde9e1
        );
}

.imagen-personaje-publico img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.35s ease;
}

.tarjeta-personaje-publico:hover
.imagen-personaje-publico img {
    transform: scale(1.045);
}

.sin-imagen-publica {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    padding: 25px;
    color: #657069;
    text-align: center;
    font-weight: 600;
}

/* =========================================
   CONTENIDO DE LA TARJETA
========================================= */

.contenido-personaje-publico {
    display: flex;
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    padding: 22px;
}

.categoria-personaje-publico {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-bottom: 13px;
    padding: 7px 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf6ef;
    color: #14552f;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.categoria-personaje-publico::before {
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.contenido-personaje-publico h3 {
    margin: 0 0 10px;
    color: #173c27;
    font-size: 1.35rem;
    line-height: 1.25;
    text-transform: capitalize;
}

.contenido-personaje-publico > p {
    display: -webkit-box;
    min-height: 4.65em;
    margin: 0 0 15px;
    overflow: hidden;
    color: #555f58;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.datos-personaje {
    width: 100%;
    margin: auto 0 17px;
    padding-top: 14px;
    border-top: 1px solid #edf0ed;
    color: #68716a;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* =========================================
   BOTÓN
========================================= */

.ver-biografia {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background: #14552f;
    color: #fff;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.ver-biografia:hover {
    transform: translateY(-2px);
    background: #0e4223;
    box-shadow: 0 7px 16px rgba(20, 85, 47, 0.23);
}

.ver-biografia:active {
    transform: translateY(0);
}

/* =========================================
   MODAL
========================================= */

.modal-personaje {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    overflow-y: auto;
    padding: 28px 18px;
    background: rgba(14, 25, 18, 0.78);
    backdrop-filter: blur(5px);
}

.modal-personaje.activo {
    display: grid;
    place-items: center;
    animation: aparecerFondo 0.22s ease;
}

.modal-contenido-personaje {
    position: relative;
    width: min(900px, 100%);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    margin: auto;
    padding: 36px;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 30px 75px rgba(0, 0, 0, 0.28);
    animation: aparecerModal 0.28s ease;
}

.cerrar-modal-personaje {
    position: sticky;
    z-index: 5;
    top: 0;
    float: right;
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    margin: -14px -14px 5px 15px;
    border: 1px solid #dfe5e0;
    border-radius: 50%;
    background: #fff;
    color: #34463a;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 13px rgba(0, 0, 0, 0.08);
}

.cerrar-modal-personaje:hover {
    background: #eef5f0;
    color: #14552f;
}

#contenido-modal-personaje {
    color: #444d47;
}

#contenido-modal-personaje > img {
    width: min(320px, 100%);
    max-height: 390px;
    display: block;
    margin: 0 auto 25px;
    border-radius: 18px;
    object-fit: cover;
    object-position: center top;
    box-shadow: 0 12px 30px rgba(19, 55, 35, 0.16);
}

#contenido-modal-personaje h2 {
    margin: 7px 0 18px;
    color: #14552f;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.15;
}

#contenido-modal-personaje p {
    line-height: 1.7;
}

.biografia-completa {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid #e5e9e6;
    color: #414942;
    font-size: 1.02rem;
    line-height: 1.85;
    white-space: pre-line;
}

/* =========================================
   ANIMACIONES
========================================= */

@keyframes aparecerFondo {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes aparecerModal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================
   TABLET
========================================= */

@media (max-width: 950px) {
    .grid-personajes-publicos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =========================================
   CELULAR
========================================= */

@media (max-width: 680px) {
    .personajes-publicos {
        width: min(100% - 24px, 1200px);
        margin-top: 180px;
    }

    .barra-personajes {
        grid-template-columns: 1fr;
    }

    .grid-personajes-publicos {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .imagen-personaje-publico {
        aspect-ratio: 16 / 11;
    }

    .modal-personaje {
        padding: 12px;
    }

    .modal-contenido-personaje {
        max-height: calc(100vh - 24px);
        padding: 24px 20px;
        border-radius: 17px;
    }

    .cerrar-modal-personaje {
        margin-top: -9px;
        margin-right: -7px;
    }
}