:root {
    --bg-dark: #050507;
    --bg-card: rgba(20, 20, 25, 0.6);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #e2e8f0;
    --accent-secondary: #cbd5e1;
    --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    --font-mono: 'JetBrains Mono', monospace;
    --header-bg: rgba(5, 5, 7, 0.8);
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent: #1e293b;
    --accent-secondary: #334155;
    --header-bg: rgba(248, 250, 252, 0.9);
}

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

body, header, .project-card, .btn {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-mono);
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Canvas Background --- */
#canvas-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.8;
}


.container, .wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Header --- */
header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 14px 32px;
    transition: 0.3s;
    background: var(--header-bg);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] header {
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    position: relative;
    transition: 0.3s;
}

.nav-links a::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: 0.3s;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::before { width: 100%; }

.lang-btn, .theme-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-main);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

[data-theme="light"] .lang-btn,
[data-theme="light"] .theme-btn {
    border-color: rgba(0,0,0,0.2);
}

.lang-btn:hover, .theme-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
}

[data-theme="light"] .lang-btn:hover,
[data-theme="light"] .theme-btn:hover {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.3);
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.theme-btn svg {
    width: 16px;
    height: 16px;
}

.theme-btn .icon-sun { display: none; }
.theme-btn .icon-moon { display: block; }

[data-theme="light"] .theme-btn .icon-sun { display: block; }
[data-theme="light"] .theme-btn .icon-moon { display: none; }

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
}

.hero-content {
    max-width: 800px;
}

.greeting {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 1rem;
    font-weight: 400;
}

h1.glitch {
    font-size: clamp(3rem, 7vw, 5.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 20px;
    position: relative;
    color: #fff;
    letter-spacing: -2px;
}

[data-theme="light"] h1.glitch {
    color: #1e293b;
}

/* Efeito Glitch no CSS */
h1.glitch::before, h1.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
}

h1.glitch::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

h1.glitch::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    4% { clip: rect(70px, 9999px, 16px, 0); }
    100% { clip: rect(66px, 9999px, 26px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(65px, 9999px, 30px, 0); }
    4% { clip: rect(20px, 9999px, 80px, 0); }
    100% { clip: rect(45px, 9999px, 75px, 0); }
}

.typewriter {
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
}

.cursor {
    animation: blink 1s infinite;
    color: var(--accent);
}

@keyframes blink { 50% { opacity: 0; } }

.description {
    max-width: 540px;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 50px;
}

.cta-buttons {
    display: flex;
    gap: 20px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn.primary {
    background: var(--accent);
    color: #0f172a;
}

[data-theme="light"] .btn.primary {
    color: #f8fafc;
}

.btn.primary:hover {
    opacity: 0.9;
}

.btn.secondary {
    background: transparent;
    border-color: rgba(255,255,255,0.2);
    color: var(--text-main);
}

[data-theme="light"] .btn.secondary {
    border-color: rgba(0,0,0,0.2);
}

.btn.secondary:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.3);
}

[data-theme="light"] .btn.secondary:hover {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.3);
}

/* --- Sections General --- */
section {
    padding: 100px 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 2rem;
    white-space: nowrap;
}

.section-header .hash {
    color: var(--text-muted);
}

.section-header .line {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,0.1);
    max-width: 300px;
}

/* --- About --- */
.about-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 50px;
    align-items: start;
}

.about-text p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.tech-stack {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tech-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 4px 12px;
    border-radius: 6px;
    background: transparent;
}

[data-theme="light"] .tech-badge {
    border-color: rgba(0,0,0,0.1);
}

.image-frame {
    position: relative;
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
}

.avatar {
    width: 100%;
    border-radius: 8px;
    filter: grayscale(100%) contrast(1.05);
    transition: all 0.15s ease;
    position: relative;
    z-index: 2;
}

.image-frame:hover .avatar {
    filter: none;
    transform: translate(-4px, -4px);
}

.frame-decor {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 1;
    transition: all 0.15s ease;
    border-radius: 8px;
}

[data-theme="light"] .frame-decor {
    border-color: rgba(0,0,0,0.1);
}

.image-frame:hover .frame-decor {
    transform: translate(4px, 4px);
}

/* --- Projects --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.15s ease;
    border: 1px solid rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .project-card {
    border-color: rgba(0,0,0,0.1);
}

.project-card:hover {
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.03);
}

[data-theme="light"] .project-card:hover {
    border-color: rgba(0,0,0,0.15);
    background: rgba(0,0,0,0.02);
}

.project-card:hover h3 { color: var(--accent); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.folder-icon { color: var(--text-muted); }
.external-links a {
    color: var(--text-muted);
    margin-left: 12px;
    transition: 0.3s;
}
.external-links a:hover { color: var(--accent); }

.card-content h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    transition: 0.3s;
}

.card-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.project-tech {
    display: flex;
    gap: 15px;
    list-style: none;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* --- Contact --- */
.contact { text-align: center; padding: 150px 0; }
.contact h2 { font-size: 3rem; margin-bottom: 20px; }
.big-btn {
    margin-top: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    padding: 16px 40px;
}
.footer-socials { margin-top: 60px; display: flex; justify-content: center; gap: 30px; }
.email-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 500;
    transition: 0.3s;
    position: relative;
}

.email-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.email-link:hover {
    color: var(--accent-secondary);
}

.email-link:hover::after {
    transform: scaleX(1);
}

.social-link { color: var(--text-muted); text-decoration: none; transition: 0.3s; }
.social-link:hover { color: var(--accent); }

footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* --- Animations Utility --- */
.scroll-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

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

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 5px;
    z-index: 101;
}

.mobile-menu-btn span {
    width: 25px;
    height: 2px;
    background: var(--text-main);
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile */
@media (max-width: 768px) {
    header {
        top: 15px;
        left: 15px;
        right: 15px;
        transform: none;
        padding: 16px 24px;
        border-radius: 20px;
    }

    nav {
        justify-content: space-between;
        width: 100%;
    }

    .logo {
        font-size: 1.3rem;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-menu-btn span {
        width: 28px;
        height: 3px;
    }

    .nav-links {
        position: fixed;
        top: 90px;
        left: 15px;
        right: 15px;
        background: var(--header-bg);
        backdrop-filter: blur(15px);
        flex-direction: column;
        gap: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 20px;
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    }

    [data-theme="light"] .nav-links {
        border-color: rgba(0,0,0,0.1);
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    }

    .nav-links.active {
        max-height: 350px;
        padding: 24px 0;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        padding: 16px 24px;
    }

    .nav-links a {
        font-size: 1rem;
    }

    .nav-links li:last-child,
    .nav-links li:nth-last-child(2) {
        display: inline-block;
        width: auto;
        padding: 16px;
    }

    .lang-btn, .theme-btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .theme-btn {
        padding: 10px;
    }

    .theme-btn svg {
        width: 20px;
        height: 20px;
    }

    h1.glitch { font-size: 2.8rem; }
    .about-grid { grid-template-columns: 1fr; }
    .image-frame { margin: 40px auto 0; }

    .cta-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .cta-buttons .btn {
        text-align: center;
    }
}
