/* --- Root & Layout --- */
:root { --bg-outer: #0a0a0c; --bg-main: #16161e; --bg-card: #1f1f2b; --border: #2d2d3d; --pastel-green: #00ffb7; --pastel-blue: #89cff0; --text-white: #ffffff; --text-dim: #9494a3; --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1); --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg-outer); font-family: 'Inter', sans-serif; height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--text-white); overflow: hidden; }
.master-container { position: relative; display: flex; width: 90vw; height: 90vh; padding: 25px; gap: 20px; background-color: var(--bg-main); border-radius: 50px; border: 1px solid var(--border); }
.sidebar-wrapper { display: flex; flex-direction: column; width: 280px; gap: 15px; }
.main-display { position: relative; flex: 1; padding: 40px; background: var(--bg-card); border-radius: 45px; border: 1px solid var(--border); overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, 0) transparent; }
.main-display::-webkit-scrollbar { width: 10px; height: 10px; }
.main-display::-webkit-scrollbar-track { background: transparent; margin: 15px; }
.main-display::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0); border-radius: 20px; background-clip: padding-box; transition: all var(--transition-base); }
.pixel-font { font-family: 'Silkscreen', sans-serif !important; image-rendering: pixelated; -webkit-font-smoothing: none; letter-spacing: 0.5px; }
.page { display: none; animation: fadeIn 0.4s forwards; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Profile Card --- */
.profile-card { padding: 20px; background: var(--bg-card); border-radius: 35px; border: 1px solid var(--border); }
.avatar { width: 60px; height: 60px; margin: 0 auto 15px; background: url("https://i.postimg.cc/Pq8yPxsT/logo.png") center/cover; border-radius: 50%; border: 2px solid var(--pastel-purple); }
.name-title h2 { font-size: 16px; font-weight: 400; }
.name-title p { font-size: 11px; color: var(--pastel-blue); margin-top: 6px; }
.profile-info-group { display: flex; flex-direction: column; gap: 15px; padding: 25px; align-items: flex-start; } 
.name-wrapper { display: flex; align-items: center; gap: 15px; width: 100%; } 
.title-divider { width: 100%; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; }

.glitch{position:relative;display:inline-block}
.glitch::before,
.glitch::after{content:attr(data-text);position:absolute;top:0;left:0;width:100%;height:100%;background:var(--bg-card);clip:rect(0,0,0,0)}
.glitch::before{left:2px;text-shadow:-2px 0 #ff00c1;animation:glitch-anim 2s infinite linear alternate-reverse}
.glitch::after{left:-2px;text-shadow:2px 0 #00fff9;animation:glitch-anim2 3s infinite linear alternate-reverse}
@keyframes glitch-anim{0%{clip:rect(10px,9999px,20px,0)}20%{clip:rect(45px,9999px,50px,0)}40%{clip:rect(10px,9999px,15px,0)}60%{clip:rect(80px,9999px,90px,0)}80%{clip:rect(30px,9999px,40px,0)}100%{clip:rect(10px,9999px,20px,0)}}
@keyframes glitch-anim2{0%{clip:rect(60px,9999px,70px,0)}20%{clip:rect(15px,9999px,25px,0)}40%{clip:rect(50px,9999px,60px,0)}60%{clip:rect(5px,9999px,15px,0)}80%{clip:rect(85px,9999px,95px,0)}100%{clip:rect(60px,9999px,70px,0)}}

/* --- Nav Card --- */
.nav-card { display: flex; flex-direction: column; flex: 1; padding: 20px 15px; gap: 6px; background: var(--bg-card); border-radius: 40px; border: 1px solid var(--border); }
.nav-item { position: relative; display: flex; align-items: center; padding: 12px 18px; gap: 12px; color: var(--text-dim); text-decoration: none; border-radius: 20px; cursor: pointer; transition: all var(--transition-base); overflow: hidden; font-size: 13px; }
.nav-item:hover { background: rgba(180, 169, 255, 0.08); color: var(--pastel-green); transform: translateX(8px); }
.nav-item.active { background: rgba(180, 169, 255, 0.15); color: var(--pastel-green); font-weight: 400; }
.nav-item::before { content: ""; position: absolute; left: 0; width: 3px; height: 0; background: var(--pastel-green); border-radius: 0 5px 5px 0; transition: 0.3s; }
.nav-item:hover::before, .nav-item.active::before { height: 60%; }

/* --- Footer Card --- */
.footer-card { padding: 20px; background: var(--bg-card); border-radius: 30px; border: 1px solid var(--border); text-align: center; font-size: 11px; color: var(--text-dim); line-height: 1.8; }

/* Resume, Portfolio, etc. --- */
.portfolio-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 35px; }
.portfolio-header h1 { font-family: 'Silkscreen'; font-size: 35px; font-weight: 200; letter-spacing: -1px; }
.resume-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.block-title h2 { font-size: 25px; color: var(--pastel-green); margin-bottom: 25px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

/* ========== Resume ========== */
.experience-timeline { border-left: 2px solid var(--border); margin-left: 10px; padding-left: 25px; position: relative; }
.res-item-wrapper { transition: all var(--transition-base); padding: 20px; margin-left: -20px; margin-right: -10px; border-radius: 16px; border: 1px solid transparent; position: relative; }
.timeline-dot { width: 12px; height: 12px; background: var(--pastel-green); border-radius: 50%; position: absolute; left: -13px; top: 27px; box-shadow: 0 0 10px var(--pastel-green); z-index: 1; }
.res-date { font-size: 14px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; padding-top: 6px; }
.company-name { color: var(--pastel-green); margin: 0 0 15px 0; font-size: 1.2rem; }
.res-role { color: var(--pastel-blue); font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.res-desc p { margin-bottom: 8px; line-height: 1.4; color: var(--text-dim); }
.res-item { display: grid; grid-template-columns: 150px 1fr; gap: 25px; margin-bottom: 45px; }
.res-info h4 { font-size: 22px; color: #fff; margin-bottom: 6px; }

/* ========== Portfolio ========== */
.filter-btn { position: relative; padding: 8px 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 14px; color: var(--text-dim); font-size: 12px; font-family: 'Silkscreen', sans-serif; font-weight: 400; cursor: pointer; overflow: hidden; transition: all var(--transition-bounce); }
.filter-btn.active { background: var(--pastel-green); color: var(--bg-outer); border-color: var(--pastel-green); font-weight: 400; box-shadow: 0 8px 20px rgba(169, 255, 212, 0.499), 0 0 15px rgba(180, 169, 255, 0.2); }
.filter-buttons { display: flex; gap: 10px; }
.filter-btn:hover { transform: translateY(-2px); border-color: var(--pastel-green); color: var(--text-white); background: rgba(0, 255, 183, 0.1); }
.portfolio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.project-card { background: rgba(255,255,255,0.02); border-radius: 24px; border: 1px solid var(--border); overflow: hidden; transition: all var(--transition-bounce); cursor: pointer; display: flex; flex-direction: column; }
.project-card:hover { transform: translateY(-8px); border-color: var(--pastel-blue); box-shadow: 0 15px 35px rgba(0,0,0,0.4); }
.project-img-wrapper { width: 100%; aspect-ratio: 1/1; overflow: hidden; background: #16161e; }
.project-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.project-card:hover .project-img-wrapper img { transform: scale(1.1); }
.project-info { padding: 20px; text-align: center; flex-grow: 1; display: flex; align-items: center; justify-content: center; }
.project-info h4 { font-size: 17px; font-weight: 500; }

/* ========== Project ========== */
.experience-timeline {transition: all 0.3s ease;}
.experience-timeline:hover .res-item-wrapper {opacity: 0.5; filter: blur(0.5px);}
.res-item-wrapper {transition: all var(--transition-base); padding: 20px; margin-left: -20px; margin-right: -10px; border-radius: 16px; border: 1px solid transparent;}
.res-item-wrapper:hover {opacity: 1 !important; filter: blur(0px) !important; background: rgba(255, 255, 255, 0.03); border-color: rgba(0, 255, 183, 0.1); transform: translateY(-2px);}
.res-item-wrapper:hover .company-name {color: var(--text-white); transition: color 0.3s ease;}
.res-item-wrapper:hover .timeline-dot {box-shadow: 0 0 15px var(--pastel-green); transform: scale(1.2);}

/* ========== Skills ========== */
.skills-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 35px; }
.skills-list li { background: rgba(0, 0, 0, 0.157); border: 1px solid var(--pastel-green); padding: 5px 12px; border-radius: 20px; font-size: 13px; color: var(--text-white); transition: var(--transition-base); }
.skills-list li:hover {background: rgba(0, 255, 183, 0.2); transform: translateY(-2px); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.tag-item { background: rgba(0, 255, 183, 0.1); color: var(--pastel-green); padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 500; transition: var(--transition-base); }
.tag-item:hover { background: rgba(0, 255, 183, 0.2); transform: translateY(-2px); }

/* ========== CV ========== */
.cv-preview-container { width: 100%; max-width: 500px; }
.cv-iframe { border: none; overflow: hidden; border-radius: 20px; background: var(--bg-main); display: block; height: 650px !important; width: 100%; }
.btn-download-cv { display: inline-flex; width: auto; background: var(--pastel-green); color: var(--bg-outer) !important; padding: 15px 30px; border-radius: 15px; text-decoration: none; font-weight: 500; gap: 10px; margin-bottom: 30px; transition: all var(--transition-bounce); border: 1px solid transparent; }
.btn-download-cv:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0, 255, 183, 0.2); filter: brightness(1.1); color: var(--bg-outer) !important; }

/* ========== About Me ========== */
.badge-base { transform: scale(1.5); transform-origin: top left;}
.linkedin-badge-container { overflow: hidden; height: 400px; display: flex; justify-content: left;}
.contact-info-list { list-style: none; }
.contact-item { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; color: var(--text-dim); }
.contact-item i { color: var(--pastel-green); }
.contact-item h5 { font-size: 15px; font-weight: 400; color: var(--text-white); }

.project-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: rgba(0,0,0,0.95); 
    z-index: 1000; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity;
}

/* เพิ่มคลาสนี้สำหรับตอนสั่งเปิด */
.project-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-content { position: relative; width: 90%; height: 90%; background: var(--bg-main); border-radius: 40px; border: 1px solid var(--border); overflow: hidden; }
.close-modal { position: absolute; top: 25px; right: 25px; z-index: 1010; width: 45px; height: 45px; background: var(--bg-card); border-radius: 50%; border: 1px solid var(--border); color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
.close-modal:hover { background: #ff5f56; border-color: #ff5f56; }
iframe { width: 100%; height: 100%; border: none; }



/* ========== Certified ========== */
.cert-container { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); 
    gap: 30px; 
}
.cert-card { 
    background-color: rgba(255,255,255,0.02); 
    border-radius: 25px; 
    padding: 30px; 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    border: 1px solid var(--border);
    transition: all var(--transition-bounce); 
    
    /* เพิ่มคำสั่งนี้เข้าไปครับ เพื่อบังคับให้การ์ดสูงเท่ากับเนื้อหาข้างในพอดี */
    height: max-content; 
}
.cert-card:hover { 
    transform: translateY(-8px); 
    border-color: var(--pastel-green); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.4); 
}
.cert-card h3 { 
    text-align: center; 
    font-size: 20px; 
    font-weight: 500; 
    margin: 0; 
    color: var(--text-white); 
    letter-spacing: 0.5px; 
}
.cert-card:hover h3 {
    color: var(--pastel-green);
    transition: color 0.3s ease;
}

.cert-media-container { 
    width: 50%; 
    aspect-ratio: 1.4; 
    background-color: #16161e; 
    border-radius: 15px; 
    overflow: hidden; 
    position: relative; 
    margin: 0 auto; 
}

.cert-media-container iframe { 
    position: absolute; 
    top: -55px; 
    left: 0;
    width: 100%; 
    height: calc(100% + 55px); 
    border: none; 
}
.btn-view { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: transparent; 
    color: var(--text-white); 
    border: 1px solid var(--pastel-green); 
    padding: 12px; 
    border-radius: 12px; 
    text-decoration: none; 
    font-size: 13px; 
    transition: all 0.3s ease; 
    
    /* เปลี่ยนจาก margin-top: auto; เป็นการกำหนดระยะห่างตายตัวครับ */
    margin-top: 10px; 
}
.btn-view:hover { 
    background: var(--pastel-green); 
    color: var(--bg-outer); 
    box-shadow: 0 0 15px rgba(0, 255, 183, 0.4); 
}