/* ==========================================================================
   1. ตั้งค่าเริ่มต้นและฟอนต์ (Global Styles)
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Kanit', 'Fira Code', sans-serif;
    scroll-behavior: smooth;
    /* แยก transition หลักเพื่อไม่ให้ไปกวนจังหวะ 3D Tilt ของเมาส์ */
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

/* 💻 ธีมโหมดมืด (Default Dark Theme) */
:root {
    --bg-color: #060913;       
    --card-bg: rgba(15, 22, 38, 0.6);       
    --accent-cyan: #00f2fe;
    --accent-purple: #4facfe;
    --text-main: #ffffff;
    --text-muted: #8fa0dd;
    --border-color: rgba(34, 47, 77, 0.5);
    --navbar-bg: rgba(6, 9, 19, 0.7);
    --grid-opacity: 0.4;
    --modal-overlay: rgba(3, 5, 12, 0.8);
}

/* ☀️ ธีมโหมดสว่าง (Light Theme) */
[data-theme="light"] {
    --bg-color: #f4f7fc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --accent-cyan: #008fa3;
    --accent-purple: #1e62ff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border-color: rgba(203, 213, 225, 0.8);
    --navbar-bg: rgba(244, 247, 252, 0.8);
    --grid-opacity: 0.1;
    --modal-overlay: rgba(226, 232, 240, 0.8);
}

/* แต่งแถบเลื่อน Browser ด้านข้างให้มีชีวิตชีวา */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--accent-purple), var(--accent-cyan));
    border-radius: 10px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    position: relative;
}

/* พื้นหลังลายจุดสไตล์ห้องทดลอง Sci-Fi (ขยับพิกเซลตามจังหวะชีพจรเบาๆ) */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--accent-cyan) 1px, transparent 1px); 
    background-size: 40px 40px;
    z-index: -1;
    opacity: var(--grid-opacity);
    animation: gridPulse 20s linear infinite;
}

@keyframes gridPulse {
    0% { background-position: 0px 0px; }
    100% { background-position: 40px 40px; }
}

/* ==========================================================================
   2. ส่วนหัวและระบบนำทาง (Navbar - ดีไซน์ลอยแก้วสมูท)
   ========================================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 8%;
    background: var(--navbar-bg);
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: fadeDown 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.5px;
    transition: transform 0.3s ease;
}
.logo:hover {
    transform: scale(1.03);
}

.logo span {
    color: var(--accent-cyan);
    font-family: 'Fira Code', monospace;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding: 4px 0;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-cyan);
}

/* เส้นใต้เรืองแสงวิ่งตามเมาส์ชี้เมนู */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.nav-links a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* ปุ่มกดสลับโหมด Theme Toggle */
.theme-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.theme-btn:hover {
    transform: scale(1.15) rotate(45deg);
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.25);
}

/* ==========================================================================
   3. Hero Section (มิติจานบินลอยละมุนฉากหน้าเว็บ)
   ========================================================================== */
.hero-section {
    min-height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    position: relative;
}

.hero-content {
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeUp 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.hero-title {
    display: flex;
    flex-direction: column; 
    align-items: center;    
    gap: 12px;              
    margin-bottom: 25px;
    width: 100%;
}

.hero-subtitle {
    font-size: 2.2rem;      
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.text-gradient {
    font-size: 3.8rem;      
    background: linear-gradient(45deg, #a855f7, var(--accent-cyan)); 
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    line-height: 1.2;
    font-weight: 700;
    filter: drop-shadow(0 2px 10px rgba(0, 242, 254, 0.15));
}

.badge {
    background: rgba(0, 242, 254, 0.06);
    color: var(--accent-cyan);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(0, 242, 254, 0.25);
    display: inline-block;
    margin-bottom: 25px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0,242,254,0.05);
    animation: badgeFloat 3s ease-in-out infinite; /* ดีดตัวลอยดุ๊กดิ๊ก */
}

@keyframes badgeFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); background: rgba(0, 242, 254, 0.1); }
}

