@charset "UTF-8";

/* =========================================================
   Nattapong Sanchan — academic site design system
   Plain CSS, no build step, no external fonts/frameworks.
   ========================================================= */

:root{
  /* Palette: warm-white surface, slate ink, deep academic blue accent.
     Tuned for contrast (AA+) and long-form reading comfort. */
  --bg:            #f7f7f5;
  --surface:       #ffffff;
  --surface-tint:  #f1f5f9;
  --border:        #dde3e8;
  --border-soft:   #e8ecef;

  --ink:           #1e2530;
  --ink-soft:      #4b5563;
  --ink-faint:     #6b7280;

  --brand:         #1d4e89;
  --brand-dark:    #163a63;
  --brand-tint:    #eaf1f8;
  --accent:        #b5482d;   /* warm accent for badges/highlights, used sparingly */

  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 1px 2px rgba(20,30,45,.04), 0 4px 14px rgba(20,30,45,.06);
  --max-w:         860px;
  --max-w-wide:    1200px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img{ max-width: 100%; height: auto; }
a{ color: var(--brand); text-decoration: none; }
a:hover{ text-decoration: underline; }
a:focus-visible, button:focus-visible{
  outline: 3px solid #8fb4e0;
  outline-offset: 2px;
}
h1,h2,h3,h4{
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.01em;
}
p{ margin: 0 0 1em; }
ul, ol{ margin: 0 0 1em; padding-left: 1.3em; }
li{ margin-bottom: .4em; }
hr{ border: none; border-top: 1px solid var(--border); margin: 2em 0; }
table{ border-collapse: collapse; }

/* ---------- Skip link ---------- */
.skip-link{
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--brand-dark);
  color: #fff;
  padding: .6em 1em;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus{ left: 1em; top: 1em; }

/* ---------- Header / nav (CSS-only responsive toggle) ---------- */
.site-header{
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner{
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: .85em 1.25em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}
.brand{
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: .01em;
}
.brand:hover{ text-decoration: none; color: var(--brand); }
.brand small{
  display: block;
  font-weight: 400;
  font-size: .72rem;
  color: var(--ink-faint);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: .1em;
}

.nav-toggle{ display: none; }
.nav-toggle-label{
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after{
  content: "";
  display: block;
  width: 18px; height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform .15s ease;
}
.nav-toggle-label span::before{ position: absolute; top: -6px; }
.nav-toggle-label span::after{ position: absolute; top: 6px; }

.site-nav ul{
  display: flex;
  flex-wrap: wrap;
  gap: .25em;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a{
  display: inline-block;
  padding: .5em .8em;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: .95rem;
  font-weight: 500;
}
.site-nav a:hover{
  background: var(--surface-tint);
  color: var(--brand-dark);
  text-decoration: none;
}
.site-nav a[aria-current="page"]{
  color: var(--brand-dark);
  background: var(--brand-tint);
}

@media (max-width: 760px){
  .nav-toggle-label{ display: flex; }
  .site-nav{
    display: none;
    width: 100%;
    order: 3;
  }
  .site-nav ul{ flex-direction: column; gap: 0; padding: .5em 0 1em; }
  .site-nav a{ display: block; padding: .7em .5em; }
  .nav-toggle:checked ~ .site-nav{ display: block; }
  .header-inner{ flex-wrap: wrap; }
}

/* ---------- Layout ---------- */
main{ display: block; }
.wrap{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25em;
}
.wrap-wide{
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.25em;
}

.page-head{
  padding: 2.6em 0 1.6em;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 2.2em;
}
.page-head h1{
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
  margin: 0 0 .35em;
}
.page-head p{
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 60ch;
  margin: 0;
}
.section{ padding-bottom: 3em; }
.section > h2{
  font-size: 1.3rem;
  margin: 0 0 1em;
  padding-bottom: .4em;
  border-bottom: 2px solid var(--brand-tint);
}
.section + .section{ border-top: 1px solid var(--border-soft); padding-top: 2.6em; }

/* ---------- Cards ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5em 1.6em;
  box-shadow: var(--shadow);
}
.card + .card{ margin-top: 1.1em; }
.card h3{ margin-top: 0; font-size: 1.05rem; }

.grid{
  display: grid;
  gap: 1.4em;
}
@media (min-width: 700px){
  .grid-2{ grid-template-columns: 1fr 1fr; }
  .grid-3{ grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Home hero ---------- */
.hero{
  padding: 3.2em 0 2.4em;
  text-align: center;
}
.hero-photo{
  width: 168px; height: 168px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
  margin: 0 auto 1.4em;
  display: block;
}
.hero h1{
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem);
  margin: 0 0 .3em;
}
.hero .role{
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 auto .6em;
}
.hero .summary{
  max-width: 62ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.hero-links{
  margin-top: 1.4em;
  display: flex;
  flex-wrap: wrap;
  gap: .6em;
  justify-content: center;
}

/* ---------- Buttons / link chips ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .5em 1em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.2;
}
.btn:hover{ background: var(--surface-tint); text-decoration: none; }
.btn-primary{
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover{ background: var(--brand-dark); border-color: var(--brand-dark); }

.tag{
  display: inline-flex;
  align-items: center;
  padding: .28em .7em;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: .82rem;
  font-weight: 600;
}
.tag-list{ display: flex; flex-wrap: wrap; gap: .5em; margin: 0 0 1em; padding: 0; list-style: none; }
.tag-list li{ margin: 0; }

/* ---------- Publications ---------- */
.pub-list{ list-style: none; margin: 0; padding: 0; }
.pub{
  display: grid;
  grid-template-columns: 4.4em 1fr;
  gap: 0 1.2em;
  padding: 1.3em 0;
  border-bottom: 1px solid var(--border-soft);
}
.pub:first-child{ padding-top: 0; }
.pub-year{
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 1.05rem;
  padding-top: .1em;
}
.pub-title{
  margin: 0 0 .3em;
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.45;
}
.pub-title a{ color: var(--ink); }
.pub-title a:hover{ color: var(--brand); }
.pub-meta{
  color: var(--ink-soft);
  font-size: .95rem;
  margin: 0 0 .6em;
}
.pub-badge{
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: .05em .55em;
  margin-left: .4em;
  vertical-align: middle;
}
.pub-links{ display: flex; flex-wrap: wrap; gap: .5em; }
.pub-links a{
  font-size: .82rem;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-tint);
  border-radius: var(--radius-sm);
  padding: .25em .6em;
}
.pub-links a:hover{ background: #dce8f4; text-decoration: none; }

@media (max-width: 560px){
  .pub{ grid-template-columns: 1fr; gap: .2em; }
  .pub-year{ padding-top: 0; }
}

/* ---------- Definition-style lists (About / Education / etc.) ---------- */
.deflist dt{ font-weight: 700; margin-top: 1em; }
.deflist dt:first-child{ margin-top: 0; }
.deflist dd{ margin: .2em 0 0; color: var(--ink-soft); }

.timeline{ list-style: none; margin: 0; padding: 0; }
.timeline li{
  padding: 1em 0;
  border-bottom: 1px solid var(--border-soft);
}
.timeline li:last-child{ border-bottom: none; }
.timeline .role{ font-weight: 700; }
.timeline .meta{ color: var(--ink-faint); font-size: .9rem; }

/* ---------- Detail / abstract pages (bib, dataset) ---------- */
.detail-head{
  padding: 2.6em 0 1.8em;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 2em;
  text-align: center;
}
.detail-head h1{
  font-size: clamp(1.4rem, 1.05rem + 1.3vw, 1.9rem);
  margin: 0 0 .5em;
}
.detail-head .authors{ color: var(--ink-soft); font-size: 1.02rem; }
.abstract{ color: var(--ink-soft); }
.keywords{ margin-top: 1em; font-size: .95rem; }
.keywords strong{ color: var(--ink); }

pre.bibtex{
  background: var(--ink);
  color: #dfe7f0;
  padding: 1.2em 1.3em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.citation-text{
  background: var(--surface-tint);
  border-left: 3px solid var(--brand);
  padding: .9em 1.1em;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
}
.field-label{
  font-weight: 700;
  display: block;
  margin: 1.1em 0 .4em;
  font-size: .95rem;
}
.field-label:first-child{ margin-top: 0; }

/* ---------- Footer ---------- */
.site-footer{
  border-top: 1px solid var(--border);
  margin-top: 3em;
  padding: 2.2em 0;
  color: var(--ink-faint);
  font-size: .9rem;
}
.site-footer a{ color: var(--ink-soft); }
.footer-inner{
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.25em;
  display: flex;
  flex-wrap: wrap;
  gap: .5em 1.4em;
  justify-content: space-between;
  align-items: center;
}
.footer-links{ display: flex; gap: 1.1em; flex-wrap: wrap; }

/* ---------- Utility ---------- */
.text-center{ text-align: center; }
.small{ font-size: .88rem; color: var(--ink-faint); }
.mt-0{ margin-top: 0; }
.notice{
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1em 1.3em;
  color: var(--ink-soft);
}

/* ---------- Print (handy for the profile/CV page) ---------- */
@media print{
  .site-header, .site-footer, .hero-links{ display: none; }
  body{ background: #fff; }
  .card{ box-shadow: none; border-color: #ccc; }
  a{ color: #000; text-decoration: underline; }
}
