/* Self-hosted fonts (SIL OFL 1.1): IBM Plex Sans Thai, JetBrains Mono — see /assets/fonts/OFL-*.txt */
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-400-thai.woff2) format('woff2');unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-400-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-500-thai.woff2) format('woff2');unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-500-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-600-thai.woff2) format('woff2');unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:600;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-600-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-700-thai.woff2) format('woff2');unicode-range:U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC}
@font-face{font-family:'IBM Plex Sans Thai';font-style:normal;font-weight:700;font-display:swap;src:url(../fonts/ibm-plex-sans-thai-700-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url(../fonts/jetbrains-mono-500-latin.woff2) format('woff2');unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD}

/* ==========================================================================
   withnat.com — site styles (mobile-first, no build step)
   ========================================================================== */

/* ---------- Tokens ---------- */
:root,
[data-theme="dark"] {
    --bg: #0b1220;
    --bg-alt: #0f1829;
    --surface: #131b2b;
    --surface-2: #1a2436;
    --border: #253149;
    --border-strong: #34425f;
    --text: #e8edf4;
    --text-muted: #a1adc2;
    --text-faint: #7d8aa3;
    --accent: #f2b45a;
    --accent-strong: #ffcf86;
    --accent-soft: rgba(242, 180, 90, 0.12);
    --accent-ink: #1b1207;
    --rose: #ff8aa0;
    --mint: #4fe0a0;
    --mint-soft: rgba(79, 224, 160, 0.12);
    --retro: #b9a4ff;
    --retro-soft: rgba(185, 164, 255, 0.14);
    --draft: #ffb86b;
    --header-bg: rgba(11, 18, 32, 0.82);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    --cover-fade: rgba(11, 18, 32, 0.7);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f6f5f2;
    --bg-alt: #eeece7;
    --surface: #ffffff;
    --surface-2: #f3f1ec;
    --border: #e1ddd4;
    --border-strong: #cbc5b9;
    --text: #131a29;
    --text-muted: #4f596b;
    --text-faint: #6b7487;
    --accent: #9c5800;
    --accent-strong: #7d4600;
    --accent-soft: rgba(176, 104, 10, 0.1);
    --accent-ink: #ffffff;
    --rose: #c42c4c;
    --mint: #0d7f48;
    --mint-soft: rgba(13, 127, 72, 0.1);
    --retro: #5b3fc4;
    --retro-soft: rgba(91, 63, 196, 0.09);
    --draft: #a35200;
    --header-bg: rgba(246, 245, 242, 0.86);
    --shadow: 0 1px 2px rgba(19, 26, 41, 0.06), 0 12px 32px -18px rgba(19, 26, 41, 0.25);
    --cover-fade: rgba(246, 245, 242, 0.35);
    color-scheme: light;
}

:root {
    --font: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", Tahoma, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --radius: 16px;
    --radius-sm: 10px;
    --container: 1200px;
    --narrow: 760px;
    --gutter: clamp(16px, 4.5vw, 32px);
    --header-h: 64px;
    --section: clamp(52px, 7vw, 88px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
@media (min-width: 720px) { body { font-size: 1.0625rem; } }
img, picture, video, svg, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--accent); color: var(--accent-ink); border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- Buttons & chips ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
    min-height: 46px; padding: 0.65em 1.25em;
    border-radius: 999px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.btn--secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { border-color: var(--accent); color: var(--text); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--small { min-height: 38px; padding: 0.4em 0.95em; font-size: 0.875rem; }
.btn--block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
    border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--text);
    cursor: pointer; padding: 0; text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--accent); }
.icon-btn--outline { border-color: var(--border-strong); }
.icon-btn--outline:hover { border-color: var(--accent); }
.icon-btn .icon { width: 20px; height: 20px; }

