/* Persiana — galeria de imagens em expansão (persiana).
   Desktop: expande no hover. Mobile: toque abre (classe .wpe-aberta via JS).
   Valores dinâmicos por widget vêm de custom properties (--wpe-*). */

.wpe-wrap { width: 100%; }

/* Cabeçalho */
.wpe-cab { max-width: 720px; margin: 0 auto 28px; }
.wpe-titulo { margin: 0 0 8px; font-size: 30px; font-weight: 600; line-height: 1.2; }
.wpe-sub { margin: 0; font-size: 14px; line-height: 1.5; }

/* Grade da persiana */
.wpe-grid {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    gap: 8px;
    height: 400px;
}

.wpe-item {
    position: relative;
    display: block;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
    background: #0f1720;
    border-radius: 8px;
    text-decoration: none;
    transition: flex var(--wpe-vel, 500ms) ease;
}

/* Abertura: desktop hover; mobile classe .wpe-aberta */
.wpe-grid:hover .wpe-item { flex: 1 1 0; }
.wpe-grid .wpe-item:hover { flex: var(--wpe-flex, 5) 1 0; }
.wpe-item.wpe-aberta { flex: var(--wpe-flex, 5) 1 0 !important; }

/* Imagem preenche o item inteiro (vence limites do tema) */
.wpe-item img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center;
    filter: var(--wpe-filtro, none);
    transition: filter var(--wpe-vel, 500ms) ease, transform var(--wpe-vel, 500ms) ease;
}
.wpe-item:hover img,
.wpe-item.wpe-aberta img { filter: grayscale(0); }

/* Overlay só quando há legenda */
.wpe-item.tem-cap::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 60%);
}

/* Legenda */
.wpe-cap {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
    opacity: 0;
    transition: opacity var(--wpe-vel, 500ms) ease;
    pointer-events: none;
}
.wpe-item:hover .wpe-cap,
.wpe-item.wpe-aberta .wpe-cap { opacity: 1; }
.wpe-cap-txt {
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
    white-space: normal;
}

.wpe-titulo, .wpe-sub, .wpe-cap-txt { font-family: inherit; }
.wpe-item:focus-visible { outline: 2px solid #0066ff; outline-offset: -2px; }

/* ═══ MOBILE: empilha; toque abre ═══ */
@media (max-width: 767px) {
    .wpe-grid { flex-direction: column; height: auto; }
    .wpe-item { flex: none; height: 80px; transition: height var(--wpe-vel, 500ms) ease; }
    .wpe-item.wpe-aberta { height: var(--wpe-altura-mob, 500px); flex: none !important; }
    /* Legenda sempre visível no item aberto */
    .wpe-item.wpe-aberta .wpe-cap { opacity: 1; }
    .wpe-item:not(.wpe-aberta) .wpe-cap { opacity: 0; }
    .wpe-item.wpe-aberta img { filter: grayscale(0); }
    /* Nome curto da imagem fechada: mostra a legenda como rótulo central */
    .wpe-item:not(.wpe-aberta).tem-cap .wpe-cap {
        opacity: 1;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
}
