/* Nguyen Ngoc Yen Nhi — research site
   Visual motif: a fixed budget, split into "kept exact" and "compressed".
   Type: Newsreader (long-form reading) + Space Grotesk (technical labels) + IBM Plex Mono (math/code). */

:root {
  --paper: #f3f4f0;
  --paper-raised: #fbfbf9;
  --ink: #1a1d26;
  --ink-soft: #565b68;
  --ink-faint: #8a8f9a;
  --line: #d8dad2;
  --line-soft: #e6e7e1;
  --accent: #14756a;        /* "exact" — solid */
  --accent-deep: #0f574f;
  --accent-wash: rgba(20, 117, 106, 0.12);
  --focus: #14756a;
  --measure: 66ch;
  --radius: 4px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161c;
    --paper-raised: #1b1e26;
    --ink: #ecede9;
    --ink-soft: #a6abb6;
    --ink-faint: #767b86;
    --line: #2d313b;
    --line-soft: #23262e;
    --accent: #58d6c6;
    --accent-deep: #8fe6da;
    --accent-wash: rgba(88, 214, 198, 0.14);
    --focus: #58d6c6;
  }
}
:root[data-theme="dark"] {
  --paper: #14161c;
  --paper-raised: #1b1e26;
  --ink: #ecede9;
  --ink-soft: #a6abb6;
  --ink-faint: #767b86;
  --line: #2d313b;
  --line-soft: #23262e;
  --accent: #58d6c6;
  --accent-deep: #8fe6da;
  --accent-wash: rgba(88, 214, 198, 0.14);
  --focus: #58d6c6;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.68;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- typography ---- */
h1, h2, h3 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
}
a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--accent-deep); } }

.ui { font-family: "Space Grotesk", system-ui, sans-serif; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.92em; }

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

/* ---- top nav ---- */
.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.nav__name {
  font-family: "Newsreader", serif;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.nav__links {
  display: flex;
  gap: 22px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
}
.nav__links a { color: var(--ink-soft); text-decoration: none; }
.nav__links a:hover { color: var(--accent-deep); }

/* ---- hero ---- */
.hero { padding: 72px 0 40px; max-width: 24ch; }
.hero__kicker {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.85rem;
  color: var(--accent-deep);
  margin: 0 0 20px;
  letter-spacing: 0.01em;
}
.hero h1 {
  font-size: clamp(2.3rem, 6.2vw, 4rem);
  margin: 0;
  max-width: 16ch;
}
.hero h1 em { font-style: italic; color: var(--accent-deep); }
.hero__lead {
  max-width: var(--measure);
  margin: 28px 0 0;
  color: var(--ink-soft);
  font-size: 1.2rem;
}

/* ---- budget bar motif ---- */
.budget { margin: 40px 0 0; max-width: 560px; }
.budget__track {
  display: flex;
  height: 30px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-raised);
}
.seg { display: block; height: 100%; }
.seg--exact { background: var(--accent); width: var(--w, 60%); }
.seg--approx {
  width: var(--w, 40%);
  background-color: var(--accent-wash);
  background-image: repeating-linear-gradient(
    -45deg, transparent 0 5px, var(--accent) 5px 6px);
}
.budget__legend {
  display: flex;
  gap: 24px;
  margin-top: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.budget__legend b { color: var(--ink); font-weight: 500; }
.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 7px; transform: translateY(1px); }
.swatch--exact { background: var(--accent); }
.swatch--approx { background-image: repeating-linear-gradient(-45deg, var(--accent-wash) 0 3px, var(--accent) 3px 4px); }

@media (prefers-reduced-motion: no-preference) {
  .seg { animation: grow 900ms cubic-bezier(.2,.7,.2,1) both; }
  .seg--approx { animation-delay: 160ms; }
  @keyframes grow { from { width: 0; } to { width: var(--w); } }
}

/* ---- sections ---- */
section { padding: 56px 0; border-top: 1px solid var(--line-soft); }
.section-head {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-faint);
  margin: 0 0 28px;
}

