/* ==========================================================================
   Thuyen Dang — personal academic site
   Minimal, docs-style. No external fonts, no frameworks, no JavaScript needed.
   ========================================================================== */

/* TeX Gyre Pagella: a Palatino-style serif from the GUST TeX Gyre project.
   GUST Font License (assets/fonts/GUST-FONT-LICENSE.TXT). Self-hosted. */
@font-face { font-family: "TeX Gyre Pagella"; src: url("fonts/pagella-regular.woff") format("woff");    font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "TeX Gyre Pagella"; src: url("fonts/pagella-italic.woff") format("woff");     font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "TeX Gyre Pagella"; src: url("fonts/pagella-bold.woff") format("woff");       font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "TeX Gyre Pagella"; src: url("fonts/pagella-bolditalic.woff") format("woff"); font-weight: 700; font-style: italic; font-display: swap; }

/* Purdue palette (marcom.purdue.edu/our-brand/visual-identity):
   Boilermaker Gold #CFB991 · Black #000000 · Aged #8E6F3E · Dust #EBD99F
   Steel #555960 · Steam #C4BFC0.  Gold never carries text on light
   backgrounds (1.9:1); it is used as a fill behind black text or as decoration. */
:root {
  --gold: #cfb991;          /* Boilermaker Gold */
  --bg: #fdfcf9;
  --surface: #f6f2e8;
  --text: #111111;          /* Black, softened slightly for long reading */
  --heading: #000000;
  --muted: #555960;         /* Steel: 6.9:1 */
  --border: #e4ded0;
  --accent: #76592c;        /* deepened Aged for link text: 6.3:1 */
  --accent-soft: #f3e9cc;   /* light Dust */
  --pill-fill: #cfb991;     /* Gold fill, black text: 11:1 */
  --pill-text: #000000;
  --focus: #000000;
  --nav-active: #ebe6da;    /* current tab: a plain darker pill */

  --serif: "TeX Gyre Pagella", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: var(--serif);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 44rem;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --surface: #1d1e21;
    --text: #ece9e3;
    --heading: #ffffff;
    --muted: #c4bfc0;       /* Steam: 10.3:1 */
    --border: #34353a;
    --accent: #cfb991;      /* Boilermaker Gold: 9.8:1 */
    --accent-soft: #2b261c;
    --pill-fill: #cfb991;
    --pill-text: #000000;
    --focus: #daaa00;       /* Rush */
    --nav-active: #2c2d31;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.125rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* keep the footer at the bottom of the window on short pages */
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
}

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

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

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

h1, h2, h3 { font-family: var(--serif); font-weight: 700; color: var(--heading); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem); margin: 0 0 0.4em; }
h2 { font-size: 1.45rem; margin: 2.4em 0 0.7em; padding-bottom: 0.35em; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.12rem; margin: 1.8em 0 0.5em; }
p  { margin: 0 0 1em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--text); color: var(--bg); padding: 0.5rem 0.9rem; border-radius: 6px;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-top: 4px solid var(--gold);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: 64rem; margin: 0 auto; padding: 0.8rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem;
}
.site-name {
  font-family: var(--serif); font-weight: 700; font-size: 1.2rem;
  color: var(--heading); text-decoration: none;
}
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; }
.site-nav a {
  display: inline-block; padding: 0.35rem 0.7rem; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 1.02rem;
}
.site-nav a:hover { color: var(--heading); background: var(--nav-active); }
.site-nav a[aria-current="page"] { color: var(--heading); background: var(--nav-active); font-weight: 700; }
@media (max-width: 40rem) {
  .site-header { position: static; }
  .site-header .inner { padding: 0.7rem 1rem; }
  .site-nav a { padding: 0.3rem 0.55rem; }
  main { padding-top: 2rem; }
}
.site-nav .ext::after { content: " \2197"; font-size: 0.8em; }

/* ---------- Main ---------- */

main { flex: 1 0 auto; width: 100%; max-width: var(--measure); margin: 0 auto; padding: 3rem 1.25rem 4rem; }
main.wide { max-width: 56rem; }

.lede { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.5em; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }

/* Home hero */
.hero { display: grid; grid-template-columns: 9.5rem 1fr; gap: 2rem; align-items: center; margin-bottom: 1rem; }
.hero img { width: 9.5rem; height: 9.5rem; border-radius: 50%; object-fit: cover; background: var(--surface); }
.hero h1 { margin-bottom: 0.15em; }
.hero .role { color: var(--muted); margin: 0; }
.hero .native-name { margin: -0.2rem 0 0.5rem; color: var(--muted); font-style: italic; }
@media (max-width: 34rem) {
  .hero { grid-template-columns: 1fr; text-align: left; gap: 1.25rem; }
  .hero img { width: 7.5rem; height: 7.5rem; }
}

