/* Academic personal site — layout inspired by Jekyll "Minimal Mistakes" */
:root {
  --bg: #ffffff;
  --bg-soft: #f2f3f3;
  --text: #494e52;
  --text-strong: #313436;
  --muted: #7a8288;
  --border: #e5e7e9;
  --link: #2f7f93;
  --link-hover: #1f5a68;
  --accent: #52adc8;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Lucida Grande", Arial, sans-serif;
  --font-serif: Georgia, Cambria, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #252a34;
    --bg-soft: #1e222a;
    --text: #d3d6db;
    --text-strong: #eaeaea;
    --muted: #9aa1a9;
    --border: #3b404a;
    --link: #7cc6db;
    --link-hover: #a6dcea;
    --accent: #00adb5;
  }
}
:root[data-theme="dark"] {
  --bg: #252a34;
  --bg-soft: #1e222a;
  --text: #d3d6db;
  --text-strong: #eaeaea;
  --muted: #9aa1a9;
  --border: #3b404a;
  --link: #7cc6db;
  --link-hover: #a6dcea;
  --accent: #00adb5;
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
@media (min-width: 1024px) { html { font-size: 17px; } }
@media (min-width: 1280px) { html { font-size: 18px; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
img { max-width: 100%; height: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg); padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.masthead__inner {
  max-width: 1280px; margin: 0 auto;
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.site-title {
  font-weight: 700; color: var(--text-strong); text-decoration: none;
  font-size: 1.05rem; display: flex; align-items: center; gap: .5rem;
  margin-right: auto;
}
.site-title img { height: 30px; width: auto; object-fit: contain; display: block; }
/* icon is black line-art on transparent: give it a light chip in dark mode */
:root[data-theme="dark"] .site-title img { background: #fff; border-radius: 6px; padding: 2px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-title img { background: #fff; border-radius: 6px; padding: 2px; }
}
.nav { display: flex; gap: 1.1rem; flex-wrap: wrap; align-items: center; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: .9rem;
  padding: .25rem 0; border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--text-strong); border-bottom-color: var(--accent); }
.theme-toggle {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; width: 32px; height: 32px; cursor: pointer;
  display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--text-strong); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Hamburger button (mobile only) */
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); color: var(--text-strong);
  border-radius: 6px; width: 36px; height: 36px; cursor: pointer;
  place-items: center; padding: 0;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle__close { display: none; }
.masthead.is-open .nav-toggle__bars { display: none; }
.masthead.is-open .nav-toggle__close { display: inline; }

/* Mobile header: title + theme + hamburger on one row, menu drops down below */
@media (max-width: 767px) {
  .masthead__inner { gap: .5rem; }
  .site-title { order: 1; }
  .theme-toggle { order: 2; width: 36px; height: 36px; }
  .nav-toggle { order: 3; display: grid; }
  .nav {
    order: 4; width: 100%;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 0;
    border-top: 1px solid var(--border); margin-top: .25rem; padding-top: .25rem;
  }
  .nav a {
    font-size: 1rem; padding: .7rem .25rem;
    border-bottom: 1px solid var(--border);
  }
  .nav a:last-child { border-bottom: 0; }
  .nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--border); color: var(--text-strong); }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); padding-left: .75rem; }
  /* collapsed by default once JS is running (without JS the links stay visible) */
  .has-js .masthead:not(.is-open) .nav { display: none; }
}

/* ---------- Layout ---------- */
.page-wrap {
  flex: 1;
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: 2rem 1rem 3rem;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem;
  align-content: start;
}
@media (min-width: 1024px) {
  .page-wrap { grid-template-columns: 250px minmax(0, 1fr); gap: 3rem; padding-top: 3rem; }
}

/* ---------- Sidebar / author profile ---------- */
.sidebar { font-size: .85rem; min-width: 0; }
@media (min-width: 1024px) {
  .sidebar { position: sticky; top: 5rem; align-self: start; }
}
.author { display: flex; gap: 1rem; align-items: center; }
@media (min-width: 1024px) { .author { flex-direction: column; align-items: flex-start; } }
.author__avatar { flex: none; }
.author__avatar img {
  width: 110px; height: 110px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border); padding: 4px; background: var(--bg);
}
@media (min-width: 1024px) { .author__avatar { flex: none; }
.author__avatar img { width: 175px; height: 175px; } }
.author__name { margin: 0; font-size: 1.15rem; color: var(--text-strong); }
.author__bio { margin: .25rem 0 0; color: var(--muted); }
.author__links { list-style: none; padding: 0; margin: 1rem 0 0; }
.author__links li { margin: .35rem 0; }
.author__links a, .author__links span {
  display: flex; align-items: center; gap: .55rem;
  color: var(--text); text-decoration: none;
}
.author__links a:hover { color: var(--link); }
.author__links svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
@media (max-width: 1023px) {
  .author__links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
}

/* ---------- Main content ---------- */
.main { min-width: 0; max-width: 760px; }
.page-title {
  font-family: var(--font-serif);
  color: var(--text-strong); font-size: 2rem; line-height: 1.2;
  margin: 0 0 .5rem;
}
.lead { color: var(--muted); margin: 0 0 2rem; }
.main h2 {
  color: var(--text-strong); font-size: 1.35rem;
  margin: 2.5rem 0 1rem; padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
.main h2:first-of-type { margin-top: 1.5rem; }
.main h3 { color: var(--text-strong); font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.main p { margin: 0 0 1rem; }
.main strong { color: var(--text-strong); }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; list-style: none; margin: 0 0 1rem; }
.tags li {
  font-size: .8rem; padding: .2rem .65rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft);
}

/* News list */
.news { list-style: none; padding: 0; margin: 0; }
.news li {
  display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem;
  padding: .55rem 0; border-bottom: 1px dashed var(--border);
}
.news li:last-child { border-bottom: 0; }
.news time { font-style: italic; color: var(--muted); font-size: .9rem; }
@media (max-width: 520px) {
  .news li { grid-template-columns: 1fr; gap: 0; }
}

/* Publication / item lists */
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.pubs li:last-child { border-bottom: 0; }
.pub__title { font-weight: 600; color: var(--text-strong); display: block; }
.pub__meta { color: var(--muted); font-size: .9rem; display: block; margin-top: .15rem; }
.pub__venue { font-style: italic; }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: .1rem .5rem; border-radius: 4px; margin-right: .35rem; vertical-align: middle;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
}
.pub__links { margin-top: .35rem; font-size: .85rem; }
.pub__links a { margin-right: .75rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; padding: .5rem 0;
}
.timeline .when { color: var(--muted); font-size: .9rem; }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

.callout {
  background: var(--bg-soft); border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem; border-radius: 0 6px 6px 0; margin: 1rem 0 1.5rem;
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
.page-footer {
  background: var(--bg-soft); border-top: 1px solid var(--border);
  color: var(--muted); font-size: .8rem;
}
.page-footer__inner {
  max-width: 1280px; margin: 0 auto; padding: 1.5rem 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
}
.page-footer a { color: var(--muted); }

/* ---------- Contact ---------- */
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem;
  padding: .9rem 0; border-bottom: 1px solid var(--border);
}
.contact-list li:last-child { border-bottom: 0; }
.contact__label { color: var(--muted); font-size: .9rem; }
.contact__value { overflow-wrap: anywhere; }
.copy-btn {
  margin-left: .5rem; font: inherit; font-size: .75rem; cursor: pointer;
  padding: .1rem .55rem; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
}
.copy-btn:hover { color: var(--text-strong); }
@media (max-width: 520px) { .contact-list li { grid-template-columns: 1fr; gap: 0; } }
