@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Noto+Sans+Thai:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Roboto:ital,wght@0,100..900;1,100..900&family=Sarabun:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap");
/* ===== GLOBAL STYLES ===== */
:root {
    --h1: clamp(2rem, 2.8vw + 1.2rem, 3.5rem); /* 30px to 44px */
    --h2: clamp(1.6rem, 1.4vw + 1.1rem, 2.4rem); /* 23px to 32px */
    --h3: clamp(1.25rem, 0.9vw + 1rem, 1.6rem); /* 19px to 22px */
    --text-size: clamp(1.05rem, 0.45vw + 0.95rem, 1.22rem); /* 17px to 18px */
    /* Small text */
    --fs-sm: clamp(0.95rem, 0.3vw + 0.9rem, 1.05rem);

    --radius: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
*,
*::before,
*::after {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
    margin: 0;
    color: var(--text);
}
html {
    background: var(--bg);
    font-family: "Inter", sans-serif;
    scroll-behavior: smooth;
    transition: background-color 0.15s ease, color 0.15s ease;
}
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    font-size: var(--text-size);
}
/* responsive images/videos */
img,
picture,
svg,
video {
    display: block;
    max-width: 100%;
    object-fit: contain;
}
ul {
    list-style: none;
    padding: 0;
}
/* ========= LINKS / BUTTONS ========= */
a {
    position: relative;
    display: inline-block;
    /* font-size: calc(var(--text-size) * 1.2); */
    font-size: 1em;
    text-decoration: none;
    text-transform: uppercase;
    padding-inline: 0.45rem;
    color: var(--text);
}
a:hover {
    color: var(--accent);
    font-weight: 700;
}
a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.25rem;
    height: 2px;
    background: var(--accent);
    border-radius: var(--radius);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
    pointer-events: none;
}
/* activate on hover / focus */
a:hover::after,
a:focus::after {
    transform: scaleX(0.8);
}

/* Typo */
h1 {
    font-size: var(--h1);
    line-height: 1.15;
    letter-spacing: 0.175rem;
}
h2 {
    font-size: var(--h2);
    line-height: 1.2;
}
h3 {
    font-size: var(--h3);
    line-height: 1.25;
}
p {
    line-height: 1.5;
}
/* ===== Buttons ===== */
button,
.btn {
    color: var(--text);
    cursor: pointer;
    border: 1px solid var(--grid);
    border-radius: var(--radius);
    background: var(--brand);
    padding: 0.5rem;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
button:hover,
.btn:hover {
    background: var(--card);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent);
}

/* ==== Select, Label and Input ==== */
select,
input,
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--grid);
    background: var(--sheet);
    font-size: var(--text-size);
    color: var(--accent);
}
textarea {
    resize: none;
    min-height: 120px;
}
input::placeholder,
textarea::placeholder {
    color: var(--accent);
}
select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}
label {
    font-size: var(--text-size);
    margin-bottom: 0.25rem;
    display: block;
}

/* layout */
.wrap {
    max-width: 90%;
    margin: 0 auto;
    padding: 0.8rem 0;
}
.site-header .wrap,
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1rem;
    background-color: var(--brand);
}
.site-header {
    background-color: var(--brand);
    padding-inline: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}
/* โลโก้: ไม่ให้โดน baseline/line-height ของ <a> */
.site-header .brand-logo {
    width: 150px;
}
/* ===== LOGO: NO HOVER EFFECT ===== */
a.no-fx::after {
    content: none !important;
}

/* ===== NAVIGATION ===== */
/* ปุ่ม hamburger */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text);
}
/* ===== NAV alignment ===== */
.site-header .nav-links {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center; /* สำคัญ: menu ไม่ลอย */
    gap: 1rem;
}
/* selector ภาษา */
/* #langSelect {
    background: var(--bg);
    color: var(--text);
} */
/* ===== Footer =====  */
.site-footer i {
    font-size: calc(var(--text-size) / 1.4);
}
/* ===== Theme toggle ===== */
.theme-toggle {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
    padding: 0.25rem;
    border: 1px solid var(--grid);
    background: var(--sheet);
    border-radius: 999px;
}
.theme-toggle .tbtn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    line-height: 1;
}

.theme-toggle .tbtn i {
    font-size: 1.1rem;
}

.theme-toggle .tlabel {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: none;
}
/* active */
.theme-toggle .tbtn.is-active {
    background: linear-gradient(
        180deg,
        var(--brand) 0%,
        var(--brand1) 50%,
        var(--brand) 100%
    );
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

/* keyboard focus */
.theme-toggle .tbtn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent);
}

/* ===== Single Theme Toggle (Dark / Light only) ===== */
.theme-toggle {
    display: flex;
    justify-content: flex-end;
}

.tbtn-single {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--grid);
    cursor: pointer;
}

.tbtn-single i {
    font-size: 1.15rem;
}

.tbtn-single .tlabel {
    font-size: 0.9rem;
    font-weight: 800;
}

.tbtn-single:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent);
}

/* ===== Modal / Toast ===== */
.msg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.msg-content {
    background: var(--card);
    padding: 25px 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 80%;
    max-width: 380px;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #2d2d2d;
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 1.5rem;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.35s ease;
    z-index: 9999;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==============================
    MEDIA QUERIES (Global)
    - keep at bottom of global.css
============================== */

/* 1) Accessibility: ลด motion */
@media (prefers-reduced-motion: reduce) {
    a::after,
    a:hover::after,
    a:focus::after {
        transition: none;
        transform: none;
    }
}

/* 2) UI compact: มือถือจอแคบมาก */
@media (max-width: 420px) {
    .tbtn-single .tlabel {
        display: none;
    }
}

/* 3) Navigation: mobile menu */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: -50%;
        width: 50%;
        height: 100dvh;
        margin-block: 0;
        background: var(--brand);

        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;

        transition: left 0.3s ease;
        z-index: 9;
    }

    .nav-links.show {
        left: 0;
    }
}

/* 4) iOS only: ขยาย rem ทั้งเว็บ (แก้ iPhone 16 Pro ดูเล็ก) */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 400px) {
        html {
            font-size: 112.5%;
        } /* 16px -> 18px */
    }
}

/* 5) (Optional) Mobile landscape: สูงน้อย ให้ UI ไม่อึดอัด */
@media (orientation: landscape) and (max-height: 420px) {
    .nav-links {
        gap: 1.25rem;
    }
}

/* =====================
    DESKTOP TYPO SCALE
===================== */

/* Desktop ปกติ */
@media (min-width: 1280px) {
    h1 {
        font-size: 150%;
    }
}
