/**
 * Módulo: Tarjetas de acreditaciones
 * Se arma desde el editor de bloques: un Grupo "ch-acred-grid" con un Grupo
 * "ch-acred" por organismo (imagen + título + "ch-acred-org" + texto +
 * nota opcional "ch-acred-meta" + botón).
 */

/*
 * En temas clásicos WordPress envuelve el contenido de cada Grupo en
 * ".wp-block-group__inner-container": la grilla y la columna flexible van en
 * ese contenedor cuando existe, y en el propio grupo cuando no.
 */
.ch-acred-grid {
    margin: 0 0 40px;
}

/* Flex en vez de grid: la última fila incompleta queda centrada */
.ch-acred-grid > .wp-block-group__inner-container,
.ch-acred-grid:not(:has(> .wp-block-group__inner-container)) {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.ch-acred-grid .ch-acred {
    flex: 0 1 calc((100% - 48px) / 3);
    min-width: 260px;
}

@media (max-width: 600px) {
    .ch-acred-grid .ch-acred {
        flex-basis: 100%;
    }
}

.ch-acred,
.ch-acred > .wp-block-group__inner-container {
    display: flex;
    flex-direction: column;
}

.ch-acred > .wp-block-group__inner-container {
    flex: 1;
}

.ch-acred {
    background: var(--bg-white);
    border: 1px solid #E3E8F0;
    border-top: 4px solid var(--color-primary);
    padding: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ch-acred:nth-child(even) {
    border-top-color: var(--color-danger);
}

.ch-acred:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(26, 66, 138, 0.10);
}

/* Logo: misma altura para todas las tarjetas */
.ch-acred .wp-block-image {
    height: 90px;
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ch-acred .wp-block-image img {
    max-height: 90px;
    max-width: 180px;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

.page-content .ch-acred h2 {
    margin: 0 0 4px;
    padding: 0;
    border: 0;
    font-size: 1.35rem;
    line-height: 1.3;
}

.ch-acred-org {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-danger);
}

.ch-acred p {
    margin-top: 0;
}

.ch-acred-meta {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* El botón queda siempre al pie de la tarjeta */
.ch-acred .wp-block-buttons {
    margin-top: auto;
    padding-top: 8px;
}

.page-content .ch-acred .wp-block-button__link {
    background: transparent;
    color: var(--color-primary) !important;
    border: 2px solid var(--color-primary);
    border-radius: 0;
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.page-content .ch-acred .wp-block-button__link::before {
    content: '\f1c1';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 8px;
}

.page-content .ch-acred .wp-block-button__link:hover {
    background: var(--color-primary);
    color: #fff !important;
}

.gob-rounded .page-content .ch-acred .wp-block-button__link {
    border-radius: 999px;
}
