/* --- 1. Setup & Variables --- */
:root {
    /* Color Palette */
    --primary-orange: #FF6B35;       
    --primary-hover: #FF8C00;
    
    /* [THEME CHANGE] พื้นหลังเปลี่ยนเป็นสีดำด้าน (Dark Theme) */
    --bg-color: #121212;             
    --grid-line: rgba(255, 255, 255, 0.05); /* เส้นตารางเปลี่ยนเป็นสีขาวจางๆ */
    
    /* [TEXT] ตัวหนังสือหลักของหน้าเว็บเป็นสีขาว */
    --text-main: #EEEEEE;            
    --text-grey-light: #AAAAAA;      

    /* [CARDS] ชุดสีสำหรับการ์ด (ยังคงเป็นสีขาวตามโจทย์) */
    --card-bg: #FFFFFF;
    --text-on-card-dark: #1A1A1A;    
    --text-on-card-grey: #666666;

    --shadow-glow: 0 0 50px rgba(255, 107, 53, 0.15); /* แสงฟุ้งสีส้ม */
    --shadow-card: 0 5px 20px rgba(0,0,0,0.3); /* เงาเข้มขึ้นเพราะพื้นหลังมืด */
}

html { scroll-behavior: smooth; }

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Kanit', sans-serif; }

body { 
    background-color: var(--bg-color);
    color: var(--text-main); /* ตัวหนังสือเว็บเป็นสีขาว */
    overflow-x: hidden;
    
    /* Grid Pattern แบบ Dark Mode */
    background-image: 
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center top;
}

/* --- 2. Floating Cubes Animation (ลูกเล่นสี่เหลี่ยมลอย) --- */
.floating-container {
    position: fixed; width: 100%; height: 100%; top: 0; left: 0; 
    pointer-events: none; z-index: -1; overflow: hidden;
}
.cube {
    position: absolute; background: var(--primary-orange);
    opacity: 0.15; /* เพิ่มความชัดนิดหน่อยบนพื้นมืด */
    border-radius: 8px;
    animation: float 20s infinite linear;
    box-shadow: 0 0 15px var(--primary-orange); /* เพิ่ม Glow ให้ก้อนสี่เหลี่ยม */
}
.cube-1 { width: 60px; height: 60px; top: 15%; left: 10%; animation-duration: 25s; }
.cube-2 { width: 40px; height: 40px; top: 60%; right: 10%; background: #FFF; opacity: 0.05; animation-duration: 18s; animation-delay: -5s;}
.cube-3 { width: 100px; height: 100px; bottom: -20px; left: 20%; opacity: 0.05; animation-duration: 30s; }

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* --- 3. Navbar (Dark Glass) --- */
nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 8%; position: fixed; width: 100%; top: 0;
    
    /* [EDIT] Navbar เป็นสีดำโปร่งแสง */
    background: rgba(18, 18, 18, 0.85); 
    backdrop-filter: blur(12px);
    z-index: 1000; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.logo { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text-main); }
.dot { color: var(--primary-orange); }

.nav-links { list-style: none; display: flex; gap: 40px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text-main); font-weight: 500; font-size: 0.95rem; transition: 0.3s; }
.nav-links a:hover { color: var(--primary-orange); }

.btn-discord {
    background: var(--text-main); /* ปุ่มสีขาว */
    color: var(--bg-color) !important; /* ตัวหนังสือสีดำ */
    padding: 10px 24px;
    border-radius: 50px; font-size: 0.9rem; transition: all 0.3s ease;
    display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.btn-discord:hover { 
    background: var(--primary-orange); 
    color: white !important;
    transform: translateY(-3px); 
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.4);
}

/* --- 4. Hero Section --- */
#home {
    min-height: 90vh; display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 100px 5% 0; position: relative;
    /* แสงฟุ้งสีส้มบนพื้นดำ ดูเหมือนลาวาหรือไฟ */
    background: radial-gradient(circle at center, rgba(255, 107, 53, 0.15) 0%, transparent 60%);
}
.hero-content { max-width: 850px; }
.subtitle { 
    color: var(--primary-orange); font-weight: 700; letter-spacing: 3px; 
    font-size: 0.8rem; margin-bottom: 20px; display: block;
    text-transform: uppercase;
}
h1 { 
    font-size: 4.5rem; line-height: 1.1; margin-bottom: 30px; 
    letter-spacing: -2px; font-weight: 800; 
    color: var(--text-main); /* หัวข้อสีขาว */
}
.description { 
    color: var(--text-grey-light); /* คำอธิบายสีเทาอ่อน */
    font-size: 1.1rem; line-height: 1.7; 
    margin-bottom: 60px; max-width: 600px; margin-left: auto; margin-right: auto; 
}
.scroll-down { 
    color: var(--text-grey-light); 
    font-size: 0.9rem; 
    cursor: pointer;
    text-decoration: none;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    animation: bounce 2s infinite; 
    opacity: 0.7;
    transition: 0.3s;
}
.scroll-down:hover { opacity: 1; color: var(--primary-orange); }

@keyframes bounce { 
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 
    40% {transform: translateY(-10px);} 
    60% {transform: translateY(-5px);} 
}

/* --- 5. Projects Section --- */
#projects { padding: 100px 8%; }
.section-head { text-align: center; margin-bottom: 70px; }
.section-head h2 { font-size: 2.5rem; font-weight: 700; color: var(--text-main); }
.line { width: 50px; height: 5px; background: var(--primary-orange); margin: 15px auto 0; border-radius: 10px; }

