/* =========================
   CONFIGURAÇÕES GLOBAIS E VARIÁVEIS
   ========================= */
:root {
    --bg: #ffffff;
    --text: #000000;
    --accent: #2e2e2ece;
    --header-bg: rgba(255, 255, 255, 0.538);
}

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

body {
    height: 100vh;
    overflow: hidden;
    font-family: "Inter", sans-serif;
    font-style: normal;
    background-color: var(--bg);
    color: var(--text);
    line-height: 2rem;
    user-select: none;
}
body.dark-mode {
    --bg: #121212; 
    --text: #e0e0e0; 
    --accent: #a3a3a3; 
    --header-bg: rgba(18, 18, 18, 0.85); 
}

main {
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden; 
    width: 100%;        
    scroll-padding-top: 3rem;
    scroll-behavior: smooth;
}
main::after {
    content: "";
    display: block;
    height: 5rem; 
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
    outline: none;
}

header a:hover {
    text-decoration: underline;
    color: var(--accent);
}

p, a {
    user-select: text;
}

/* =========================
   PRELOADER (TELA DE CARREGAMENTO)
   ========================= */

/* 1. Esconde o site e trava o scroll enquanto carrega */
body.loading-active header,
body.loading-active main {
    opacity: 0;
    pointer-events: none;
    overflow: hidden !important; 
}

/* 2. Prepara o Fade-In suave para o site quando a classe for removida */
header {
    transition: transform 0.3s ease-in-out, background-color 0.3s ease, opacity 0.8s ease-in-out;
}
main {
    transition: opacity 0.8s ease-in-out;
}

/* 3. Estilos do Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg); 
    z-index: 99999; 
    display: flex;
    justify-content: center;
    align-items: center;
    /* Transição de Fade-Out do preloader (dura 0.6s) */
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}

#preloader.hidden-preloader {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    display: flex;
    align-items: center;
    font-family: "Geist", Consolas, monospace;
    font-size: clamp(3rem, 8vw, 6rem); 
    font-weight: 700;
    color: var(--text);
}

.preloader-faces {
    height: 0.8em;
    width: auto;
    margin: 0 0.1em;
    transform: translateY(0.05em); 
}

#load-percentage {
    font-size: 0.4em; 
    margin-left: 0.5rem;
    font-weight: 600;
    font-family: "Geist", Consolas, monospace;
}


/* =========================
   CABEÇALHO E NAVEGAÇÃO (NAV BAR)
   ========================= */
header {
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem 2.5rem;
    z-index: 100; 
    background-color: var(--header-bg); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px); 
    transition: transform 0.3s ease-in-out, background-color 0.3s ease;
}

.nav-hidden {
    transform: translateY(-100%); 
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; 
    width: 100%;
}

header ul.nav-links {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2.5rem;
    font-family: "Geist", Consolas, monospace;
    font-weight: 600;
}

.theme-switch a {
    display: flex;
    align-items: center;
    gap: 0.5rem; 
    font-family: "Geist", Consolas, monospace;
    font-size: 0.9rem;
    font-weight: 600;
}

#theme-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor; 
    stroke-width: 2;
    fill: none;
    display: block; 
}

.logo a {
    font-size: 1rem;
    font-family: "Geist", Consolas, monospace;
    font-weight: 600;
}

nav a {
    font-size: 0.9rem;
    letter-spacing: 0.05rem;
}

section {
    height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

/* =========================
   SEÇÃO HERO (INICIAL)
   ========================= */
#hero {
    display: flex;
    justify-content: center;
    align-items: center;
}

#glitch-text {
    font-family: "Cascadia code", Consolas, monospace;
    font-optical-sizing: auto;
    font-weight: 650;
    font-size: clamp(1.4rem, 5.5vw, 5rem);
    line-height: 1;
    white-space: nowrap;
}

/* =========================
   SOBRE MIM (TÍTULO NO CANTO SUPERIOR DIREITO E TEXTO À ESQUERDA)
   ========================= */
.about-details {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; 
    align-items: center; 
    width: 100%;
    height: auto; 
    min-height: 100vh; 
    /* O padding-top de 28vh compensa o espaço do título que agora é absoluto,
       mantendo o bloco de texto exatamente na mesma altura de antes */
    padding: 28vh 5% 15vh 5%; 
    text-align: center;
}

