/* ---------- tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #171b23;
  --text-muted: #5b6472;
  --rule: #e3e6ec;
  --accent: #308280;
  --accent-soft: #30828026;
  --accent2: #23605e;
  --link: #276d6b;
  --on-accent: #ffffff;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max-w: 700px;
}

:root[data-theme="dark"] {
  --bg: #11141a;
  --surface: #181c24;
  --text: #e7eaf0;
  --text-muted: #939bab;
  --rule: #2a2f3a;
  --accent: #5fb3b0;
  --accent-soft: #5fb3b033;
  --accent2: #8ccfcc;
  --link: #7cc4c1;
  --on-accent: #11141a;
}

* { box-sizing: border-box; }

::selection {
  background: var(--accent-soft);
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  padding: 0 20px;
  padding-top: 76px;
}


.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-block: 24px 80px;
}

/* ---------- top bar (fixed) ---------- */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  z-index: 100;
}

#topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
}

.topbar-inner {
  max-width: 800px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-family: var(--sans);
  font-size: 0.88rem;
  flex-shrink: 0;
}

.topbar-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.topbar-nav a:hover,
.topbar-nav a.active {
  color: var(--accent);
}

.topbar-nav a.button {
  color: var(--on-accent);
  background: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
}

.topbar-nav a.button:hover,
.topbar-nav a.button.active {
  background: var(--accent2);
  color: var(--on-accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent2);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- header ---------- */
header.hero {
  display: flex;
  gap: 26px;
  align-items: center;
  margin: 0 0 40px;
}

.avatar {
  width: 132px;
  height: 132px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 34px;
  filter: drop-shadow(0 3px 10px rgba(23, 27, 35, 0.16));
}

.page > h1 {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  margin: 0 0 28px;
  letter-spacing: 0.1px;
  text-wrap: balance;
}

.page-subtitle {
  margin: -22px 0 24px;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-style: italic;
}

.back-link {
  font-family: var(--sans);
  font-size: 0.85rem;
  margin: 0 0 18px;
}

.back-link a {
  color: var(--text-muted);
  text-decoration: none;
}

.back-link a:hover {
  color: var(--accent);
}

.hero-text h1 {
  font-size: 1.85rem;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: 0.1px;
  text-wrap: balance;
}

.hero-text .title {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 1.02rem;
  font-style: italic;
}

ul.quick-links {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--text-muted);
}

ul.quick-links li.loc-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

ul.quick-links li.links-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 6px;
  column-gap: 18px;
}

ul.quick-links .link-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

ul.quick-links svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

ul.quick-links a {
  color: var(--link);
  text-decoration: none;
}

ul.quick-links a:hover { color: var(--accent2); }

/* ---------- sections ---------- */
section { margin-bottom: 44px; }

h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

p { margin: 0 0 14px; }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 2px;
}
a:hover {
  color: var(--accent2);
  text-decoration-color: currentColor;
}

/* ---------- interests ---------- */
ul.interests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

ul.interests li {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 12px;
}

.pub-note {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: -6px;
}

/* ---------- publications ---------- */
ul.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub {
  padding: 10px 0 10px 22px;
  position: relative;
  border-bottom: 1px dashed var(--rule);
}

.pub:last-child { border-bottom: none; }

.pub::before {
  content: "\2022";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1.3;
}

.pub .pub-title { font-weight: 600; }

.pub .pub-meta {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.pub .pub-links {
  font-family: var(--sans);
  font-size: 0.82rem;
  margin-top: 4px;
}

.pub .pub-links a { margin-right: 12px; }

/* ---------- teaching ---------- */
h3 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin: 24px 0 10px;
}

h3:first-of-type { margin-top: 0; }

ul.course-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.course {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
}

.course + .course { margin-top: 6px; }

.course-date {
  flex: 0 0 auto;
  width: 92px;
  padding-top: 1px;
  text-align: right;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.course-main {
  flex: 1;
  min-width: 0;
  padding-left: 16px;
  border-left: 2px solid var(--rule);
}

.course-title {
  display: block;
  font-weight: 600;
}

.course-meta {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---------- material lists (materials pages) ---------- */
.topic-section + .topic-section {
  margin-top: 32px;
}

.topic-heading {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  margin: 0 0 12px;
  padding-bottom: 0;
  border-bottom: none;
}

ul.material-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.material-item {
  padding: 10px 0 10px 16px;
  border-left: 2px solid var(--rule);
}

.material-item + .material-item { margin-top: 6px; }

.material-title {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
}

.material-meta {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ---------- contact ---------- */
dl.contact-list {
  font-family: var(--sans);
  font-size: 0.92rem;
  margin: 0;
}

dl.contact-list > div {
  display: flex;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
}

dl.contact-list > div:last-child { border-bottom: none; }

dl.contact-list dt {
  width: 100px;
  flex-shrink: 0;
  color: var(--text-muted);
}

dl.contact-list dd { margin: 0; }

/* ---------- footer ---------- */
footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.watermark {
  width: 39px;
  height: 39px;
  margin: 14px auto 0;
  background: var(--text);
  opacity: 0.025;
  -webkit-mask-image: url("assets/watermark.png");
  mask-image: url("assets/watermark.png");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* ---------- responsive ---------- */
@media (max-width: 600px) {
  .topbar-brand { display: none; }
  .topbar-inner { justify-content: center; }
  .topbar-nav { gap: 14px; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  header.hero { flex-direction: column; align-items: flex-start; text-align: left; }
  .avatar { width: 84px; height: 84px; border-radius: 22px; }
}