/* --- FEATURED CARD (White Card on Dark Bg) --- */
.project-featured {
    display: grid; grid-template-columns: 1.2fr 1fr; 
    
    /* [KEEP WHITE] พื้นหลังการ์ดยังคงเป็นสีขาว */
    background: var(--card-bg); 
    
    border-radius: 24px; overflow: hidden;
    box-shadow: var(--shadow-card); margin-bottom: 80px;
    border: none; /* เอาเส้นขอบออกเพื่อให้ดู Clean บนพื้นดำ */
    transition: transform 0.3s ease;
}
.project-featured:hover { transform: translateY(-5px); }

.featured-img-box { 
    height: 500px; 
    background: #2C3E50; 
    position: relative; 
    overflow: hidden; 
}
.project-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.featured-img-box:hover .project-img { transform: scale(1.05); }

.featured-info { padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.status-badge {
    background: #E8FFF3; color: #00875A; font-weight: 700; font-size: 0.75rem;
    padding: 6px 12px; border-radius: 6px; width: fit-content; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px; letter-spacing: 0.5px;
}
.blink { animation: blinker 1.5s linear infinite; color: #00C853; }
@keyframes blinker { 50% { opacity: 0; } }

/* [TEXT OVERRIDE] เนื่องจากการ์ดเป็นสีขาว ตัวหนังสือข้างในต้องกลับไปเป็นสีดำ */
.project-name { 
    font-size: 3rem; margin: 10px 0 20px; line-height: 1; letter-spacing: -1px; 
    color: var(--text-on-card-dark); 
}
.featured-info h3 { color: var(--text-on-card-dark); }
.featured-info p { color: var(--text-on-card-grey); margin-bottom: 30px; line-height: 1.6; }

.tags span {
    background: #F4F5F7; padding: 6px 14px; border-radius: 50px; font-size: 0.85rem;
    margin-right: 8px; font-weight: 500; color: #555;
}
.btn-view {
    margin-top: 30px; text-decoration: none; color: var(--primary-orange); 
    font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 10px;
    transition: 0.3s;
}
.btn-view:hover { gap: 15px; }

/* --- ARCHIVE GRID (White Cards) --- */
.archive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.project-card { 
    background: var(--card-bg); /* การ์ดสีขาว */
    border-radius: 20px; overflow: hidden;
    box-shadow: var(--shadow-card); transition: 0.4s;
    border: none;
}
.project-card:hover { transform: translateY(-8px); box-shadow: 0 15px 30px rgba(255, 107, 53, 0.2); } /* เงาเรืองแสงตอน Hover */

.card-img-box { height: 220px; background: #FF6B35; overflow: hidden; }
.card-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.project-card:hover .card-img { transform: scale(1.1); }

.card-content { padding: 30px; }
.status-text { font-size: 0.7rem; font-weight: 800; color: #999; background: #eee; padding: 4px 8px; border-radius: 4px; }
.card-content h4 { color: var(--primary-orange); margin-top: 15px; font-size: 0.9rem; }

/* [TEXT OVERRIDE] ตัวหนังสือในการ์ดต้องเป็นสีดำ */
.card-content h3 { font-size: 1.5rem; margin: 5px 0 10px; color: var(--text-on-card-dark); }
.theme-desc { font-size: 0.9rem; color: var(--text-on-card-grey); margin-bottom: 25px; }

.link-text { text-decoration: none; color: var(--text-on-card-dark); font-weight: 600; font-size: 0.9rem; transition: 0.3s;}
.link-text:hover { color: var(--primary-orange); margin-left: 5px; }

/* --- COMING SOON CARD (ปรับให้เข้ากับ Dark Mode) --- */
.coming-soon { 
    background: transparent; /* โปร่งใสเห็นพื้นหลังดำ */
    border: 2px dashed #444; /* เส้นปะสีเทาเข้ม */
    box-shadow: none;
    display: flex; align-items: center; justify-content: center; min-height: 350px;
}
.coming-soon:hover { border-color: var(--primary-orange); transform: none; box-shadow: none; }
.centered { text-align: center; color: #666; }
/* ไอคอนและตัวหนังสือ Coming soon ปรับให้สว่างขึ้นนิดหน่อย */
.icon-box i { font-size: 2.5rem; margin-bottom: 15px; opacity: 0.5; color: #888; }
.coming-soon h3 { color: #AAA; } 
.coming-soon p { color: #666; }

/* --- 6. About & Footer --- */
#about { 
    padding: 100px 8%; display: flex; align-items: center; gap: 80px; 
    background: transparent; /* เอาสีขาวออก ให้กลืนกับพื้นหลังดำ */
}
.about-text { flex: 1; }
/* หัวข้อ About สีขาว */
.about-text h2 { font-size: 2.5rem; margin-bottom: 20px; color: var(--text-main); }
.about-text p { color: var(--text-grey-light); line-height: 1.8; margin-top: 20px; }

.stats-mini { display: flex; gap: 60px; }
.stat-item strong { font-size: 3.5rem; color: var(--primary-orange); line-height: 1; display: block; font-weight: 800; }
.stat-item span { font-size: 0.9rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }

footer { text-align: center; padding: 50px 20px; background: #000; color: #555; font-size: 0.85rem; border-top: 1px solid #222; }

/* --- 7. Mobile Responsive --- */
@media (max-width: 900px) {
    h1 { font-size: 2.8rem; }
    .project-featured { grid-template-columns: 1fr; }
    .featured-img-box { height: 300px; } /* ปรับความสูงรูปมือถือ */
    #about { flex-direction: column; text-align: start; gap: 40px; }
    .nav-links { display: none; } 
    nav { justify-content: center; }
}