/* =========================================
   Global & Reset Styles
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'Kanit';
    src: url('asset/fonts/Kanit (1)/Kanit-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Kanit';
    src: url('asset/fonts/Kanit (1)/Kanit-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #7a00df;
    --text-dark: #191919;
    --text-muted: #555555;
    --bg-light: #fbf9f5; /* สีครีมอ่อนๆ สไตล์ Minimal คล้ายภาพตัวอย่าง */
    --font-main: 'Kanit', sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-dark);
    
    /* จัด Content ให้อยู่ตรงกลางทั้งแนวนอน (Horizontal) และแนวตั้ง (Vertical) */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

/* =========================================
   Main Content Layout
   ========================================= */
.main-container {
    position: relative;
    z-index: 1; /* วางเหนือ Canvas ด้านหลัง */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 800px;
    width: 100%;
    gap: 32px; /* เว้นระยะห่างระหว่างส่วนรูปภาพและส่วนข้อความ */
    
    /* พื้นหลังสี background บังเอฟเฟกต์ไม่ให้มารกสายตาตรงเนื้อหา */
    background-color: var(--bg-light);
    padding: 48px 36px;
    border-radius: 24px;
    
    /* Transition นุ่มนวลเมื่อโหลดเสร็จ */
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.main-container.content-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   Part 1: Image Styling
   ========================================= */
.image-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.hero-image {
    max-width: 100%;
    height: auto;
    max-height: 100px;
    object-fit: contain;
    border-radius: 12px;
    /* transition สวยงามเมื่อมีการโหลด */
    transition: transform 0.3s ease;
}

.hero-image:hover {
    transform: scale(1.02);
}

/* =========================================
   Part 2: Text Content Styling (Clean & Minimal)
   ========================================= */
.text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.welcome-heading {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

/* เน้นสีหลัก #7a00df ที่ข้อความไฮไลต์ */
.highlight-text {
    color: var(--primary-color);
    position: relative;
    display: inline-block;
}

.welcome-subtext {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-muted);
    max-width: 540px;
    line-height: 1.6;
}

/* Responsive Design สำหรับหน้าจอขนาดเล็ก */
@media (max-width: 600px) {
    .welcome-heading {
        font-size: 1.85rem;
        word-break: break-word;
    }

    .welcome-subtext {
        font-size: 0.95rem;
    }

    .image-wrapper {
        padding: 0 8px;
    }

    .hero-image {
        max-width: 80%;
        max-height: 75px; /* ปรับขนาดความสูงให้พอดีกับหน้าจอมือถือ */
        height: auto;
    }

    .main-container {
        padding: 32px 18px;
        width: 100%;
    }
}

@media (max-width: 380px) {
    .welcome-heading {
        font-size: 1.5rem;
    }

    .hero-image {
        max-width: 85%;
        max-height: 60px;
    }

    .main-container {
        padding: 24px 14px;
    }
}

/* =========================================
   Part 3: Interactive Water Drop Canvas
   ========================================= */
.water-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    display: block;
}

/* =========================================
   Part 4: Progressive Preloader (2 Seconds)
   ========================================= */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-light);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 88%;
    max-width: 380px;
    gap: 20px;
}

.preloader-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preloader-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 0 16px rgba(122, 0, 223, 0.5);
    animation: pulseDot 1.2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% {
        transform: scale(0.85);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
    }
}

.preloader-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.2px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background-color: rgba(122, 0, 223, 0.1);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.progress-bar {
    height: 100%;
    width: 100%;
    transform-origin: left center;
    transform: scaleX(0);
    background: linear-gradient(90deg, #7a00df, #b347ff);
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(122, 0, 223, 0.4);
    animation: fillProgress 2s cubic-bezier(0.2, 0.6, 0.35, 1) forwards;
}

@keyframes fillProgress {
    0% {
        transform: scaleX(0);
    }
    100% {
        transform: scaleX(1);
    }
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.progress-status {
    font-weight: 400;
}

.progress-text {
    font-weight: 700;
    color: var(--primary-color);
    font-variant-numeric: tabular-nums;
}

/* =========================================
   Part 5: Language Switch Toggle (Top-Right)
   ========================================= */
.lang-switch-wrapper {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    animation: fadeIn 1s ease forwards;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    background-color: rgba(251, 249, 245, 0.9); /* สี --bg-light แบบโปร่งแสง */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 3px;
    border-radius: 999px;
    border: 1px solid rgba(122, 0, 223, 0.16);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.lang-switch:hover {
    border-color: rgba(122, 0, 223, 0.35);
    box-shadow: 0 6px 20px rgba(122, 0, 223, 0.1);
}

.lang-btn {
    border: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    outline: none;
    letter-spacing: 0.5px;
}

.lang-btn:hover:not(.active) {
    color: var(--primary-color);
}

.lang-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(122, 0, 223, 0.35);
}

.lang-btn:focus-visible {
    box-shadow: 0 0 0 2px var(--bg-light), 0 0 0 4px var(--primary-color);
}

/* เอฟเฟกต์การสลับข้อความอย่างนุ่มนวล */
.text-wrapper {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.text-wrapper.lang-changing {
    opacity: 0;
    transform: translateY(4px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive สำหรับปุ่มสลับภาษาในมือถือ */
@media (max-width: 600px) {
    .lang-switch-wrapper {
        top: 16px;
        right: 16px;
    }

    .lang-btn {
        padding: 5px 11px;
        font-size: 0.775rem;
    }
}

/* =========================================
   Part 6: Navigation Links Bar (Centered)
   ========================================= */
.nav-links-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
    margin-top: 8px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-links-container.lang-changing {
    opacity: 0;
    transform: translateY(4px);
}

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background-color: #ffffff;
    color: var(--text-dark);
    text-decoration: none;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 10px;
    border: 1.5px solid rgba(122, 0, 223, 0.16);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.nav-link-btn:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-link-btn:active {
    transform: translateY(0);
}

.nav-link-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--bg-light), 0 0 0 4px var(--primary-color);
}

@media (max-width: 600px) {
    .nav-links-container {
        gap: 10px;
    }

    .nav-link-btn {
        padding: 10px 16px;
        font-size: 0.875rem;
        flex: 1 1 calc(50% - 10px);
        max-width: 100%;
        text-align: center;
    }
}

@media (max-width: 380px) {
    .nav-links-container {
        flex-direction: column;
    }

    .nav-link-btn {
        width: 100%;
    }
}