.hero-content p {
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 45px;
    max-width: 750px;
}

.btn-primary {
    display: inline-block;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-cyan));
    color: #060913;
    font-weight: 700;
    padding: 16px 36px;
    border-radius: 12px;
    text-decoration: none;
    box-shadow: 0 5px 22px rgba(0, 242, 254, 0.25);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-primary:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 242, 254, 0.4);
    letter-spacing: 0.5px;
}

/* ==========================================================================
   4. About & Education Section (ระบบกล่องโฮเวอร์บิด 3D คมกริบ)
   ========================================================================== */
.about-section {
    padding: 80px 8%;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px; 
    margin-top: 40px;
    align-items: start; 
}

.about-info-card, .about-education-card {
    background: linear-gradient(135deg, rgba(15, 22, 38, 0.7) 0%, rgba(6, 9, 19, 0.5) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px; 
    position: relative;
    overflow: hidden;
    min-height: 380px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    
    /* ระบบความสมูธของการขยับตามเมาส์ */
    transition: transform 0.15s ease-out, border-color 0.5s ease, box-shadow 0.5s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.about-info-card:hover, .about-education-card:hover {
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: 0 20px 45px rgba(0, 242, 254, 0.12);
}

/* ดันหัวข้อให้อ่านง่ายและลอยมิติขึ้นมา */
.about-info-card h3, .about-education-card h3 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    font-weight: 700;
    transform: translateZ(20px); /* ลอยตัดฉากหลัง */
}

.info-list {
    list-style: none;
    transform: translateZ(10px);
}

.info-list li {
    margin-bottom: 18px; 
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 10px;
    line-height: 1.7;
    transition: transform 0.3s ease;
}
.info-list li:hover {
    transform: translateX(5px); /* เลื่อนเบาๆ ตอนอ่านข้อมูล */
}

.info-list strong {
    color: var(--accent-cyan);
    font-weight: 600;
    margin-right: 8px;
    display: inline-block;
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.2); 
}

/* Timeline ประวัติการศึกษา */
.timeline {
    border-left: 2px dashed rgba(79, 172, 254, 0.3);
    padding-left: 25px;
    margin-left: 10px;
    transform: translateZ(15px);
}

.timeline-item {
    position: relative;
    margin-bottom: 35px;
}
.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    transition: transform 0.3s ease;
}
.timeline-item:hover::before {
    transform: scale(1.4);
}

.timeline-year {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--accent-purple);
    display: block;
    margin-bottom: 8px;
}

