/* iOS-like typography — SF Pro for English, Anuphan for Thai (loopless) */
:root {
    --font-latin:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Text",
        "SF Pro Display",
        "Helvetica Neue",
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    --font-thai:
        "Anuphan",
        "Sukhumvit Set",
        "IBM Plex Sans Thai",
        "Noto Sans Thai",
        sans-serif;
    /* Latin first → English uses system font; Thai glyphs fall through to Anuphan */
    --font-sans:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Text",
        "SF Pro Display",
        "Helvetica Neue",
        "Segoe UI",
        Roboto,
        "Anuphan",
        "Sukhumvit Set",
        "IBM Plex Sans Thai",
        "Noto Sans Thai",
        sans-serif;
    --font-mono:
        "SF Mono",
        ui-monospace,
        "Menlo",
        "Monaco",
        "Courier New",
        monospace;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-optical-sizing: auto;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    font-feature-settings: "kern" 1;
    letter-spacing: -0.011em;
    line-height: 1.47059;
}

button,
input,
textarea,
select {
    font-family: inherit;
}

/* English — SF Pro / system UI style */
:lang(en),
[lang="en"] {
    font-family: var(--font-latin);
    letter-spacing: -0.011em;
    line-height: 1.47059;
}

/* Thai — loopless Anuphan / Sukhumvit style */
:lang(th),
[lang="th"] {
    font-family: var(--font-thai);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.65;
    word-break: break-word;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.022em;
    line-height: 1.2;
}

:lang(th) h1,
:lang(th) h2,
:lang(th) h3,
:lang(th) h4,
:lang(th) h5,
:lang(th) h6,
[lang="th"] h1,
[lang="th"] h2,
[lang="th"] h3,
[lang="th"] h4,
[lang="th"] h5,
[lang="th"] h6 {
    font-family: var(--font-thai);
    letter-spacing: 0;
    line-height: 1.35;
}

:lang(en) h1,
:lang(en) h2,
:lang(en) h3,
:lang(en) h4,
:lang(en) h5,
:lang(en) h6,
[lang="en"] h1,
[lang="en"] h2,
[lang="en"] h3,
[lang="en"] h4,
[lang="en"] h5,
[lang="en"] h6 {
    font-family: var(--font-latin);
    letter-spacing: -0.022em;
    line-height: 1.2;
}

strong, b {
    font-weight: 600;
}
