/* ==========================================
   Global Variables & Reset
   ========================================== */
:root {
    --bg-color: #0b1120;
    --surface-color: rgba(30, 41, 59, 0.6);
    --surface-hover: rgba(30, 41, 59, 0.9);
    --header-bg: rgba(11, 17, 32, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary-color: #3b82f6;
    --accent-color: #ef4444;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6, #ef4444);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --spacing-sm: 0.5rem;
    --spacing-md: 0.8rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 3.5rem;
    /* ปรับลดพื้นที่ว่างระหว่างเซกชันลงจาก 5rem */
    --border-radius: 16px;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;
    --header-bg: rgba(248, 250, 252, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #475569;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    position: relative;

    background-image: radial-gradient(var(--border-color) 1.5px, transparent 1.5px);
    background-size: 35px 35px;
    background-attachment: fixed;
}

/* ==========================================
   Background Glow Decorations & Animation
   ========================================== */
.bg-decoration {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.45;
    pointer-events: none;
}

@keyframes float-glow {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 30px) scale(0.9);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.35) 0%, rgba(0, 0, 0, 0) 70%);
    animation: float-glow 15s ease-in-out infinite;
}

.shape-2 {
    top: 40%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    animation: float-glow 18s ease-in-out infinite reverse;
}

.shape-3 {
    bottom: -10%;
    left: 20%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    animation: float-glow 22s ease-in-out infinite 2s;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: var(--spacing-xl) 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    text-align: center;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.6rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.6);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
    backdrop-filter: blur(5px);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ==========================================
   Navigation
   ========================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    /* ปรับลดจาก 75px */
}

.logo {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary-color);
}

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

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    transition: 0.3s;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}

