/* main.css: Final Version with Contact Image Fix */
@import url(fontawesome-all.min.css);
@import url("https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;600;700&display=swap");

:root {
    --primary-color: #e74c3c;
    --accent-color: #f39c12;
    --bg-dark-main: #1a1a1a;
    --bg-dark-body: #111111;
    --text-light: #ffffff;
    --text-muted: #aaaaaa;
    --nav-height: 70px;
}

/* Reset & Basic */
html { box-sizing: border-box; font-size: 20px; }
body {
    line-height: 1.7;
    font-family: 'Kanit', sans-serif;
    color: var(--text-light);
    background-color: var(--bg-dark-body);
    padding-top: var(--nav-height);
}
a { color: var(--primary-color); text-decoration: none; transition: all 0.2s; }
a:hover { color: var(--text-light); }
h1, h2, h3, h4 {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text-light);
}
h1 { font-size: 44px; }
h2 {
    font-size: 32px;
    border-bottom: none;
    padding-bottom: 0;
    text-transform: uppercase;
}
p { font-size: 19px; }

/* Wrapper and Main Content Layout */
#wrapper {
    max-width: none;
    margin: 0;
    box-shadow: none;
    background-color: var(--bg-dark-main);
    min-height: calc(100vh - var(--nav-height));
}
#main {
    padding: 40px 5%;
    max-width: 1200px;
    margin: 0 auto;
    display: block;
}

/* --- Navigation Bar (slightly inward right alignment) --- */
#nav {
    background-color: var(--bg-dark-body);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: var(--nav-height);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6%; /* เดิม 5% → เพิ่มนิดเดียว เพื่อขยับเข้ามา */
}

#nav h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    flex-shrink: 0;
}

#nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    gap: 20px;
    margin-right: 10%; /* ขยับเมนูจากขอบขวามานิดนึง */
}
#nav li { margin-left: 0; }
#nav a {
    display: block;
    color: var(--text-light);
    padding: 10px 10px;
    text-transform: uppercase;
    font-weight: 600;
    border-radius: 4px;
    font-size: 17px;
    transition: background-color 0.2s, color 0.2s;
}
#nav li.active a {
    background-color: var(--primary-color);
    color: var(--text-light);
}
#nav a:hover:not(.active) {
    background-color: rgba(231, 76, 60, 0.3);
    color: var(--text-light);
}

/* Header Section */
#header {
    background-color: var(--bg-dark-main);
    color: var(--text-light);
    text-align: left;
    height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 0 5%;
    max-width: 1200px;
    margin: 0 auto;
}
.header-grid {
    display: grid;
    grid-template-columns: 40% 60%;
    align-items: center;
    width: 100%;
}
.header-image {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding-top: 100%;
    margin: 0;
}
.header-image img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    max-height: 100vh;
}
.header-content {
    padding-left: 60px;
    z-index: 10;
}
#header h1 { font-size: 60px; margin-bottom: 10px; }
#header p { font-size: 24px; color: var(--text-muted); }
.highlight { color: var(--primary-color); }

/* Resume Section */
.resume-section {
    margin-bottom: 60px;
    background-color: var(--bg-dark-main);
    padding: 40px 0;
}
.resume-section h2 { padding-bottom: 10px; }
.resume-item {
    padding: 16px 0;
    border-bottom: 1px dashed #333333;
}
.resume-item h3 {
    color: var(--primary-color);
    font-size: 22px;
    margin-bottom: 4px;
}
.resume-item p {
    margin: 4px 0;
    font-size: 18px;
    color: var(--text-muted);
}

/* Project Page */
#main[style*="display: flex"] {
    display: flex;
    justify-content: space-between;
}
.project-content {
    flex: 1;
    max-width: 70%;
    padding-right: 60px;
}
.project-sidebar {
    width: 30%;
    padding-left: 20px;
}
.project-post {
    margin-bottom: 60px;
}
.project-post h3 {
    font-size: 30px;
    color: var(--text-light);
    margin-top: 20px;
    margin-bottom: 10px;
}
.project-post img {
    width: 100%;
    height: auto;
    display: block;
    margin: 20px 0 30px 0;
    border-radius: 4px;
}
.project-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.project-sidebar li {
    padding: 10px 0;
    border-bottom: 1px solid #333333;
    font-size: 18px;
}
.project-sidebar a {
    color: var(--text-muted);
}
.project-sidebar a:hover {
    color: var(--primary-color);
}

/* CONTACTS PAGE STYLES (Fixed image overflow) */
.contact-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--nav-height) - 50px);
    background-color: var(--bg-dark-main);
    padding: 60px 5%;
    box-sizing: border-box;
    gap: 40px;
}
.contact-info {
    flex: 1;
    padding: 40px;
    max-width: 50%;
}
.contact-info h2 {
    font-size: 50px;
    line-height: 1.2;
    margin-bottom: 10px;
    color: var(--text-light);
}
.contact-info p {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 20px;
}
.contact-detail {
    margin: 30px 0;
    display: flex;
    align-items: center;
    color: var(--text-light);
}
.contact-detail i {
    color: var(--primary-color);
    font-size: 24px;
    width: 25px;
    flex-shrink: 0;
    margin-right: 15px;
}
.contact-detail p { margin: 0; }

.contact-form-area {
    flex: 1;
    max-width: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.contact-form-area img {
    width: 100%;
    max-width: 450px;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Footer */
#footer {
    background-color: var(--bg-dark-body);
    color: #666666;
    padding: 30px;
    text-align: center;
    font-size: 18px;
    margin-top: 0;
}
#footer a { color: var(--primary-color); }

/* Header Contact Info */
.header-contact-info {
    padding-bottom: 30px;
    margin-bottom: 40px;
    border-bottom: 1px dashed #333333;
}
.header-contact-info p {
    font-size: 18px;
    color: var(--text-muted);
    margin: 4px 0;
}

/* Mobile Adjustments */
@media screen and (max-width: 1366px) {
    .header-grid { grid-template-columns: 1fr; }
    .header-image { padding-top: 60%; }
    .header-content {
        padding: 60px 0 20px;
        text-align: center;
    }
    #header h1 { font-size: 50px; }
    #nav { justify-content: center; }
    #nav h1 { display: none; }

    #main[style*="display: flex"] {
        flex-direction: column;
        padding: 20px;
    }
    .project-content { max-width: 100%; padding-right: 0; }
    .project-sidebar { width: 100%; padding-left: 0; margin-top: 40px; }

    /* Mobile Contacts Layout */
    .contact-container {
        flex-direction: column;
        padding: 40px 20px;
        gap: 20px;
    }
    .contact-info, .contact-form-area {
        max-width: 100%;
        padding: 20px 10px;
        text-align: center;
    }
    .contact-form-area img {
        max-width: 80%;
        height: auto;
    }
}
@media screen and (max-width: 600px) {
    #nav ul { justify-content: space-around; width: 100%; }
    #nav li { margin: 0; }
    #nav a { padding: 8px; font-size: 15px; }
}
