/* Source Serif 4 (SIL OFL), self-hosted. Browsers only download these files
   on pages that actually use the font, i.e. blog posts. */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/source-serif-4-latin-opsz-normal.woff2) format('woff2-variations');
  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: 'Source Serif 4';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/source-serif-4-latin-ext-opsz-normal.woff2) format('woff2-variations');
  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: 'Source Serif 4';
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/source-serif-4-latin-opsz-italic.woff2) format('woff2-variations');
  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: 'Source Serif 4';
  font-style: italic;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/source-serif-4-latin-ext-opsz-italic.woff2) format('woff2-variations');
  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;
}

:root {
  /* Palette based on Nightfox (github.com/EdenEast/nightfox.nvim). */
  --bg: #192330;       /* nightfox bg1 */
  --bg-alt: #212e3f;   /* nightfox bg2: code blocks */
  --text: #cdcecf;     /* nightfox fg1 */
  --text-dim: #8e9aaf; /* nightfox comment, lifted slightly for readable contrast */
  --accent: #d4ac0d;
  --border: #29394f;   /* nightfox bg3 */
  --font-display: 'FiraCode Nerd Font', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif 4', Charter, Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
}

/* Highlighted text uses the theme gold; dark text on top keeps it readable. */
::selection { background: var(--accent); color: var(--bg); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; }

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}
.site-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  font-size: 1.1rem;
  letter-spacing: .02em;
}
.brand:hover { color: var(--accent); text-decoration: none; }
.brand:hover .brand-text { color: var(--accent); }

.brand-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  animation-name: typing;
  animation-duration: 900ms;
  animation-fill-mode: both;
}

.brand .cursor {
  display: inline-block;
  width: 4px;
  height: 1.4em;
  margin-left: 1px;
  background: var(--accent);
  animation: blink 1s steps(2, jump-none) infinite;
}

@keyframes typing {
  from { width: 0; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .brand-text { animation: none; width: auto; }
  .brand .cursor { animation: none; }
}

nav { display: flex; gap: 1.25rem; font-family: var(--font-display); font-size: .9rem; }
nav a { color: var(--text-dim); }
nav a:hover { color: var(--accent); }

main { padding: 2.5rem 0 4rem; min-height: 60vh; }

h1, h2, h3 { font-family: var(--font-display); color: var(--text); }
h1 { font-size: 1.6rem; margin-bottom: 1.5rem; }

.timeline-year {
  font-size: 1.05rem;
  color: var(--accent);
  margin: 2.5rem 0 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
}
.timeline-year:first-of-type { margin-top: 0; }

.timeline-list, .paper-list, .teaching-list, .blog-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.about-links {
  display: flex;
  gap: .75rem;
  margin: 0 0 1.5rem;
}
.about-links a {
  font-family: var(--font-display);
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .3rem .7rem;
  color: var(--text);
}
.about-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.keyword-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.keyword {
  font-family: var(--font-display);
  font-size: .78rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .2rem .65rem;
}

.timeline-item, .paper-item, .teaching-item, .service-item {
  display: flex;
  gap: .9rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.timeline-item .icon, .paper-item .icon, .teaching-item .icon, .service-item .icon {
  font-size: 1.1rem;
  line-height: 1.6;
  flex-shrink: 0;
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 5.4rem;
  flex-shrink: 0;
}

.icon-arxiv {
  height: 1.1em;
  width: auto;
  vertical-align: -0.15em;
}

/* ---- Vertical timeline (homepage) ------------------------------------ */
.vtl {
  --line-x: .6rem;                  /* horizontal position of the bar */
  --line: rgba(212, 172, 13, .35);  /* accent gold, semi-transparent */
  --gutter: 2.1rem;                 /* space left of the cards for the bar */
  max-height: min(640px, 70vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  /* Fade out at the bottom to hint there is more below. */
  -webkit-mask-image: linear-gradient(to bottom, #000 90%, transparent);
          mask-image: linear-gradient(to bottom, #000 90%, transparent);
  outline: none;
}
.vtl:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); border-radius: 6px; }

.vtl-track {
  position: relative;
  list-style: none;
  margin: 0;
  /* Bottom padding lets the last card scroll fully clear of the fade. */
  padding: 0 .25rem 4rem var(--gutter);
}
/* The bar itself. */
.vtl-track::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--line-x);
  width: 2px;
  background: var(--line);
}

/* Year marker: gold dot on the bar and the year beside it. It sticks to the
   top of the box while you scroll through that year's entries. */
.vtl-year {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  margin: 0 0 .6rem calc(-1 * var(--gutter));
  padding: .45rem 0;
  background: var(--bg);
}
.vtl-year:not(:first-child) { margin-top: 1.4rem; }
/* Continue the bar through the year row, whose background would hide it. */
.vtl-year::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--line-x);
  width: 2px;
  background: var(--line);
}
.vtl-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin-left: calc(var(--line-x) + 1px - 6px);  /* centre it on the bar */
  margin-right: calc(var(--gutter) - var(--line-x) - 7px);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);  /* small gap between dot and bar */
  flex-shrink: 0;
}
.vtl-year-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