.link-row { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1.25rem 0 0; list-style: none; }

/* Pills / buttons */
.pill {
  display: inline-flex; align-items: center; gap: 0.3em;
  padding: 0.2rem 0.65rem; border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.95rem; line-height: 1.5; color: var(--text); text-decoration: none; background: var(--bg);
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill.primary { background: var(--pill-fill); border-color: var(--pill-fill); color: var(--pill-text); font-weight: 700; }
.pill.primary:hover { color: var(--pill-text); border-color: var(--heading); }

/* Definition-style info block */
.facts { display: grid; grid-template-columns: max-content 1fr; align-items: baseline; gap: 0.35rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Callout */
.callout {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1.5rem 0; font-size: 0.97rem;
}
.callout > :last-child { margin-bottom: 0; }

/* ---------- Publication list ---------- */

.pubs { list-style: none; padding: 0; margin: 0; }
.pub { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; line-height: 1.35; margin: 0 0 0.25rem; }
.pub-title a { color: var(--heading); text-decoration: none; }
.pub-title a:hover { color: var(--accent); text-decoration: underline; }
.pub-authors { margin: 0; color: var(--text); }
.pub-authors .me { font-weight: 700; }
.pub-venue { margin: 0.1rem 0 0; color: var(--muted); font-size: 1.02rem; }
.pub-venue cite { font-style: italic; }
.pub-note { margin: 0.35rem 0 0; font-size: 0.92rem; color: var(--muted); }
.pub-links { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0.6rem 0 0; list-style: none; }
.source-note { font-size: 0.88rem; color: var(--muted); margin-top: 2rem; }

/* Talks */
.talks { list-style: none; padding: 0; margin: 0; }
.talks li { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.talks li:last-child { border-bottom: 0; }
.talks time, .talks .when { color: var(--muted); font-size: 1rem; font-variant-numeric: tabular-nums; padding-top: 0.1rem; }
.talks .t-title { font-weight: 700; }
.talks .t-where { color: var(--muted); font-size: 1.02rem; }
.talks .t-title .t-where { font-weight: 400; }
@media (max-width: 34rem) { .talks li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* ---------- Cards (notes, resources) ---------- */

.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; background: var(--bg); display: flex; flex-direction: column;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.card:hover { border-color: var(--gold); background: var(--surface); }
.card { border-top: 3px solid var(--gold); }
.card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); } /* whole card clickable */
.card p { margin: 0 0 0.6rem; color: var(--muted); font-size: 1.02rem; }
.card .meta { margin-top: auto; font-size: 0.82rem; color: var(--muted); }
.card .pub-links { position: relative; z-index: 1; margin-top: auto; }
.tag.upcoming { margin: 0 0.3rem 0 0; vertical-align: 0.1em; }
.tag { display: inline-block; font-size: 0.82rem; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--heading); border: 1px solid var(--gold); margin-bottom: 0.5rem; align-self: flex-start; }

/* ---------- Teaching ---------- */

.courses { list-style: none; padding: 0; margin: 0; }
.courses li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: 0.3rem 0; }
.courses .term { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 34rem) { .courses li { grid-template-columns: 1fr; gap: 0; } }

details { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 1.1rem; margin: 0.75rem 0; }
details[open] { padding-bottom: 0.8rem; }
summary { cursor: pointer; padding: 0.8rem 0; font-weight: 700; color: var(--heading); list-style: none; display: flex; align-items: center; gap: 0.6rem; }
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; width: 0.45rem; height: 0.45rem; flex: none;
  border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg); transition: transform 0.15s ease;
}
details[open] > summary::before { transform: rotate(45deg); }
summary .sub { font-weight: 400; color: var(--muted); }
details p.role { color: var(--muted); font-size: 1rem; }

/* ---------- Guide / long-form ---------- */

.prose ol, .prose ul { padding-left: 1.3rem; }
.prose li { margin: 0.3rem 0; }
.prose .link-row { padding-left: 0; }
.callout .link-row { margin-top: 0.5rem; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; overflow-x: auto; font-size: 0.9rem; line-height: 1.5; }
pre code { background: none; padding: 0; }
.toc { font-size: 0.95rem; }
.toc ol { margin: 0.3rem 0 0; }

/* Tables (guide pages) */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
caption { text-align: left; font-weight: 700; color: var(--heading); padding-bottom: 0.4rem; }
th, td { text-align: left; vertical-align: top; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
thead th { border-bottom: 2px solid var(--gold); color: var(--heading); }
tbody th { font-weight: 700; color: var(--heading); }
kbd { font-family: var(--mono); font-size: 0.85em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 0.3em; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); box-shadow: inset 0 -4px 0 var(--gold); color: var(--muted); font-size: 0.88rem; }
.site-footer .inner { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1.25rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
