/* ============================================================
   Academic Homepage — 「program note」world
   Warm paper · ink brown-black · one clay accent · hairline rules
   Faces: Newsreader (self-hosted serif) · system sans body ·
   system mono for film-slate metadata only.
   ============================================================ */

@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  /* the reading room, daylight through a high window */
  --paper: #f6f1e8;
  --paper-elev: #fdfaf3;
  --ink: #201c15;
  --ink-soft: #57503f;
  --ink-faint: #8d8470;
  --line: #ddd4c2;
  --accent: #b04a17;
  --accent-soft: rgba(176, 74, 23, 0.09);
  --serif: "Newsreader", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --sans: -apple-system, "Helvetica Neue", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1120px;
}

[data-theme="dark"] {
  /* the screening room: house lights down, beam from the projector */
  --paper: #17140f;
  --paper-elev: #211d16;
  --ink: #ede6d6;
  --ink-soft: #b3a891;
  --ink-faint: #7e7460;
  --line: #3a342a;
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, 0.13);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* browser chrome ships with the design */
::selection { background: var(--accent); color: var(--paper-elev); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- entrance: one soft fade, staggered, once ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.sidebar > *, .section, .footer {
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sidebar > *:nth-child(2) { animation-delay: 0.06s; }
.sidebar > *:nth-child(3) { animation-delay: 0.12s; }
.sidebar > *:nth-child(4) { animation-delay: 0.18s; }
.sidebar > *:nth-child(5) { animation-delay: 0.24s; }
.sidebar > *:nth-child(6) { animation-delay: 0.30s; }
.sidebar > *:nth-child(7) { animation-delay: 0.36s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
  height: 58px; display: flex; align-items: center; gap: 20px;
}
.brand {
  font-family: var(--serif); font-weight: 600; font-size: 19px;
  color: var(--ink); text-decoration: none; white-space: nowrap; letter-spacing: 0.01em;
}
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 14px;
  padding: 6px 10px; border-radius: 4px;
}
.nav a:hover { color: var(--accent); }

/* ---------- Language switcher: the slate ---------- */
.lang-switch {
  display: flex; gap: 0; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.lang-switch button {
  border: none; background: transparent; color: var(--ink-faint);
  font-family: var(--mono); font-size: 12px; padding: 6px 11px; cursor: pointer;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button:hover { color: var(--accent); }
.lang-switch button.active {
  background: var(--ink); color: var(--paper); font-weight: 600;
}

.theme-toggle {
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-soft); width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; font-size: 15px; line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Layout: the editorial spread ---------- */
.layout {
  max-width: var(--maxw); margin: 0 auto; padding: 48px 28px 90px;
  display: grid; grid-template-columns: 300px 1fr; gap: 60px;
}

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 92px; align-self: start; }

/* the portrait: CV-photo scale, slow drift on hover (the one motion) */
.film-still { margin-bottom: 20px; width: 160px; }
.still-frame {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden;
  border-radius: 4px;
}
.still-frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.001);
  transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1), translate 6s cubic-bezier(0.25, 1, 0.5, 1);
}
.still-frame:hover img { transform: scale(1.045) translateY(-1.2%); }
.film-still figcaption {
  margin-top: 10px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint);
  display: flex; justify-content: space-between; gap: 10px;
}

.name {
  font-family: var(--serif); font-weight: 600;
  font-size: 32px; line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 10px;
}
.name .name-alt {
  display: block; font-size: 19px; font-weight: 400; color: var(--ink-faint);
  margin-top: 5px; letter-spacing: 0.02em;
}
.role { color: var(--ink-soft); font-size: 15px; }
.affiliation {
  color: var(--ink-faint); font-size: 14px; margin-top: 3px;
  font-family: var(--mono); letter-spacing: 0.02em;
}

.emails { margin-top: 16px; display: grid; gap: 3px; }
.emails a {
  font-size: 14px; color: var(--accent); text-decoration: none;
  text-underline-offset: 3px; width: fit-content;
}
.emails a:hover { text-decoration: underline; }

