/* CSS Variables */
:root {
    --bg-dark: #111111;
    --bg-black: #000000;
    --text-light: #fff;
    --accent: #F1402D;
    --beige: #f5e9da;
    --card-bg: #181818;
    --border-radius: 12px;
    --transition: 0.3s cubic-bezier(.4,0,.2,1);
    --font-main: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --grey: #aaa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-black);
    color: var(--text-light);
    font-family: var(--font-main);
    min-height: 100vh;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 110px;
    z-index: 1000;
    /* Transição suave para a altura da navbar */
    transition: height 0.4s cubic-bezier(.4,0,.2,1);
}

/* O fundo escuro agora é um elemento separado para poder deslizar para cima */
.navbar::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: -1;
    transition: transform 0.4s cubic-bezier(.4,0,.2,1);
    transform: translateY(0);
}

.navbar-section {
    display: flex;
    align-items: center;
    flex: 1;
}
.navbar-section.center {
    justify-content: center;
}
.navbar-section.right {
    justify-content: flex-end;
    gap: 1.2rem;
}

/* Adicionado: Transição para os itens laterais (links, idiomas e redes sociais) */
.navbar-section.left,
.navbar-section.right {
    transition: transform 0.4s cubic-bezier(.4,0,.2,1), opacity 0.4s cubic-bezier(.4,0,.2,1);
}

/* === MODO SCROLLED: Oculta a navbar, deixa só a logo === */
.navbar.scrolled {
    height: 80px; /* Área invisível no topo para capturar o hover do mouse */
}
.navbar.scrolled::before {
    transform: translateY(-100%); /* Desliza o fundo para cima */
}
.navbar.scrolled .navbar-section.left,
.navbar.scrolled .navbar-section.right {
    transform: translateY(-100%); /* Desliza os itens para cima */
    opacity: 0;
    pointer-events: none; /* Desativa o clique nos itens enquanto invisíveis */
}
.navbar.scrolled .navbar-logo {
    width: 117px; 
    height: 35px; 
}

/* === MODO HOVER NO SCROLL: Navbar surge de cima === */
.navbar.scrolled:hover {
    height: 110px; /* Volta a altura normal para os itens caberem */
}
.navbar.scrolled:hover::before {
    transform: translateY(0); /* Desliza o fundo de volta para baixo */
}
.navbar.scrolled:hover .navbar-section.left,
.navbar.scrolled:hover .navbar-section.right {
    transform: translateY(0); /* Desliza os itens de volta para baixo */
    opacity: 1;
    pointer-events: auto; /* Reativa os cliques */
}
.navbar.scrolled:hover .navbar-logo {
    width: 235px; /* Logo expande para o tamanho original */
    height: 70px;
}

/* Navbar Links */
.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}
.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    text-transform: lowercase;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    font-weight: 400;
    transition: color var(--transition);
}
.nav-links a:hover {
    color: var(--accent);
}

/* Navbar Logo */
.navbar-logo {
    position: relative;
    width: 235px;
    height: 70px;
    display: block;
    transition: width 0.4s cubic-bezier(.4,0,.2,1), height 0.4s cubic-bezier(.4,0,.2,1);
}

/* Configuração geral das 3 imagens da logo */
.navbar-logo img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; 
    border-radius: 0; 
    box-shadow: none; 
    cursor: pointer;
    transition: opacity 0.4s ease-in-out;
}

/* Estado inicial: apenas a logo padrão (vermelha) aparece */
#logo-img-default { opacity: 1; }
#logo-img-hover { opacity: 0; }
#logo-img-scrolled { opacity: 0; }

/* === COMPORTAMENTO 1: Hover normal na logo (troca pra logo 2) === */
.navbar-logo:hover #logo-img-default { opacity: 0; }
.navbar-logo:hover #logo-img-scrolled { opacity: 0; } /* Garante que a branca suma */
.navbar-logo:hover #logo-img-hover { opacity: 1; }

