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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0f;
    color: #e0e0e0;
    overflow-x: hidden;
}

/* Animated gradient background */
/* class selector */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #0a0a0f 100%);
    z-index: -2;
}

/* pseudo-element ที่สร้างเนื้อหาก่อนเนื้อหาจริง */
.bg-gradient::before {
    content: ''; /* ต้องมีเสมอ เพื่อให้ pseudo-element ปรากฏ */
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 5%;
    backdrop-filter: blur(20px);
    background: rgba(10, 10, 15, 0.7);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    z-index: 100;
    transition: all 0.3s ease;
}

nav.scrolled {
    padding: 1rem 5%;
    background: rgba(10, 10, 15, 0.95);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5%;
    position: relative;
}

.hero-content {
    max-width: 1400px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-text h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease;
}

.hero-text .highlight {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text p {
    font-size: 1.25rem;
    color: #b0b0b0;
    margin-bottom: 2rem;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: transparent;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

/* Animated Code Visual */
.hero-visual {
    position: relative;
    height: 500px;
    animation: fadeInUp 0.8s ease 0.3s both;
}

.ouput-window {
    background: rgba(30, 30, 45, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.code-window {
    background: rgba(30, 30, 45, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.code-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.code-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background: #ff5f56;
}

.dot-yellow {
    background: #ffbd2e;
}

.dot-green {
    background: #27c93f;
}

.code-content {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #a0a0a0;
}

.code-line {
    opacity: 0;
    animation: typeLine 0.3s ease forwards;
}

/* .code-line:nth-child(1) { animation-delay: 0.5s; }
        .code-line:nth-child(2) { animation-delay: 0.8s; }
        .code-line:nth-child(3) { animation-delay: 1.1s; }
        .code-line:nth-child(4) { animation-delay: 1.4s; }
        .code-line:nth-child(5) { animation-delay: 1.7s; }
        .code-line:nth-child(6) { animation-delay: 2s; } */

.code-line {
    display: none;
    /* เริ่มซ่อน */
    margin: 5px 0;
    white-space: pre;
    /* เก็บ spacing */
}

@keyframes typeLine {
    to {
        opacity: 1;
    }
}

.keyword {
    color: #ff79c6;
}

.function {
    color: #50fa7b;
}

.string {
    color: #f1fa8c;
}

.comment {
    color: #6272a4;
}

.variable {
    color: #fefefe;
}

/* Floating particles */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #6366f1;
    border-radius: 50%;
    animation: float 6s infinite;
    opacity: 0.6;
}

.particle:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 60%;
    left: 80%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    top: 40%;
    left: 10%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(-30px) translateX(20px);
    }
}

/* Skills Section */
.section {
    padding: 6rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: stretch;
    gap: 2rem;
}

.skills-grid a {
    text-decoration: none;
}

.skill-card {
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
}

.skill-card:hover {
    transform: translateY(-8px);
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.2);
}

.skill-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.skill-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: #fff;
}

.skill-card p {
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skilltag {
    padding: 0.4rem 0.8rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 6px;
    font-size: 0.85rem;
    color: #a0a0ff;
}

.see-more {
    margin-top: 1rem;
    text-align: center;
}
.see-more a {
    color: #6272a4;
}
.see-more a:hover {
    text-decoration-line: underline;
}


/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* สำหรับแท็บเล็ต จะเหลือ 2 คอลัมน์ */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* สำหรับมือถือ จะเหลือ 1 คอลัมน์ */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.project-card {
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

.project-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.project-image::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-image::before {
    opacity: 1;
}

.project-content {
    padding: 2rem;
}

.project-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: #fff;
}

.project-content p {
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.4rem 0.8rem;
    /* background: rgba(6, 7, 107, 0.2); */
    background: rgb(230, 76, 76);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 6px;
    font-size: 0.85rem;
    /* color: #a0a0ff; */
}

/* About me section */
.about_me-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.about_me-card {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 16px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
}

.about_me-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.3);
}

.about_me-content {
    padding: 2rem;
}

.about_me-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    /* color: #fff; */
    color: #a855f7;
}