.timeline-content h4 {
    color: var(--text-main);
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.timeline-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.timeline-content .text-gradient {
    font-size: 1.1rem; 
    font-weight: 500;
    margin-top: 5px;
    display: block;
    line-height: 1.4;
}

/* ==========================================================================
   5. My Skills Section (เวอร์ชันหลอดพลังนีออนวิ่ง และ Micro-interactions)
   ========================================================================== */
.skills-section {
    padding: 90px 8%;
    position: relative;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 35px;
    margin-top: 50px;
}

.skill-category-card {
    background: linear-gradient(135deg, rgba(15, 22, 38, 0.7) 0%, rgba(6, 9, 19, 0.5) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    
    /* คอนโทรลเมาส์ให้หน่วงพริ้ว */
    transition: transform 0.15s ease-out, border-color 0.5s ease, box-shadow 0.5s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.skill-category-card:hover {
    border-color: rgba(0, 242, 254, 0.4);
    box-shadow: 0 20px 40px rgba(0, 242, 254, 0.1);
}

.skill-category-card h3 {
    font-size: 1.35rem;
    color: var(--text-main);
    margin-bottom: 35px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transform: translateZ(25px);
}

.skill-category-card h3 i {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px currentColor);
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 26px;
    transform: translateZ(15px);
}

.skill-item-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* หัวข้อเขยิบขวาเล็กน้อยให้อ่านง่ายตอนเล็ง */
.skill-item-wrapper:hover .skill-info {
    transform: translateX(6px);
}

.skill-info span {
    display: flex;
    align-items: center;
}

.skill-info i {
    font-size: 1.3rem;
    margin-right: 10px;
    display: inline-block;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.skill-item-wrapper:hover .skill-info i {
    transform: scale(1.25) rotate(8deg);
}

.skill-percent {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.8;
    transition: all 0.3s ease;
}
.skill-item-wrapper:hover .skill-percent {
    opacity: 1;
    color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(0,242,254,0.4);
}

.skill-bar-bg {
    width: 100%;
    height: 8px; 
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.01);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.skill-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), var(--fill-color));
    box-shadow: 0 0 12px var(--fill-color), 0 0 4px var(--fill-color);
    width: calc(var(--percent) * 1%);
    transform-origin: left;
    transform: scaleX(0); 
    animation: slideInBarSmooth 1.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slideInBarSmooth {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* สีคัลเลอร์ฟูลประจำคลาสภาษาต่างๆ */
.text-cyan { color: #00f2fe; }
.text-purple { color: #a855f7; }
.text-python { color: #3776AB; }
.text-html { color: #E34F26; }
.text-js { color: #F7DF1E; }
.text-cyber { color: #00f2fe; filter: drop-shadow(0 0 4px rgba(0,242,254,0.4)); }
.text-marketing { color: #ff007f; }
.text-comm { color: #a855f7; }
.text-think { color: #ff7b00; }
.text-team { color: #4facfe; }

.skill-card-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.05) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
    pointer-events: none;
    transition: transform 0.8s ease, background 0.5s ease;
}
.skill-category-card:hover .skill-card-glow {
    transform: translate(-15px, -15px) scale(1.25);
    background: radial-gradient(circle, rgba(0, 242, 254, 0.09) 0%, transparent 70%);
}

/* ==========================================================================
   6. Projects Section & Filtering (เวอร์ชัน 3D Deep Space - โครงสร้างเดิมเป๊ะ 100%)
   ========================================================================== */
.projects-section {
    padding: 90px 8%; 
    position: relative;
}

.section-title {
    text-align: center;
    margin-bottom: 50px; 
}

.section-title h2 {
    font-size: 2.8rem; 
    margin-bottom: 15px;
    font-weight: 700;
}

.section-title p {
    color: var(--text-muted);
    font-size: 1.1rem; 
}

/* 🔘 ตัวกรองประเภทโปรเจกต์ */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 50px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 12px 28px; 
    border-radius: 10px;
    font-size: 1.05rem; 
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.filter-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--text-main);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-cyan));
    border-color: transparent;
    color: #060913;
    font-weight: bold;
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.35);
    transform: translateY(-2px);
}

.filter-item.hide {
    display: none !important;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 40px; 
    align-items: stretch; /* 🔗 คงเดิม: บังคับบล็อกทุกใบยืดสูงเท่ากันเป็นระเบียบเป๊ะ */
}

/* 🗂️ ตัวการ์ดโปรเจกต์หลัก */
.project-card {
    background: linear-gradient(135deg, rgba(15, 22, 38, 0.7) 0%, rgba(6, 9, 19, 0.8) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color); 
    border-radius: 22px; 
    padding: 35px; 
    position: relative;
    overflow: hidden;
    
    display: flex;
    flex-direction: column;
    height: 100%; /* 🔗 คงเดิม: เต็มความสูงแถว */
    
    /* ⚡ พิกัดความไวของแอนิเมชันรองรับ Tilt */
    transition: transform 0.15s ease-out, border-color 0.5s ease, box-shadow 0.5s ease;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    
    transform-style: preserve-3d; 
    backface-visibility: hidden;
}

.project-card:hover {
    border-color: rgba(0, 242, 254, 0.5); 
    box-shadow: 0 25px 50px rgba(0, 242, 254, 0.12), 0 0 30px rgba(79, 172, 254, 0.05);
}

/* 🌌 แสงเรืองออร่าหลังการ์ดวิ่งกวาดตามเมาส์ */
.card-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.12) 0%, transparent 70%);
    top: -70px;
    left: -70px;
    pointer-events: none;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), background 0.5s ease;
    z-index: 1;
}
.project-card:hover .card-glow {
    transform: scale(1.5) translate(15px, 15px);
    background: radial-gradient(circle, rgba(0, 242, 254, 0.25) 0%, transparent 70%);
}

/* 🏷️ แท็กชนิดโปรเจกต์ ลอยตัดเลเยอร์ระดับท็อป พร้อมแอนิเมชันเรืองแสงและขยับได้ */
.card-tag {
    position: absolute;
    top: 25px;
    right: 25px;
    background: linear-gradient(45deg, #ff007f, #ff7b00);
    color: white;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3);
    
    /* 🔗 ผสานค่า translateZ(30px) เดิมของคุณ เพื่อให้ลอยมีมิติแบบ 3D และใส่แอนิเมชันลอยดุ๊กดิ๊ก */
    transform: translateZ(30px); 
    animation: tagFloatActive 3.5s ease-in-out infinite;
    
    overflow: hidden; /* บังคับให้เอฟเฟกต์แสงวิ่งผ่านไม่ล้นขอบป้าย */
}

/* 🌟 เพิ่มเลเยอร์แสงสะท้อนวิ่งผ่านป้าย (Shimmer Effect) */
.card-tag::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.55),
        transparent
    );
    transform: skewX(-25deg);
    /* แสงวิ่งผ่านวิบวับทุกๆ 3.5 วินาที */
    animation: tagShinePass 3.5s ease-in-out infinite;
}

