/* =======================================================
    1. VARIÁVEIS E CONFIGURAÇÕES GLOBAIS
    ======================================================= */
:root {
    /* Light Mode Cores */
    --primary-color: #5d53ff; /* Cor de Destaque (Azul/Roxo Vibrante) */
    --secondary-color: #3f36a5; 
    --text-color: #2c3e50;
    --background-color: #f0f4f8;
    --card-bg: #ffffff;
    --link-color: #2980b9;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --progress-bar-bg: #ecf0f1;
}

/* Dark Mode Cores */
body.dark-mode {
    --primary-color: #8a81ff; /* Azul/Roxo mais claro para contraste */
    --secondary-color: #3f36a5;
    --text-color: #ecf0f1;
    --background-color: #1f2937;
    --card-bg: #2d3748;
    --link-color: #74b9ff; 
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    --progress-bar-bg: #4a5568;
}

/* Configurações do Body */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color 0.5s, color 0.5s; /* Transição de tema suave */
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--link-color);
}

/* Adiciona foco visível para acessibilidade */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Títulos de Seção */
.section-title {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 50px;
    font-weight: 700;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background-color: var(--secondary-color);
    margin: 10px auto 0;
    border-radius: 2px;
    transform: scaleX(0); 
    transition: transform 0.6s ease-out;
}

/* Classe JS para acionar a animação da linha */
.section-title.is-visible::after {
    transform: scaleX(1);
}

/* =======================================================
    2. HEADER E NAVEGAÇÃO (AJUSTADO PARA ROLAGEM HORIZONTAL)
    ======================================================= */
#header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}

#nav {
    display: flex;
    /* Ajusta para centralizar o menu e colocar o toggle de tema à direita */
    justify-content: space-between; 
    align-items: center;
    padding: 15px 20px; 
}

/* Remove o Botão Menu Hambúrguer completamente */
.menu-toggle {
    display: none !important; 
}

#nav ul {
    list-style: none;
    display: flex; 
    margin: 0;
    padding: 0;
    order: 1; 
    flex-grow: 1; /* Ocupa o espaço central */
    
    /* NOVO: Propriedades para Rolagem Horizontal */
    overflow-x: auto; 
    overflow-y: hidden;
    white-space: nowrap; /* Impede a quebra de linha */
    -webkit-overflow-scrolling: touch;
    
    /* Remove a barra de rolagem horizontal se o browser suportar */
    scrollbar-width: none; /* Firefox */
}

/* Remove a barra de rolagem em navegadores baseados em Webkit (Chrome, Safari) */
#nav ul::-webkit-scrollbar {
    display: none; 
}

#nav li {
    margin-left: 30px;
    flex-shrink: 0; /* Impede que os itens encolham no mobile */
}

#nav a {
    color: var(--text-color);
    font-weight: 600;
    position: relative;
}

/* Efeito Underline Animado */
#nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    left: 50%;
    bottom: -5px;
    transition: all 0.3s ease-in-out;
    transform: translateX(-50%);
}

#nav a:hover::after,
#nav a.active::after {
    width: 100%;
}

/* Botão de Tema */
.theme-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.5em;
    transition: transform 0.3s;
    margin-left: 30px; 
    order: 2; 
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* =======================================================
    3. HERO SECTION (APRESENTAÇÃO)
    ======================================================= */
#hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 0;
}

.hero-content {
    max-width: 900px;
    display: flex; 
    flex-direction: column;
    align-items: center; 
}

.hero-content h1 {
    font-family: 'Fira Code', monospace;
    font-size: 4em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 auto 10px auto; 
}

.hero-content h2 {
    font-size: 1.8em;
    font-weight: 300;
    color: var(--secondary-color);
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
    animation-delay: 0.5s; 
}

.social-links {
    margin-top: 30px;
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
    animation-delay: 1s; 
    
    display: flex;
    justify-content: center;
    gap: 15px; 
}

.social-links .custom-icon {
    width: 2.5em; 
    height: 2.5em;
    object-fit: contain; 
    transition: transform 0.3s;
}