/* === COMPORTAMENTO 2: Página rolada para baixo (MODO SCROLLED) === */
/* Se a navbar está recolhida e NÃO está com o mouse em cima, mostra a logo 3 (branca) */
.navbar.scrolled:not(:hover) #logo-img-default { opacity: 0; }
.navbar.scrolled:not(:hover) #logo-img-hover { opacity: 0; }
.navbar.scrolled:not(:hover) #logo-img-scrolled { opacity: 1; }

/* Navbar Language Toggle & Socials */
.lang-switcher {
    color: var(--grey);
    font-size: 1rem;
    margin-right: 1.2rem;
    display: flex;
    gap: 0.3em;
    user-select: none;
}
.lang-switcher span {
    color: var(--grey);
    transition: color var(--transition);
    cursor: pointer;
}
.lang-switcher span.active {
    color: var(--text-light);
}
.lang-switcher span:hover {
    color: var(--accent);
}

.social-icons {
    display: flex;
    gap: 0.8rem;
}
.social-icons img {
    width: 22px;
    height: 22px;
    filter: grayscale(1) brightness(1.5);
    opacity: 0.8;
    transition: filter var(--transition), opacity var(--transition);
}
.social-icons img:hover {
    filter: none;
    opacity: 1;
}

/* Hero Section */
.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding-top: 110px;
    overflow: hidden;
    z-index: 0;
}
.hero-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}
.hero-bg-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.3;
    display: block;
}
.hero-content {
    position: relative;
    margin: 0 auto;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    z-index: 2;
}
.hero-desc {
    font-size: 1.1rem;
    color: #aaa;
    margin-bottom: 0.35rem;
}
.hero-title {
    font-size: 4.2rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 0.6rem;
}
.hero-subdesc {
    font-size: 1.15rem;
    color: #bbb;
    margin-bottom: 1rem;
    max-width: 500px;
}
.hero-btn {
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: 24px;
    padding: 0.8rem 2.2rem;
    font-size: 1.1rem;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: all var(--transition);
}
.hero-btn:hover {
    background: var(--beige);
    color: #111;
    transform: translateY(-2px) scale(1.04);
}

/* Portfolio Grid */
.portfolio {
    padding: 4rem 0 2rem 0;
    background: var(--bg-dark);
}
.portfolio-title {
    text-align: center;
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 2.5rem;
    color: var(--text-light);
}
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Portfolio Card */
.portfolio-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    display: block;
    text-decoration: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    transition: transform var(--transition), box-shadow var(--transition);
}
.portfolio-card:hover {
    transform: scale(1.035) translateY(-4px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.28);
}
.portfolio-card video {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    background-color: #222; 
}
.portfolio-card-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(241, 64, 45, 0);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 2;
}
.portfolio-card:hover .portfolio-card-content {
    background: rgba(241, 64, 45, 0.8);
    opacity: 1;
}
.portfolio-card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff !important; 
    margin-bottom: 0.5rem;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}