/* 🔄 คำสั่งควบคุมป้ายให้ขยับลอยขึ้น-ลงแบบฟลูอิด (Smooth Floating) */
@keyframes tagFloatActive {
    0%, 100% {
        transform: translateZ(30px) translateY(0);
        box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3);
    }
    50% {
        transform: translateZ(35px) translateY(-5px); /* ลอยสูงขึ้นและดันมิติ 3D ไปข้างหน้าอีกนิด */
        box-shadow: 0 8px 22px rgba(255, 0, 127, 0.55); /* เรืองแสงเข้มขึ้นตอนลอย */
    }
}

/* 🔄 คำสั่งควบคุมจังหวะแสงวิ่งผ่านหน้าป้าย */
@keyframes tagShinePass {
    0% {
        left: -100%;
    }
    22%, 100% {
        left: 200%;
    }
}

/* 🖼️ กล่องภาพโปรเจกต์จมมิติลึกลงไป */
.card-image-container {
    width: 100%;
    height: 250px; 
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 28px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 0 25px rgba(0,0,0,0.6);
    transform: translateZ(15px); 
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}
.project-card:hover .project-img {
    transform: scale(1.06) rotate(0.5deg);
}

/* 📄 ตัวหนังสือตั้งตรงเด่น ลอยขนานกล่อง อ่านง่ายขั้นสุดกูรูแนะนำ */
.project-card h3 {
    font-size: 1.4rem; 
    margin-bottom: 14px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0.3px;
    transform: translateZ(25px); /* ลอยแยกชั้น ชัดใสแจ๋ว */
}

.project-card p {
    color: var(--text-muted);
    font-size: 1.1rem; 
    line-height: 1.7;
    margin-bottom: 30px;
    flex-grow: 1; /* 🔗 คงเดิม: ดันเนื้อหาปุ่มให้เท่ากันเสมอ */
    transform: translateZ(20px); /* ลอยระนาบพอดีสายตา */
}

