/*
    obras.css — Estilos para listagens e galerias de obras/projetos.
    Referências: app/Views/obrascosteira.php, app/Views/projeto.php, app/Views/obra.php, app/Views/obracivildetail.php
*/
/* Simple styles for Obras public pages and gallery animation */
/* ===== GRID PROFISSIONAL PARA PROJETOS ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 28px;
    padding: 20px 0;
}

/* ===== CARD PRINCIPAL - LAYOUT POSTER ===== */
.project-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.27, 1),
        box-shadow 0.28s ease,
        opacity 0.22s ease;
    will-change: transform, box-shadow;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

.project-link {
    display: block;
    width: 100%;
    height: 340px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background: #f3f4f6;
    position: relative;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.project-card:hover .project-image {
    transform: scale(1.04);
}

.project-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    color: #9ca3af;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ===== INFORMAÇÕES DO CARD ===== */
.project-info {
    flex: 1;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-card h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
    word-break: break-word;
}

.project-card p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.obra-gallery {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.obra-slide {
    display: none;
}

.obra-slide img {
    width: 100%;
    height: 360px;
    object-fit: cover;
    display: block;
}

.obra-slide.active {
    display: block;
}

.obra-prev,
.obra-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.obra-prev {
    left: 8px
}

.obra-next {
    right: 8px
}

/* responsive */
@media (max-width:640px) {
    .obra-slide img {
        height: 200px
    }
}

/* Layout solicitado: Título em caixa, descrição em caixa, 3 fotos em linha e vídeo abaixo */
.obra-title-box {
    border: 3px solid var(--accent, #0ea5a2);
    padding: 18px;
    margin-bottom: 18px;
    border-radius: 6px;
    background: #fff;
}

.obra-desc-box {
    border: 2px solid rgba(0, 0, 0, 0.06);
    padding: 18px;
    margin-bottom: 18px;
    min-height: 80px;
    background: #fff;
}

.obra-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.thumb-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    border: 3px solid var(--accent, #0ea5a2);
    border-radius: 6px;
}

.obra-video-box {
    border: 1.5px solid rgba(2, 6, 23, 0.06);
    padding: 24px;
    margin-top: 24px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(6, 95, 70, 0.05) 0%, rgba(15, 23, 42, 0.02) 100%);
}

.video-thumbnail-btn {
    cursor: pointer;
}

.video-thumbnail-box {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 6px;
    transition: transform 0.3s ease;
}

.video-thumbnail-box img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.3s ease;
}

.video-thumbnail-btn:hover .video-thumbnail-box img {
    filter: brightness(0.85);
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    z-index: 10;
}

.video-thumbnail-btn:hover .video-play-button {
    transform: translate(-50%, -50%) scale(1.1);
}

.video-embed {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.video-embed iframe {
    width: 100%;
    height: auto;
    min-height: 480px;
    border-radius: 6px;
    border: 1.5px solid rgba(2, 6, 23, 0.06);
    box-shadow: 0 4px 12px rgba(2, 6, 23, 0.08);
    display: block;
}

/* Video Thumbnail Button Styles - Bootstrap Modal */
.video-thumbnail-btn {
    border: none !important;
    padding: 0 !important;
    background: none !important;
    cursor: pointer;
    width: 100% !important;
    transition: transform 0.2s ease;
}

.video-thumbnail-btn:hover .video-play-button svg {
    transform: scale(1.15);
}

.video-thumbnail-box {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 6px;
    transition: filter 0.3s ease;
}

.video-thumbnail-btn:hover .video-thumbnail-box {
    filter: brightness(1.1);
}

.video-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.video-play-button svg {
    transition: transform 0.2s ease;
}

@media (max-width: 760px) {
    .obra-thumbs {
        grid-template-columns: 1fr;
    }

    .thumb-item img {
        height: 160px;
    }
}

/* Title box subtle border */
.obra-title-box {
    border: 1.5px solid rgba(2, 6, 23, 0.06);
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 6px;
    background: #fff;
}

/* Thumbnails: smaller, hover-zoom and subtle shadow */
.thumb-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    border: 1.5px solid rgba(2, 6, 23, 0.06);
    border-radius: 6px;
    transition: transform 220ms ease, box-shadow 220ms ease;
    cursor: pointer;
}

.thumb-item img:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
}

/* Modal gallery */
.obra-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.obra-modal.open {
    display: flex;
}

.obra-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.obra-modal-content {
    position: relative;
    z-index: 2;
    max-width: 1000px;
    width: 1000px;
    height: auto;
    padding: 20px;
    box-sizing: border-box;
}

.obra-modal-slides {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.obra-modal-slide {
    display: none;
    width: 100%;
}

.obra-modal-slide.active {
    display: block;
}

.obra-modal-slide img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.obra-modal-close {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 3;
    background: transparent;
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
}

.obra-modal-prev,
.obra-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: none;
    padding: 10px 14px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
}

.obra-modal-prev {
    left: 8px
}

.obra-modal-next {
    right: 8px
}

@media (max-width:640px) {
    .obra-modal-content {
        padding: 10px;
    }

    .thumb-item img {
        height: 120px
    }
}

/* Interactive gallery inspired by Harsh Singh effect */
/* Garante que o container da galeria tenha altura */
.interactive-gallery {
    display: flex;
    gap: 5px;
    height: 120px;
    width: 400px;
    margin-top: 20px;
    perspective: 2000px;
    border-radius: 8px;
    overflow: hidden;


}

.interactive-gallery .ig-item {
    flex: 1;
    position: relative;
    display: block;
    overflow: hidden;
    background-color: #ccc;
    /* Cor de fundo se a imagem falhar */
    transition: flex 0.3s ease;
    /* JS-driven falloff */
    --falloff: 0;
    --tilt: 0deg;
    transition: transform var(--fall-smoothness) ease, filter 0.5s;
    /* Adicionado um z-index dinâmico para o item em foco não ficar atrás dos outros */
    z-index: calc(1 + (var(--falloff) * 10));
    transform: translateZ(calc(var(--falloff) * var(--hover-intensity))) rotateY(var(--tilt));

    /* Ajuste no filtro: Se o falloff for 0 (estado inicial), a imagem agora aparece */
    filter: brightness(calc(0.6 + (var(--falloff) * 0.4))) saturate(calc(0.5 + (var(--falloff) * 0.5)));
}

/* Isso faz a imagem preencher todo o espaço da miniatura */
.interactive-gallery .ig-item .img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--img);
    background-size: cover;
    background-position: center;
    pointer-events: none;
    /* Deixa o clique passar para o link */
}

/* Zonas de hover para o efeito de inclinação */
.interactive-gallery .hover-zone {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 10;
}

.interactive-gallery .hover-zone i {
    flex: 1;
    height: 100%;
}