/* 1. CONFIGURAÇÕES GERAIS */
@import url('https://fonts.googleapis.com/css2?family=Grandstander:wght@400;700;900&display=swap');

:root {
    --bg-color: #2e1e14;
    --dot-color: #23170f;
    --border-color: #f5e1a4;
    --text-color: #f5e1a4;
    --dot-grid-size: 90px;
    --lang-width: 220px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Grandstander', cursive;
    min-height: 100vh;
    padding: 60px 20px;
    position: relative;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

@media (max-width: 768px) {
    /* 1. Ajuste do contêiner principal para permitir quebra de linha */
    .top-nav {
        display: flex !important;
        flex-flow: row wrap !important; /* Permite que os itens "pulem" pra baixo */
        justify-content: center !important;
        align-items: center !important;
        padding: 10px 0 !important;
        gap: 15px !important; /* Espaço entre o nav e a bandeira */
        margin-bottom: 20px !important;
        position: relative !important;
        top: 0 !important;
    }

    /* 2. Faz a logo ocupar 100% da largura para ficar sozinha no topo */
    .header-logo {
        flex: 0 0 100% !important; 
        position: static !important;
        display: flex !important;
        justify-content: center !important;
        margin-bottom: 5px !important;
    }

    .header-logo img {
        height: 55px !important;
        width: auto !important;
    }

    /* 3. Ajuste dos links (nav) - REMOVIDO O FUNDO PRETO */
    .top-nav nav {
        display: flex !important;
        flex-direction: row !important;
        gap: 15px !important; /* Espaço entre home, projects, about */
        background: none !important; /* Tira o fundo preto arredondado */
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .top-nav a {
        font-size: 24px !important;
        text-shadow: 2px 2px 0px rgba(0,0,0,0.2) !important;
    }

    /* 4. Coloca o seletor de idioma na mesma linha do nav */
    .lang-selector {
        position: static !important;
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
    }

    .lang-selected {
        font-size: 0 !important; /* Esconde o texto "idioma" */
        background: none !important;
        border: none !important;
        padding: 0 !important;
        gap: 4px !important; /* Espaço entre a bandeira e a setinha */
        box-shadow: none !important;
    }

    .lang-selected img {
        height: 20px !important;
        width: auto !important;
        border-radius: 2px !important;
        transform: none !important; /* Remove o ajuste de subir a bandeira */
    }

    /* Esconde o texto mas garante que a setinha (chevron) apareça */
    .lang-selected span {
        display: none !important;
    }

    .chevron {
        display: block !important;
        width: 14px !important;
        fill: var(--text-color) !important;
        margin: 0 !important;
    }

    /* 5. Ajuste do Dropdown (lista de idiomas) ao abrir */
    .lang-dropdown {
        position: absolute !important;
        top: 100% !important;
        right: 10px !important;
        left: auto !important;
        transform: none !important;
        min-width: 150px !important;
        z-index: 100010 !important;
    }
}


/* 2. FUNDO ANIMADO */
body::before {
    content: "";
    position: fixed;
    top: -100%; left: -100%; width: 300%; height: 300%;
    z-index: -1;
    background-image: 
        radial-gradient(var(--dot-color) 30%, transparent 28%),
        radial-gradient(var(--dot-color) 30%, transparent 28%);
    background-position: 0 0, calc(var(--dot-grid-size) / 2) calc(var(--dot-grid-size) / 2);
    background-size: var(--dot-grid-size) var(--dot-grid-size);
    transform: rotate(-35deg); 
    animation: moveDots 8s linear infinite;
}

@keyframes moveDots {
    from { background-position: 0 0, 45px 45px; }
    to { background-position: -90px 90px, -45px 135px; }
}

body::after {
    content: "";
    position: fixed; top: 0; left: 0; width: 100%; height: 200px;
    background: linear-gradient(to bottom, rgba(30, 17, 13, 1) 0%, transparent 100%);
    z-index: 100000; pointer-events: none;
}

/* --- 3. HEADER STICKY --- */
.top-nav {
    display: flex; 
    justify-content: center; 
    align-items: center;
    max-width: 1100px; 
    padding: 20px;
    margin: 0 auto 60px auto;
    position: sticky;
    top: -60px;
    z-index: 100001;
    transition: top 0.3s ease-out;
}

/* Header visível ao rolar para cima */
body.scrolled.show-header .top-nav {
    top: 20px;
}

/* Header escondida ao rolar para baixo */
body.scrolled:not(.show-header) .top-nav {
    top: -120px;
}

.header-logo { position: absolute; left: 0; }
.header-logo img { height: 70px; width: auto; }
.top-nav nav { display: flex; gap: 40px; }
.top-nav a { 
    color: var(--text-color); 
    text-decoration: none; 
    font-size: 36px; 
    font-weight: 900; 
    text-shadow: 3px 3px 0px rgba(0,0,0,0.2); 
}

@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        margin: 0 auto 40px auto;
    }
    
    .header-logo {
        position: static;
        margin-bottom: 10px;
    }
    
    .header-logo img {
        height: 50px;
    }
    
    .top-nav nav {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .top-nav a {
        font-size: 20px;
    }
    
    .lang-selector {
        position: static;
        margin-top: 10px;
    }
}

/* --- SELETOR DE IDIOMAS (CORRIGIDO) --- */
.lang-selector {
    position: absolute;
    right: 0;
    font-family: 'Grandstander', cursive;
    cursor: pointer;
    z-index: 10000;
}

.lang-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 32px;
    font-weight: 900;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    line-height: 1;
}