.links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.links a {
  font-size: 13px; color: var(--ink-soft); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px;
  background: transparent;
}
.links a:hover { color: var(--accent); border-color: var(--accent); }

.interests { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.interests h3 {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--ink-faint); margin-bottom: 9px; font-weight: 500;
}
.interests .tag {
  display: inline-block; font-family: var(--serif); font-style: italic;
  font-size: 13.5px; color: var(--ink-soft); padding: 1px 4px;
}
.interests .tag + .tag::before { content: "·"; margin-right: 8px; color: var(--ink-faint); font-style: normal; }

/* ---------- Sections ---------- */
.section { margin-bottom: 58px; }
.section-title {
  font-family: var(--serif); font-weight: 600; font-size: 23px;
  letter-spacing: -0.01em; margin-bottom: 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-sub { color: var(--ink-faint); font-size: 14px; margin: -8px 0 14px; }
#bio p { margin-bottom: 13px; max-width: 70ch; }
#bio a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
#bio a:hover { text-decoration: underline; }

/* ---------- Research ---------- */
.research-block {
  background: var(--paper-elev); border: 1px solid var(--line);
  padding: 22px 26px;
}
.research-block h3 {
  font-family: var(--serif); font-weight: 600; font-size: 18px;
  line-height: 1.4; margin-bottom: 10px; letter-spacing: -0.01em;
}
.research-block p { font-size: 15px; color: var(--ink-soft); max-width: 72ch; }

/* ---------- News: the ledger ---------- */
.news-list { list-style: none; }
.news-list li {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px;
  padding: 9px 0; font-size: 15px; border-bottom: 1px dashed var(--line);
}
.news-list li:last-child { border-bottom: none; }
.news-date {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint);
  padding-top: 3px; font-variant-numeric: tabular-nums;
}

/* ---------- Publications (hidden until entries exist) ---------- */
.pub-year {
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  color: var(--accent); margin: 22px 0 10px;
}
.pub { padding: 12px 14px; border-radius: 12px; margin-bottom: 4px; }
.pub:hover { background: var(--paper-elev); }
.pub-title { font-size: 16px; font-weight: 600; }
.pub-authors { font-size: 14px; color: var(--ink-soft); margin-top: 3px; }
.pub-authors .me { color: var(--accent); font-weight: 600; }
.pub-venue { font-size: 14px; font-style: italic; font-family: var(--serif); color: var(--ink-faint); margin-top: 2px; }
.pub-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Projects: one authored block, not a card grid ---------- */
#project-list .proj {
  border: 1px solid var(--line); background: var(--paper-elev);
  padding: 22px 26px;
}
.proj h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.proj h3 a { color: var(--ink); text-decoration: none; }
.proj h3 a:hover { color: var(--accent); }
.proj p { font-size: 15px; color: var(--ink-soft); max-width: 72ch; }
.proj .proj-links { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  font-size: 12.5px; text-decoration: none; padding: 3px 12px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft);
}
.badge:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Awards & teaching: one list ---------- */
.simple-list { list-style: none; }
.simple-list li {
  padding: 8px 0; font-size: 15px;
  border-bottom: 1px dashed var(--line);
}
.simple-list li:last-child { border-bottom: none; }
.simple-list .when {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint);
  margin-right: 14px; font-variant-numeric: tabular-nums;
}

/* ---------- Contact ---------- */
#contact-block p { margin-bottom: 8px; color: var(--ink-soft); max-width: 70ch; }
#contact-block a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
#contact-block a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line); padding-top: 20px;
  color: var(--ink-faint); font-size: 13px;
  font-family: var(--mono); letter-spacing: 0.02em;
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; gap: 36px; padding-top: 32px; }
  .sidebar { position: static; max-width: 420px; margin: 0 auto; text-align: center; }
  .film-still { margin-left: auto; margin-right: auto; }
  .film-still figcaption { justify-content: center; }
  .emails a { margin: 0 auto; }
  .links { justify-content: center; }
  .nav { display: none; }
  .news-list li { grid-template-columns: 1fr; gap: 2px; }
}