/* Título Gigante na Posição Exata do Retângulo Vermelho */
.about-details .huge-title {
    position: absolute;
    top: 12vh; /* Fica logo abaixo da Navbar */
    right: 8vw; /* Joga exatamente para o canto direito */
    font-family: "Space mono", Consolas, monospace;
    font-size: clamp(3.5rem, 8vw, 7rem); 
    font-weight: 400;
    color: var(--text);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin: 0;
}

/* Container do Texto empurrado mais para a Direita */
.about-container-alt {
    position: relative;
    width: 100%;
    max-width: 1100px; 
    margin: 0 auto 0 10vw; 
    text-align: left; 
    z-index: 2; 
}

/* Tipografia do Texto */
.about-text {
    font-family: "Geist", "Inter", sans-serif;
    color: var(--text);
    font-weight: 500; 
    font-size: clamp(1.8rem, 3.2vw, 2.9rem); 
    line-height: 1.35; 
    letter-spacing: -0.02em;
}

body.dark-mode .about-text {
    color: #e0e0e0; 
}

/* =========================
   AJUSTES DOS SVGs INLINE (JAVA/SPRING/FACES)
   ========================= */
.inline-icon {
    display: inline-block;
    vertical-align: middle; 
    margin-top: -15px;      
    margin-bottom: -15px;   
}

.icon-spring {
    height: 1em; 
    width: auto;
    margin: 0 0.05em;
    transform: translateY(-2px);
}

.icon-java {
    height: 1.4em; /* Aumentado a pedido! */
    width: auto;
    margin: 0 -0.15em;
    transform: translateY(-13px);
}

/* Ajustes Mobile */
@media (max-width: 768px) {
    .about-details {
        padding-top: 15vh; /* Ajuste para mobile */
    }
    .about-details .huge-title {
        position: relative; /* No celular ele volta ao fluxo normal para não sobrepor o texto */
        top: 0;
        right: 0;
        text-align: right;
        width: 100%;
        font-size: 3.5rem;
        margin-bottom: 2rem;
    }
    .about-container-alt {
        margin: 0 auto; /* Remove o empurrão pra direita no celular para não cortar a tela */
    }
    .about-text {
        font-size: 1.25rem;
    }

    .icon-java {
        transform: translateY(-5px); 
    }

    .icon-spring {
    transform: translateY(-1px);
}
}
/* =========================
   PROJETOS
   ========================= */
.projects-details {
    position: relative; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
    padding: 0 5%;
}

.projects-details h1 {
    position: absolute;
    top: 9%;
    left: 2.1rem;
    font-family: "Space mono", Consolas, monospace;
    font-size: 6rem;
    font-weight: 100;
    color: var(--text);
}

.projects-grid {
    display: flex;
    justify-content: space-between;
    gap: 2rem; 
    width: 100%;
    max-width: 1200px;
    margin-top: 1rem; 
}

.project-card {
    flex: 1; 
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-image-container {
    width: 100%;
    aspect-ratio: 1 / 1; 
    border: 1px solid var(--text); 
    border-radius: 16px; 
    overflow: hidden; 
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
}

.project-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.project-info {
    font-family: "Geist", monospace;
    font-size: 0.85rem; 
    line-height: 1.5;
    color: var(--text);
    text-align: left;
}

.project-info a {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent);
    text-decoration: underline;
}

/* =========================
   CONTATO
   ========================= */
#contato {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: calc(100vh - 3rem); 
    min-height: auto; 
    padding: 0 5%;
}

.contact-center-box {
    max-width: 1400px; 
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    margin-top: -5rem; 
}

#glitch-contact {
    font-family: "Space mono", Consolas, monospace;
    font-size: clamp(2.5rem, 6vw, 5.5rem); 
    font-weight: 400;
    line-height: 1.2; 
    color: var(--text);
    text-align: left; 
}

.bottom-left {
    position: absolute;
    bottom: 2%;
    left: 2.1rem;
    font-family: "Space mono", Consolas, monospace;
    font-size: clamp(1.5rem, 3vw, 3rem); 
    font-weight: 100;
    margin: 0;
    top: auto; 
}

footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
    background-color: var(--bg);
    color: var(--accent);
}

.bottom-left a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.bottom-left a:hover {
    color: var(--accent); 
    cursor: pointer;
}

/* =========================
   DESIGN RESPONSIVO (TELAS MÉDIAS E TABLETS)
   ========================= */