.theme-toggle {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.theme-toggle:hover {
    background: var(--surface-hover);
    transform: rotate(15deg);
}

/* ==========================================
   Hero Section & Image Card (ลดพื้นที่ว่าง)
   ========================================== */
.hero {
    min-height: 72vh;
    /* ปรับลดจาก 100vh ป้องกันกล่องยืดโล่งเกินไป */
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 2.5rem;
    /* ลดลงจาก 4rem เพื่อขยับเนื้อหากระชับเข้าหากัน */
    padding: 95px 0 2.5rem 0;
}

.greeting-badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.hero-content h1 {
    font-size: clamp(2.3rem, 4vw, 3.5rem);
    line-height: 1.15;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-content .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1.8rem;
    /* ลดช่องว่างจาก 2.5rem */
    max-width: 95%;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

@keyframes float {

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

    50% {
        transform: translateY(-10px);
    }
}

.hero-img-wrapper {
    position: relative;
    padding: 4px;
    animation: float 6s ease-in-out infinite;
    max-width: 350px;
    width: 100%;
    justify-self: center;
}

.hero-img-inner {
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(145deg, #1e2538, #0f1322);
    padding: 1.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 2px solid rgba(59, 130, 246, 0.6);
}

body.light-theme .hero-img-inner {
    background: linear-gradient(145deg, #e2e8f0, #cbd5e1);
    border: 2px solid rgba(59, 130, 246, 0.4);
}

/* สไตล์สำหรับป้ายทักษะลอยตัว */
.floating-badge {
    position: absolute;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 10;
    animation: float-badge 4s ease-in-out infinite;
}

body.light-theme .floating-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.1);
}

.badge-1 {
    top: 15%;
    left: -20px;
    animation-delay: 0s;
}

.badge-2 {
    bottom: 25%;
    right: -15px;
    animation-delay: 1.5s;
}

.badge-3 {
    bottom: -10px;
    left: 15%;
    animation-delay: 3s;
}

@keyframes float-badge {

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

    50% {
        transform: translateY(-8px);
    }
}

.hero-img {
    width: 100%;
    height: auto;
    aspect-ratio: 4/5;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================
   Tech Ticker (แถบอักษรเลื่อน)
   ========================================== */
.tech-ticker-wrap {
    width: 100%;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    overflow: hidden;
    display: flex;
    white-space: nowrap;
    backdrop-filter: blur(5px);
}

.tech-ticker {
    display: inline-block;
    animation: ticker 25s linear infinite;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.tech-ticker span {
    margin: 0 1.8rem;
    color: var(--primary-color);
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ==========================================
   About Section (แก้ไขปรับลดขนาดรูปโปรไฟล์ลงอีก + เพิ่มกรอบหนาเรืองแสงชัดเจน)
   ========================================== */
.about-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 3rem;
    align-items: center;
}

/* แก้ไขจุดสำคัญ: บีบขนาดรูปให้เล็กลงเหลือ 220px และทำขอบหนา 4px เรืองแสงสีน้ำเงินชัดเจน */
.about-img-wrapper {
    border-radius: 20px;
    overflow: hidden;
    border: 4px solid var(--primary-color);
    /* เพิ่มความหนาเป็น 4px และใช้สีน้ำเงินหลักเพื่อความชัดเจนเด่นตา */
    position: relative;
    max-width: 220px;
    /* ลดขนาดความกว้างลงอีกให้กะทัดรัดขึ้นตามคำขอ */
    width: 100%;
    justify-self: center;
    /* จัดรูปภาพให้อยู่กึ่งกลางคอลัมน์ฝั่งซ้ายอย่างสวยงาม */
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    /* เพิ่มเงาเรืองแสง (Glow) ช่วยเน้นเส้นขอบให้คมเข้มทะลุมิติ */
}

.about-img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.about-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4/5;
}

.about-info h3 {
    font-size: 1.8rem;
    margin-bottom: 0.8rem;
}

.about-info p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
}

.education-timeline {
    border-left: 2px solid var(--border-color);
    padding-left: 1.25rem;
    margin-bottom: 2rem;
}

.education-timeline h4 {
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
    margin-left: -1.25rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.2rem;
}

.timeline-dot {
    position: absolute;
    left: -1.25rem;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--accent-gradient);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.timeline-date {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.timeline-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.timeline-place {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================
   Skills Section
   ========================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.skill-card {
    background: var(--surface-color);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    transition: var(--transition-smooth);
    text-align: center;
}

.skill-card:hover {
    transform: translateY(-8px);
    background: var(--surface-hover);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
}

.skill-icon-wrapper {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.skill-card h3 {
    margin-bottom: 0.6rem;
    font-size: 1.2rem;
}

.skill-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==========================================
   Projects Section
   ========================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.project-img-wrapper {
    height: 220px;
    overflow: hidden;
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s ease;
}

.project-card:hover .project-img {
    transform: scale(1.06);
}

.project-info {
    padding: 1.5rem;
}

.project-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.project-info p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.tag {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.project-link-text {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.project-link-text:hover {
    text-decoration: underline;
}

/* ==========================================
   Contact Section
   ========================================== */
.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-top: -0.8rem;
    margin-bottom: 1.2rem;
}

.section-subtitle-underline {
    width: 45px;
    height: 4px;
    background: var(--accent-gradient);
    margin: 0 auto 2.5rem;
    border-radius: 2px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 750px;
    margin: 0 auto;
}

.contact-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.2rem 1.5rem;
    text-align: center;
    transition: var(--transition-smooth);
}

.contact-card:hover {
    transform: translateY(-6px);
    background: var(--surface-hover);
}

.icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    transition: 0.4s;
}

.email-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.phone-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.contact-card:hover .icon-circle {
    transform: scale(1.1) rotate(10deg);
}

.contact-card:hover.email-card {
    border-color: #ef4444;
}

.contact-card:hover.phone-card {
    border-color: #3b82f6;
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    text-align: center;
    padding: 2.5rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
}

/* ==========================================
   Responsive & Mobile 
   ========================================== */
.bottom-nav {
    display: none;
}

@media screen and (max-width: 992px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 105px;
    }

    .hero-content {
        order: 2;
    }

    .hero-img-wrapper {
        order: 1;
        max-width: 310px;
        margin: 0 auto 2rem;
    }

    .floating-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .badge-1 {
        left: -10px;
    }

    .badge-2 {
        right: -10px;
    }

    .hero-subtitle {
        margin: 0 auto 2rem;
    }

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

    .about-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    /* ปรับขนาดรูปโปรไฟล์บนหน้าจอแท็บเล็ตและมือถือให้เหมาะสม ไม่ใหญ่เกินไป */
    .about-img-wrapper {
        max-width: 190px;
        margin: 0 auto;
    }

    .education-timeline {
        text-align: left;
        max-width: 500px;
        margin: 2rem auto;
    }
}

@media screen and (max-width: 768px) {
    .nav-list {
        display: none;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: var(--header-bg);
        backdrop-filter: blur(15px);
        border-top: 1px solid var(--border-color);
        z-index: 1000;
        padding: 0 1rem;
    }

    .bottom-nav .nav-link {
        color: var(--text-muted);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.4rem;
        border-radius: 50%;
        transition: 0.3s;
    }

    .bottom-nav .nav-link.active {
        color: var(--primary-color);
        background: rgba(59, 130, 246, 0.1);
    }

    .footer {
        padding-bottom: 80px;
    }
}