/**
 * [wss_divulgacion] — estilos independientes del shortcode de divulgación.
 * Variables inyectadas inline desde PHP:
 *   --wss-div-accent : color destacado (#AB192D por defecto)
 *   --wss-div-cols   : nº de columnas en escritorio (4 por defecto)
 */

.wss-div {
    --wss-div-accent: #AB192D;
    --wss-div-cols: 4;
    --wss-div-gap: 24px;
    --wss-div-radius: 10px;
    color: #222;
    box-sizing: border-box;
}

.wss-div *,
.wss-div *::before,
.wss-div *::after {
    box-sizing: border-box;
}

/* ---------- Barra de filtros ---------- */
.wss-div-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.wss-div-filter__btn {
    appearance: none;
    border: 1.5px solid var(--wss-div-accent);
    background: #fff;
    color: var(--wss-div-accent);
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    padding: 9px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}

.wss-div-filter__btn:hover,
.wss-div-filter__btn:focus,
.wss-div-filter__btn:focus-visible {
    background: rgba(171, 25, 45, .08);
    color: var(--wss-div-accent);
    text-decoration: none;
    outline: none;
}

.wss-div-filter__btn.is-active,
.wss-div-filter__btn.is-active:hover,
.wss-div-filter__btn.is-active:focus {
    background: var(--wss-div-accent);
    color: #fff;
    text-decoration: none;
}

/* ---------- Grupos por término ---------- */
.wss-div-group {
    margin: 0 0 40px;
}

.wss-div-group[hidden] {
    display: none;
}

.wss-div-group__title {
    position: relative;
    font-size: 1.4rem;
    line-height: 1.25;
    margin: 0 0 20px;
    padding: 0 0 10px;
    color: var(--wss-div-accent);
    border-bottom: 2px solid rgba(171, 25, 45, .18);
}

.wss-div-group__title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 64px;
    height: 2px;
    background: var(--wss-div-accent);
}

/* ---------- Grid de tarjetas ---------- */
.wss-div-grid {
    display: grid;
    grid-template-columns: repeat(var(--wss-div-cols), minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--wss-div-gap);
}

.wss-div-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e6e6e6;
    border-radius: var(--wss-div-radius);
    background: #fff;
    overflow: hidden;
    padding-bottom: 16px;
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.wss-div-card:hover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, .12);
    transform: translateY(-3px);
    border-color: var(--wss-div-accent);
}

/* Media (puede ser botón, enlace o estático). */
.wss-div-card__media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f3f3f3;
    overflow: hidden;
    padding: 0;
    margin: 0;
    border: none;
    cursor: default;
}

.wss-div-card__media--btn,
.wss-div-card__media--link {
    cursor: pointer;
}

.wss-div-card__media img,
.wss-div-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.wss-div-card__media--btn:hover img,
.wss-div-card__media--link:hover img {
    transform: scale(1.04);
}

.wss-div-card__media--placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f0f0f0 0%, #e2e2e2 100%);
}

/* Icono de zoom (lupa) sobre la imagen en tarjetas de tipo imagen. */
.wss-div-card__zoom {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(171, 25, 45, .9);
    opacity: 0;
    transition: opacity .2s ease;
}

.wss-div-card__zoom::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 8px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
}

.wss-div-card__zoom::after {
    content: "";
    position: absolute;
    top: 20px;
    left: 19px;
    width: 7px;
    height: 2px;
    background: #fff;
    transform: rotate(45deg);
}

.wss-div-card__media--btn:hover .wss-div-card__zoom,
.wss-div-card__media--btn:focus-visible .wss-div-card__zoom {
    opacity: 1;
}

.wss-div-card__title {
    font-size: 1.02rem;
    line-height: 1.3;
    font-weight: 600;
    margin: 16px 14px 12px;
    color: #1d1d1d;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* CTA inferior (enlace de descarga o botón de lightbox). */
.wss-div-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: auto auto 0;
    padding: 8px 18px;
    border: none;
    border-radius: 999px;
    background: var(--wss-div-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: .92rem;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: filter .18s ease;
}

.wss-div-card__cta:hover,
.wss-div-card__cta:focus,
.wss-div-card__cta:focus-visible {
    background: var(--wss-div-accent);
    color: #fff;
    text-decoration: none;
    filter: brightness(1.1);
    outline: none;
}

.wss-div-card__cta-icon {
    position: relative;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: #fff;
}

/* Icono descarga (flecha hacia abajo). */
.wss-div-card__cta-icon--download::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 9px;
    background: currentColor;
    transform: translateX(-50%);
}

.wss-div-card__cta-icon--download::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateX(-50%) rotate(45deg);
}

.wss-div-card__cta-text {
    color: #fff;
}

/* Icono lupa. */
.wss-div-card__cta-icon--zoom::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 11px;
    height: 11px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.wss-div-card__cta-icon--zoom::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 6px;
    height: 2px;
    background: currentColor;
    transform: rotate(45deg);
}

/* ---------- Lightbox ---------- */
.wss-div-lightbox[hidden] {
    display: none;
}

.wss-div-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.wss-div-lightbox__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .82);
    cursor: pointer;
}

.wss-div-lightbox__dialog {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    animation: wss-div-pop .22s ease;
}

@keyframes wss-div-pop {
    from {
        opacity: 0;
        transform: scale(.97);
    }

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

.wss-div-lightbox__close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--wss-div-accent);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}

.wss-div-lightbox__close:hover,
.wss-div-lightbox__close:focus,
.wss-div-lightbox__close:focus-visible {
    background: var(--wss-div-accent);
    color: #fff;
    filter: brightness(1.1);
    text-decoration: none;
    outline: none;
}

.wss-div-lightbox__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wss-div-lightbox__img {
    max-width: 92vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.wss-div-lightbox__caption {
    margin-top: 12px;
    color: #fff;
    font-size: .95rem;
    text-align: center;
    max-width: 80vw;
}

.wss-div-lightbox__caption:empty {
    display: none;
}

body.wss-div-lightbox-open {
    overflow: hidden;
}

/* ---------- Estado vacío ---------- */
.wss-div-empty {
    padding: 24px;
    text-align: center;
    color: #666;
    background: #f7f7f7;
    border-radius: 8px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .wss-div-grid {
        grid-template-columns: repeat(min(var(--wss-div-cols), 3), minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .wss-div {
        --wss-div-gap: 18px;
    }

    .wss-div-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .wss-div-grid {
        grid-template-columns: 1fr;
    }

    .wss-div-lightbox__close {
        top: 6px;
        right: 6px;
    }
}