/*
 * twicy.github.io
 *
 * The look follows the original Minimal Mistakes theme by Michael Rose
 * (https://github.com/mmistakes/minimal-mistakes, MIT), as adapted by Hanlin Cai
 * (https://github.com/GuangLun2000/GuangLun2000.github.io). Rewritten as plain CSS:
 * flexbox sticky footer, CSS grid layout, self-hosted fonts, Markdown/MathJax styles.
 * The DM Sans typeface and the blue, blurred "aurora" backdrop take their cue from
 * DeepSeek's website (https://www.deepseek.com).
 */

/* Fonts (SIL Open Font License, see assets/fonts/OFL-DMSans.txt) ===========
   DM Sans by Colophon Foundry, one variable file per style and subset (weights
   100-1000, optical sizes 9-40). The basic Latin face is preloaded in
   _includes/head.html; with `font-display: optional` the browser either has it for
   the first paint or keeps the fallback for that page view, so text never re-flows. */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: optional;
  src: url("../fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: optional;
  src: url("../fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-style: italic;
  font-weight: 100 1000;
  font-display: optional;
  src: url("../fonts/dm-sans-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans";
  font-style: italic;
  font-weight: 100 1000;
  font-display: optional;
  src: url("../fonts/dm-sans-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Tokens ================================================================= */
:root {
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-head: var(--font-body);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  /* Neutrals lean slightly blue, to sit with the accent. */
  --page: #f7faff; /* the page ground, under the blue wash */
  --bg: #fff; /* cards and panels */
  --fg: #283347;
  --fg-strong: #0f172a;
  --fg-muted: #64748b;
  --link: #1e293b;
  --line: #e2e8f0;
  --line-soft: #edf1f7;
  --bg-soft: #f1f5fb;
  --code-bg: #f5f8fc;
  --code-inline-bg: #e7edf7;
  --quote-border: #cbd5e1;
  --ink: #0b1b3a; /* footer */

  /* Accent: blues only. */
  --accent-deep: #1d4ed8;
  --accent: #2563eb;
  --accent-light: #60a5fa;
  --accent-gradient: linear-gradient(90deg, var(--accent-deep), var(--accent), var(--accent-light));
  --accent-ring: var(--accent-deep), var(--accent), var(--accent-light), var(--accent), var(--accent-deep);
  --accent-wash: rgb(59 130 246 / 0.14); /* highlighter behind text */
  --accent-shadow: rgb(29 78 216 / 0.45); /* coloured, soft shadows */

  --sidebar: 11rem;
  --gap: 3rem;
  --measure: 40rem;
  --gutter: 1rem;
}

/* Lets gradients rotate (summary card border, photo ring). */
@property --accent-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* Base =================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 106.25%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-y: scroll; /* keep the scrollbar so short and long pages line up */
}
body {
  margin: 0;
  /* Sticky footer: the page is a column and the main area absorbs spare height,
     so the footer sits at the bottom of the window on short pages. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Large, blurred blue and white blocks wash over the top of the page. */
  background:
    radial-gradient(42rem 30rem at 6% -4rem, rgb(59 130 246 / 0.28), transparent 70%),
    radial-gradient(36rem 26rem at 96% 2rem, rgb(147 197 253 / 0.42), transparent 70%),
    radial-gradient(30rem 24rem at 70% 40rem, rgb(191 219 254 / 0.32), transparent 70%),
    var(--page);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  font-optical-sizing: auto;
}
/* A faint dot grid that shows only in the empty margins of wide screens and
   fades out well before the text column. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgb(30 58 138 / 0.13) 1px, transparent 1.4px);
  background-size: 22px 22px;
  --fade: linear-gradient(90deg, #000, transparent calc(50% - 30rem), transparent calc(50% + 30rem), #000);
  -webkit-mask-image: var(--fade);
  mask-image: var(--fade);
}
.site-header,
.site-footer {
  flex: none;
}
.site-body {
  flex: 1 0 auto;
}
::selection {
  background: #dbe7fe;
  color: var(--fg-strong);
}
.wrap {
  width: 100%;
  max-width: calc(var(--sidebar) + var(--gap) + var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: -100vw;
  z-index: 10;
  padding: 0.4rem 0.8rem;
  background: #000;
  color: #fff;
}
.skip-link:focus {
  left: 0.5rem;
}

/* Header ================================================================= */
.site-header {
  padding: 1.25rem 0 1.1rem;
  font-family: var(--font-head);
}
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0.5rem;
  align-items: baseline;
}
.site-title,
.site-nav a {
  color: var(--fg-strong);
  text-decoration: none;
}
/* The name is set like the page titles; the menu is a step smaller and lighter. */
.site-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-nav a {
  color: var(--fg);
  font-size: 1.1rem;
  font-weight: 500;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  position: relative;
}
.site-nav a::before {
  content: "";
  position: absolute;
  top: -0.35em;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg-strong);
}
.site-nav a:hover::before,
.site-nav a[aria-current="page"]::before {
  transform: scaleX(1);
}

/* Sidebar ================================================================ */
.sidebar {
  margin-bottom: 1.75rem;
}
.author {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.author-photo {
  display: block;
  flex: none;
  width: 4.5rem;
  height: 4.5rem;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 50%;
  object-fit: cover;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    conic-gradient(from var(--accent-angle), var(--accent-ring)) border-box;
  box-shadow: 0 14px 30px -16px var(--accent-shadow), 0 2px 6px rgb(15 23 42 / 0.08);
}
.author-photo:hover {
  animation: accent-spin 2.5s linear infinite;
}
.author-bio {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-style: italic;
}
.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  line-height: 1.6;
}
.author-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  color: var(--fg);
  text-decoration: none;
}
.author-links a:hover span {
  text-decoration: underline;
}
.icon {
  flex: none;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* Main column ============================================================ */
.main {
  min-width: 0; /* let wide code blocks and tables scroll instead of widening the page */
  padding-bottom: 3rem;
}
.content {
  overflow-wrap: break-word;
}
.content > :first-child {
  margin-top: 0;
}

/* Footer ================================================================= */
.site-footer {
  padding: 2rem 0 2.5rem;
  background: var(--accent-gradient) top / 100% 3px no-repeat, var(--ink);
  color: #b6c2d9;
  font-family: var(--font-head);
  font-size: 0.95rem;
  line-height: 1.5;
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.site-footer p {
  margin: 0;
}
.site-footer a {
  color: #e2e8f0;
  text-decoration: none;
}
.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

/* Two columns on wider screens =========================================== */
@media (min-width: 54em) {
  :root {
    --gutter: 1.5rem;
  }
  .site-header {
    padding: 2rem 0 1.6rem;
  }
  .header-inner,
  .site-body,
  .footer-inner {
    grid-template-columns: var(--sidebar) minmax(0, var(--measure));
    column-gap: var(--gap);
  }
  .site-body {
    display: grid;
    align-items: start;
  }
  .footer-inner > p {
    grid-column: 2;
  }
  .sidebar {
    position: sticky;
    top: 2rem;
    margin-bottom: 0;
  }
  .author {
    display: block;
  }
  .author-photo {
    width: 8rem;
    height: 8rem;
    margin-bottom: 1.25rem;
  }
  .author-links {
    display: block;
  }
  .author-links li {
    margin-bottom: 0.3rem;
  }
}
@media (min-width: 62em) {
  html {
    font-size: 112.5%;
  }
}
/* Large monitors: scale everything up a little, so the page does not shrink
   into a narrow island; the line length (in characters) stays the same. */
@media (min-width: 80em) {
  html {
    font-size: 118.75%;
  }
}
@media (min-width: 100em) {
  html {
    font-size: 125%;
  }
}

/* Typography ============================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 1.9em 0 0.55em;
  color: var(--fg-strong);
  font-family: var(--font-head);
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.2;
  scroll-margin-top: 1rem;
}
h1 {
  font-size: 2.1rem;
  margin-top: 1.4em;
}
h2 {
  font-size: 1.6rem;
}
h3 {
  font-size: 1.3rem;
}
h4 {
  font-size: 1.15rem;
}
h5 {
  font-size: 1rem;
}
h6 {
  font-size: 0.95rem;
  font-weight: 400;
}
.page-title {
  margin-top: 0;
}
.page-title::after,
.content > h1:first-child::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 3px;
  margin-top: 0.4em;
  border-radius: 3px;
  background: var(--accent-gradient);
}
:is(h1, h2, h3, h4, h5) + :is(h2, h3, h4, h5, h6) {
  margin-top: 0.6em; /* e.g. "Publications" directly followed by "2025" */
}
p,
ul,
ol,
dl,
blockquote,
pre,
table,
figure,
details {
  margin: 0 0 1.15em;
}
strong,
b {
  font-weight: 700;
}
a {
  color: var(--link);
}
.content a {
  text-decoration: underline dotted;
  text-decoration-color: #94a3b8;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
.content a:hover {
  color: var(--accent);
  text-decoration-style: solid;
  text-decoration-color: currentColor;
}
.content ul,
.content ol {
  padding-left: 1.4em;
}
.content ul > li {
  list-style-type: square;
}
.content ol > li {
  list-style-type: decimal;
}
.content li {
  margin: 0.2em 0;
}
.content li > p {
  margin-bottom: 0.5em;
}
.content li > ul,
.content li > ol {
  margin: 0.2em 0 0.4em;
}
dt {
  font-weight: 700;
}
dd {
  margin: 0 0 0.6em 1.5em;
}
blockquote {
  margin: 1.4em 0;
  padding: 0.1em 0 0.1em 1.1em;
  border-left: 4px solid var(--quote-border);
  color: #475569;
}
blockquote > :last-child {
  margin-bottom: 0;
}
hr {
  height: 0;
  margin: 2.2em 0;
  border: 0;
  border-top: 1px solid var(--line);
}
abbr[title] {
  text-decoration: underline dotted;
}
mark {
  background: #fff1a8;
  color: inherit;
}
sub,
sup {
  position: relative;
  font-size: 75%;
  line-height: 0;
  vertical-align: baseline;
}
sup {
  top: -0.5em;
}
sub {
  bottom: -0.25em;
}
.footnotes {
  font-size: 0.9em;
}
summary {
  cursor: pointer;
}

/* AI summary card (_includes/post-summary.html) ========================= */
/* A 1px gradient border that spins while the summary streams in, then rests. */
.summary-card {
  --summary-bg: var(--bg);
  margin: 1.1em 0 1.4em;
  padding: 0.8em 1.15em 0.95em;
  border: 1px solid transparent;
  border-radius: 10px;
  background:
    linear-gradient(var(--summary-bg), var(--summary-bg)) padding-box,
    conic-gradient(from var(--accent-angle), var(--accent-ring)) border-box;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  transition: box-shadow 0.9s ease;
}
.summary-card.is-streaming {
  animation: summary-spin var(--summary-time, 2.5s) cubic-bezier(0.3, 0.1, 0.3, 1);
  box-shadow: 0 10px 30px -16px var(--accent-shadow), 0 0 0 4px rgb(37 99 235 / 0.07);
}
.summary-head {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin-bottom: 0.3em;
  font-family: var(--font-head);
  font-size: 0.85rem;
  line-height: 1.4;
}
.summary-spark {
  flex: none;
  width: 1.05em;
  height: 1.05em;
  fill: var(--accent);
}
.is-streaming .summary-spark {
  animation: summary-twinkle 1.1s ease-in-out infinite;
}
.summary-label {
  background: linear-gradient(90deg, var(--accent-ring)) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.is-streaming .summary-label {
  animation: summary-shimmer 1.4s linear infinite;
}
.summary-by {
  margin-left: auto;
  color: var(--fg-muted);
}
.summary-text {
  margin: 0;
  font-size: 0.95em;
  line-height: 1.65;
}
/* Words start hidden but keep their place, so the card never changes height. */
.summary-card.is-armed .summary-word {
  opacity: 0;
  filter: blur(3px);
  transition: opacity 0.35s ease, filter 0.35s ease;
}
.summary-card.is-armed .summary-word.is-on {
  opacity: 1;
  filter: none;
}
/* An empty inline caret, drawn by ::after: it takes no width and adds no line
   break opportunity, so it stays on the word's line and never re-wraps the text. */
.summary-caret {
  position: relative;
}
.summary-caret::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0.15em;
  width: 0.45em;
  height: 1em;
  border-radius: 2px;
  background: linear-gradient(var(--accent), var(--accent-light));
  animation: summary-blink 0.8s steps(1) infinite;
}
.is-done .summary-caret {
  opacity: 0;
  transition: opacity 0.4s;
}
@keyframes summary-spin {
  to { --accent-angle: 720deg; }
}
@keyframes accent-spin {
  to { --accent-angle: 360deg; }
}
@keyframes summary-shimmer {
  to { background-position: -200% 0; }
}
@keyframes summary-twinkle {
  50% { transform: scale(0.75) rotate(45deg); opacity: 0.7; }
}
@keyframes summary-blink {
  50% { opacity: 0; }
}

/* Page styles (each page sets `class:` in its front matter) =============== */

/* Section headings on list pages trail off into a thin line. */
:is(.about, .publications, .blogs, .services) > h2 {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 1.45rem;
}
:is(.about, .publications, .blogs, .services) > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* About: the introduction floats on a frosted card over the blue wash;
   in Education, the years sit on the right. */
.hero {
  margin: 0 0 2.2rem;
  padding: 1.5rem 1.6rem 1.4rem;
  border: 1px solid rgb(255 255 255 / 0.9);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 #fff inset, 0 22px 50px -28px var(--accent-shadow);
}
.hero > p {
  margin: 0 0 0.9em;
}
.hero > p:last-child {
  margin: 0;
}
.about .when {
  float: right;
  margin-left: 1em;
  color: var(--fg-muted);
  font-family: var(--font-head);
  font-style: normal;
}
.about li::after {
  content: "";
  display: block;
  clear: both;
}

/* Projects: a timeline with one dot per project; the dates sit above each title. */
.projects > :where(:not(.page-title)) {
  margin-top: 0;
  margin-bottom: 0;
  padding: 0 0 1.15em 1.6rem;
  border-left: 2px solid var(--line-soft);
}
.projects > h3 {
  --pad: 1.6em;
  display: flex;
  flex-direction: column-reverse;
  padding-top: var(--pad);
  padding-bottom: 0.4em;
  font-size: 1.3rem;
}
.projects > .page-title + h3 {
  --pad: 0.2em;
}
.projects > h3::before {
  content: "";
  position: absolute;
  top: calc(var(--pad) + 0.02em);
  left: calc(-1px - 0.45rem);
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: 0 0 0 4px var(--bg);
}
.projects > h3 > .heading-anchor {
  right: auto;
  left: 0.4rem;
}
.projects .when {
  margin-bottom: 0.35em;
  color: var(--accent);
  font-size: 0.62em;
  font-style: normal;
  letter-spacing: 0.08em;
}
.projects > ul {
  padding-left: calc(1.6rem + 1.1em); /* bullets line up with the titles */
}
.projects > h3 + p {
  color: var(--fg-muted);
  font-size: 0.92em;
}
.projects img {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

/* Publications: one card per paper, with the venue as a badge. */
.publications ul {
  padding-left: 0;
}
.publications ul > li {
  margin: 0 0 1rem;
  padding: 0.95rem 1.15rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  list-style: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.publications ul > li:hover {
  border-color: #bfd3fb;
  box-shadow: 0 12px 30px -20px var(--accent-shadow);
}
.publications li > p {
  margin: 0;
}
.publications li > p:first-child {
  color: var(--fg-strong);
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.3;
}
.publications li > p:first-child > strong:first-child {
  display: inline-block;
  margin-right: 0.45em;
  padding: 0.1em 0.6em;
  border-radius: 999px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.72em;
  letter-spacing: 0.04em;
  vertical-align: 0.15em;
}
.publications li > p + p {
  margin-top: 0.5em;
  color: var(--fg-muted);
  font-size: 0.9em;
  line-height: 1.6;
}
.publications li > p + p strong {
  color: var(--fg-strong);
  background: linear-gradient(transparent 60%, var(--accent-wash) 0);
}

/* Blogs: one row per post, the whole row is the link. */
.blogs ul {
  padding-left: 0;
}
.blogs ul > li {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 0 -0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  list-style: none;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.blogs ul > li:hover,
.blogs ul > li:focus-within {
  background: var(--bg);
  box-shadow: 0 8px 22px -14px var(--accent-shadow);
}
.blogs ul > li::after {
  content: "→";
  margin-left: auto;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-0.4em);
  transition: opacity 0.2s, transform 0.2s;
}
.blogs ul > li:hover::after,
.blogs ul > li:focus-within::after {
  opacity: 1;
  transform: none;
}
.blogs li a {
  text-decoration: none;
}
.blogs li a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.post-date {
  flex: none;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.8em;
}

/* Paper Notes posts (_drafts/paper-notes-template.md): under each paper's title,
   the affiliations and links, then its tags as pills. */
.paper-meta {
  margin-top: -0.3em;
  color: var(--fg-muted);
  font-size: 0.92em;
}
.content ul.paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.2em;
  padding: 0;
}
.content ul.paper-tags > li {
  margin: 0;
  padding: 0.1em 0.7em;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 600;
  list-style: none;
}

/* Post navigation (_includes/post-nav.html): the previous and next posts as
   cards, then a pill back to the Blogs page. */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-top: 3rem;
}
.post-nav a {
  text-decoration: none; /* ties with `.content a` and wins by coming later */
}
.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1.1rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg-strong);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.post-nav-next {
  grid-column: 2;
  align-items: flex-end;
  text-align: right;
}
.post-nav-link:hover,
.post-nav-all:hover {
  border-color: #bfd3fb;
  box-shadow: 0 12px 30px -20px var(--accent-shadow);
}
.post-nav-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.post-nav-label .icon {
  transition: transform 0.2s;
}
.post-nav-prev:hover .icon {
  transform: translateX(-0.2em);
}
.post-nav-next:hover .icon {
  transform: translateX(0.2em);
}
.post-nav-title {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}
.post-nav-all {
  grid-column: 1 / -1;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.92rem;
  font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s;
}
@media (max-width: 34em) {
  .post-nav {
    grid-template-columns: 1fr;
  }
  .post-nav-next {
    grid-column: auto;
  }
}

/* Services: the institution reads as a small label above its list. */
.services > h3 {
  margin-top: 0.4em;
  color: var(--fg-muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  .author-photo:hover {
    animation: none;
  }
  .site-nav a::before,
  .blogs ul > li,
  .blogs ul > li::after,
  .publications ul > li,
  .post-nav-link,
  .post-nav-all,
  .post-nav-label .icon {
    transition: none;
  }
}

/* Section permalinks (added by _includes/scripts.html) =================== */
.content h2,
.content h3,
.content h4 {
  position: relative;
}
.heading-anchor {
  position: absolute;
  right: 100%;
  padding-right: 0.3em;
  color: #b0b0b0;
  font-weight: 400;
  text-decoration: none !important;
  opacity: 0;
  transition: opacity 0.15s;
}
.content :hover > .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}
@media (hover: none) {
  .heading-anchor {
    display: none;
  }
}

/* Images ================================================================= */
img {
  border: 0;
}
.content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 85vh;
  margin: 1.4em auto;
}

