/* Portfolio CSS Fixed - Rewrite */

/* --- Layout Principal --- */
#portfolio {
    padding: 3rem 0 4rem 0;
    background-color: var(--color-bg-alt);
    position: relative;
    /* Importante: overflow visible para deixar títulos/sombras aparecerem */
    overflow: visible;
    color: var(--color-text);
}

/* Forçar visibilidade do título */
#portfolio .section-header {
    width: 100%;
    position: relative;
    z-index: 5;
    opacity: 1 !important;
    transform: none !important;
    margin-bottom: 3rem;
}

.portfolio-wrapper {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    z-index: 2;
    /* Acima de qualquer bg */
}

/* --- Carrossel Container (Scroll Nativo) --- */
.portfolio-carousel {
    width: 100%;
    /* Overflow auto habilita scroll, mas escondemos a barra visualmente */
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 2rem 0;
    /* Espaço para hover shadow */

    /* Esconder scrollbar Firefox */
    scrollbar-width: none;
    /* Esconder scrollbar IE */
    -ms-overflow-style: none;

    /* Prevenir seleção acidental */
    user-select: none;
}

/* Esconder scrollbar Webkit */
.portfolio-carousel::-webkit-scrollbar {
    display: none;
}

.carousel-track {
    display: flex;
    gap: 2rem;
    padding: 0 1rem;
    width: max-content;
}

/* --- Botões de Navegação Global --- */
.portfolio-nav {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.portfolio-nav:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: scale(1.1);
}

/* --- Project Card --- */
.project-card {
    min-width: 350px;
    max-width: 350px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    /* Conteúdo não vazar */
    transition: transform 0.3s ease, box-shadow 0.3s ease, min-width 0.3s ease;
    /* Animar width se expandir? Não, altura */
    display: flex;
    flex-direction: column;
    /* Correção de altura mínima */
    min-height: 500px;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* --- Galeria Interna do Card --- */
.card-gallery {
    position: relative;
    width: 100%;
    height: 250px;
    background-color: #e0e0e0;
    overflow: hidden;
    flex-shrink: 0;
}

.gallery-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.gallery-inner img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-inner img.active {
    opacity: 1;
    z-index: 1;
}

/* Setas da Galeria */
.gallery-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    pointer-events: none;
}

.card-gallery:hover .gallery-controls {
    opacity: 1;
}

.g-btn {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    pointer-events: auto;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.g-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* --- Conteúdo do Card --- */
.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    background: var(--color-bg);
}

.category-badge {
    background-color: #000;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    align-self: flex-start;
    margin-bottom: 0.8rem;
    letter-spacing: 0.05em;
}

.card-content h3 {
    font-size: 1.4rem;
    margin: 0 0 1rem 0;
    color: var(--color-primary);
}

/* Descrição Expansível */
.card-description {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
    /* Transição suave de altura se necessário */
}

.full-text {
    display: none;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Estado Expandido */
.project-card.expanded .full-text {
    display: block;
    opacity: 1;
    animation: fadeIn 0.4s ease;
}

.read-more-btn {
    background: transparent;
    border: none;
    color: var(--color-accent);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    align-self: flex-start;
    padding: 0;
    margin-top: auto;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.read-more-btn:hover {
    border-bottom-color: var(--color-accent);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsivo */
@media (max-width: 768px) {
    .project-card {
        min-width: 280px;
        max-width: 280px;
    }

    .portfolio-nav {
        display: none;
        /* Mobile usa swipe natural */
    }

    .carousel-track {
        gap: 1rem;
    }
}