/* =========================================
   1. VARIÁVEIS E RESET (DESIGN SYSTEM)
   ========================================= */
:root {
    /* Paleta de Cores Neon/Dark */
    --bg-deep: #05070a;
    --bg-card: #0e121d;
    --primary-purple: #7b2cbf;
    --primary-purple-glow: rgba(123, 44, 191, 0.6);
    --accent-cyan: #00ffea;
    --accent-cyan-glow: rgba(0, 255, 234, 0.5);
    --text-main: #eaeaea;
    --text-muted: #a0a8b8;

    /* Fontes */
    --font-art: 'Playfair Display', serif;
    --font-tech: 'Inter', sans-serif;
}

html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.section {
    padding: 5rem 10%;
    position: relative;
    scroll-margin-top: 80px;
    /* Offset para o header fixo */
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: var(--font-tech);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: default;
    /* Restaurado cursor padrão para evitar confusão */
}

/* Cursor Singularidade (O rastro agora é um complemento) */
#custom-cursor {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--accent-cyan);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    /* Centraliza no ponto do mouse */
    box-shadow: 0 0 15px var(--accent-cyan-glow);
    transition: width 0.3s, height 0.3s;
}

#cursor-follower {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 1px solid var(--primary-purple);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    /* Centraliza */
    transition: transform 0.1s ease-out, left 0.15s ease-out, top 0.15s ease-out;
    box-shadow: 0 0 10px var(--primary-purple-glow);
}

/* Efeito de Textura/Ruído no Fundo (Estilo Tela de Pintura) */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: 0.07;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 4px;
}

/* Utilitários de Texto */
h1,
h2,
h3 {
    font-family: var(--font-art);
    font-weight: 700;
}

.highlight {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--accent-cyan-glow);
}

.purple-glow {
    color: var(--primary-purple);
    text-shadow: 0 0 15px var(--primary-purple-glow);
}

/* =========================================
   2. HEADER & LOGO
   ========================================= */
header {
    position: fixed;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    z-index: 100;
    /* Glassmorphism */
    background: rgba(5, 7, 10, 0.7);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: padding 0.4s, background 0.4s, border-color 0.4s;
}

header.scrolled {
    padding: 1rem 5%;
    background: rgba(5, 7, 10, 0.9);
    border-bottom-color: rgba(0, 255, 234, 0.2);
}

/* Logo CSS Puro: O Cubo Wireframe */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
}

.cube-icon {
    width: 30px;
    height: 30px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(45deg);
    animation: floatCube 6s ease-in-out infinite;
}

.cube-face {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 5px var(--accent-cyan-glow);
    opacity: 0.8;
}

/* Construção do Cubo 3D em CSS */
.front {
    transform: translateZ(15px);
}

.back {
    transform: rotateY(180deg) translateZ(15px);
}

.right {
    transform: rotateY(90deg) translateZ(15px);
}

.left {
    transform: rotateY(-90deg) translateZ(15px);
}

.top {
    transform: rotateX(90deg) translateZ(15px);
}

.bottom {
    transform: rotateX(-90deg) translateZ(15px);
}

.logo-text {
    font-family: var(--font-tech);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.3s, text-shadow 0.3s;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-cyan);
    transition: width 0.3s;
}

nav a.active {
    color: var(--accent-cyan);
    text-shadow: 0 0 8px var(--accent-cyan-glow);
}

nav a.active::after {
    width: 100%;
}

nav a:hover {
    color: var(--accent-cyan);
}

/* Menu Toggle (Hamburger) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 1001;
    padding: 10px;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--accent-cyan);
    transition: 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 0 5px var(--accent-cyan-glow);
}

/* Animação do Hamburger */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =========================================
   3. HERO SECTION (A Arte da Matemática)
   ========================================= */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 0 20px;
}

/* Fundo Animado Abstrato (Simulando Manim) */
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(123, 44, 191, 0.15) 0%, transparent 60%);
    overflow: hidden;
}

/* Linhas animadas no fundo */
.math-line {
    position: absolute;
    width: 200%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-purple), transparent);
    opacity: 0.3;
    transform: rotate(45deg);
    animation: drift 10s linear infinite;
}

.math-line:nth-child(2) {
    top: 20%;
    animation-duration: 15s;
    width: 150%;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    opacity: 0;
    animation: fadeUp 1s ease-out forwards 0.5s;
}

.hero h1 span {
    font-style: italic;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 3rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: fadeUp 1s ease-out forwards 0.8s;
}

.cta-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--primary-purple), #5a189a);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(123, 44, 191, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    opacity: 0;
    animation: fadeUp 1s ease-out forwards 1.1s;
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px var(--primary-purple-glow);
}

/* =========================================
   4. SEÇÃO SOBRE (Layout Split)
   ========================================= */
