/* --- ESTILOS GERAIS E VARIÁVEIS DE COR --- */
:root {
    --cor-primaria: #005A9C;
    --cor-secundaria: #FFC72C;
    --cor-fundo: #F4F4F4;
    --cor-texto: #333333;
    --cor-container: #FFFFFF;
    --cor-terciaria: #fded92;
}

body {
    font-family: 'Lato', sans-serif; 
    line-height: 1.6;
    margin: 0;
    background: linear-gradient(to bottom right, var(--cor-terciaria), var(--cor-primaria));
    color: var(--cor-texto);
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    color: var(--cor-primaria);
}

main, header, footer {
    width: 90%;
    max-width: 960px;
    margin: 0 auto;
}

a {
    color: var(--cor-primaria);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- CABEÇALHO E NAVEGAÇÃO --- */
header {
    background-color: var(--cor-container);
    padding: 20px 30px;
    margin-top: 20px;
    border-radius: 8px;
    text-align: center;
    border-bottom: 4px solid var(--cor-secundaria);
}

header nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.logo img {
    width: 200px;
    height: auto;
}

.descricao {
    font-size: 1.1em;
    margin-top: 10px;
    color: var(--cor-primaria);
    font-weight: bold;
    font-style: italic;
}

/* --- ESTILO DAS SEÇÕES --- */
section {
    background-color: var(--cor-container);
    padding: 25px 30px;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* REGRA ÚNICA E CORRIGIDA PARA H2 */
section h2 {
    border-bottom: 2px solid var(--cor-fundo);
    padding-bottom: 10px;
    margin-top: 0;
    position: relative;
    display: inline-block;
}

/* --- ESTILOS PARA AS IMAGENS E PROGRAMAS --- */
.banner {
    padding: 0;
    margin-top: 20px;
    line-height: 0;
}

.banner img {
    width: 100%;
    border-radius: 8px;
}

#docentes article {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

#docentes img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--cor-secundaria);
}

.galeria-infraestrutura {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.galeria-infraestrutura img {
    width: 32%;
    border-radius: 8px;
    object-fit: cover;
}

/* CÓDIGO ATUALIZADO PARA SEÇÃO DE PROGRAMAS */
.programa-item {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 25px;
}

.programa-item img {
    width: 200px;
    height: 150px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0; /* Impede que a imagem encolha */
}

.programa-texto {
    flex: 1; /* Faz o texto ocupar o espaço restante */
}

/* --- SEÇÃO DE EVENTOS --- */
#eventos ul {
    list-style: none;
    padding: 0;
}

#eventos li {
    background-color: var(--cor-fundo);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 4px solid var(--cor-primaria);
}

/* --- FORMULÁRIO DE CONTATO --- */
form div {
    margin-bottom: 15px;
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

form input[type="text"],
form input[type="email"],
form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

form button {
    background-color: var(--cor-primaria);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

/* --- RODAPÉ --- */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: #ffffff;
}

/* --- ANIMAÇÕES E EFEITOS HOVER --- */
img,
header nav a,
form button,
.programa-item {
    transition: all 0.3s ease-in-out;
}

header nav a {
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
}

header nav a:hover {
    background-color: var(--cor-primaria);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 90, 156, 0.4);
    text-decoration: none; /* Remove o sublinhado que aparece por padrão */
}

.galeria-infraestrutura img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

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

form button:hover {
    background-color: #00487a;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 90, 156, 0.4);
}

/* --- LÓGICA DAS ANIMAÇÕES DE ROLAGEM (CONTROLADAS PELO JS) --- */
/* 1. ESTADO INICIAL: Todas as seções começam invisíveis */
section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* 2. ESTADO VISÍVEL: O JS adiciona a classe .visivel para ativar a animação */
section.visivel {
    opacity: 1;
    transform: translateY(0);
}

/* 3. Animação da linha do subtítulo */
section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background-color: var(--cor-secundaria);
    transition: width 0.8s ease-out;
    transition-delay: 0.3s; /* pequeno delay para a linha aparecer depois da seção */
}

section.visivel h2::after {
    width: 100%;
}

/* 4. Animação escalonada para a lista de eventos */
#eventos li {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.5s ease-out;
}

#eventos.visivel li {
    opacity: 1;
    transform: translateX(0);
}

#eventos.visivel li:nth-child(1) { transition-delay: 0.3s; }
#eventos.visivel li:nth-child(2) { transition-delay: 0.5s; }
#eventos.visivel li:nth-child(3) { transition-delay: 0.7s; }

/* --- DESIGN RESPONSIVO (PARA CELULARES) --- */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    main, header, footer {
        width: 100%;
        border-radius: 0;
    }
    
    header nav ul {
        flex-direction: column;
        gap: 10px;
    }
    
    #docentes article {
        flex-direction: column;
        text-align: center;
    }

    .galeria-infraestrutura {
        flex-direction: column;
    }

    .galeria-infraestrutura img {
        width: 100%;
    }
    
    .programa-item {
        flex-direction: column;
        text-align: center;
    }
    
    .programa-item img {
        width: 100%;
        height: 200px;
    }
}

/* --- BOTÃO VOLTAR AO TOPO --- */
#btnTopo {
    position: fixed; /* Fica fixo na tela */
    bottom: 20px;
    right: 30px;
    z-index: 99; /* Garante que fique sobre outros elementos */
    background-color: var(--cor-terciaria);
    color: white;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 25%; /* Deixa o botão redondo */
    font-size: 15px;
    text-decoration: none;
    
    /* Inicialmente escondido com uma transição suave */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#btnTopo.mostrar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

#btnTopo:hover {
    background-color: #00487a; /* Cor primária um pouco mais escura */
    transform: scale(1.1); /* Efeito de zoom ao passar o mouse */
}

/* Para navegadores que preferem menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}