.about_me-content p {
    color: #b0b0b0;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.about_me-content-variable{
    color: #fefefe;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.edu_column {
    display: flex;
    /* gap: 2rem; */
    /* gap: initial; */
    justify-content: space-between;
}

.work_column {
    display: flex;
    /* gap: 2rem; */
    /* gap: initial; */
    justify-content: space-between;
}

/* Contact Section */
.contact-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-content p {
    font-size: 1.2rem;
    color: #b0b0b0;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.social-link {
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    text-decoration: none;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 968px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 3rem;
    }

    .cta-buttons {
        justify-content: center;
    }

    .nav-links {
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .section-title {
        font-size: 2rem;
    }
}

/* 1. แก้ไขให้รูป Cover ในการ์ดแสดงผลพอดีและไม่บิดเบี้ยว */
.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    position: relative;
    z-index: 1;
}

/* 2. จัด h3 ใต้ section-title ให้อยู่ตรงกลาง พร้อม Cursor กระพริบสำหรับเอฟเฟกต์พิมพ์ */
.section-subtitle {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 400;
    color: #b0b0b0;
    margin-top: -2rem;      /* ดึงระยะเข้าใกล้ title หลักขึ้นเล็กน้อย */
    margin-bottom: 3.5rem;  /* เว้นระยะห่างลงไปถึงการ์ด */
    min-height: 1.8rem;     /* กัน layout กระตุกขณะพิมพ์ */
    display: flex;
    justify-content: center;
    align-items: center;
}

.section-subtitle::after {
    content: '|';
    margin-left: 5px;
    color: #a855f7;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 3. แก้ไขระยะห่างระหว่างแท็กราคาและปุ่ม */
.project-content .project-tags {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem; /* กำหนดระยะห่างระหว่างราคากับปุ่ม */
}

/* 4. ตกแต่งปุ่มลิงก์ตัวอย่างเว็บให้ดูทันสมัย เข้ากับธีม */
.btn-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid rgba(168, 85, 247, 0.5);
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-preview:hover {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(168, 85, 247, 0.35);
    color: #ffffff;
}

/* กล่องครอบปุ่ม จัดระยะห่าง */
.card-actions {
    display: flex;
    gap: 0.75rem; /* ระยะห่างระหว่าง 2 ปุ่ม */
    width: 100%;
}

/* ปรับให้แต่ละปุ่มขยายเท่าๆ กัน */
.card-actions .btn-preview {
    flex: 1;
    font-size: 0.85rem;      /* ปรับขนาดตัวอักษรให้พอดีกับปุ่มคู่ */
    padding: 0.65rem 0.5rem;
    text-align: center;
    white-space: nowrap;     /* ป้องกันข้อความตัดบรรทัด */
}

/* ปุ่มวิดีโอ (สไตล์โปร่งใส outline เพื่อให้แยกความสำคัญได้ง่าย) */
.btn-video {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #e0e0e0;
}

.btn-video:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* ปุ่มดูเว็บจริง (สไตล์เด่น primary) */
.btn-live {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border: 1px solid transparent;
    color: #ffffff;
}

.btn-live:hover {
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
}

/* สำหรับ H1 และ Section Title (หัวข้อใหญ่ภาษาอังกฤษ) */
h1, 
.section-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700; /* หรือ 800 เพื่อความคมชัดโมเดิร์น */
    letter-spacing: -0.02em; /* ลดระยะห่างตัวอักษรเล็กน้อยเพื่อความกระชับ */
}

/* สำหรับ H3 และ Subtitle (ข้อความภาษาไทย / คำอธิบายหัวข้อ) */
h3, 
.section-subtitle {
    font-family: 'IBM Plex Sans Thai', sans-serif;
    font-weight: 400; /* น้ำหนักกำลังพอดี อ่านง่าย */
    letter-spacing: 0.01em;
}

/* หากต้องการให้ H3 ในการ์ดสินค้าหนาขึ้นเล็กน้อย */
.project-content h3 {
    font-family: 'IBM Plex Sans Thai', sans-serif;
    font-weight: 600;
}