.lang-dropdown {
    position: absolute;
    top: 110%;
    right: 0;
    background: var(--bg-color);
    border: 3px solid var(--border-color);
    list-style: none;
    padding: 10px 0;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.3);
    min-width: 190px;
    display: none;
}

.lang-selector.open .lang-dropdown {
    display: block;
}

.lang-dropdown li {
    padding: 10px 14px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.2s;
    color: var(--text-color);
}

.lang-dropdown li:hover {
    background-color: rgba(245, 225, 164, 0.1);
    color: var(--border-color);
}

.lang-dropdown li.active {
    color: var(--border-color);
}

.lang-dropdown img {
    width: 24px;
    height: 16px;
}

@media (max-width: 768px) {
    .lang-selected {
        font-size: 18px;
    }
    
    .lang-dropdown {
        font-size: 14px;
        min-width: 150px;
        right: auto;
        left: 0;
    }
    
    .lang-dropdown li {
        font-size: 14px;
        padding: 8px 10px;
    }
}

/* --- 4. JANELAS --- */
.desktop-container {
    max-width: 1100px; 
    margin: 0 auto; 
    display: grid;
    grid-template-columns: 1.8fr 1fr; 
    gap: 35px; 
    position: relative; 
    z-index: 1; 
}

.window {
    border: 4px solid var(--border-color);
    background-color: var(--bg-color);
    display: flex; 
    flex-direction: column;
    box-shadow: 12px 12px 0px rgba(0,0,0,0.25);
    margin-bottom: 20px;
}

.window-header {
    border-bottom: 4px solid var(--border-color);
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center; 
    background-color: rgba(0,0,0,0.1);
    height: 60px;
    min-height: 60px;
}

@media (max-width: 768px) {
    .desktop-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .window {
        border: 3px solid var(--border-color);
        box-shadow: 6px 6px 0px rgba(0,0,0,0.25);
        margin-bottom: 15px;
    }
    
    .window-header {
        border-bottom: 3px solid var(--border-color);
        padding: 0 10px;
        height: 50px;
        min-height: 50px;
    }
    
    .window-header .title {
        font-size: 20px;
        padding-top: 8px;
    }
    
    .win-btn {
        width: 28px;
        height: 28px;
        border: 2px solid var(--border-color);
    }
}

.window-header .title {
    font-weight: 900;
    font-size: 28px;
    line-height: 1;
    padding-top: 10px; 
    display: block;
}

.window-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    height: 100%;
}

.win-btn {
    background: none;
    border: 3px solid var(--border-color);
    width: 34px; 
    height: 34px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    cursor: pointer;
}
.win-btn svg { fill: var(--border-color); width: 18px; }

/* 5. CONTEÚDO E LINKS EXTERNOS AUTOMÁTICOS */
.window-content { padding: 30px; font-size: 24px; line-height: 1.3; }

@media (max-width: 768px) {
    .window-content {
        padding: 20px;
        font-size: 18px;
        line-height: 1.4;
    }
}

/* LINKS GERAIS */
a { 
    color: var(--text-color); 
    font-weight: 700; 
    text-decoration: underline; 
    display: inline-flex; 
    align-items: baseline; 
}

