/* Estilos específicos para páginas de portfólio */

/* Cabeçalho do Portfólio */
.portfolio-header {
    margin-top: 80px;
    padding: 100px 40px;
    text-align: center;
    background-color: #0a0a0a;
}

.portfolio-header-container {
    max-width: 800px;
    margin: 0 auto;
}

.portfolio-header h1 {
    font-size: 48px;
    font-weight: 300; /* leve como padrão do site */
    margin-bottom: 30px;
    letter-spacing: 2px;
    color: #ffffff;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
}

.portfolio-header p {
    font-size: 18px;
    color: #cccccc;
    line-height: 1.6;
    letter-spacing: 0.5px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-weight: 300; /* manter leve */
}

/* Categorias do Portfólio */
.portfolio-categories {
    padding: 100px 40px;
    background-color: #0a0a0a;
}

.portfolio-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

.portfolio-category {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.portfolio-category:hover {
    transform: translateY(-10px);
}

.portfolio-category a {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.portfolio-category img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.portfolio-category:hover img {
    transform: scale(1.1);
}

.category-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 60px 30px 30px;
    color: #ffffff;
}

.category-overlay h3 {
    font-size: 32px;
    font-weight: 300; /* manter leve */
    letter-spacing: 1px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
}

/* Galeria de Imagens */
.gallery-section {
    padding: 100px 40px;
    background-color: #0a0a0a;
}

.gallery-container {
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0 2vw;
    box-sizing: border-box;
}

.gallery-header {
    text-align: center;
    margin-bottom: 80px;
}

.gallery-header h1 {
    font-size: 48px;
    font-weight: 300; /* leve */
    margin-bottom: 20px;
    letter-spacing: 2px;
    color: #ffffff;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
}

.gallery-header p {
    font-size: 18px;
    color: #cccccc;
    letter-spacing: 0.5px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-weight: 300;
}

.gallery-grid {
    column-count: 3;
    column-gap: 24px;
    width: 100%;
    max-width: 100vw;
    margin: 0 0 80px 0;
    padding: 0;
}

@media (max-width: 1024px) {
    .gallery-grid {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        column-count: 1;
    }
}

@media (max-width: 1024px) {
    .gallery-grid {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        column-count: 1;
    }
}

.gallery-item {
    display: block;
    break-inside: avoid;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    background: #181818;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.13);
}

.gallery-item:hover img {
    transform: scale(1.03);
    box-shadow: 0 4px 24px rgba(0,0,0,0.22);
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: block;
    break-inside: avoid;
    width: 100%;
    box-sizing: border-box;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Modal/Lightbox */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    margin: 0 auto;
    display: flex;            /* garante centralização do conteúdo interno */
    align-items: center;      /* vertical */
    justify-content: center;  /* horizontal */
    object-fit: contain;

    /* Contexto para animações */
    overflow: hidden;
}

/* Transição suave entre imagens do lightbox */
.modal-content img, #modalImage {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;

    /* Fade + slide */
    opacity: 1;
    transition: opacity 100ms ease-in-out, transform 100ms ease-in-out;
    will-change: opacity, transform;
}

/* Crossfade */
#modalImage.fading-out {
    opacity: 0;
    transform: translateX(var(--slide-dir, 0)) scale(0.985);
}
#modalImage.fading-in {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Estados de slide direcional */
#modalImage.slide-left-out { transform: translateX(-8%) scale(0.985); opacity: 0; }
#modalImage.slide-left-in { transform: translateX(6%); opacity: 0.3; }
#modalImage.slide-right-out { transform: translateX(8%) scale(0.985); opacity: 0; }
#modalImage.slide-right-in { transform: translateX(-6%); opacity: 0.3; }

@media (max-width: 768px) {
    .modal-content {
        margin: 0 auto;              /* força centralização no mobile */
        padding: 0 8px;              /* pequena folga para setas não empurrarem imagem */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .modal-content img, #modalImage {
        max-width: calc(100vw - 32px); /* considera espaço para setas laterais */
        max-height: 80vh;
        margin: 0 auto;               /* central horizontal */
        display: block;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 0 auto;
        padding: 0 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .modal-content img, #modalImage {
        max-width: calc(100vw - 24px);
        max-height: 70vh;
        margin: 0 auto;
    }
}

