/* ==========================================================================
   0. RESET & ROOT VARIABLES
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --text-muted: #888888;
    --accent-color: #ffffff;
    --accent-subtle: #222222;
    --accent-glow: rgba(255, 255, 255, 0.1);
    
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --sidebar-width: 25%;
    --transition-smooth: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-color);
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Custom Selection Highlight */
::selection {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-subtle);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   1. CYBER BACKGROUND ACCENT (MINIMAL GLITCH GRID)
   ========================================================================== */
.cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.01) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

/* ==========================================================================
   2. LAYOUT STRUCTURING
   ========================================================================== */
.container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Mobile Header Default: Hidden */
.mobile-header {
    display: none;
}

/* ==========================================================================
   3. SIDEBAR (LEFT FIXED COMPONENT)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--accent-subtle);
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    background-color: var(--bg-color);
}

.brand {
    margin-bottom: 60px;
}

.brand .name {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 8px;
}

.brand .title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

/* Navigation Links */
.nav-menu ul {
    list-style: none;
}

.nav-menu li {
    margin-bottom: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
    position: relative;
    padding: 5px 0;
}

.nav-num {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    margin-right: 15px;
    font-weight: 400;
    opacity: 0.5;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--accent-color);
    transition: var(--transition-smooth);
}

/* Active State & Hover States */
.nav-link:hover, .nav-link.active {
    color: var(--accent-color);
    padding-left: 8px;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

/* Sidebar Footer / Controls */
.sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.btn-cv {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--accent-color);
    color: var(--bg-color);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: 14px 20px;
    border: 1px solid var(--accent-color);
    transition: var(--transition-smooth);
}

.btn-cv:hover {
    background-color: var(--bg-color);
    color: var(--accent-color);
}

.icon-download {
    width: 16px;
    height: 16px;
    transition: var(--transition-smooth);
}

.btn-cv:hover .icon-download {
    transform: translateY(2px);
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.social-links a:hover {
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* ==========================================================================
   4. MAIN CONTENT AREA (RIGHT PART)
   ========================================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 80px 10%;
}

.section {
    padding: 60px 0;
    border-bottom: 1px solid var(--accent-subtle);
    perspective: 1000px; /* Bật phối cảnh 3D cho các lớp con */
}

.section-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
}

.section-title::before {
    content: '// ';
    color: var(--text-color);
}

/* SECTION: OVERVIEW */
.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 50px;
    text-transform: uppercase;
}

.bio-text {
    max-width: 750px;
}

.bio-text p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.bio-text .p-lead {
    font-size: 1.35rem;
    color: var(--text-color);
    font-weight: 300;
    line-height: 1.6;
}

.quote-wrapper {
    margin-top: 60px;
    text-align: center;
    padding: 20px 0;
    border-top: 1px dashed var(--accent-subtle);
    border-bottom: 1px dashed var(--accent-subtle);
}

.terminal-quote {
    font-family: var(--font-mono);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* SECTION: PROJECTS (3D CARD PARALLAX EFFECT) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.project-card-3d {
    background-color: transparent;
    border: 1px solid var(--accent-subtle);
    transition: border-color 0.3s ease;
    transform-style: preserve-3d; /* Giữ nguyên không gian 3D */
    will-change: transform;
}

.project-card-inner {
    padding: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform: translateZ(30px); /* Đẩy nội dung chữ nổi lên bề mặt 3D */
}

.project-card-3d:hover {
    border-color: var(--accent-color);
}

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

.project-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    border: 1px solid var(--accent-subtle);
    padding: 4px 10px;
}

.project-year {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.project-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 15px;
    letter-spacing: -0.02em;
}

.project-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
}

.project-link {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.project-link i {
    font-size: 0.65rem;
    transition: var(--transition-smooth);
}

.project-card-3d:hover .project-link i {
    transform: translateX(4px);
}

/* SECTION: SKILLS */
.skills-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-width: 800px;
}