.social-links a:hover .custom-icon {
    transform: scale(1.1); 
}

/* Animação de Fade In genérica (usada por JS para AOS) */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =======================================================
    4. SEÇÕES COM ANIMAÇÃO (AOS - Intersection Observer)
    ======================================================= */
.section {
    padding: 80px 0;
    opacity: 0; 
    transform: translateY(50px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Efeito Tilt/Hover nos cards (Geral) */
.card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease-out, box-shadow 0.3s, background-color 0.3s;
}

.card:hover {
    transform: translateY(-5px); /* Efeito de subida para cards gerais (About, Contact, Skills) */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* SEÇÃO ABOUT */
#about .card {
    display: flex;
    gap: 40px;
    align-items: center;
}

.profile-img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--primary-color);
    flex-shrink: 0;
    transition: filter 0.3s;
}

body.dark-mode .profile-img {
    filter: brightness(0.9) contrast(1.1);
}

/* SEÇÃO SKILLS */
#skills .skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); 
    gap: 30px;
}

.skill-item {
    display: flex; 
    flex-direction: column;
    justify-content: space-between;
}

.skill-content-icon {
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    text-align: center;
    padding: 0; 
    height: 100%; 
    flex-grow: 1; 
}

.skill-icon.large {
    width: 100%; 
    max-width: 150px; 
    height: auto;
    max-height: 150px; 
    margin-bottom: 0; 
    transition: transform 0.3s ease;
}

.skill-item:hover .skill-icon.large {
    transform: scale(1.1); 
}

.progress-bar {
    display: none; 
}


/* SEÇÃO EXPERIENCE & EDUCATION (TIMELINE) */
#experience, #education {
    background-color: var(--background-color); 
}

.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

/* Linha central da Timeline */
.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    background-color: inherit;
    width: 50%;
    opacity: 0; 
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.timeline-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Círculo no meio da Timeline */
.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    right: -10px;
    background-color: var(--primary-color);
    border: 4px solid var(--background-color); 
    top: 15px;
    border-radius: 50%;
    z-index: 1;
}

.timeline-left {
    left: 0;
    text-align: right;
}

.timeline-right {
    left: 50%;
}

/* Alinhamento dos círculos */
.timeline-right::after {
    left: -10px;
}

.timeline-content {
    padding: 20px 30px;
    background-color: var(--card-bg);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.timeline-content h4 {
    color: var(--secondary-color);
    font-size: 1.1em;
}

.timeline-content .dates {
    font-size: 0.9em;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

/* =======================================================
    SEÇÃO PROJECTS (CARROSSEL HORIZONTAL)
    ======================================================= */
.projects-carousel {
    display: flex;
    overflow-x: scroll; /* ATIVA O SCROLL HORIZONTAL */
    padding-bottom: 20px; /* Espaço para a barra de rolagem não cortar a sombra */
    gap: 30px;
    -webkit-overflow-scrolling: touch; /* Melhora o scroll em dispositivos Apple */
    /* Opcional: Estilo da barra de rolagem (Firefox) */
    scrollbar-width: thin; 
    scrollbar-color: var(--primary-color) var(--card-bg);
}

/* Estilo da barra de rolagem para navegadores WebKit (Chrome, Safari) */
.projects-carousel::-webkit-scrollbar {
    height: 8px;
}
.projects-carousel::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}
.projects-carousel::-webkit-scrollbar-track {
    background: var(--card-bg);
}


.project-card {
    /* IMPORTANTE para o carrossel: Largura fixa e impede quebra de linha */
    flex: 0 0 350px; 
    /* Altura ajustada para o formato retangular */
    min-height: 380px; 
    position: relative;
    overflow: hidden;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease-out, box-shadow 0.3s, background-color 0.3s;
}

/* 🚀 CORREÇÃO APLICADA: Usando um seletor mais específico e 'transform: none' */
.projects-carousel .project-card:hover {
    transform: none; /* Anula qualquer transformação de subida herdada de .card:hover */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15); /* Mantém apenas a sombra mais forte */
}