/* ⚙️ แท็กเทคโนโลยี */
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 35px;
    transform: translateZ(22px);
}

.tech-stack span {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 6px 14px;
    border-radius: 8px;
    color: #a4b8f0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}
.project-card:hover .tech-stack span {
    background: rgba(0, 242, 254, 0.04);
    border-color: rgba(0, 242, 254, 0.2);
    color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
}

/* 1. สร้างชั้นเลเยอร์แสงสะท้อนสีขาวโปร่งแสงซ่อนไว้ทางซ้ายของการ์ด */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%; /* ซ่อนไว้ข้างนอกการ์ดฝั่งซ้าย */
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.25), /* ความสว่างของเส้นแสง (ปรับตัวเลขตามชอบ) */
        transparent
    );
    transform: skewX(-50deg); /* สั่งเอียงทำมุมให้แสงเฉียงดูสวยงาม */
    z-index: 5; /* ให้อยู่เหนือรูปภาพ แต่อยู่ใต้ตัวหนังสือและป้าย Featured */
    pointer-events: none; /* เพื่อไม่ให้ขวางการคลิกปุ่มบนการ์ด */
}

/* 2. เมื่อเอาเมาส์ชี้ (Hover) ให้สั่งวิ่งเลื่อนตำแหน่งจากซ้ายสุดข้ามไปขวาสุดอย่างรวดเร็ว */
.project-card:hover::before {
    left: 150%; /* วิ่งทะลุไปฝั่งขวา */
    /* 🚀 ปรับจาก 0.8s เป็น 1.5s (ช้าลงเกือบเท่าตัว) และปรับจังหวะให้ผ่อนความเร็วช่วงท้ายแบบผู้ดี */
    transition: left 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 🔘 ปุ่มแอคชันใต้การ์ด */
.card-actions {
    display: flex;
    gap: 18px;
    margin-top: auto;
    width: 100%;
    transform: translateZ(25px);
}

.btn-card {
    flex: 1;
    text-align: center;
    padding: 14px; 
    border-radius: 10px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.btn-card.preview {
    background: linear-gradient(45deg, rgba(79, 172, 254, 0.15), rgba(0, 242, 254, 0.15));
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.4);
}
.btn-card.preview:hover {
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-cyan));
    color: #060913;
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
    transform: translateY(-3px);
}