.portfolio-card-desc {
    font-size: 1rem;
    color: #ffffff !important;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}
.portfolio-card:hover .portfolio-card-title,
.portfolio-card:hover .portfolio-card-desc {
    transform: translateY(0);
}

/* Contact Section */
.contact {
    background: var(--bg-black);
    padding: 4rem 0 2rem 0;
}
.form-container {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 0 2rem;
}
.contact-form {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2.5rem 2rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.contact-form label {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 0.4rem;
    font-weight: 500;
}
.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    border: none;
    background: #222;
    color: #fff;
    font-size: 1rem;
    font-family: var(--font-main);
    resize: none;
}
.contact-form textarea {
    min-height: 100px;
}
.contact-form button {
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: 24px;
    padding: 0.8rem 2.2rem;
    font-size: 1.1rem;
    font-family: var(--font-main);
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all var(--transition);
    font-weight: 600;
    align-self: center;
    width: 100%;
}
.contact-form button:hover {
    background: var(--beige);
    color: #111;
    transform: translateY(-2px);
}

/* Footer */
footer {
    background: var(--bg-dark);
    color: var(--text-light);
    text-align: center;
    padding: 2.2rem 0 1.2rem 0;
    margin-top: 2rem;
}
.footer-social {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.2rem;
}
.footer-social a {
    display: inline-block;
}
.footer-social img {
    width: 22px !important;
    height: 22px !important;
    filter: grayscale(1) brightness(1.5);
    opacity: 0.85;
    transition: filter var(--transition), opacity var(--transition);
    object-fit: contain;
}
.footer-social img:hover {
    filter: none;
    opacity: 1;
}
.footer-copyright {
    color: #bbb;
    font-size: 1rem;
    margin-top: 0.7rem;
}

/* ========================================= */
/* HAMBURGER MENU (CORREÇÃO DO X E BORDA)    */
/* ========================================= */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px; /* Aumentado para o X não ser cortado */
    height: 44px;
    cursor: pointer;
    z-index: 1100;
    outline: none; /* Remove aquele quadrado de foco */
    -webkit-tap-highlight-color: transparent; /* Remove o fundo azul ao clicar no celular */
}
.hamburger span {
    display: block;
    width: 28px; /* Barrinhas um pouco mais largas */
    height: 3px;
    background-color: #ffffff !important;
    margin: 6px 0; /* Espaço maior entre as linhas */
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
/* Animação do Hamburger virando um "X" */
.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Ocultar os itens duplicados no layout de computador */
.mobile-only { display: none !important; }

/* ========================================= */
/* RESPONSIVIDADE E MOBILE AQUI              */
/* ========================================= */
@media (max-width: 850px) {
    
    /* 1. Garante que idiomas e redes sociais apareçam dentro do menu */
    li.mobile-only { 
        display: flex !important; 
        flex-direction: column; 
        align-items: center; 
        gap: 1.5rem; 
        margin-top: 2rem; 
        width: 100%;
    }
    .mobile-only .social-icons {
        display: flex !important;
        justify-content: center;
        gap: 1.5rem;
    }
    /* Deixa os ícones sociais um pouco maiores no menu mobile */
    .mobile-only .social-icons img {
        width: 28px;
        height: 28px;
    }
    
    /* Esconde a parte direita da navbar original no mobile */
    .desktop-only { display: none !important; }

    /* Travar a Navbar no mobile (impede sumir ao rolar) */
    .navbar, .navbar.scrolled, .navbar.scrolled:hover {
        height: 70px !important;
        padding: 0 1.5rem;
    }
    .navbar::before, .navbar.scrolled::before, .navbar.scrolled:hover::before {
        transform: translateY(0) !important; 
    }
    .navbar-section.left, .navbar-section.right,
    .navbar.scrolled .navbar-section.left, .navbar.scrolled .navbar-section.right {
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Ajustar tamanho da Logo Mobile */
    .navbar-logo, .navbar.scrolled .navbar-logo, .navbar.scrolled:hover .navbar-logo {
        width: 140px !important;
        height: 42px !important;
    }
    .navbar.scrolled:not(:hover) #logo-img-default { opacity: 1 !important; }
    .navbar.scrolled:not(:hover) #logo-img-scrolled { opacity: 0 !important; }

    /* Exibe o Hambúrguer */
    .hamburger { display: flex; }

    /* 2. MENU MOBILE: SURGINDO DE BAIXO PARA CIMA */
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0; 
        width: 100vw;
        height: calc(100vh - 70px);
        background: var(--bg-dark);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 4rem;
        gap: 2rem;
        /* Inicialmente o menu fica escondido "abaixo" da tela */
        transform: translateY(120%); 
        transition: transform 0.5s cubic-bezier(.4,0,.2,1); 
        z-index: 999;
    }
    
    /* Quando ativo, ele desliza para cima até a posição normal */
    .nav-links.active {
        transform: translateY(0); 
    }
    
    .nav-links li {
        list-style: none;
    }
    .nav-links a {
        font-size: 1.6rem;
    }
}

/* Ajustes Extras de Layout para celulares finos */
@media (max-width: 700px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    .hero {
        justify-content: center;
    }
    .hero-content {
        margin-left: 0;
        align-items: center;
        text-align: center;
        padding: 0 1rem;
    }
    .hero-title {
        font-size: 3rem;
    }
}