/* ---- work list ---- */
.work { list-style: none; margin: 0; padding: 0; }
.work li { padding: 22px 0; border-bottom: 1px solid var(--line-soft); }
.work li:first-child { padding-top: 0; }
.work__title {
  font-size: 1.4rem;
  margin: 0 0 6px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.work__title a { text-decoration: none; color: var(--ink); }
.work__title a:hover { color: var(--accent-deep); }
.flag {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.68rem;
  color: var(--accent-deep);
  border: 1px solid var(--accent);
  border-radius: 100px;
  padding: 2px 9px;
  transform: translateY(-2px);
}
.work__meta {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.work__meta .role { color: var(--ink-faint); }
.work__links { font-family: "Space Grotesk", sans-serif; font-size: 0.86rem; display: flex; gap: 18px; flex-wrap: wrap; }
.work__links a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.work__links a:hover { border-color: var(--accent); }
.work__links .todo { color: var(--ink-faint); border: none; }

/* ---- feature note card ---- */
.note-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  background: var(--paper-raised);
}
.note-card:hover { border-color: var(--accent); }
.note-card h3 { font-size: 1.7rem; margin: 0 0 10px; }
.note-card h3 em { font-style: italic; }
.note-card p { margin: 0 0 16px; color: var(--ink-soft); max-width: 56ch; }
.note-card .more { font-family: "Space Grotesk", sans-serif; font-size: 0.9rem; color: var(--accent-deep); }

/* ---- prose (bio + article) ---- */
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.25em; }
.prose h2 { font-size: 1.85rem; margin: 2.4em 0 0.6em; }
.prose h2:first-child { margin-top: 0; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose em.term { font-style: normal; font-weight: 600; color: var(--accent-deep); }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 22px;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft); font-style: italic;
}

/* ---- article header ---- */
.article-head { padding: 64px 0 36px; border-bottom: 1px solid var(--line); }
.back { font-family: "Space Grotesk", sans-serif; font-size: 0.88rem; color: var(--ink-soft); text-decoration: none; }
.back:hover { color: var(--accent-deep); }
.article-head h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin: 28px 0 0; max-width: 20ch; }
.article-head h1 em { font-style: italic; }
.article-head .dek { max-width: 58ch; margin: 20px 0 0; color: var(--ink-soft); font-size: 1.2rem; }
.article-meta {
  display: flex; gap: 28px; flex-wrap: wrap;
  margin-top: 24px;
  font-family: "Space Grotesk", sans-serif; font-size: 0.86rem; color: var(--ink-faint);
}
.article-meta b { color: var(--ink-soft); font-weight: 500; }

/* ---- article body layout ---- */
.article-body { display: grid; grid-template-columns: 1fr; gap: 0; padding: 48px 0 0; }
.toc { display: none; }
@media (min-width: 940px) {
  .article-body { grid-template-columns: 200px minmax(0, var(--measure)); gap: 64px; }
  .toc {
    display: block; position: sticky; top: 36px; align-self: start;
    font-family: "Space Grotesk", sans-serif; font-size: 0.86rem;
  }
  .toc ol { list-style: none; margin: 0; padding: 0; counter-reset: s; }
  .toc li { margin: 0 0 11px; counter-increment: s; }
  .toc a { color: var(--ink-soft); text-decoration: none; display: block; }
  .toc a::before { content: counter(s) "  "; color: var(--ink-faint); }
  .toc a:hover { color: var(--accent-deep); }
}

/* ---- figure ---- */
figure { margin: 2.4em 0; }
figure svg { width: 100%; height: auto; display: block; }
figcaption {
  font-family: "Space Grotesk", sans-serif; font-size: 0.85rem;
  color: var(--ink-soft); margin-top: 14px; max-width: 58ch; line-height: 1.5;
}

/* ---- stat row ---- */
.stats { display: flex; flex-wrap: wrap; gap: 36px; margin: 2em 0; }
.stat { max-width: 22ch; }
.stat .n { font-size: 2.3rem; font-weight: 500; color: var(--accent-deep); line-height: 1; display: block; }
.stat .l { font-family: "Space Grotesk", sans-serif; font-size: 0.85rem; color: var(--ink-soft); margin-top: 8px; display: block; }

/* ---- footer ---- */
footer { border-top: 1px solid var(--line); padding: 44px 0 64px; margin-top: 24px; }
.footer-grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-grid a { font-family: "Space Grotesk", sans-serif; font-size: 0.9rem; color: var(--ink-soft); text-decoration: none; }
.footer-grid a:hover { color: var(--accent-deep); }
.footer-note { font-family: "Space Grotesk", sans-serif; font-size: 0.82rem; color: var(--ink-faint); margin-top: 20px; }

.draft {
  font-family: "Space Grotesk", sans-serif; font-size: 0.8rem;
  background: var(--accent-wash); color: var(--accent-deep);
  border: 1px dashed var(--accent); border-radius: 4px;
  padding: 2px 8px; display: inline-block;
}

