:root {
  --bg: #f7f8fa;
  --bg-rgb: 247, 248, 250;
  --surface: #ffffff;
  --surface-raised: #f1f4f8;
  --header-bg: rgba(247, 248, 250, 0.9);
  --overlay-bg: rgba(247, 248, 250, 0.99);
  --text: #1d2430;
  --text-secondary: #4e5b70;
  --muted: #667489;
  --border: #d8dde5;
  --accent: #2f5eb8;
  --accent-hover: #1f4fa8;
  --accent-rgb: 47, 94, 184;
  --chip-bg: #f3f7ff;
  --chip-border: #d8e3fa;
  --maxw: 960px;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(17, 24, 39, 0.05);
  --font-en: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-ko: "Apple SD Gothic Neo", "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --font-km: "Noto Sans Khmer", "Noto Sans Khmer UI", "Khmer OS", "Khmer UI", "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --font-ui: var(--font-en);
}

[data-theme="dark"] {
  --bg: #0b0d10;
  --bg-rgb: 11, 13, 16;
  --surface: #11151a;
  --surface-raised: #161b22;
  --header-bg: rgba(17, 21, 26, 0.9);
  --overlay-bg: rgba(17, 21, 26, 0.98);
  --text: #e6edf3;
  --text-secondary: #a9b4c0;
  --muted: #7d8896;
  --border: #232a33;
  --accent: #6aa0ff;
  --accent-hover: #8ab4ff;
  --accent-rgb: 106, 160, 255;
  --chip-bg: rgba(106, 160, 255, 0.08);
  --chip-border: rgba(106, 160, 255, 0.22);
  --shadow: 0 8px 24px rgba(5, 8, 15, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html[lang="en"] {
  --font-ui: var(--font-en);
}

html[lang="ko"] {
  --font-ui: var(--font-ko);
}

html[lang="km"] {
  --font-ui: var(--font-km);
  text-rendering: optimizeLegibility;
}

html[lang="km"] body {
  line-height: 1.72;
}

html[lang="km"] h1,
html[lang="km"] h2,
html[lang="km"] h3,
html[lang="km"] h4 {
  line-height: 1.4;
}

html[lang="km"] h1 {
  max-width: 24ch;
  overflow-wrap: anywhere;
}

html[lang="km"] .lead {
  line-height: 1.75;
  overflow-wrap: anywhere;
}

html[lang="km"] .site-name {
  line-height: 1.3;
}

html[lang="km"] .eyebrow,
html[lang="km"] .timeline-group-title {
  letter-spacing: normal;
  text-transform: none;
}

html[lang="km"] .nav-list a,
html[lang="km"] .timeline-date {
  line-height: 1.5;
}

html[lang="km"] .tag-list li {
  white-space: normal;
  line-height: 1.45;
  max-width: 100%;
  overflow-wrap: anywhere;
}

html[lang="km"] .timeline-heading,
html[lang="km"] .timeline-meta,
html[lang="km"] .timeline-role,
html[lang="km"] .footer-privacy-note,
html[lang="km"] .contact-link,
html[lang="km"] .footer-privacy-link {
  line-height: 1.65;
}

html[lang="km"] .timeline-heading,
html[lang="km"] .timeline-meta,
html[lang="km"] .timeline-role {
  overflow-wrap: anywhere;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
}

html[data-i18n-pending="true"] body {
  visibility: hidden;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.container {
  width: min(100% - 2rem, var(--maxw));
  margin-inline: auto;
}

.section {
  padding: 3rem 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  overflow: visible;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(4px);
}

.header-inner {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  position: relative;
  padding: 0.68rem 0;
  min-width: 0;
}

.site-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  flex: none;
}

.icon-control {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
}

#lang-toggle {
  min-width: 4.35rem;
}

#lang-toggle-value {
  display: inline-block;
  min-width: 2ch;
  text-align: center;
}

#theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.theme-toggle-icon {
  width: 0.92rem;
  height: 0.92rem;
  display: block;
  flex: none;
}

.icon-control[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.28);
}

.icon-control:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-toggle {
  display: none;
  position: relative;
  z-index: 20;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  line-height: 1;
  font-size: 1.05rem;
  cursor: pointer;
}

.site-nav {
  min-width: 0;
  flex: 1;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.45rem 0.7rem;
}

.nav-list li {
  min-width: 0;
}

.site-nav .nav-list {
  justify-content: flex-end;
}

.nav-list a {
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  max-width: 100%;
  padding: 0.08rem 0;
  line-height: 1.35;
  font-size: 0.89rem;
  overflow-wrap: anywhere;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  color: var(--accent);
}

.hero {
  padding-top: 4.5rem;
}

.evidence-strip-section {
  padding-top: 0;
  padding-bottom: 1.5rem;
}

.evidence-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.evidence-strip-label {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.evidence-strip-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
}

.evidence-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.26rem 0.62rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.84rem;
  line-height: 1.2;
  font-weight: 500;
}

.evidence-pill:hover,
.evidence-pill:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.eyebrow {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.82rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0;
}

h1 {
  margin-top: 0.5rem;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  max-width: 18ch;
}

h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
}

.lead {
  max-width: 68ch;
  margin: 1rem 0 0;
  color: var(--muted);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.7rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 1.1rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.22);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.section-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.work-section {
  border-top: 1px solid var(--border);
}

.work-section h2 {
  color: var(--text-secondary);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
}