/* Tables ================================================================= */
.content table {
  display: block; /* scroll horizontally when wider than the column */
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.92em;
  line-height: 1.5;
  margin: 1.5em 0;
}
.content th,
.content td {
  padding: 0.45em 0.85em;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.content thead th {
  background: var(--bg-soft);
}
.content tbody tr:nth-child(even) {
  background: rgb(241 245 251 / 0.6);
}

/* Code =================================================================== */
code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}
:not(pre) > code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--code-inline-bg);
  font-size: 0.84em;
}
div.highlighter-rouge,
figure.highlight {
  margin: 1.4em 0;
}
pre {
  margin-top: 0;
  padding: 0.95em 1.15em;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--code-bg);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre;
  tab-size: 4;
}
div.highlighter-rouge pre,
figure.highlight pre {
  margin-bottom: 0;
}
pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}
kbd {
  padding: 0.1em 0.4em;
  border: 1px solid #c8c8c8;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fafafa;
  font-size: 0.8em;
}

/* Syntax highlighting (Rouge tokens). Palette from GitHub Primer's light theme. */
.highlight { color: #1f2328; }
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cpf,
.highlight .c1, .highlight .cs { color: #59636e; font-style: italic; }
.highlight .cp { color: #953800; }
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kp,
.highlight .kr, .highlight .kt, .highlight .kv, .highlight .ow { color: #cf222e; }
.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi,
.highlight .il, .highlight .mo, .highlight .mx { color: #0550ae; }
.highlight .s, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .dl,
.highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .s1, .highlight .ss { color: #0a3069; }
.highlight .sr { color: #116329; }
.highlight .nf, .highlight .fm, .highlight .nd { color: #6639ba; }
.highlight .nc, .highlight .nn, .highlight .ne { color: #953800; }
.highlight .nb, .highlight .bp, .highlight .no, .highlight .na { color: #0550ae; }
.highlight .nt { color: #116329; }
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm { color: #953800; }
.highlight .gd { color: #82071e; background: #ffebe9; }
.highlight .gi { color: #116329; background: #dafbe1; }
.highlight .gh, .highlight .gu { color: #0550ae; font-weight: 700; }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 700; }
.highlight .gr, .highlight .gt, .highlight .err { color: #82071e; }
.highlight .gp, .highlight .go { color: #59636e; }

/* Math (MathJax) ========================================================= */
mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto; /* fallback for the rare equation MathJax cannot wrap */
  overflow-y: hidden;
  padding: 0.1em 0;
}

/* Comments (giscus) ====================================================== */
.comments {
  min-height: 12rem; /* reserve room so the footer does not jump as the widget loads */
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* Print ================================================================== */
@media print {
  .skip-link,
  .site-nav,
  .sidebar,
  .comments,
  .post-nav,
  .site-footer,
  .heading-anchor,
  .summary-caret,
  body::before {
    display: none !important;
  }
  .summary-word {
    opacity: 1 !important;
    filter: none !important;
  }
  .site-body {
    display: block;
  }
  body {
    font-size: 11pt;
  }
  pre {
    white-space: pre-wrap;
  }
}