.btn-card.detail-btn {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-card.detail-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Dummy Card Coming Soon */
.dummy-card {
    opacity: 0.45;
    border-style: dashed;
    border-color: rgba(79, 172, 254, 0.3);
    background: linear-gradient(135deg, rgba(15, 22, 38, 0.3) 0%, rgba(6, 9, 19, 0.4) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
.dummy-card:hover {
    opacity: 0.9;
    border-color: var(--accent-purple);
    border-style: solid;
    box-shadow: 0 25px 50px rgba(168, 85, 247, 0.15);
    background: rgba(168, 85, 247, 0.01);
}

.card-icon {
    font-size: 2.8rem;
    color: var(--text-muted);
    margin-bottom: 22px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.dummy-card:hover .card-icon {
    transform: scale(1.25) rotate(8deg);
    color: var(--accent-purple);
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.6));
}

/* 🔒 การ์ดโปรเจกต์ที่ปิดตัวลงแล้ว (Warp.exe) */
.project-card.project-closed { 
    opacity: 0.55; 
    filter: grayscale(40%); 
    border: 1px dashed rgba(255, 74, 74, 0.25); 
    background: linear-gradient(135deg, rgba(15, 22, 38, 0.6) 0%, rgba(255, 74, 74, 0.01) 100%);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
.project-card.project-closed:hover {
    opacity: 1; 
    filter: grayscale(0%); 
    border-color: #ff4a4a; 
    border-style: solid;
    box-shadow: 0 25px 50px rgba(255, 74, 74, 0.15);
}
.project-card.project-closed:hover .card-glow {
    transform: scale(1.5) translate(15px, 15px);
    background: radial-gradient(circle, rgba(255, 74, 74, 0.22) 0%, transparent 70%);
}

/* ==========================================================================
   🔔 แถบกล่องแจ้งเตือนสถานะการขยับลอยดุ๊กดิ๊ก
   ========================================================================== */
.status-notice {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 20px; 
    display: flex;             
    justify-content: center;   
    align-items: center;
    gap: 8px;
    width: 100%;              
    padding: 10px 14px;        
    border-radius: 10px;       
    letter-spacing: 0.5px;
    position: relative;
    z-index: 2;
    transform: translateZ(22px); /* ลอยเหนือชั้นรูปภาพขึ้นมา */

    color: #ff4a4a !important; 
    background: rgba(255, 74, 74, 0.05); 
    border: 1px solid rgba(255, 74, 74, 0.15);
    text-shadow: 0 0 10px rgba(255, 74, 74, 0.4); 
    animation: statusFloatRed 3s ease-in-out infinite;
}

.status-notice.status-active {
    color: #00ffaa !important; 
    background: rgba(0, 255, 170, 0.05); 
    border: 1px solid rgba(0, 255, 170, 0.18);
    text-shadow: 0 0 10px rgba(0, 255, 170, 0.4);
    animation: statusFloatGreen 3s ease-in-out infinite;
}

.project-card:hover .status-notice {
    transform: translateZ(26px) translateY(-2px);
    border-color: rgba(255, 74, 74, 0.4);
}
.project-card:hover .status-notice.status-active {
    transform: translateZ(26px) translateY(-2px);
    border-color: rgba(0, 255, 170, 0.45);
}

@keyframes statusFloatRed {
    0%, 100% { transform: translateY(0); background: rgba(255, 74, 74, 0.05); }
    50% { transform: translateY(-4px); background: rgba(255, 74, 74, 0.12); border-color: rgba(255, 74, 74, 0.35); }
}
@keyframes statusFloatGreen {
    0%, 100% { transform: translateY(0); background: rgba(0, 255, 170, 0.05); }
    50% { transform: translateY(-4px); background: rgba(0, 255, 170, 0.12); border-color: rgba(0, 255, 170, 0.38); }
}

/* ==========================================================================
   6.5 ส่วนเสริมตกแต่งหน้าต่างระบบ (Modal Popup Style)
   ========================================================================== */
.modal {
    display: none; 
    position: fixed; 
    z-index: 200; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: var(--modal-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: linear-gradient(135deg, #0f1626 0%, #060913 100%);
    border: 1px solid var(--border-color);
    max-width: 650px;
    width: 100%;
    border-radius: 20px;
    padding: 35px;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.6), 0 0 30px rgba(0,242,254,0.02);
    animation: modalFadeIn 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text-muted);
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}
.modal-close:hover {
    color: var(--accent-cyan);
    transform: scale(1.1) rotate(90deg);
}

#modalBody h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.modal-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

#modalBody h4 {
    color: var(--accent-cyan);
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 8px;
}

#modalBody p {
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.9;
}   

/* ==========================================================================
   7. Contact & Footer Section (กล่องปุ่มกดไฮเทค)
   ========================================================================== */
.contact-section {
    padding: 60px 8%;
    text-align: center;
}

.contact-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.contact-card-link {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 16px 32px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.contact-card-link i {
    color: var(--accent-cyan);
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.contact-card-link:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
}
.contact-card-link:hover i {
    transform: scale(1.2) rotate(-10deg);
}

.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-cyan));
    color: #060913;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 99;
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    transform: translateY(-6px) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.5);
}

footer {
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
    font-size: 0.9rem;
}

/* ==========================================================================
   8. Animations (เพิ่มความละมุน คมชัด ฟลูอิด)
   ========================================================================== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
    animation: fadeUp 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}