#tsparticles {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background: linear-gradient(to bottom right, rgb(233, 187, 187), rgb(233, 163, 225), rgb(233, 208, 114));
}

body {
    margin: 0;
    padding: 0;
    font-family: Segoe UI, sans-serif;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
    scroll-behavior: smooth;
}


:root {
    font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    font-weight: 400;
    color-scheme: light dark;
    color: #ffffffde;
    background-color: #242424;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 32px;
    box-sizing: border-box;
}

.navbar {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translate(-50%);
    background: #f2f2f2;
    padding: 16px 36px;
    border-radius: 48px;
    display: flex;
    align-items: center;
    gap: 60px;
    box-shadow: 0 8px 20px #00000014;
    z-index: 1000;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.nav-list {
    display: flex;
    gap: 18px;
    list-style: none;
    padding: 0;
    margin: 0;
}

li {
    display: list-item;
    text-align: -webkit-match-parent;
    unicode-bidi: isolate;
}

.nav-item {
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: .2s ease;
    font-weight: 500;
}

a {
    font-weight: 500;
    color: #646cff;
    text-decoration: inherit;
}

ul {
    display: block;
    list-style-type: disc;
    margin-block-start: 1em;
    margin-block-end: 1em;
    margin-inline-start: 0px;
    margin-inline-end: 0px;
    padding-inline-start: 40px;
    unicode-bidi: isolate;
}

img {
    overflow-clip-margin: content-box;
    overflow: clip;
}

.avatar-nav {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 6px #0000001a;
}

.intro {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 32px 40px;
    width: 100%;
}

.intro-left h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 10px;
    animation: slideInLeft 2s ease-out;
}

.intro-left p {
    font-size: 14px;
    color: #444;
    margin-bottom: 20px;
    animation: slideInRight 1s ease-out;
}

.hero-left h2 {
    font-size: 20px;
    color: #555;
    margin-bottom: 10px;
    animation: slideInRight 1s ease-out;
}

.icons {
    display: flex;
    gap: 20px;
    font-size: 20px;
    justify-content: center;
    animation: slideInRight 1s ease-out;
}

svg {
    stroke-width: 0;
    height: 1em;
    width: 1em;
}

div {
    unicode-bidi: isolate;
}

.intro-right {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 32px;
    box-sizing: border-box;
}

.intro-right img {
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    object-fit: cover;
}

