/* ==========================================================================
   SOAR Lab — style.css
   Sections below use the same names as the HTML comments in index.html.
   To change a colour, font or spacing everywhere, edit the tokens in
   "Design tokens" only.
   ========================================================================== */


/* ---------- Design tokens ---------- */
:root {
  --color-bg: #ffffff;          /* page background */
  --color-surface: #f6f7f9;     /* card / panel background */
  --color-text: #1a1a1a;        /* main text */
  --color-muted: #555a62;       /* secondary text (roles, affiliations) */
  --color-rule: #e2e4e8;        /* thin divider lines and card borders */
  --color-accent: #1b2a4a;      /* links, wordmark, small rules, focus ring */
  --color-accent-contrast: #ffffff; /* text on accent-coloured buttons */

  --font-body: "IBM Plex Sans", "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif; /* all text */
  --font-thai: "IBM Plex Sans Thai", "IBM Plex Sans", system-ui, sans-serif; /* text marked lang="th" */

  --text-base: 1.0625rem;       /* body text size (17px) */
  --text-small: 0.9375rem;      /* captions, affiliations (15px) */
  --text-h1: clamp(1.75rem, 1.2rem + 2.4vw, 2.625rem); /* page title, scales with screen */
  --text-h2: 1.5rem;            /* section headings */
  --text-h3: 1.125rem;          /* person names, theme titles */
  --line-height: 1.65;          /* body line spacing */

  --space-xs: 0.5rem;           /* tight gaps */
  --space-s: 1rem;              /* default gap */
  --space-m: 1.75rem;           /* between blocks */
  --space-l: 3rem;              /* inside sections */
  --space-xl: 5rem;             /* between sections */
  --gutter: 1rem;               /* left/right page margin on phones */

  --max-width: 44rem;           /* width of the text column */
  --header-height: 3.5rem;      /* sticky header height */
  --radius: 4px;                /* corner rounding */
}

/* Dark theme: used automatically when the visitor's device is in dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121519;
    --color-surface: #1a1e24;
    --color-text: #e6e8eb;
    --color-muted: #a7adb6;
    --color-rule: #2c323a;
    --color-accent: #a9bde3;
    --color-accent-contrast: #121519;
  }
}


/* ---------- Fonts (self-hosted, SIL Open Font License — see assets/fonts/OFL.txt) ---------- */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  src: url("assets/fonts/ibm-plex-sans-thai-thai-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  src: url("assets/fonts/ibm-plex-sans-thai-thai-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}


/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height);
  overflow-wrap: break-word;
}

:lang(th) {
  font-family: var(--font-thai);
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 var(--space-s);
}

p, ul, ol {
  margin: 0 0 var(--space-s);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Visible placeholder for missing content — search the HTML for "TODO" */
.todo {
  background: #fff3c4;
  color: #4a3b00;
  padding: 0 0.25em;
  border-radius: 2px;
  font-size: 0.9em;
}

/* Skip link: appears only when a keyboard user presses Tab first */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: var(--space-xs) var(--space-s);
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.skip-link:focus {
  top: var(--space-xs);
}


/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-rule);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
}

.wordmark {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  text-decoration: none;
}

.menu-toggle {
  display: none; /* shown only on small screens when script.js is running */
  font: inherit;
  font-size: var(--text-small);
  color: var(--color-text);
  background: none;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.site-nav a {
  display: inline-block;
  padding: 0.5rem 0;
  font-size: var(--text-small);
  color: var(--color-text);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* Small screens: collapse links behind the Menu button */
@media (max-width: 47.99rem) {
  .js .menu-toggle {
    display: block;
  }

  .js .site-nav {
    display: none;
    width: 100%;
  }

  .js .site-nav.is-open {
    display: block;
  }

  .site-nav {
    width: 100%;
    padding-bottom: var(--space-xs);
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .site-nav a {
    display: block;
    padding: 0.625rem 0;
    border-top: 1px solid var(--color-rule);
  }
}


/* ---------- Intro ---------- */
.intro {
  padding: var(--space-xl) 0 var(--space-l);
}

.intro .kicker {
  font-size: var(--text-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.intro h1 {
  font-size: var(--text-h1);
  max-width: 20em;
}

.intro .tagline {
  font-size: 1.1875rem;
  color: var(--color-text);
  max-width: 34em;
}

.intro .home {
  color: var(--color-muted);
  font-size: var(--text-small);
  margin: 0;
}


/* ---------- Sections (shared) ---------- */
.section {
  padding: var(--space-l) 0;
  border-top: 1px solid var(--color-rule);
  scroll-margin-top: var(--header-height);
}

.section h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--space-m);
}

/* short accent rule above each section heading */
.section h2::before {
  content: "";
  display: block;
  width: 2rem;
  height: 2px;
  background: var(--color-accent);
  margin-bottom: var(--space-s);
}

.section h3 {
  font-size: var(--text-h3);
  margin-bottom: var(--space-xs);
}


/* ---------- About ---------- */
.focus-list {
  padding-left: 1.25rem;
}

.focus-list li {
  margin-bottom: 0.25rem;
}


/* ---------- Research ---------- */
.themes {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: theme;
}

.theme {
  counter-increment: theme;
  margin-bottom: var(--space-m);
  padding-left: 2.5rem;
  position: relative;
}

.theme::before {
  content: counter(theme, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-accent);
}

.theme p {
  margin: 0;
}

.clinical {
  margin-top: var(--space-l);
}


/* ---------- People ---------- */
.pi {
  display: grid;
  gap: var(--space-m);
  margin-bottom: var(--space-l);
}

.pi-photo {
  width: 10rem;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
  font-size: var(--text-small);
  color: var(--color-muted);
}

.pi .credentials {
  font-weight: 400;
}

.pi .role {
  color: var(--color-muted);
  margin-bottom: var(--space-xs);
}

.pi .role {
  font-size: var(--text-small);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-s);
}

.pi .profile-links {
  font-size: var(--text-small);
  color: var(--color-muted);
}

@media (min-width: 40rem) {
  .pi {
    grid-template-columns: 10rem 1fr;
    align-items: start;
  }
}

.people-subheading {
  font-size: var(--text-h3);
  margin-bottom: var(--space-s);
}

.people-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-s);
}

@media (min-width: 40rem) {
  .people-list {
    grid-template-columns: 1fr 1fr;
  }
}

.person {
  padding: var(--space-s);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.person h4 {
  margin-top: 0;
  font-size: 1rem;
  margin-bottom: 0.125rem;
}

.person .role {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 0.25rem;
}

.person .affiliation {
  font-size: var(--text-small);
  color: var(--color-muted);
  margin: 0;
  line-height: 1.5;
}


/* ---------- Publications & presentations ---------- */
.pub-list {
  padding-left: 1.5rem;
  margin: 0;
}

.pub {
  margin-bottom: var(--space-s);
  padding-left: 0.25rem;
}

.pub::marker {
  color: var(--color-muted);
  font-size: var(--text-small);
}


/* ---------- Join us ---------- */
.button {
  display: inline-block;
  padding: 0.625rem 1.125rem;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-small);
}

.button:hover {
  text-decoration: underline;
}


/* ---------- Contact ---------- */
.contact-list {
  margin: 0;
}

.contact-list dt {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contact-list dd {
  margin: 0 0 var(--space-s);
}

address {
  font-style: normal;
}


/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--color-rule);
  padding: var(--space-m) 0 var(--space-l);
  font-size: var(--text-small);
  color: var(--color-muted);
}

.site-footer p {
  margin-bottom: var(--space-xs);
}


/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
