/* ─── Nuestro Impacto — categorías de becarios — FUNJOSE ────────────────────
   Usado por template-parts/impacto.php en dos modos:
   - .fj-impact--resumen  (home): tarjetas con 4 fotos random + "Ver todos".
   - .fj-impact--completo (página Nuestro Impacto): tarjetas + filtros + listado
     completo de personas por categoría.
   Tarjetas: 1 columna en xs/sm, 2 en md (≥768px), 3 en lg+ (≥992px).
   ────────────────────────────────────────────────────────────────────────── */

.fj-impact {
    max-width: 1200px;
    margin: 0 auto;
    padding: 96px 64px;
    box-sizing: border-box;
}

.fj-impact__head {
    text-align: justify;
    margin-bottom: 48px;
}

.fj-impact__eyebrow {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--global-palette2, #0077b6);
    margin: 0 0 16px;
}

.fj-impact__title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: clamp(2.2rem, 4.4vw, 3.2rem);
    line-height: 1.18;
    color: #1A1860;
    margin: 0 0 24px;
    max-width: 60%;
    text-align: left;
}

.fj-impact__text {
    font-size: 1.375rem;
    color: #555c74;
    line-height: 1.78;
    max-width: 100%;
    margin: 0;
    text-align: left;
}

/* ── Filtros (modo completo) ── */
.fj-impact__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 48px;
    padding: 20px;
    background: #F7F8FC;
    border-radius: 16px;
}

.fj-impact__filter {
    font-family: 'Manrope', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1A1860;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #d7dbe8;
    background: #fff;
    cursor: pointer;
    max-width: 100%;
    width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fj-impact__filters-reset {
    padding: 10px 20px;
    font-size: 0.9rem;
    margin-left: auto;
}

/* ── Grid de tarjetas de categoría ──
   Resumen (home): 1 columna en xs/sm, 2 en md (≥768px), 3 en lg+ (≥992px).
   Completo (Nuestro Impacto): siempre 1 categoría por fila — cada tarjeta
   trae el listado completo de personas, no solo una vista previa. ── */
.fj-impact__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

@media screen and (min-width: 768px) {
    .fj-impact--resumen .fj-impact__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (min-width: 992px) {
    .fj-impact--resumen .fj-impact__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.fj-impact-card {
    scroll-margin-top: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #fff;
    border-radius: 20px;
    padding: 40px 28px;
    box-shadow: 0 4px 24px rgba(26, 24, 96, 0.08);
}

.fj-impact-card.is-hidden {
    display: none;
}

.fj-impact-card__title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.3;
    color: #1A1860;
    margin: 0 0 12px;
    min-height: 2.6em;
}

.fj-impact-card__count {
    position: relative;
    display: inline-block;
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 1;
    color: #1A1860;
    padding-bottom: 12px;
    margin: 0;
}

.fj-impact-card__count::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 160%;
    height: 4px;
    background: var(--global-palette1, #fea900);
}

.fj-impact-card__label {
    margin: 14px 0 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #555c74;
}

.fj-impact-card__photos {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 64px;
    align-items: center;
    margin-bottom: 28px;
}

.fj-impact-card__photo-link {
    appearance: none;
    background: none;
    padding: 0;
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e4e7ee;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.fj-impact-card__photo-link:hover {
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.2);
}

.fj-impact-card__photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fj-impact-card__no-photos {
    font-size: 0.85rem;
    color: #98a0b3;
    margin: 0;
}

.fj-impact-card__cta {
    margin-top: auto;
}

/* ── Listado completo por categoría (modo completo) ── */
.fj-impact-card__full-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 20px 12px;
    margin-top: 8px;
    padding-top: 28px;
    border-top: 1px solid #e4e7ee;
}

.fj-impact-card__empty {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    color: #98a0b3;
    margin: 0;
}

.fj-person-card {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
}

.fj-person-card.is-hidden {
    display: none;
}

/* El tema define un fondo/color de hover global para cualquier <button>;
   como la tarjeta de persona es un <button>, hay que anularlo explícitamente
   para que no tape la foto y el nombre. */
.fj-person-card:hover,
.fj-person-card:focus,
.fj-person-card:active {
    background: none;
    color: inherit;
    box-shadow: none;
}

.fj-person-card__photo {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: #EEF0F8;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px #e4e7ee;
    transition: box-shadow 0.2s ease;
}

.fj-person-card:hover .fj-person-card__photo {
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.2);
}

.fj-person-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fj-person-card__placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: #EEF0F8;
}

.fj-person-card__name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1A1860;
    line-height: 1.3;
}

/* ── Tablet (720–1024px) ── */
@media screen and (min-width: 720px) and (max-width: 1024px) {
    .fj-impact {
        padding: 80px 64px;
    }
}

/* ── Móvil (≤719px) ── */
@media screen and (max-width: 719px) {
    .fj-impact {
        padding: 64px 28px;
    }
    .fj-impact__title,
    .fj-impact__text {
        max-width: 100%;
    }
    .fj-impact__text {
        font-size: 1rem;
    }
    .fj-impact__filters {
        justify-content: center;
    }
    .fj-impact__filters-reset {
        margin-left: 0;
        width: 100%;
    }
}

/* ── Popup con la ficha de la persona ── */
.fj-modal[hidden] {
    display: none;
}

.fj-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.fj-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 24, 96, 0.55);
}

body.fj-modal-open {
    overflow: hidden;
}

.fj-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: #fff;
    border-radius: 24px;
    padding: 48px 36px 36px;
    box-sizing: border-box;
    box-shadow: 0 20px 60px rgba(26, 24, 96, 0.35);
    text-align: center;
}

.fj-modal__close {
    appearance: none;
    background: #F7F8FC;
    border: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    color: #1A1860;
    cursor: pointer;
}

.fj-modal__close span {
    display: block;
    transform: translateY(-1px);
}

.fj-modal__close:hover,
.fj-modal__close:focus,
.fj-modal__close:active {
    background: #F7F8FC;
    color: #1A1860;
    box-shadow: none;
}

.fj-modal__photo-wrap {
    width: 128px;
    height: 128px;
    margin: 0 auto 24px;
    border-radius: 50%;
    overflow: hidden;
    background: #EEF0F8;
}

.fj-modal__photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fj-modal__nombre {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.4rem;
    line-height: 1.3;
    color: #1A1860;
    margin: 0 0 24px;
}

.fj-modal__meta {
    margin: 0;
}

.fj-modal__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid #e4e7ee;
}

.fj-modal__row[hidden] {
    display: none;
}

.fj-modal__row dt {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #98a0b3;
}

.fj-modal__row dd {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1A1860;
    text-align: right;
}

.fj-modal__badge {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0077b6;
    background: #E4F1FA;
    padding: 6px 14px;
    border-radius: 999px;
}

@media screen and (max-width: 719px) {
    .fj-modal__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .fj-modal__row dd {
        text-align: left;
    }
}