.skills-category h5 {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 20px;
    color: var(--text-color);
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--accent-subtle);
    padding: 10px 18px;
    transition: var(--transition-smooth);
}

.skill-badge:hover {
    color: var(--bg-color);
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* SECTION: EXPERIENCE (TIMELINE) */
.timeline {
    position: relative;
    max-width: 800px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 200px;
    width: 1px;
    height: calc(100% - 10px);
    background-color: var(--accent-subtle);
}

.timeline-item {
    display: flex;
    margin-bottom: 50px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.time-meta {
    width: 160px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.duration {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
}

.location {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.time-content {
    padding-left: 81px;
    position: relative;
}

/* Nút tròn định vị mốc thời gian */
.time-content::before {
    content: '';
    position: absolute;
    top: 6px;
    left: -4px;
    width: 9px;
    height: 9px;
    background-color: var(--bg-color);
    border: 1px solid var(--text-color);
    border-radius: 50%;
}

.time-content h4 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.role-subtitle {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.time-content p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* SECTION: CONTACT */
.contact-wrapper {
    max-width: 700px;
}

.contact-lead {
    font-size: 1.2rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 40px;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.contact-card {
    border: 1px solid var(--accent-subtle);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition-smooth);
}

.contact-card i {
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.card-text span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.card-text strong {
    font-size: 1.05rem;
    font-weight: 700;
}

.contact-card:hover {
    border-color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.02);
}

.contact-card:hover i {
    color: var(--accent-color);
    transform: scale(1.1);
}

/* FOOTER */
.site-footer {
    padding: 60px 0 20px 0;
    text-align: left;
}

.site-footer p {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ==========================================================================
   5. RESPONSIVE DESIGN (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 30%;
    }
    .hero-title {
        font-size: 2.8rem;
    }
    .timeline::before {
        left: 150px;
    }
    .time-meta {
        width: 120px;
    }
    .time-content {
        padding-left: 41px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    /* Show Mobile Header Top Bar */
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 30px;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        background-color: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--accent-subtle);
        z-index: 1000;
    }
    
    .mobile-logo {
        font-weight: 900;
        letter-spacing: -0.05em;
        font-size: 1.3rem;
    }
    
    /* Hamburger Button Setup */
    .menu-toggle {
        background: none;
        border: none;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    
    .menu-toggle .bar {
        width: 24px;
        height: 1px;
        background-color: var(--text-color);
        transition: var(--transition-smooth);
    }
    
    /* Active animation for hamburger */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Transform Sidebar into Responsive Menu Drawer */
    .sidebar {
        width: 100vw;
        height: calc(100vh - 72px);
        top: 72px;
        left: -100vw; /* Hidden by default */
        border-right: none;
        border-bottom: 1px solid var(--accent-subtle);
        padding: 50px 30px;
        transition: var(--transition-smooth);
    }
    
    .sidebar.active {
        left: 0; /* Slide in */
    }
    
    .brand {
        display: none; /* Already using mobile top logo */
    }
    
    .nav-menu li {
        margin-bottom: 30px;
    }
    
    .nav-link {
        font-size: 1.1rem;
    }
    
    /* Adjust Main Content view space */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 120px 30px 40px 30px;
    }
    
    .hero-title {
        font-size: 2.2rem;
        margin-bottom: 35px;
    }
    
    .bio-text .p-lead {
        font-size: 1.15rem;
    }
    
    .projects-grid, .contact-grid {
        grid-template-columns: 1fr;
    }
    
    /* Fluid adjustments for Timeline on mobile */
    .timeline::before {
        left: 8px;
    }
    .timeline-item {
        flex-direction: column;
        gap: 15px;
    }
    .time-meta {
        width: 100%;
        flex-direction: row;
        gap: 20px;
        align-items: center;
    }
    .time-content {
        padding-left: 30px;
    }
    .time-content::before {
        left: -25px;
        top: 5px;
    }
}