.modal-close {
    /* Fixo no canto superior direito da página, fora da imagem */
    position: fixed;
    top: 18px;
    right: 24px;

    /* Hit target robusto */
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;

    z-index: 2100;
    background: rgba(0,0,0,0.25);
    color: #ffffff;

    /* Esconde totalmente o &times; textual para evitar "X" duplo */
    font-size: 0 !important;
    line-height: 0 !important;
    text-indent: -9999px;
    overflow: hidden;

    font-weight: 300;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;

    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Variável para tamanho do ícone */
    --close-icon: 26px;
}

.modal-close:hover {
    color: #eaeaea;
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.6);
    opacity: 1;
}

/* Ícone do X em SVG para escalar perfeitamente */
.modal-close::before {
    content: "";
    display: block;
    width: var(--close-icon);
    height: var(--close-icon);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    /* X branco com stroke consistente */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
    opacity: 0.92;
}

/* Lightbox navigation */
.lightbox-caption {
    position: fixed;
    top: 18px;
    left: 24px;
    z-index: 2100;

    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-size: 15px;
    color: #ffffff;
    letter-spacing: 0.6px;
}

.lightbox-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.85;
}

.lightbox-arrow:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.6);
    opacity: 1;
}

.lightbox-arrow.left { left: 24px; right: auto; }
.lightbox-arrow.right { right: 24px; left: auto; }

.lightbox-arrow svg {
    width: 22px;
    height: 22px;
    stroke: #ffffff;
    stroke-width: 2;
    fill: none;
}

@media (max-width: 768px) {
    /* Esconde as setas no mobile; navegação por gesto */
    .lightbox-arrow {
        display: none !important;
    }

    .lightbox-caption {
        top: 12px;
        left: 12px;
        font-size: 14px;
        padding: 5px 9px;
        border-radius: 6px;
        background: rgba(0,0,0,0.6);
    }

    /* Aumenta o X e mantém boa área de toque no mobile */
    .modal-close {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        font-size: 32px; /* visível e proporcional em telas pequenas */
        line-height: 1;
    }
}

/* Navegação entre categorias */
.category-navigation {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 60px;
}

.category-nav-item {
    text-align: center;
    transition: transform 0.3s ease;
}

.category-nav-item:hover {
    transform: translateY(-5px);
}

.category-nav-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.category-nav-item img {
    width: 200px;
    height: 250px;
    object-fit: cover;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.category-nav-item:hover img {
    transform: scale(1.05);
}

.category-nav-item h3 {
    font-size: 24px;
    font-weight: 300; /* leve */
    color: #ffffff;
    letter-spacing: 1px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
}

.category-nav-item p {
    font-size: 16px;
    color: #cccccc;
    margin-top: 10px;
    letter-spacing: 0.5px;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-weight: 300;
}

/* Responsividade */
@media (max-width: 768px) {
    .portfolio-header {
        padding: 60px 20px;
    }
    
    .portfolio-header h1 {
        font-size: 36px;
    }
    
    .portfolio-categories {
        padding: 60px 20px;
    }
    
    .portfolio-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .gallery-section {
        padding: 60px 20px;
    }
    
    .gallery-header h1 {
        font-size: 36px;
    }
    
    .gallery-grid {
        gap: 15px;
    }
    
    .gallery-item {
        max-width: calc(50% - 8px);
        min-width: 200px;
    }
    
    .category-navigation {
        flex-direction: column;
        gap: 30px;
    }
    
    .category-nav-item img {
        width: 150px;
        height: 200px;
    }
    
    .modal-close {
        top: 12px;
        right: 12px;

        /* mantém proporção e centralização no mobile */
        width: 40px;
        height: 40px;
        font-size: 18px; /* levemente menor que desktop, porém proporcional */
    }
}

@media (max-width: 480px) {

    .portfolio-header h1,
    .gallery-header h1 {
        font-size: 28px;
    }

    .portfolio-header p,
    .gallery-header p {
        font-size: 16px;
    }

    .gallery-header {
        margin-top: 90px;
    }

    .category-overlay h3 {
        font-size: 24px;
    }

    .gallery-grid {
        gap: 10px;
    }

    .gallery-item {
        max-width: 100%;
        min-width: auto;
    }

    .category-nav-item h3 {
        font-size: 20px;
    }
}