/* Entry: small hollow dot on the bar, a short stem, then the card. */
.vtl-item {
  position: relative;
  margin-bottom: .8rem;
}
.vtl-item::before {
  content: '';
  position: absolute;
  top: 1.15rem;
  left: calc(var(--line-x) + 1px - var(--gutter));
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
  transform: translate(-50%, -50%);
}
.vtl-item::after {
  content: '';
  position: absolute;
  top: 1.15rem;
  left: calc(var(--line-x) + 7px - var(--gutter));
  width: calc(var(--gutter) - var(--line-x) - 7px);
  height: 1px;
  background: var(--border);
}
.tl-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .7rem .9rem;
  transition: border-color .15s ease;
}
.tl-card:hover { border-color: var(--line); }
.tl-card .timeline-meta { margin-bottom: .3rem; min-width: 0; }
.tl-card .timeline-title { display: block; line-height: 1.35; }

.vtl-empty { color: var(--text-dim); }

.timeline-item time, .tl-card time {
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: .8rem;
}

.timeline-title, .paper-title a, .teaching-title a, .service-title a {
  color: var(--text);
  font-weight: 600;
}
.timeline-title:hover, .paper-title a:hover, .teaching-title a:hover, .service-title a:hover { color: var(--accent); }

 .timeline-venue, .paper-venue, .teaching-org, .blog-summary, .service-summary {
  color: var(--text-dim);
  font-size: .92rem;
  margin: .2rem 0 0;
}

.timeline-summary{
    color: var(--text-dim);
}

.paper-links a, .teaching-dates, .service-meta {
  font-size: .85rem;
  font-family: var(--font-display);
  color: var(--text-dim);
}
.paper-links a { margin-right: .75rem; color: var(--accent); }

.cite { margin-top: .5rem; }
.cite summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: .8rem;
  color: var(--accent);
}
.cite summary:hover { text-decoration: underline; }
.cite pre {
  margin-top: .5rem;
  font-size: .78rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-btn {
  display: inline-block;
  margin-top: .5rem;
  font-family: var(--font-display);
  font-size: .75rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .25rem .6rem;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.cite-note {
  margin: .4rem 0 0;
  font-size: .72rem;
  color: var(--text-dim);
  font-style: italic;
}
.intro {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin: 0 0 2.5rem;
}
.intro-photo {
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.intro-text { min-width: 0; }

/* Link buttons under the intro (CV / Scholar / GitHub). */
.intro-links {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1.1rem 0 0;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .42rem .9rem;
  font-family: var(--font-display);
  font-size: .85rem;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }
.btn:hover, .btn:focus-visible {
  text-decoration: none;
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 172, 13, .18);
}
.btn-primary {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus-visible {
  color: var(--bg);
  box-shadow: 0 6px 20px rgba(212, 172, 13, .38);
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover, .btn:focus-visible { transform: none; }
}
.intro p:first-child { margin-top: 0; }

/* Blog posts read as long-form prose: serif body, headings stay monospace. */
.prose-serif, .article-content { font-family: var(--font-serif); font-size: 1.1rem; line-height: 1.7; }

.blog-item { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.blog-meta { color: var(--text-dim); font-family: var(--font-display); font-size: .85rem; margin: .2rem 0 .5rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--text-dim);
  font-size: .85rem;
}

article img { max-width: 100%; }
code, pre { font-family: var(--font-display); }
pre {
  background: var(--bg-alt);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
  border: 1px solid var(--border);
}

@media (max-width: 600px) {
  .wrap { padding: 0 1rem; }
  .site-header { padding: 1rem 0; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: .6rem; }
  nav { gap: .85rem; font-size: .82rem; flex-wrap: wrap; }
  main { padding: 1.75rem 0 3rem; }
  h1 { font-size: 1.35rem; }
  .timeline-year { font-size: .95rem; margin: 2rem 0 .85rem; }

  .timeline-item, .paper-item, .teaching-item, .service-item { flex-wrap: wrap; gap: .35rem; }
  .timeline-meta { min-width: auto; width: 100%; }

  .about-links { flex-wrap: wrap; }

  .intro { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .intro-photo { width: 120px; height: 120px; }
}

@media (max-width: 380px) {
  .brand { font-size: 1rem; }
  nav { gap: .65rem; font-size: .78rem; }
}

.article-content{
    font-size: .78rem;
    color: var(--accent);
}
