/* ===== Fonts (vendored, SIL OFL 1.1 — see assets/fonts/*/LICENSE) ===== */
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 300; font-display: swap; src: url('../assets/fonts/roboto/roboto-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/roboto/roboto-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/roboto/roboto-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('../assets/fonts/roboto/roboto-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 300; font-display: swap; src: url('../assets/fonts/noto-sans-thai/noto-sans-thai-thai-300-normal.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/noto-sans-thai/noto-sans-thai-thai-400-normal.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/noto-sans-thai/noto-sans-thai-thai-500-normal.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Noto Sans Thai'; font-style: normal; font-weight: 700; font-display: swap; src: url('../assets/fonts/noto-sans-thai/noto-sans-thai-thai-700-normal.woff2') format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }

/* ===== Tokens ===== */
:root {
  --theme: #8b2332;
  --theme-soft: #f6eced;
  --fg: #1f2328;
  --muted: #6a737d;
  --rule: #e5e7eb;
  --chip: #f6f8fa;
  --bg: #ffffff;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Roboto', 'Noto Sans Thai', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--theme); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--theme); outline-offset: 2px; }
main { display: block; }
noscript { display: block; text-align: center; padding: 24px; }

/* ===== Header ===== */
.site-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 56px;
  padding: 0 110px;
  border-bottom: 1px solid var(--rule);
}
.site-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 24px; font-size: 15px; }
.site-nav a { color: var(--fg); padding: 6px 0; }
.site-nav a:hover { color: var(--theme); text-decoration: none; }
.site-nav a.on { color: var(--theme); }
.menu-toggle { display: none; }
.lang-toggle {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  font: inherit;
  font-size: 13px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
}
.lang-toggle:hover { border-color: var(--theme); }
.lang-toggle .on { color: var(--theme); font-weight: 700; }

/* ===== Page ===== */
.page { max-width: 860px; margin: 0 auto; padding: 32px 32px 24px; overflow-wrap: anywhere; }
.page::after { content: ''; display: block; clear: both; }
h1 { font-size: 40px; font-weight: 300; line-height: 1.15; margin: 0; }
h1 b { font-weight: 700; }
.desc { color: var(--muted); font-size: 15px; margin: 6px 0 20px; }
.load-error {
  border: 1px solid var(--theme);
  background: var(--theme-soft);
  border-radius: 6px;
  padding: 14px 16px;
}

/* ===== Images ===== */
.img-placeholder { background: linear-gradient(135deg, var(--chip), var(--rule)); }
img { display: block; max-width: 100%; }

/* ===== About ===== */
.profile { float: right; width: 200px; margin: 0 0 16px 28px; text-align: center; }
.portrait { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 6px; }
.profile .addr { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 8px; }
.page p { margin: 0 0 12px; }
.fact-label { font-weight: 500; }
.section-title { clear: both; font-size: 20px; font-weight: 500; color: var(--theme); margin: 28px 0 4px; }
.more { display: block; text-align: right; font-size: 14px; margin-top: 10px; }
.social { clear: both; display: flex; justify-content: center; gap: 18px; padding: 28px 0 4px; }
.social a { color: var(--fg); }
.social a:hover { color: var(--theme); }
.social svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Publication entries ===== */
.pub { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.pub-side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.abbr { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: #fff; background: var(--theme); padding: 1px 8px; border-radius: 3px; }
.abbr.j { background: #5a636d; }
.thumb { width: 120px; height: 70px; object-fit: cover; border-radius: 4px; }
.pub-title { font-weight: 700; line-height: 1.4; }
.pub-authors { font-size: 14px; }
.author.me { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pub-venue { font-size: 14px; font-style: italic; color: var(--muted); }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btns button, .btns .btn {
  font: inherit; font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 9px; border: 1px solid var(--fg); border-radius: 3px; background: none; color: var(--fg); cursor: pointer; line-height: 1.7;
}
.btns button:hover, .btns .btn:hover, .btns button[aria-expanded="true"] { border-color: var(--theme); color: var(--theme); text-decoration: none; }
.drop { margin-top: 8px; padding: 10px 12px; font-size: 14px; background: var(--chip); border-radius: 4px; }
.drop[hidden] { display: none; }
.drop.bib { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }

/* ===== Publications page ===== */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.filters button { font: inherit; font-size: 14px; padding: 3px 14px; border-radius: 999px; border: 1px solid var(--rule); background: none; color: var(--fg); cursor: pointer; }
.filters button:hover { border-color: var(--theme); }
.filters button.on { background: var(--theme); border-color: var(--theme); color: #fff; }
.year { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
.year .y { font-size: 26px; font-weight: 300; color: #b9bdc3; padding-top: 10px; }
.empty { color: var(--muted); padding: 16px 0; }

/* ===== Projects page ===== */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.card { display: block; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; color: inherit; background: var(--bg); }
a.card:hover { border-color: var(--theme); text-decoration: none; }
.card-img { width: 100%; height: 120px; object-fit: cover; }
.card-body { padding: 10px 12px 12px; }
.card-title { font-weight: 700; line-height: 1.35; }
.card-desc { font-size: 14px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.tag { font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--theme-soft); color: var(--theme); }
.tag.done { background: var(--chip); color: var(--muted); }

/* ===== Teaching page ===== */
.course { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 14px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.course .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--muted); }
.course-name { font-weight: 500; }
.course-sub { font-size: 14px; color: var(--muted); }
.course-link { font-size: 14px; white-space: nowrap; }

/* ===== Members page ===== */
.people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 18px; margin: 12px 0 6px; }
.person { text-align: center; font-size: 13px; }
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin: 0 auto 8px; }
.person-name { font-weight: 500; font-size: 15px; }
.person-topic, .person-since { color: var(--muted); line-height: 1.45; }
.subsection-title { font-size: 16px; font-weight: 500; margin: 18px 0 2px; }
.alumni-list + .alumni-list { margin-top: 18px; }
.alumni-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.alumni-year { font-weight: 500; color: var(--theme); }
.alumni-name { font-weight: 500; }
.alumni-detail, .alumni-next, .alumni-links { font-size: 14px; color: var(--muted); line-height: 1.45; }
.alumni-next, .alumni-links { margin-top: 2px; }

/* ===== Awards page ===== */
.award { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.award-year { font-weight: 500; color: var(--theme); }
.award-title { font-weight: 500; }
.award-org { font-size: 14px; color: var(--muted); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 24px;
  padding: 14px 16px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.site-footer p { margin: 0; }

/* ===== Phones ===== */
@media (max-width: 720px) {
  .site-header { justify-content: space-between; flex-wrap: wrap; padding: 0 16px; }
  .menu-toggle {
    display: block;
    background: none;
    border: 0;
    color: var(--fg);
    font-size: 22px;
    line-height: 1;
    padding: 10px 4px;
    cursor: pointer;
  }
  .lang-toggle { position: static; transform: none; }
  .site-nav { display: none; order: 3; width: 100%; flex-direction: column; gap: 0; padding: 0 0 10px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 9px 0; border-top: 1px solid var(--rule); }
  .page { padding: 24px 16px 16px; }
  h1 { font-size: 32px; }
  .profile { float: none; width: 180px; margin: 0 auto 18px; }
  .pub { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; }
  .thumb { width: 84px; height: 52px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .course { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-link { justify-self: start; }
  .year { display: block; }
  .year .y { font-size: 22px; padding-top: 14px; border-bottom: 1px solid var(--rule); }
}