.chip {
    display: inline-flex; align-items: center; gap: 0.35em;
    padding: 0.15em 0.65em; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; line-height: 1.6; letter-spacing: 0.01em;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
    text-decoration: none; white-space: nowrap;
}
.chip--cat { color: var(--accent); border-color: transparent; background: var(--accent-soft); position: relative; z-index: 2; }
.chip--cat:hover { color: var(--accent-strong); }
.chip--draft { color: var(--draft); background: transparent; border-color: currentColor; }
.chip--muted { color: var(--text-faint); }

.tag-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list li {
    font-size: 0.8125rem; line-height: 1.4; padding: 0.35em 0.75em; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.tag-list--soft li { background: var(--bg); color: var(--text); }

.status-badge {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.45em;
    margin: 0 0 1rem; padding: 0.35em 0.9em 0.35em 0.75em;
    border-radius: 999px; background: var(--mint-soft); color: var(--mint);
    font-size: 0.875rem; line-height: 1.4; border: 1px solid color-mix(in srgb, var(--mint) 35%, transparent);
}
.status-badge strong { font-weight: 700; }
.status-badge__sep { opacity: 0.6; }
.status-badge__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 var(--mint); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mint) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

.eyebrow { margin: 0 0 0.6rem; font-family: var(--mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.link-arrow { display: inline-flex; align-items: center; gap: 0.4em; font-weight: 600; text-decoration: none; }
.link-arrow .icon { transition: transform .15s ease; }
.link-arrow:hover .icon { transform: translateX(3px); }

.notice { padding: 14px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); }
.notice--draft { border-color: var(--draft); color: var(--text); background: color-mix(in srgb, var(--draft) 8%, var(--surface)); }
.notice ul { padding-left: 1.2em; }

/* ---------- Preview bar ---------- */
.preview-bar { background: var(--draft); color: #1b1207; font-size: 0.875rem; }
.preview-bar__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding-block: 8px; }
.preview-bar a { color: inherit; font-weight: 700; }
.preview-bar__links { display: flex; gap: 16px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; }
.brand:hover { color: var(--text); }
.brand__mark {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #f2b45a, #e8875a); color: #1b1207;
    font-family: var(--mono); font-size: 0.82rem; font-weight: 500; letter-spacing: -0.02em;
}
.brand__name { font-size: 1.05rem; }
.site-header__actions { display: flex; align-items: center; gap: 4px; }
.site-nav ul { list-style: none; display: flex; align-items: center; gap: 2px; }
.site-nav a:not(.btn) {
    display: block; padding: 8px 12px; border-radius: 8px;
    color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 0.95rem;
}
.site-nav a:not(.btn):hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 0 0; }
.site-nav__resume { display: none; }

.theme-toggle__light { display: none; }
[data-theme="light"] .theme-toggle__light { display: inline; }
[data-theme="light"] .theme-toggle__dark { display: none; }
.nav-toggle { display: none; }
.nav-toggle__close { display: none; }

@media (max-width: 879.98px) {
    .header-resume { display: none; }
    /* Without JS the nav is a scrollable row; with JS it becomes a menu panel. */
    .site-header__inner { flex-wrap: wrap; }
    .site-nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
    .site-nav ul { padding-bottom: 8px; }
    .js .nav-toggle { display: inline-grid; }
    .js .site-nav {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
        padding: 8px var(--gutter) 20px; max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    }
    .js .site-nav.is-open { display: block; }
    .js .site-nav ul { flex-direction: column; align-items: stretch; gap: 2px; padding: 0; }
    .js .site-nav a:not(.btn) { padding: 14px 12px; font-size: 1.05rem; border-radius: 10px; }
    .js .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); border-radius: 0 10px 10px 0; background: var(--surface); }
    .js .site-nav__resume { display: block; padding-top: 12px; }
    .js .site-nav__resume .btn { width: 100%; min-height: 48px; }
    .nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
    .nav-toggle[aria-expanded="true"] .nav-toggle__close { display: inline; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section); }
