﻿/* ==========================================================================
   Page Full - Galeria (frontend)
   Estilos específicos da seção de galeria exibida na home (e via shortcode).
   As classes de container/header (.sf-section__*) são compartilhadas com
   products.css. Aqui o grid e o efeito hover das imagens.
   ========================================================================== */

/* Prevenir rolagem horizontal e definir fundo contínuo na página dedicada */
body.sf-gallery-page-active {
    background-color: #ffffff !important;
    overflow-x: hidden;
}

/* Reset total de espaçamento do tema na página dedicada de galeria */
body.sf-gallery-page-active .entry-content,
body.sf-gallery-page-active .wp-block-post-content,
body.sf-gallery-page-active main,
body.sf-gallery-page-active .wp-site-blocks,
body.sf-gallery-page-active article,
body.sf-gallery-page-active .wp-block-group {
    max-width: 100% !important;
    width: 100% !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
}

body.sf-gallery-page-active .sf-footer {
    margin-top: 0 !important;
}

/* Ocultar títulos e cabeçalhos nativos do tema quando na página de galeria */
body.sf-gallery-page-active .wp-block-post-title,
body.sf-gallery-page-active .entry-title,
body.sf-gallery-page-active .page-title,
body.sf-gallery-page-active header.entry-header,
body.sf-gallery-page-active .entry-header,
body.sf-gallery-page-active h1.single-title,
body.sf-gallery-page-active .wp-block-query-title,
body.sf-gallery-page-active footer.wp-block-template-part,
body.sf-gallery-page-active .wp-block-template-part-footer,
body.sf-gallery-page-active footer.site-footer,
body.sf-gallery-page-active .site-footer {
    display: none !important;
}

/* Container da seção na página dedicada de galeria.
   Restaura a centralização estendida em telas grandes (max-width 1400px)
   com margens automáticas, mantendo full-width em telas menores.
   Paridade visual com body.sf-products-page-active .sf-section__container
   em products.css (ver PLANO-CORRECAO-CARROSSEL-PRODUTOS.md). */
body.sf-gallery-page-active .sf-section__container {
    max-width: 1400px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    box-sizing: border-box !important;
}

/* A própria seção de galeria se estende ponta a ponta na página dedicada
   (o fundo/área visual ocupa 100%, mas o conteúdo interno fica centralizado
   em 1400px via .sf-section__container). Paridade visual com
   body.sf-products-page-active .sf-all-products-section em products.css. */
body.sf-gallery-page-active .sf-gallery-section {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.sf-gallery-section {
    padding: 60px 0;
    background: #fafafa;
}

/* Galeria em modo carrossel infinito: ganha padding lateral para as setas
   (paralelo a .sf-featured-section com botões prev/next). */
.sf-gallery-section--carousel .sf-carousel-wrapper {
    padding: 0 32px;
}

/* Cards da galeria como slide do carrossel: largura fixa (a engine
   SFCarousel calcula cardStep = cardWidth + gap a partir do outerWidth
   do primeiro filho da track). */
.sf-carousel-track--gallery .sf-gallery-item {
    width: 280px;
    min-width: 280px;
    flex: 0 0 280px;
}

/* Fallback/legado: grid responsivo quando usado fora do carrossel
   (ex.: customizações antigas que ainda referenciem .sf-gallery-grid). */
.sf-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.sf-gallery-item {
    margin: 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f0f0f1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    cursor: zoom-in;
}

.sf-gallery-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

.sf-gallery-item__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.sf-gallery-item__img-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}

.sf-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.sf-gallery-item:hover img {
    transform: scale(1.08);
}

.sf-gallery-item__caption {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 24px 14px 12px;
    margin: 0;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sf-gallery-item:hover .sf-gallery-item__caption {
    opacity: 1;
    transform: translateY(0);
}

/* Responsivo */
@media (max-width: 768px) {
    .sf-gallery-section {
        padding: 40px 0;
    }
    .sf-gallery-section--carousel .sf-carousel-wrapper {
        padding: 0 28px;
    }
    /* Slides um pouco menores no mobile, mas still >= 240px para cards
       permanecerem legíveis. A engine recalcula cardStep automaticamente. */
    .sf-carousel-track--gallery .sf-gallery-item {
        width: 240px;
        min-width: 240px;
        flex: 0 0 240px;
    }
    .sf-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    .sf-gallery-item__caption {
        opacity: 1;
        transform: none;
        background: rgba(0, 0, 0, 0.55);
        padding: 18px 10px 8px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .sf-carousel-track--gallery .sf-gallery-item {
        width: 220px;
        min-width: 220px;
        flex: 0 0 220px;
    }
    .sf-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