.section {
    padding: 5rem 10%;
    position: relative;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.image-frame {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 20px;
    overflow: hidden;
    /* Efeito de borda neon */
    border: 1px solid rgba(0, 255, 234, 0.3);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* Placeholder da Foto da Monick */
.monick-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(80%) contrast(1.2);
    transition: filter 0.5s;
    background-color: #1a1f2e;
    /* Placeholder caso imagem falhe */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.image-frame:hover .monick-photo {
    filter: grayscale(0%);
}

.about-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

.about-text p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

/* =========================================
   5. PROJETO MATVERSO (Código & Visual)
   ========================================= */
.project-section {
    background-color: #030407;
}

.project-header {
    text-align: center;
    margin-bottom: 3rem;
}

.project-header h2 {
    font-size: 2.5rem;
}

.code-demo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(123, 44, 191, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* O "Editor de Código" */
.code-block {
    padding: 2rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    background: #0d0f16;
    color: #a0a8b8;
    border-right: 1px solid #222;
}

.code-line {
    display: block;
    margin-bottom: 5px;
}

.kwd {
    color: var(--primary-purple);
}

/* Keyword */
.str {
    color: var(--accent-cyan);
}

/* String */
.fun {
    color: #ffd700;
}

/* Function */

/* A "Tela de Saída" (Visualização) */
.visual-block {
    background: radial-gradient(circle, #0a0e1a 0%, #000 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

#math-interactive {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* =========================================
   6. TIMELINE (Currículo)
   ========================================= */
.timeline-container {
    position: relative;
    margin-top: 3rem;
    padding-left: 2rem;
    border-left: 2px solid rgba(123, 44, 191, 0.3);
}

.timeline-item {
    position: relative;
    margin-bottom: 4rem;
    padding-left: 2rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.6s ease-out;
}

.timeline-item.active {
    opacity: 1;
    transform: translateX(0);
}

/* Linha de Progresso Orgânica */
.timeline-container::after {
    content: '';
    position: absolute;
    left: -2px;
    top: 0;
    width: 2px;
    height: var(--timeline-height, 0);
    /* Usa a variável do JS */
    background: linear-gradient(to bottom, var(--primary-purple), var(--accent-cyan));
    box-shadow: 0 0 10px var(--accent-cyan-glow);
    transition: height 0.3s ease-out;
    z-index: 1;
}

/* Os "Nós" da timeline */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.6rem;
    top: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-deep);
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.timeline-date {
    font-family: var(--font-tech);
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.timeline-title {
    font-size: 1.5rem;
    margin: 0.5rem 0;
    color: white;
}

.timeline-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.medal-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.5);
    color: #ffd700;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.btn-secondary {
    display: inline-block;
    margin-top: 2rem;
    padding: 10px 25px;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* =========================================
   7. FOOTER
   ========================================= */
footer {
    background: black;
    padding: 4rem 10% 2rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

footer p {
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4), 0 0 20px rgba(0, 255, 234, 0.2);
    font-weight: 400;
}

.social-links {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.social-links a {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: color 0.3s;
    text-decoration: none;
}

.social-links a:hover {
    color: var(--primary-purple);
}

/* =========================================
   8. ANIMAÇÕES DE REVELAÇÃO (REVEAL)
   ========================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Delays para elementos em grid */
.reveal-delay-1 {
    transition-delay: 0.2s;
}

.reveal-delay-2 {
    transition-delay: 0.4s;
}

.reveal-delay-3 {
    transition-delay: 0.6s;
}

/* Flutuação de Símbolos */
.floating-symbol {
    position: absolute;
    font-family: var(--font-art);
    color: var(--primary-purple);
    opacity: 0.25;
    /* Aumentado para melhor visibilidade */
    font-size: 3rem;
    pointer-events: none;
    z-index: 1;
    /* Colocado à frente do fundo, mas atrás do texto se necessário */
    text-shadow: 0 0 10px var(--primary-purple-glow);
    animation: floatAround 20s linear infinite;
}

@keyframes floatAround {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, 50px) rotate(10deg);
    }

    66% {
        transform: translate(-20px, 80px) rotate(-10deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

/* =========================================
   9. ANIMAÇÕES (KEYFRAMES)
   ========================================= */
@keyframes floatCube {

    0%,
    100% {
        transform: rotateX(-20deg) rotateY(45deg) translateY(0);
    }

    50% {
        transform: rotateX(-20deg) rotateY(45deg) translateY(-10px);
    }
}

@keyframes drift {
    0% {
        transform: translateX(-50%) rotate(45deg);
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        transform: translateX(50%) rotate(45deg);
        opacity: 0;
    }
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseWave {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
        box-shadow: 0 0 0 var(--accent-cyan-glow);
    }

    50% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 20px var(--accent-cyan-glow);
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
        box-shadow: 0 0 0 var(--accent-cyan-glow);
    }
}

/* Terminal de Insights */
#insights-terminal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    background: rgba(14, 18, 29, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 234, 0.2);
    border-radius: 10px;
    padding: 15px;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 500;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

#insights-terminal.visible {
    opacity: 1;
    transform: translateY(0);
}

.terminal-header {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f56;
}

.dot.yellow {
    background: #ffbd2e;
}

.dot.green {
    background: #27c93f;
}

/* Transição de Página */
#page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-deep);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#page-transition.active {
    opacity: 1;
    pointer-events: all;
}

.loader-cube {
    width: 50px;
    height: 50px;
    border: 2px solid var(--accent-cyan);
    animation: rotateLoader 2s linear infinite;
}

@keyframes rotateLoader {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.5);
        color: var(--primary-purple);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    .hero h1 span {
        font-size: 2rem;
    }

    .about-grid,
    .code-demo {
        grid-template-columns: 1fr;
    }

    .code-block {
        display: none;
    }

    /* Esconde o código no mobile para focar no visual */
    .image-frame {
        height: 300px;
    }

    nav ul {
        display: none;
    }

    /* Simplificação do menu para exemplo */
}