/* ===== Tung Duong Ta — personal website ===== */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1d232b;
  --muted: #5d6673;
  --line: #e4e0d8;
  --accent: #1f5f8b;       /* UMBC-ish deep blue */
  --accent-2: #b8860b;     /* gold */
  --accent-soft: #e6f0f7;
  --tag-bg: #eef2f6;
  --ok: #2e7d4f;
  --warn: #9a6400;
  --shadow: 0 1px 2px rgba(20, 30, 40, .05), 0 4px 16px rgba(20, 30, 40, .06);
  --radius: 12px;
  --maxw: 1040px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
:root[data-theme="dark"] {
  --bg: #12161b;
  --surface: #181e25;
  --surface-2: #1e252e;
  --text: #e7ebf0;
  --muted: #9aa5b3;
  --line: #2a323c;
  --accent: #6cb2e6;
  --accent-2: #e0b94f;
  --accent-soft: #1b2a37;
  --tag-bg: #232c36;
  --ok: #6fcf97;
  --warn: #f2c26b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b; --surface: #181e25; --surface-2: #1e252e; --text: #e7ebf0; --muted: #9aa5b3;
    --line: #2a323c; --accent: #6cb2e6; --accent-2: #e0b94f; --accent-soft: #1b2a37; --tag-bg: #232c36;
    --ok: #6fcf97; --warn: #f2c26b; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h2 { font-family: var(--serif); font-size: 1.75rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: .5rem 0; }
ul { padding-left: 1.2rem; margin: .4rem 0; }
li { margin: .2rem 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 2px; margin-left: auto; list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; }
.nav-links a {
  color: var(--muted); font-size: .9rem; font-weight: 500; padding: 6px 10px; border-radius: 8px; display: block;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .menu-btn { display: grid; margin-left: auto; }
  .nav-links {
    display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 36px; }
.hero .wrap { display: grid; grid-template-columns: 220px 1fr; gap: 40px; align-items: center; }
.avatar { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; border: 4px solid var(--surface); box-shadow: var(--shadow); }
.hero h1 { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; letter-spacing: -.01em; }
.hero .role { font-size: 1.1rem; color: var(--muted); margin: 6px 0 14px; }
.hero .lead { font-size: 1.05rem; max-width: 62ch; }
.status {
  display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 500;
  background: var(--accent-soft); color: var(--accent); padding: 6px 12px; border-radius: 999px; margin-bottom: 14px;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; font-size: .9rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); transition: border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0d1620; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0d1620; } }
.btn.primary:hover { color: #fff; filter: brightness(1.08); }
.btn svg { width: 16px; height: 16px; flex: none; }

@media (max-width: 720px) {
  .hero { padding: 32px 0 20px; }
  .hero .wrap { grid-template-columns: 1fr; text-align: center; gap: 20px; }
  .avatar { width: 150px; height: 150px; margin: 0 auto; }
  .hero h1 { font-size: 2rem; }
  .hero .lead { margin: 0 auto; }
  .links { justify-content: center; }
}

/* ---------- Sections ---------- */
section { padding: 40px 0; }
section + section { border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.sec-head .aside { color: var(--muted); font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: .82rem; background: var(--tag-bg); color: var(--text); padding: 3px 10px; border-radius: 999px; }

/* ---------- News ---------- */
.news { list-style: none; padding: 0; margin: 0; }
.news li { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.news li:last-child { border-bottom: 0; }
.news time { font-weight: 600; color: var(--accent); font-size: .9rem; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .news li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Publications ---------- */
.pub-group { margin-bottom: 26px; }
.pub-group > h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.pub { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pub:last-child { border-bottom: 0; }
.pub .key { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.pub .title { font-weight: 600; }
.pub .authors { color: var(--muted); font-size: .93rem; }
.pub .authors .me { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-2); text-underline-offset: 3px; }
.pub .venue { font-style: italic; font-size: .93rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin-right: 4px; vertical-align: 1px; font-style: normal; }
.b-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.b-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.b-acc { background: var(--accent-soft); color: var(--accent); }
.pub .plinks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pub .plinks a { font-size: .8rem; font-weight: 500; border: 1px solid var(--line); padding: 2px 9px; border-radius: 6px; }
.pub .plinks a:hover { border-color: var(--accent); text-decoration: none; }
@media (max-width: 520px) { .pub { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Research projects ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 760px) { .projects { grid-template-columns: 1fr; } }
.project h3 { margin-bottom: 2px; }
.project .meta { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.project ul { font-size: .94rem; }
.project .plinks { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

.earlier { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; }
@media (max-width: 760px) { .earlier { grid-template-columns: 1fr; } }
.earlier .card { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; padding: 16px; }
.earlier img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.earlier p { font-size: .9rem; margin: 4px 0 0; }
@media (max-width: 420px) { .earlier .card { grid-template-columns: 1fr; } .earlier img { width: 100%; height: 140px; } }

/* ---------- Timeline (experience / education) ---------- */
.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 26px 34px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--accent);
}
.tl-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tl-head .when { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-org { color: var(--muted); font-size: .93rem; }
.tl-item ul { font-size: .94rem; }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile button, .tile a.thumb { all: unset; cursor: zoom-in; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.tile a.thumb { cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.tile:hover img { transform: scale(1.03); }
.tile .cap { padding: 10px 12px 12px; font-size: .88rem; }
.tile .cap strong { display: block; font-size: .92rem; }
.tile button:focus-visible, .tile a.thumb:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Honors list */
.honors { list-style: none; padding: 0; margin: 0 0 22px; }
.honors li { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.honors li:last-child { border-bottom: 0; }
.honors time { font-weight: 600; color: var(--accent-2); font-size: .9rem; }
@media (max-width: 520px) { .honors li { grid-template-columns: 1fr; gap: 0; } }

/* Skills */
.skills { display: grid; grid-template-columns: 220px 1fr; gap: 10px 20px; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--muted); }
@media (max-width: 600px) { .skills { grid-template-columns: 1fr; gap: 2px; } .skills dd { margin-bottom: 10px; } }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(8, 10, 14, .9); display: none; z-index: 100; padding: 24px; }
.lightbox.open { display: grid; place-items: center; }
.lightbox figure { margin: 0; max-width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-height: calc(100vh - 110px); width: auto; border-radius: 6px; }
.lightbox figcaption { color: #e7ebf0; font-size: .95rem; text-align: center; }
.lightbox .close { position: absolute; top: 14px; right: 16px; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; cursor: pointer; }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 30px 0 40px; color: var(--muted); font-size: .9rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.note { font-size: .82rem; color: var(--muted); margin-top: 10px; }

/* Language switch */
.lang-btn { font-size: .78rem; font-weight: 700; letter-spacing: .03em; color: var(--text); text-decoration: none; }
.lang-btn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Keep nav labels on one line; Vietnamese labels are longer, so give the bar more room */
.nav .wrap { max-width: 1240px; }
.nav-links a { white-space: nowrap; }
@media (min-width: 901px) and (max-width: 1180px) {
  .nav-links a { padding: 6px 7px; font-size: .86rem; }
}
@media (max-width: 1120px) {
  html[lang="vi"] .menu-btn { display: grid; margin-left: auto; }
  html[lang="vi"] .nav-links {
    display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; box-shadow: var(--shadow);
  }
  html[lang="vi"] .nav-links.open { display: flex; }
}