.work-section .work-intro {
  margin-top: 0.4rem;
  color: var(--muted);
  max-width: 70ch;
  font-size: 0.93rem;
}

.work-section .card {
  box-shadow: none;
  background: var(--surface-raised);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 1rem 0 0;
  margin: 0;
}

.tag-list li {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.card-grid {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(12, 1fr);
  list-style: none;
  padding: 0;
}

.card {
  grid-column: span 4;
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card p {
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.card-links a {
  color: var(--text);
}

.card-links a:hover,
.card-links a:focus-visible {
  color: var(--accent);
}

#stack p {
  margin-top: 0.9rem;
  color: var(--text-secondary);
  max-width: 75ch;
}

#research h2 {
  margin-bottom: 0.75rem;
}

.research-note-text {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.68;
  max-width: 75ch;
}

.thesis-grid {
  margin-top: 1.25rem;
}

.thesis-grid .card {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 75ch;
  justify-self: center;
  text-align: left;
}

.thesis-label {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
}

.thesis-meta {
  font-size: 0.88rem;
  color: var(--muted);
}

.timeline-intro {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 70ch;
}

.timeline-group {
  margin-top: 1.1rem;
}

.timeline-group + .timeline-group {
  margin-top: 1.6rem;
}

.timeline-group-title {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.timeline-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0 0 0 1.45rem;
  position: relative;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 0.2rem;
  bottom: 0.35rem;
  left: 0.38rem;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 0.7rem;
  min-width: 0;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  top: 0.5rem;
  left: -1.09rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.timeline-content {
  min-width: 0;
  padding: 0.1rem 0 0.4rem;
}

.timeline-date {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}

.timeline-heading {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.timeline-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.timeline-role {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.timeline-group-institution {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.timeline-awards-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

.timeline-award-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.85rem;
  padding: 0.32rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  align-items: baseline;
}

.award-year {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 2.8rem;
  flex: none;
}

.award-sem {
  color: var(--text-secondary);
  flex: none;
}

.award-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2.45rem 0 2.1rem;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.3rem;
}

.contact-cta {
  width: 100%;
}

.contact-cta h2 {
  margin-bottom: 0.8rem;
}

.contact-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.contact-links li {
  min-width: 0;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-raised);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.2;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease,
    box-shadow 0.18s ease;
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.22);
  text-decoration: none;
}

.contact-link-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex: none;
}

.contact-link-label {
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.footer-meta {
  width: 100%;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.footer-privacy-note {
  margin: 0;
  font-size: 0.79rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 74ch;
  text-align: center;
}

.footer-privacy-link {
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.footer-privacy-link:hover,
.footer-privacy-link:focus-visible {
  color: var(--accent);
}

.footer-controls {
  width: 100%;
  margin-top: 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.58rem;
}

.research-secondary {
  margin: 0.9rem auto 0;
  max-width: 75ch;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

.research-secondary-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.research-secondary-body {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.55;
}

.research-secondary-link {
  margin: 0.55rem 0 0;
}

@media (max-width: 920px) {
  .card {
    grid-column: span 6;
  }
}

@media (min-width: 860px) {
  .timeline-list {
    padding-left: 1.6rem;
  }

  .timeline-list::before {
    left: 0.45rem;
  }

  .timeline-item {
    display: grid;
    grid-template-columns: minmax(8.5rem, 10rem) minmax(0, 1fr);
    align-items: start;
    column-gap: 1rem;
  }

  .timeline-marker {
    left: -1.16rem;
  }

  .timeline-date {
    margin: 0;
  }
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

.site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 15;
    border-top: 1px solid var(--border);
    background: var(--overlay-bg);
    box-shadow: var(--shadow);
  }

  .site-nav:not(.is-open) {
    display: none;
  }

  .site-nav .nav-list {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0 0.9rem;
  }

  .site-nav .nav-list a {
    display: inline-block;
    font-size: 0.96rem;
    line-height: 1.45;
    padding: 0.24rem 0;
  }

}

@media (max-width: 640px) {
  .section {
    padding: 2.25rem 0;
  }

  .header-inner {
    padding: 0.55rem 0;
  }

  .hero {
    padding-top: 2.5rem;
    padding-bottom: 1.75rem;
  }

  .evidence-strip {
    padding: 0.8rem 0.85rem;
  }

  h1 {
    font-size: clamp(1.55rem, 8.2vw, 2rem);
    line-height: 1.18;
  }

  .lead {
    margin-top: 0.8rem;
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .tag-list {
    gap: 0.45rem;
    padding-top: 0.85rem;
  }

  .tag-list li {
    padding: 0.35rem 0.62rem;
    font-size: 0.85rem;
  }

  .card {
    grid-column: 1 / -1;
  }

  .timeline-list {
    padding-left: 1.35rem;
  }

  .timeline-list::before {
    left: 0.34rem;
  }

  .timeline-marker {
    left: -1.03rem;
  }

  .timeline-content {
    padding: 0.1rem 0 0.45rem;
  }

  .timeline-date {
    font-size: 0.8rem;
  }

  .site-footer {
    padding: 2.15rem 0 1.95rem;
  }

  .contact-cta h2 {
    margin-bottom: 0.75rem;
  }

  html[lang="km"] h1 {
    line-height: 1.32;
  }

  html[lang="km"] .lead {
    font-size: 1rem;
    line-height: 1.68;
  }

  html[lang="km"] .tag-list li {
    padding: 0.4rem 0.68rem;
    font-size: 0.9rem;
  }
}