/* ÍCONE DE LINK EXTERNO AUTOMÁTICO */
/* Ele aparece apenas em links dentro do conteúdo ou lista lateral */
.window-content a::after, .links-list a::after {
    content: "";
    display: inline-block;
    width: 0.65em;
    height: 0.65em;
    margin-left: 3px; /* Bem perto do texto */
    background-color: currentColor;
    /* SVG ↗ */
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 3h7v7h-2V6.41l-9 9L8.59 14l9-9H14V3zM5 5h5V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-5h-2v5H5V5z"/></svg>') no-repeat center;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 3h7v7h-2V6.41l-9 9L8.59 14l9-9H14V3zM5 5h5V3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-5h-2v5H5V5z"/></svg>') no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* 6. COLUNA LATERAL E REDES SOCIAIS */
.side-column { 
    display: flex; 
    flex-direction: column; 
    gap: 35px; 
}

.avatar-img img { 
    width: 100%; 
    display: block; 
}

.links-list { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.links-list a {
    text-decoration: none;
    font-size: 26px;
    align-items: center;
}

/* Ícones das redes */
.social-icon {
    width: 32px; 
    height: 32px;
    margin-right: 12px;
    fill: currentColor;
}

@media (max-width: 768px) {
    .side-column {
        gap: 20px;
    }
    
    .links-list a {
        font-size: 18px;
    }
    
    .social-icon {
        width: 24px;
        height: 24px;
        margin-right: 8px;
    }
}

/* Responsividade */
@media (max-width: 850px) {
    .desktop-container { grid-template-columns: 1fr; }
    .top-nav { flex-direction: column; gap: 30px; }
    .header-logo { position: static; }
}

/* --- ESTILOS ESPECÍFICOS DA HOME --- */

.hero-container {
    max-width: 900px;
    margin: 100px auto;
    text-align: center;
    position: relative;
    z-index: 10;
}

.main-title {
    font-size: 80px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 20px;
    text-shadow: 6px 6px 0px rgba(0,0,0,0.3);
}

.main-title span {
    color: var(--border-color);
}

.hero-subtitle {
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 50px;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .main-title {
        font-size: 48px;
        text-shadow: 3px 3px 0px rgba(0,0,0,0.3);
    }
    
    .hero-subtitle {
        font-size: 18px;
        margin-bottom: 30px;
    }
}

/* --- BOTÕES RETRO COM EFEITO DE PREENCHIMENTO --- */

.home-actions {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.retro-btn {
    position: relative;
    display: inline-block;
    padding: 20px 40px;
    font-size: 24px;
    font-weight: 900;
    color: var(--border-color);
    text-decoration: none;
    border: 4px solid var(--border-color);
    background-color: var(--bg-color);
    box-shadow: 8px 8px 0px rgba(0,0,0,0.2);
    overflow: hidden;
    transition: color 0.3s ease;
}

.retro-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: var(--border-color);
    z-index: 0;
    transition: left 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.retro-btn span {
    position: relative;
    z-index: 1;
}

.retro-btn:hover::before {
    left: 0;
}

.retro-btn:hover {
    color: var(--bg-color);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.4);
    transform: translate(2px, 2px);
}

@media (max-width: 768px) {
    .home-actions {
        gap: 15px;
    }
    
    .retro-btn {
        padding: 15px 30px;
        font-size: 18px;
        border: 3px solid var(--border-color);
        box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    }
    
    .retro-btn:hover {
        box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
        transform: translate(1px, 1px);
    }
}

/* Responsividade Home */
@media (max-width: 850px) {
    .main-title { font-size: 50px; }
    .home-actions { flex-direction: column; align-items: center; }
    .retro-btn { width: 100%; max-width: 300px; }
}
/* --- LAYOUT DE PROJETOS --- */

.projects-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 40px;
    z-index: 10;
    position: relative;
}

.project-card {
    transition: transform 0.3s ease;
}

.title-section-project {
    text-shadow: 4px 4px 0px rgba(0,0,0,0.3);
}

.project-name {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 10px;
    color: var(--border-color);
}

.project-credits {
    font-size: 18px;
    margin-bottom: 20px;
    opacity: 0.8;
}

/* --- DESCRIÇÃO EXPANSÍVEL (DETAILS) --- */

.project-details {
    margin-bottom: 25px;
    border: 2px dashed rgba(245, 225, 164, 0.3);
    border-radius: 4px;
}

.project-details summary {
    padding: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 20px;
    color: var(--border-color);
    list-style: none; /* Remove a setinha padrão */
    display: flex;
    align-items: center;
}

.project-details summary::before {
    content: "▶";
    font-size: 14px;
    margin-right: 10px;
    transition: transform 0.2s;
}

.project-details[open] summary::before {
    transform: rotate(90deg); /* Gira a setinha ao abrir */
}

.details-content {
    padding: 15px;
    font-size: 20px;
    line-height: 1.4;
    background-color: rgba(0,0,0,0.15);
}

/* --- AJUSTE NO BOTÃO PARA FICAR MENOR NOS PROJETOS --- */

.project-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-small {
    padding: 12px 25px !important;
    font-size: 18px !important;
}

/* --- RESPONSIVIDADE PROJETOS --- */
@media (max-width: 850px) {
    .project-name { font-size: 26px; }
    .project-actions { justify-content: center; }
}

@media (max-width: 768px) {
    .projects-container {
        gap: 25px;
    }
    
    .project-name {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .project-credits {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .project-details {
        border: 2px dashed rgba(245, 225, 164, 0.2);
        margin-bottom: 20px;
    }
    
    .project-details summary {
        font-size: 16px;
        padding: 8px;
    }
    
    .details-content {
        padding: 10px;
        font-size: 14px;
    }
    
    .btn-small {
        padding: 10px 20px !important;
        font-size: 14px !important;
        border: 2px solid var(--border-color) !important;
    }
    
    .project-actions {
        justify-content: center;
    }
}

/* Container da Galeria */
.project-gallery {
    display: flex;
    flex-wrap: wrap; /* Permite que as fotos quebrem a linha */
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Div que segura a imagem */
.zoom-item {
    width: 185px;  /* Tamanho da miniatura */
    height: 100px;
    position: relative;
}

.zoom-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    cursor: zoom-in;
    
    /* Transição suave com um leve "pulo" (bounce) */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s ease, 
                z-index 0s;
    
    position: relative;
    z-index: 1;
}

/* --- O EFEITO DE MEGA ZOOM AO PASSAR O MOUSE --- */
.zoom-item img:hover {
    z-index: 999; /* Faz a imagem ficar na frente de TUDO (janelas, menu, etc) */
    
    /* Aumenta a imagem em 4x (ajuste o número se quiser maior ou menor) */
    transform: scale(4); 
    
    /* Sombra pesada para dar profundidade */
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    
    border-width: 1px; /* Deixa a borda mais fina quando grande */
}

/* IMPORTANTE: Ajuste para evitar que a janela corte o zoom */
.window {
    overflow: visible !important; 
}
.window-content {
    overflow: visible !important;
}

.project-main-logo {
    max-height: 120px;
    max-width: 80%;
    object-fit: contain;
}

/* SELETOR DE IDIOMAS */
.lang-selector {
    position: absolute;
    right: 0;
    font-family: 'Grandstander', cursive;
    cursor: pointer;
    z-index: 10000;
}

.lang-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 32px;
    font-weight: 900;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    line-height: 1;
}

.lang-selected img {
    /* usar unidade em para acompanhar o tamanho do texto e centralizar verticalmente */
    height: 1em;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    align-self: center;
    /* pequeno ajuste fino para subir levemente o ícone */
    transform: translateY(-0.12em);
}

.lang-selected span {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.chevron {
    width: 24px;
    fill: var(--text-color);
}

.lang-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    background: var(--bg-color);
    border: 3px solid var(--border-color);
    list-style: none;
    padding: 10px 0;
    display: none; /* Escondido por padrão */
    box-shadow: 8px 8px 0px rgba(0,0,0,0.3);
    min-width: 190px;
}

.lang-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Permite abrir via classe .open (usado pelo JS) */
.lang-selector.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lang-dropdown {
    position: absolute;
    top: 120%; /* posiciona tocando o gatilho para evitar sumiço ao mover o mouse */
    right: 0;
    background: var(--bg-color);
    border: 3px solid var(--border-color);
    list-style: none;
    padding: 10px 0;
    box-shadow: 8px 8px 0px rgba(0,0,0,0.3);
    min-width: 190px;
    z-index: 10001;

    /* Melhor usar visibilidade/opacity para o controle de exibição */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease, visibility 0.16s ease;
}

/* Classe aplicada via JS ao anexar o dropdown ao body para garantir prioridade máxima */
.lang-dropdown.topmost {
    position: fixed !important;
    z-index: 2147483647 !important;
    left: auto !important;
    right: auto !important;
    will-change: top, left;
}

.lang-dropdown li {
    padding: 10px 14px; /* 14px a partir da borda esquerda */
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 14px; /* 14px entre a bandeira e o texto do idioma */
    transition: background 0.2s;
    position: relative;
}

.lang-dropdown img {
    width: auto;
    height: 1.2em;
    display: block;
    align-self: center;
}

/* Destaque visual para o item ativo */
.lang-dropdown li.active {
    color: var(--border-color);
}
.lang-dropdown li.active::after {
    content: '✓';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--border-color);
    font-weight: 600;
}

/* Bandeira maior com cantos arredondados no header */
.lang-selected img {
    border-radius: 8px;
    padding: 2px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.15);
}

.lang-dropdown li:hover {
    background-color: rgba(245, 225, 164, 0.1);
    color: var(--border-color);
}

@media (max-width: 850px) {
    .lang-selector { position: static; margin-top: 20px; }
}

/* Esconde conteúdo até as traduções serem aplicadas para evitar flash de idioma */
.lang-loading {
    visibility: hidden;
}