/* ===== academic homepage layout (home only) ===== */
.layout { display: grid; grid-template-columns: 1fr; gap: 40px; padding: 40px 0 0; }
@media (min-width: 900px) {
  .layout { grid-template-columns: 288px minmax(0, 1fr); gap: 60px; }
  .sidebar { position: sticky; top: 32px; align-self: start; }
}

/* profile card */
.avatar {
  width: 150px; height: 150px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  box-shadow: 0 0 0 5px var(--accent-wash);
  font-family: "Newsreader", serif; font-size: 3.1rem; color: var(--accent-deep);
  margin-bottom: 22px;
}
.sidebar h1 { font-size: 1.7rem; margin: 0 0 4px; }
.sidebar .affil { font-family: "Space Grotesk", sans-serif; font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 4px; line-height: 1.45; }
.sidebar .focus { font-family: "Space Grotesk", sans-serif; font-size: 0.86rem; color: var(--ink-faint); margin: 10px 0 0; line-height: 1.5; }
.social { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 20px 0 0; font-family: "Space Grotesk", sans-serif; font-size: 0.9rem; }
.social a { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.social a:hover { border-color: var(--accent); color: var(--ink); }
.social .todo { color: var(--ink-faint); border-bottom: 1px dashed var(--line); }
.seeking {
  margin-top: 22px; padding: 12px 14px; border-radius: 6px;
  background: var(--accent-wash); border: 1px solid var(--accent);
  font-family: "Space Grotesk", sans-serif; font-size: 0.84rem; color: var(--accent-deep); line-height: 1.5;
}

/* main column blocks */
.maincol { min-width: 0; }
.block { padding: 0 0 44px; border: 0; }
.block .h {
  font-family: "Space Grotesk", sans-serif; font-size: 1.12rem; font-weight: 500;
  color: var(--ink); margin: 0 0 18px; display: flex; align-items: center; gap: 9px;
}
.block .h .e { font-size: 1.15rem; }
.block > p { max-width: var(--measure); }
.block > p:first-of-type { margin-top: 0; }

/* mini budget signature */
.sig { margin: 22px 0 4px; max-width: 420px; }
.sig .budget__track { height: 20px; }

/* news feed */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 74px 1fr; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 1rem; line-height: 1.5; }
.news .date { font-family: "IBM Plex Mono", monospace; font-size: 0.82rem; color: var(--accent-deep); padding-top: 2px; }
.news .what { color: var(--ink); }

/* publications */
.pubgroup { font-family: "Space Grotesk", sans-serif; font-size: 0.82rem; color: var(--ink-faint); margin: 26px 0 14px; }
.pub { display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); align-items: start; }
.badge {
  font-family: "Space Grotesk", sans-serif; font-size: 0.72rem; font-weight: 500;
  text-align: center; color: var(--ink); background: var(--paper-raised);
  border: 1px solid var(--line); border-radius: 5px; padding: 8px 6px; line-height: 1.3;
}
.badge.sub { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-wash); }
.pub__t { font-size: 1.12rem; line-height: 1.35; margin: 0 0 5px; }
.pub__t a { color: var(--ink); text-decoration: none; }
.pub__t a:hover { color: var(--accent-deep); }
.pub__a { font-family: "Space Grotesk", sans-serif; font-size: 0.86rem; color: var(--ink-soft); margin: 0 0 4px; line-height: 1.45; }
.pub__a b { color: var(--ink); font-weight: 600; }
.pub__v { font-size: 0.98rem; color: var(--ink-soft); font-style: italic; margin: 0 0 7px; }
.pub__links { font-family: "Space Grotesk", sans-serif; font-size: 0.82rem; display: flex; gap: 14px; flex-wrap: wrap; }
.pub__links a { color: var(--accent-deep); text-decoration: none; }
.pub__links a:hover { text-decoration: underline; }
.pub__links .todo { color: var(--ink-faint); }

/* generic dated rows (education, experience) */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 128px 1fr; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.rows .when { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; color: var(--ink-faint); padding-top: 3px; }
.rows .role { font-weight: 500; }
.rows .org { font-family: "Space Grotesk", sans-serif; font-size: 0.88rem; color: var(--ink-soft); }
@media (max-width: 560px) {
  .pub, .news li, .rows li { grid-template-columns: 1fr; gap: 6px; }
  .badge { width: 120px; }
}

/* honors / services simple list */
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 9px 0; border-bottom: 1px solid var(--line-soft); line-height: 1.5; }
.plain .year { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; color: var(--ink-faint); margin-left: 6px; }
