/* =========================
   RESET & BASE
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #030712;
    --card: rgba(17, 24, 39, 0.7);
    --border: rgba(255, 255, 255, 0.06);
    --primary: #38bdf8;
    --secondary: #8b5cf6;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --success: #22c55e;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* =========================
   GRID BACKGROUND & PARTICLES
========================= */
.grid-bg {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.015) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    pointer-events: none;
}

.particle {
    position: fixed;
    width: 3px;
    height: 3px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: float linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes float {
    from {
        transform: translateY(100vh) scale(1);
    }

    to {
        transform: translateY(-10vh) scale(0.5);
    }
}

/* =========================
   HEADER & NAVIGATION
========================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 8%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.sticky {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(3, 7, 18, 0.8);
    padding: 15px 8%;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
    color: #fff;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.navbar {
    display: flex;
    gap: 32px;
}

.navbar a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s ease;
}

.navbar a:hover,
.navbar a.active {
    color: var(--primary);
}

/* Custom Hamburger Menu CSS Toggle */
.menu-icon-wrapper {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 1100;
    width: 28px;
}

.menu-icon-wrapper span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-icon-wrapper.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-icon-wrapper.open span:nth-child(2) {
    opacity: 0;
}

.menu-icon-wrapper.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =========================
   HERO / HOME SECTION
========================= */
section {
    padding: 100px 8% 80px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

.home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    padding-top: 120px;
}

.home-content {
    flex: 1.2;
}

.status-wrapper {
    margin-bottom: 20px;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    font-size: 13px;
    font-weight: 600;
}

.home-content h1 {
    font-size: 56px;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, var(--muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-content h3 {
    font-size: 24px;
    margin-bottom: 24px;
    font-weight: 500;
    color: #e5e7eb;
}

.typing {
    color: var(--primary);
    font-weight: 700;
}

.home-content p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.7;
    max-width: 580px;
}

.hero-btns {
    display: flex;
    gap: 16px;
    margin-top: 35px;
}

.btn {
    padding: 12px 28px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.15);
}

.secondary {
    border: 1px solid var(--border);
    color: #fff;
    background: rgba(255, 255, 255, 0.02);
}

.btn:hover {
    transform: translateY(-3px);
}

.primary:hover {
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.25);
}

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

/* =========================
   AVATAR (KHÔNG BỊ QUAY LỘN CHỮ)
========================= */
.home-image {
    flex: 0.8;
    display: flex;
    justify-content: center;
}

.avatar-container {
    position: relative;
    width: 280px;
    height: 280px;
}

.avatar-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 3px;
    animation: rotate 12s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.avatar {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: #0f172a;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -2px;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =========================
   GRIDS (ABOUT, SKILLS, PROJECTS)
========================= */
.info-grid,
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.info-card {
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-card:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.3);
    background: rgba(17, 24, 39, 0.9);
}

.info-card h4 {
    color: var(--primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.info-card p {
    color: #e5e7eb;
    font-size: 16px;
    font-weight: 500;
}

.project-grid {
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.project-card {
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: rgba(56, 189, 248, 0.3);
}

.project-header span {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
}

.project-card h3 {
    font-size: 20px;
    margin: 16px 0 10px;
    color: #fff;
}

.project-card p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
    flex-grow: 1;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}

.tags span {
    padding: 4px 10px;
    border-radius: 6px;
    background: #1f2937;
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 500;
}

.project-links a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.project-links a:hover {
    transform: translateX(4px);
    color: var(--secondary);
}

/* =========================
   STYLE PHẦN ARCHITECTURE (MỚI)
========================= */
.arch-flow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
}

.arch-step {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px 24px;
    flex: 1;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.3s;
}

.arch-step:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

.arch-icon {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 16px;
}

.arch-step h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #fff;
}

.arch-step p {
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.6;
}

.arch-line {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    align-self: center;
    opacity: 0.4;
    position: relative;
}

/* =========================
   TERMINAL (CONTACT)
========================= */
.terminal {
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.terminal-header {
    background: #0f172a;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #1e293b;
}

.terminal-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot.red {
    background: #ef4444;
}

.dot.yellow {
    background: #f59e0b;
}

.dot.green {
    background: #10b981;
}

.terminal-title {
    color: var(--muted);
    font-size: 12px;
    font-family: monospace;
    margin-left: 10px;
}

.terminal-body {
    padding: 24px;
    font-family: monospace;
    font-size: 14px;
}

.terminal-body .command {
    color: #fff;
    margin-bottom: 16px;
}

.terminal-body .command .user {
    color: var(--success);
}

.terminal-body .output {
    color: #cbd5e1;
    margin-bottom: 8px;
}

.terminal-body .output .label {
    color: var(--primary);
    display: inline-block;
    width: 90px;
}

.terminal-body .output a {
    color: #fff;
    text-decoration: underline;
}

/* =========================
   FOOTER & ANIMATIONS
========================= */
footer {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 14px;
}

.hide-initially {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s, transform 0.6s;
}

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

/* =========================
   MEDIA QUERIES (RESPONSIVE)
========================= */
@media (max-width: 1024px) {
    section {
        padding: 80px 6% 60px;
    }

    .home-content h1 {
        font-size: 46px;
    }

    .arch-flow {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 16px 6%;
    }

    .header.sticky {
        padding: 12px 6%;
    }

    .menu-icon-wrapper {
        display: flex;
    }

    .navbar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: rgba(3, 7, 18, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid var(--border);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 32px;
        transition: right 0.4s ease;
    }

    .navbar.active {
        right: 0;
    }

    .home {
        flex-direction: column-reverse;
        text-align: center;
        padding-top: 100px;
        gap: 40px;
    }

    .home-content p {
        margin: 0 auto;
    }

    .hero-btns {
        justify-content: center;
    }

    .home-image .avatar-container {
        width: 220px;
        height: 220px;
    }

    .avatar {
        font-size: 48px;
    }

    .section-title {
        font-size: 26px;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .arch-flow {
        flex-direction: column;
        align-items: center;
    }

    .arch-line {
        width: 2px;
        height: 30px;
    }

    .arch-step {
        width: 100%;
    }
}