@media (max-width: 1024px) {
    .huge-title, 
    .projects-details h1 {
        font-size: 4.5rem;
        left: 1.5rem;
    }
    .projects-grid {
        gap: 1rem;
        margin-top: 8rem;
    }
}

/* =========================
   DESIGN RESPONSIVO (TELAS MENORES E CELULARES)
   ========================= */
@media (max-width: 768px) {
    /* MATA O ESPAÇO EM BRANCO NO FINAL DO SITE. Trava o scroll perfeitamente! */
    main::after {
        display: none; 
    }

    section {
        height: auto;
        min-height: 100vh;
        padding-top: 6rem; 
        padding-bottom: 2rem;
        scroll-snap-align: none; 
    }

    header {
        padding: 1rem;
        position: fixed; 
    }

    header nav {
        flex-direction: column;
        gap: 0.8rem;
    }

    header ul.nav-links {
        position: static; 
        transform: none;
        width: 100%;
        justify-content: center;
    }
    
    .theme-switch {
        align-self: center; 
    }

    nav a {
        font-size: 0.85rem;
    }
    
    html, body, main {
        overflow-x: hidden;
    }

    /* FIX 1: HERO QUEBRANDO PALAVRA POR LINHA (Sem vazar pra direita) */
    #glitch-text {
        font-size: clamp(3rem, 12vw, 4.5rem); 
        line-height: 1.1;
        text-align: center;
        white-space: normal;
        /* O min-content força a caixa a ter a largura da maior palavra, garantindo a quebra de linha natural! */
        width: min-content; 
        margin: 0 auto;
        padding: 0;
    }

    /* FIX 2: SOBRE MIM 100% ALINHADO À ESQUERDA */
    .about-details {
        padding-top: 15vh;
        align-items: flex-start; /* Alinha todo o bloco do sobre mim na margem esquerda */
    }
    .about-details .huge-title {
        position: relative; 
        top: 0;
        right: 0;
        text-align: left; /* Impede o título de ir para a extrema direita */
        width: 100%;
        font-size: clamp(3.2rem, 12vw, 4.5rem);
        margin-bottom: 2rem;
    }
    .about-container-alt {
        /* O !important destrói definitivamente a margem do Desktop que estava empurrando pro lado */
        margin: 0 !important; 
        width: 100%;
    }
    .about-text {
        font-size: 1.25rem;
    }

    /* PROJETOS */
    .projects-details h1 {
        position: relative;
        top: 0;
        left: 0;
        font-size: 3.5rem;
        margin-bottom: 1.5rem;
        margin-top: 2rem; 
        width: 100%;
    }
    .projects-grid {
        flex-direction: column;
        align-items: center;
        margin-top: 1rem; 
        gap: 2.5rem;
    }
    .project-card {
        width: 100%;
        max-width: 320px;
    }
    .project-info {
        text-align: center;
    }

/* FIX 3: CONTATO - BLOQUEADO NO FUNDO DA TELA */
    #contato {
        min-height: 100vh;
        padding-top: 10vh;
        padding-bottom: 2rem;
        flex-direction: column;
        justify-content: center; /* Centraliza a caixa inteira na tela */
        gap: 0; 
    }
    .contact-center-box {
        margin-top: 0;
    }
    #glitch-contact {
        /* Mantém o texto principal gigante e imponente como na segunda imagem */
        font-size: clamp(2.8rem, 12vw, 4rem); 
        line-height: 1.15; 
        margin-bottom: 0;
    }
    .bottom-left {
        position: relative;
        /* Reduz o texto inferior para ficar elegante como na primeira imagem */
        font-size: 1.1rem; 
        line-height: 1.6;
        bottom: 0;
        left: 0;
        align-self: flex-start;
        margin-top: 3.5rem; /* Dá um respiro bem legal do texto gigante de cima */
        width: 100%;
    }
}

/* =========================
   TRANSIÇÕES DE SCROLL (ANIMAÇÃO)
   ========================= */
.hidden {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, transform;
}

.show {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .hidden {
        transition: none;
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   OCULTAR BARRA DE ROLAGEM (SCROLLBAR)
   ========================= */
main::-webkit-scrollbar,
body::-webkit-scrollbar,
html::-webkit-scrollbar {
    display: none;
}

main, body, html {
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}