img {
    overflow-clip-margin: content-box;
    overflow: clip;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.intro h1 {
    font-size: 2.5rem;
    margin: 0;
}

.intro p {
    color: #777;
}

.icon {
    color: #007bff;
    margin-right: 8px;
}

section {
    padding: 40px 20px;
    max-width: 900px;
    margin: auto;
}

.section {
    width: 100%;
    max-width: 1024px;
    padding: 64px 32px;
    box-sizing: border-box;
}

.about {
    opacity: 1;
    transform: translate(0);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

#about p {
    text-align: justify;
    /* nếu muốn ngắt từ (hyphenation) tự động */
    hyphens: auto;
}

.title {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 40px;
}

main {
    flex: 1;
    position: relative;
    /* tạo stacking context */
    z-index: 0;
    /* đảm bảo nằm trên #tsparticles */
    padding: 20px;
}

footer {
    text-align: center;
    padding: 10px 0;
    font-size: 14px;
}

/* 1. Container: đường timeline nằm giữa */
/* Timeline-container bây giờ position: absolute tính theo viewport */
.timeline-container {
    position: relative;
    top: 0;
    left: 50%;
    /* canh tâm viewport */
    transform: translateX(-50%);
    width: 75vw;
    /* hoặc bao nhiêu bạn thích */
    max-width: none;
    padding: 2rem 0;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: #ccc;
}

/* 2. Mỗi item rộng khoảng nửa container (trừ gap), rồi dùng margin auto để đẩy trái/phải */
.timeline-item {
    position: relative;
    /* width = 50% của container trừ đi 1rem gap mỗi bên */
    width: calc(50% - 2rem);
    margin-bottom: 1.5rem;
}

/* Các item lẻ (1,3,5…) căn sang trái */
.timeline-item:nth-child(odd) {
    margin-right: auto;
    margin-left: 0;
}

/* Các item chẵn (2,4,6…) căn sang phải */
.timeline-item:nth-child(even) {
    margin-left: auto;
    margin-right: 0;
}

/* 1. Đặt kích thước và xoá border cũ */
.timeline-item::before {
    content: "";
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    background-repeat: no-repeat;
    background-size: contain;
    /* thay chấm bằng svg circle icon */
    background-image: url('data:image/svg+xml;charset=UTF-8,\%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20512%20512%22%3E\%3Cpath%20d%3D%22M256%20512A256%20256%200%201%200%20256%200a256%20256%200%201%200%200%20512zm0-352a96%2096%200%201%201%200%20192%2096%2096%200%201%201%200-192z%22/%3E\%3C/svg%3E');
}

/* 2. Vị trí icon cho item lẻ/chẵn */
.timeline-item:nth-child(odd)::before {
    right: -3rem;
}

.timeline-item:nth-child(even)::before {
    left: -3rem;
}


/* 4. Styling summary & body không đổi */
.timeline-header {
    background: #ffffff93;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

    /* nội dung bên trong */
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timeline-header:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.timeline-header::-webkit-details-marker {
    display: none;
}

.timeline-header::marker {
    font-size: 0;
}

.timeline-header::after {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.timeline-item[open]>.timeline-header::after {
    transform: rotate(90deg);
}

.timeline-body {
    padding: 0 1rem 1rem;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.timeline-body ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.skill-chip {
    display: inline-block;
    margin: 0.2rem 0.3rem 0 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    background: #eee;
    border-radius: 12px;
}

.container {
    text-align: center;
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    color: rgb(0, 0, 0);
    font-size: 3rem;
    margin-bottom: 50px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-top: 30px;
}

.project-card {
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    position: relative;
    justify-self: center;
    transform-origin: center center;
}

.project-card:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(-10px);
}

.card-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(45deg, #ff9a56, #ff6b95);
    position: relative;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-card:hover .card-image img {
    transform: scale(1.1);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .overlay {
    opacity: 1;
}

.overlay h3 {
    color: white;
    font-size: 2rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay p {
    color: white;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.view-btn {
    background: #ff6b95;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    margin-top: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: #ff9a56;
    transform: scale(1.1);
}

.card-content {
    padding: 30px;
    text-align: left;
}

.card-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.3;
}

.card-subtitle {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-description {
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
}

.card-subtitle a {
    color: #ff6b95;
    text-decoration: none;
    font-weight: 500;
}

.card-subtitle a:hover {
    color: #ff9a56;
    text-decoration: underline;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.tech-tag {
    background: #f0f0f0;
    color: #666;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

@media (max-width: 968px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .project-card {
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .project-card {
        max-width: 350px;
        height: 450px;
    }

    h1 {
        font-size: 2rem;
    }

    .projects-grid {
        gap: 15px;
    }
}

.skills-section {
    padding: 20;
}

.skills-section .container {
    position: relative;
    /* Không nhất thiết phải là absolute */
    width: 90vw;
    max-width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    /* Dịch trái 50% để căn giữa */
    background: #ffffffb8;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 40px;
    box-sizing: border-box;
}


/* Grid các nhóm skill section */
.skills-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
}

/* Grid bên trong từng khối (ngôn ngữ, frontend, backend, ...) */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
}

/* Các khối nhỏ skill item */
.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    transition: 0.3s ease;
}

.skill-item:hover {
    background: #ffffff3f;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Icon skill (sửa lại dùng hình ảnh) */
.skill-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}

.skill-icon img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.skill-icon img:hover {
    transform: scale(1.1);
}

/* Tên skill */
.skill-name {
    font-size: 0.9rem;
    color: #495057;
}

/* Responsive breakpoints */
@media (max-width: 768px) {
    .skills-section .container {
        padding: 40px 20px;
    }

    .skills-wrapper {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 24px;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .skill-icon {
        width: 48px;
        height: 48px;
    }

    .skill-icon img {
        width: 32px;
        height: 32px;
    }
}

#contact-form * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


#contact-form .container {
    border-radius: 20px;
    background: #ffffffcf;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 100vw;
    width: 60vw;
    padding: 60px 50px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    margin: 0 auto;
}

#contact-form .container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

#contact-form .header {
    text-align: center;
    margin-bottom: 40px;
}

#contact-form .header p {
    font-size: 1.1rem;
    text-align: center;
    color: #6c757d;
    line-height: 1.6;
    max-width: 450px;
    margin: 0 auto;
}

#contact-form .form-group {
    margin-bottom: 25px;
}

#contact-form .form-group label {
    display: block;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

#contact-form .form-group input,
#contact-form .form-group textarea {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    background: #fafbfc00;
    transition: all 0.3s ease;
    resize: none;
}

#contact-form .form-group input:focus,
#contact-form .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#contact-form .form-group input::placeholder,
#contact-form .form-group textarea::placeholder {
    color: #7a7a7a;
}

#contact-form .form-group textarea {
    min-height: 120px;
    max-height: 200px;
}

#contact-form .submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#contact-form .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#contact-form .submit-btn:active {
    transform: translateY(0);
}

#contact-form .submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#contact-form .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#contact-form .message {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

#contact-form .message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#contact-form .message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    #contact-form .container {
        padding: 40px 30px;
        margin: 10px;
    }

    #contact-form .header h1 {
        font-size: 2rem;
    }

    #contact-form .header p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    #contact-form .container {
        padding: 30px 20px;
    }

    #contact-form .header h1 {
        font-size: 1.8rem;
    }
}

#contact-form .container {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}