/* Estrutura interna para o layout de Conteúdo + Informação (usado em todos os cards) */
.project-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Contêiner de Mídia (Vídeo/Imagem) */
.project-card .video-container {
    width: 100%;
    /* Define uma altura relativa para a área do vídeo/imagem. ~50% do card verticalmente */
    height: 50%; 
    max-height: 200px; /* Limite opcional para controle */
    overflow: hidden; 
}

.project-card .video-container video, 
.project-card .video-container img {
    width: 100%;
    /* CRÍTICO: Faz a mídia preencher o contêiner e corta o excesso, mantendo a proporção */
    height: 100%; 
    object-fit: cover; 
    display: block; 
}

.project-info {
    padding: 15px;
    flex-grow: 1; /* Faz o info ocupar o restante do espaço no card */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-info h4 {
    color: var(--secondary-color);
    margin-bottom: 5px;
    font-size: 1.1em;
}

.project-info p {
    font-size: 0.9em;
    margin-bottom: 10px;
    color: var(--text-color);
}



.project-card:hover .project-overlay {
    opacity: 1;
    transform: translateY(0);
}

.project-overlay h4 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.project-overlay p {
    font-size: 0.9em;
    margin-bottom: 20px;
}




/* SEÇÃO CONTACT */
#contact .card {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#contact form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

#contact input, #contact textarea {
    padding: 12px;
    border: 1px solid var(--progress-bar-bg);
    border-radius: 6px;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: border-color 0.3s;
}

#contact input:focus, #contact textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color)30;
}

#contact button {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
}

#contact button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

/* FOOTER */
#footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    border-top: 1px solid var(--progress-bar-bg);
    font-size: 0.9em;
    color: var(--secondary-color);
}


/* =======================================================
    5. MEDIA QUERIES (RESPONSIVIDADE AJUSTADA)
    ======================================================= */
@media (max-width: 992px) {
    /* -------------------------------------
        HEADER/NAVEGAÇÃO (ROLAGEM HORIZONTAL)
        ------------------------------------- */
    
    /* Remove padding lateral do nav container para dar mais espaço para a rolagem */
    #nav {
        padding: 15px 0; 
    }

    #nav ul {
        /* Garante que o menu ocupe o espaço e seja rolável */
        justify-content: flex-start; /* Alinha os links à esquerda na rolagem */
        
        /* Adiciona padding horizontal (simulado) para o primeiro e último item não ficarem colados na borda */
        padding: 0 20px; 
    }

    #nav li {
        margin-left: 20px; /* Reduz o espaçamento entre itens no mobile */
    }
    
    #nav li:first-child {
        margin-left: 0; /* Remove a margem do primeiro item, ele será espaçado pelo padding do UL */
    }

    #nav a {
        padding: 8px 0; /* Reduz padding vertical dos links */
    }
    
    /* Outras seções */
    .hero-content h1 {
        font-size: 3em; 
        text-align: center; 
    }

    #about .card {
        flex-direction: column;
        text-align: center;
    }

    .timeline::after {
        left: 20px; 
    }

    .timeline-item {
        width: 100%;
        padding-left: 60px;
        padding-right: 10px;
        text-align: left;
    }

    .timeline-item::after {
        left: 10px;
        right: auto;
    }

    .timeline-right {
        left: 0;
    }
    
    /* Ajuste de tamanho do card de projeto no mobile para manter a proporção */
    .project-card {
        flex: 0 0 90vw; /* Ocupa 90% da largura da tela no mobile */
        min-height: 350px; 
    }
}

@media (max-width: 600px) {
    .hero-content h1 {
        font-size: 2em; 
    }

    .hero-content h2 {
        font-size: 1.4em;
    }

    .section-title {
        font-size: 1.8em;
    }

    .container {
        padding: 0 10px;
    }
    
    #skills .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .skill-icon.large {
        max-width: 100px;
        max-height: 100px;
    }
}