.section--tight { padding-block: clamp(32px, 5vw, 56px); }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: clamp(24px, 4vw, 40px); }
.section-title { font-size: clamp(1.6rem, 3.2vw, 2.25rem); margin: 0; }
.section-title--small { font-size: clamp(1.25rem, 2.2vw, 1.5rem); margin-bottom: 1rem; }
.section-foot { margin: 28px 0 0; }
.prose-lead { font-size: 1.125rem; color: var(--text-muted); max-width: 60ch; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(12px, 2.5vw, 24px); }
.hero__cover { position: relative; border-radius: var(--radius); overflow: hidden; background: #3a2a18; }
.hero__cover img { width: 100%; height: clamp(168px, 30vw, 380px); object-fit: cover; object-position: 72% 50%; }
.hero__cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, var(--cover-fade)); pointer-events: none; }
.hero__profile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding-inline: clamp(4px, 2.5vw, 32px); margin-top: -56px; }
.hero__avatar img {
    width: 112px; height: 112px; border-radius: 50%; object-fit: cover;
    border: 4px solid var(--bg); box-shadow: 0 0 0 2px var(--accent), var(--shadow); background: var(--surface);
}
.hero__intro { min-width: 0; }
.hero__name { font-size: clamp(2.4rem, 6.5vw, 4rem); letter-spacing: -0.03em; margin: 0 0 0.35rem; line-height: 1.05; }
.hero__headline { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 0.75rem; font-size: 0.9rem; font-weight: 500; color: var(--text); }
.hero__role { padding: 0.25em 0.75em; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
@media (min-width: 720px) {
    .hero__headline { gap: 4px 0; font-size: clamp(1rem, 1.6vw, 1.2rem); }
    .hero__role { padding: 0; border: 0; background: none; border-radius: 0; }
    .hero__role:not(:last-child)::after { content: "|"; margin-inline: 0.55em; color: var(--accent); opacity: 0.8; }
}
.hero__tagline { margin: 0; color: var(--rose); font-weight: 500; font-size: 1.05rem; }
.hero__body { padding-inline: clamp(4px, 2.5vw, 32px); margin-top: clamp(20px, 3vw, 32px); display: grid; gap: 20px; }
.hero__lede { font-size: clamp(1.05rem, 1.7vw, 1.2rem); color: var(--text-muted); max-width: 68ch; margin: 0; }
.hero__facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--text-muted); font-size: 0.95rem; }
.hero__facts li { display: inline-flex; align-items: center; gap: 8px; }
.hero__facts .icon { color: var(--accent); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

@media (min-width: 720px) {
    .hero__profile { flex-direction: row; align-items: flex-start; gap: 28px; margin-top: -76px; }
    .hero__avatar img { width: 152px; height: 152px; }
    .hero__intro { padding-top: 92px; }
}

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.stat { padding: 18px 18px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.stat dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.stat dd { margin: 0; line-height: 1.35; }
.stat__value { display: block; font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
.stat__unit { color: var(--text-muted); font-size: 0.9rem; }
@media (min-width: 960px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } .stat { padding: 22px; } }

/* ---------- Split / career path ---------- */
.split { display: grid; gap: 40px; }
@media (min-width: 960px) { .split { grid-template-columns: 1fr 1.1fr; gap: 64px; align-items: start; } }
.career-path { list-style: none; position: relative; display: grid; gap: 12px; }
.career-path__step { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.career-path__step h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.career-path__step p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.career-path__num { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-weight: 500; }
.career-path__step:not(:last-child)::after { content: ""; position: absolute; left: 41px; bottom: -13px; width: 2px; height: 14px; background: var(--border-strong); }

/* ---------- Expertise / principles ---------- */
.expertise-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .expertise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
.expertise { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.expertise__title { font-size: 1.05rem; margin-bottom: 14px; }
.principles { display: grid; gap: 16px; }
@media (min-width: 640px) { .principles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .principles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; } }
.principle { padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface), transparent); }
.principle__num { display: block; font-family: var(--mono); color: var(--accent); font-size: 0.85rem; margin-bottom: 14px; }
.principle h3 { font-size: 1.08rem; }
.principle p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Cards ---------- */
.card-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .card-grid--2, .card-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1080px) { .card-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.project-card, .post-card {
    position: relative; display: flex; flex-direction: column; min-width: 0;
    border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.project-card__body { padding: clamp(20px, 3vw, 28px); display: flex; flex-direction: column; gap: 4px; flex: 1; }
.project-card__client { margin: 0; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.project-card__title { font-size: 1.25rem; margin: 2px 0 0; }
.project-card__sector { margin: 0 0 10px; color: var(--text-faint); font-size: 0.9rem; }
.project-card__summary { color: var(--text-muted); margin-bottom: 14px; }
.project-card__highlights { margin: 0 0 16px; padding-left: 1.1em; color: var(--text-muted); font-size: 0.95rem; display: grid; gap: 4px; }
.project-card .tag-list { margin-top: auto; }
.project-card--media { overflow: hidden; }
.project-card__media { margin: 0; position: relative; }
.project-card__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.project-card__media figcaption { position: absolute; left: 12px; bottom: 10px; right: 12px; font-size: 0.75rem; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.project-card--note { background: transparent; border-style: dashed; }
.project-card:hover { border-color: var(--border-strong); }

.post-card { padding: clamp(20px, 3vw, 26px); gap: 10px; }
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.post-card__top { display: flex; flex-wrap: wrap; gap: 6px; }
.post-card__title { font-size: 1.15rem; margin: 2px 0 0; line-height: 1.4; overflow-wrap: anywhere; }
.post-card__title a { color: var(--text); text-decoration: none; }
.post-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-card__title a:focus-visible { outline: none; }
.post-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-card__excerpt { margin: 0; color: var(--text-muted); font-size: 0.95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.post-card__meta, .article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: auto; padding-top: 6px; color: var(--text-faint); font-size: 0.82rem; }
.post-card--featured { background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.post-card--featured .post-card__title { font-size: 1.25rem; }
.post-card.is-draft { border-style: dashed; }
.meta-date, .meta-read { display: inline-flex; align-items: center; gap: 6px; }
.meta-lang { font-family: var(--mono); font-size: 0.7rem; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 4px; }

/* ---------- CTA panel ---------- */
.cta-panel {
    position: relative; overflow: hidden; display: grid; gap: 32px;
    padding: clamp(24px, 5vw, 56px); border-radius: calc(var(--radius) + 8px);
    background:
        radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 55%),
        linear-gradient(160deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
}
.cta-panel__text p { color: var(--text-muted); max-width: 56ch; }
.cta-panel .section-title { margin-bottom: 12px; }
.cta-panel__contact { align-self: center; }
@media (min-width: 960px) { .cta-panel { grid-template-columns: 1.3fr 1fr; gap: 56px; } }
.cta-panel--slim { align-items: center; }
.cta-panel--slim .cta-panel__text p { margin: 0; }
@media (min-width: 960px) { .cta-panel--slim { grid-template-columns: 1fr auto; } }

/* ---------- Contact list ---------- */
.contact-list { list-style: none; display: grid; gap: 10px; }
.contact-list li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); min-width: 0; }
.contact-list__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.contact-list__body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.contact-list__label { font-size: 0.75rem; color: var(--text-faint); font-family: var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.contact-list a { color: var(--text); font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.contact-list a:hover { color: var(--accent); }
.contact-list--compact { gap: 6px; }
.contact-list--compact li { padding: 0; background: none; border: 0; gap: 10px; }
.contact-list--compact .contact-list__icon { width: 30px; height: 30px; border-radius: 8px; }
.contact-list--compact .contact-list__icon .icon { width: 16px; height: 16px; }
.contact-list--compact a { font-weight: 400; color: var(--text-muted); font-size: 0.95rem; }
.copy-btn { width: 38px; height: 38px; color: var(--text-muted); }
.copy-btn.is-done { color: var(--mint); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(16px, 3vw, 32px); }
.page-hero--compact { padding-bottom: 8px; }
.page-hero__inner > * { max-width: 860px; }
.page-hero__inner--profile > * { max-width: none; }
.page-hero__inner--profile { display: grid; gap: 24px; align-items: center; }
.page-hero__avatar img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--accent); }
@media (min-width: 720px) {
    .page-hero__inner--profile { grid-template-columns: 180px minmax(0, 760px); gap: 40px; }
    .page-hero__avatar img { width: 180px; height: 180px; }
}
.page-title { font-size: clamp(2.1rem, 5.5vw, 3.4rem); letter-spacing: -0.025em; line-height: 1.1; margin-bottom: 0.4em; }
.page-lede { font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: var(--text-muted); max-width: 64ch; }

/* ---------- About / contact layouts ---------- */
.prose-layout { display: grid; gap: 40px; }
@media (min-width: 1000px) { .prose-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 64px; align-items: start; } .aside-card { position: sticky; top: calc(var(--header-h) + 24px); } }
.aside-card, .contact-card { padding: clamp(20px, 3vw, 28px); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.aside-card__title { font-size: 1.1rem; }
.aside-card__actions { display: grid; gap: 10px; margin-top: 20px; }
.facts { margin: 0 0 8px; display: grid; gap: 12px; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.facts dd { margin: 0; }
.contact-layout { display: grid; gap: 20px; }
@media (min-width: 900px) { .contact-layout { grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: start; } }
.contact-card--status .btn { margin-top: 16px; }

/* ---------- Prose / article ---------- */
.prose { max-width: 70ch; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: clamp(1.35rem, 2.4vw, 1.6rem); margin-top: 2.2em; }
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li + li { margin-top: 0.35em; }
.prose blockquote { margin: 1.5em 0; padding: 0.4em 1.2em; border-left: 3px solid var(--accent); color: var(--text-muted); background: var(--surface); border-radius: 0 10px 10px 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5em 0; }
.prose :not(pre) > code { padding: 0.12em 0.4em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 0.85em; }
.prose pre { padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); overflow-x: auto; line-height: 1.55; }
.prose img { border-radius: 12px; margin: 1.5em auto; }
.prose img.alignleft, .prose img.alignright, .prose img.alignnone { margin-inline: 0; }
.prose iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; margin: 1.5em 0; background: var(--surface); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 1.5em 0; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.prose a { overflow-wrap: anywhere; }
.prose--article { font-size: 1.0625rem; line-height: 1.85; }
.prose--article:lang(th) { line-height: 1.9; }
@media (min-width: 720px) { .prose--article { font-size: 1.125rem; } }

.article__header { padding-top: clamp(28px, 5vw, 64px); padding-bottom: 12px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.875rem; color: var(--text-faint); margin-bottom: 20px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: 0.6; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.article__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.article__title { font-size: clamp(1.75rem, 4.6vw, 2.75rem); line-height: 1.3; letter-spacing: -0.02em; margin-bottom: 18px; overflow-wrap: anywhere; }
.article__title:lang(th) { line-height: 1.4; letter-spacing: 0; }
.article__meta { font-size: 0.9rem; padding: 0; margin-bottom: 18px; }
.article__origin { display: flex; gap: 10px; align-items: flex-start; margin: 32px 0 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.875rem; }
.article__origin .icon { margin-top: 3px; color: var(--accent); }
.author-box { display: flex; gap: 16px; align-items: flex-start; margin: 40px 0 0; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.author-box img { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.author-box__name { font-weight: 700; margin: 0 0 2px; }
.author-box__bio { margin: 0 0 8px; color: var(--text-muted); font-size: 0.9rem; }
.author-box__links { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9rem; }
.post-nav { display: grid; gap: 12px; margin: 28px 0 var(--section); }
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }
.post-nav__link { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--border); text-decoration: none; color: var(--text); min-width: 0; }
.post-nav__link:hover { border-color: var(--accent); color: var(--text); }
.post-nav__link--next { text-align: right; align-items: flex-end; }
.post-nav__dir { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-faint); }
.post-nav__title { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ---------- Blog filters & pagination ---------- */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding-bottom: 6px; overflow-x: auto; scrollbar-width: thin; }
.filter-bar__list { list-style: none; display: flex; gap: 8px; flex: none; }
@media (min-width: 720px) {
    .filter-bar { flex-wrap: nowrap; align-items: flex-start; overflow: visible; }
    .filter-bar__list { flex: 1 1 0; min-width: 0; flex-wrap: wrap; }
}
.filter-chip {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    min-height: 40px; padding: 0.4em 0.95em; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
    text-decoration: none; font-size: 0.9rem; font-weight: 500;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-chip__count { font-family: var(--mono); font-size: 0.75rem; opacity: 0.7; }
.filter-chip--timeline { margin-left: auto; color: var(--retro); flex: none; }
.filter-bar > .small { margin-left: auto; flex: none; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 40px; }
.pagination__pages { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.pagination__page, .pagination__step, .pagination__gap {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 10px;
    text-decoration: none; color: var(--text-muted); font-weight: 500;
}
.pagination__page, .pagination__step { border: 1px solid var(--border); background: var(--surface); }
.pagination__page:hover, .pagination__step:hover { border-color: var(--accent); color: var(--text); }
.pagination__page.is-current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pagination__step.is-disabled { opacity: 0.4; }
@media (max-width: 479.98px) { .pagination__step span { display: none; } }

/* ---------- Timeline ---------- */
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--text-muted); font-size: 0.875rem; }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend__dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; }
.legend__dot--new { border-color: var(--accent); background: var(--accent-soft); }
.legend__dot--archive { border-color: var(--text-faint); }
.year-jump { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: thin; }
.year-jump a { flex: none; padding: 4px 10px; border-radius: 8px; font-family: var(--mono); font-size: 0.85rem; color: var(--text-muted); text-decoration: none; border: 1px solid var(--border); }
.year-jump a:hover { color: var(--accent); border-color: var(--accent); }
.timeline-wrap > * { max-width: 820px; }
.tl-year { margin-bottom: 24px; }
.tl-year__title {
    position: sticky; top: var(--header-h); z-index: 5; margin: 0; padding: 12px 0;
    background: var(--bg); font-family: var(--mono); font-size: 1.35rem; font-weight: 500; color: var(--text);
    display: flex; align-items: center; gap: 12px;
}
.tl-year__count { font-size: 0.75rem; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.timeline { list-style: none; position: relative; margin: 4px 0 0 7px; padding-left: 26px; border-left: 2px solid var(--border); }
.timeline__item { position: relative; padding: 10px 0 18px; }
.timeline__dot { position: absolute; left: -35px; top: 16px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--text-faint); }
.timeline__item--new .timeline__dot { border-color: var(--accent); background: var(--accent-soft); }
.timeline__date { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 4px; font-family: var(--mono); font-size: 0.8rem; color: var(--text-faint); }
.timeline__title { font-size: 1.05rem; font-weight: 600; line-height: 1.5; margin: 0 0 4px; overflow-wrap: anywhere; }
.timeline__title a { color: var(--text); text-decoration: none; }
.timeline__title a:hover { color: var(--accent); text-decoration: underline; }
.timeline__meta { margin: 0; font-size: 0.82rem; color: var(--text-faint); }
.timeline__meta a { color: inherit; }

/* ---------- Tables (preview) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table th { background: var(--surface); font-weight: 600; color: var(--text-muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding-top: clamp(40px, 6vw, 64px); margin-top: 0; }
.site-footer__grid { display: grid; gap: 32px; }
@media (min-width: 800px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1.3fr; gap: 48px; } }
.site-footer__tagline { margin: 12px 0 4px; color: var(--rose); }
.footer-heading { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); font-weight: 500; margin-bottom: 14px; }
.site-footer__nav ul { list-style: none; display: grid; gap: 6px; }
.site-footer__nav a { color: var(--text-muted); text-decoration: none; }
.site-footer__nav a:hover { color: var(--accent); }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 40px; padding-block: 20px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-faint); }
.site-footer__bottom p { margin: 0; }
.site-footer__bottom a { color: var(--text-muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Resume ---------- */
.resume-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.resume-toolbar p { margin: 0; }
.resume { padding: clamp(20px, 5vw, 56px); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.resume__header { display: grid; gap: 20px; padding-bottom: 24px; border-bottom: 2px solid var(--accent); margin-bottom: 8px; }
@media (min-width: 800px) { .resume__header { grid-template-columns: 1fr auto; } }
.resume__name { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0; letter-spacing: -0.02em; }
.resume__headline { font-weight: 600; margin: 6px 0; }
.resume__tagline { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.resume__section { padding-top: 20px; }
.resume__section h2 { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.resume__list { padding-left: 1.1em; display: grid; gap: 6px; }
.resume__skills { display: grid; gap: 10px; margin: 0; }
.resume__skills dt { font-weight: 600; }
.resume__skills dd { margin: 0; color: var(--text-muted); }
.resume__footer { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-faint); }

.error-page { padding-bottom: var(--section); }

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    :root, [data-theme] { --bg: #fff; --bg-alt: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-muted: #222; --text-faint: #444; --border: #ccc; --accent: #7a4300; }
    body { font-size: 11pt; background: #fff; }
    .site-header, .site-footer, .no-print, .skip-link, .preview-bar, .copy-btn { display: none !important; }
    .resume { border: 0; padding: 0; }
    .section { padding: 0; }
    a { color: #000; text-decoration: none; }
    .contact-list--compact .contact-list__icon { display: none; }
}

/* ---------- Photos (masonry grid + lightbox) ---------- */
.photo-grid { columns: 2 160px; column-gap: 10px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .photo-grid { columns: 3 220px; column-gap: 14px; } }
@media (min-width: 1080px) { .photo-grid { columns: 4 240px; } }
.photo-grid__item { break-inside: avoid; margin-bottom: 10px; }
@media (min-width: 720px) { .photo-grid__item { margin-bottom: 14px; } }
.photo-grid__link { display: block; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-2); }
.photo-grid__link img { display: block; width: 100%; height: auto; transition: transform 0.35s ease, opacity 0.2s ease; }
.photo-grid__link:hover img { transform: scale(1.03); }
.photo-grid__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 8, 14, 0.94); color: #fff; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(5, 8, 14, 0.94); }
.lightbox__img { max-width: calc(100vw - 32px); max-height: calc(100vh - 96px); width: auto; height: auto; object-fit: contain; border-radius: 6px; }
.lightbox__btn { position: absolute; color: #fff; background: rgba(255, 255, 255, 0.08); }
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.lightbox__close { top: 14px; right: 14px; }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); }
.lightbox__prev { left: 14px; }
.lightbox__prev .icon { transform: rotate(180deg); }
.lightbox__next { right: 14px; }
.lightbox__count { position: absolute; bottom: 14px; left: 0; right: 0; margin: 0; text-align: center; font-family: var(--mono); font-size: 0.8rem; color: rgba(255, 255, 255, 0.7); }
@media (max-width: 719.98px) { .lightbox__prev, .lightbox__next { top: auto; bottom: 6px; transform: none; } }
@media (prefers-reduced-motion: reduce) { .photo-grid__link img { transition: none; } .photo-grid__link:hover img { transform: none; } }

/* ---------- Article figures (images inserted in the editor) ---------- */
.prose figure { margin: 1.8em 0; }
.prose figure img { display: block; margin: 0 auto; max-height: 80vh; width: auto; }
.prose figcaption { margin-top: 0.6em; text-align: center; font-size: 0.88rem; color: var(--text-faint); }

/* ---------- Post card cover ---------- */
.post-card__cover { display: block; margin: calc(-1 * clamp(20px, 3vw, 26px)) calc(-1 * clamp(20px, 3vw, 26px)) 6px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2); }
.post-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.post-card:hover .post-card__cover img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .post-card__cover img { transition: none; } .post-card:hover .post-card__cover img { transform: none; } }
