/* Single-column academic layout.
   Type: Source Serif 4 for the name and headings, Source Sans 3 for text. */

:root {
  --bg: #fcfcfd;
  --fg: #1c2230;
  --muted: #6b7280;
  --soft: #4b5563;
  --rule: #d6dae1;
  --rule-soft: #e5e8ed;
  --accent: #171717;
  --accent-strong: #111111;
  --link: #1a4770;
  --link-hover: #4a9fd4;
  --code-bg: #f3f5f8;
  --bracket: #9aa3b2;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Source Code Pro", "Courier New", Courier, monospace;
}

html {
  font-size: 16px;
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg);
}

body {
  margin: 0;
  line-height: 1.55;
  padding-top: 56px;
}

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

/* Top navigation bar (same as the original design) */
.top-bar {
  background: rgba(23, 23, 23, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

.top-bar .box {
  width: 100%;
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.25em;
}

.top-bar .logo {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.top-bar nav a {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  position: relative;
  padding-bottom: 2px;
  margin-left: 1.5em;
}

.top-bar nav a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #fff;
  transition: width 0.3s ease;
}

.top-bar nav a:hover::after,
.top-bar nav a.active::after {
  width: 100%;
}

.top-bar a:hover {
  color: #fff;
  text-decoration: none;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5em 1.25em 3em;
}

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

p {
  margin: 0 0 0.9em;
}

.muted {
  color: var(--muted);
}

/* Masthead */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2em;
  padding-bottom: 1.75em;
  margin-bottom: 1.75em;
  border-bottom: 1px solid var(--rule);
}

.masthead h1 {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 0 0 0.35em;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.masthead-line {
  margin: 0 0 0.15em;
}

.masthead-line a {
  color: var(--fg);
}

.masthead-line a:hover {
  color: var(--link-hover);
}

.masthead-links {
  margin-top: 0.9em;
  font-weight: 600;
}

.masthead-links .sep {
  color: var(--bracket);
  margin: 0 0.4em;
  font-weight: 400;
}

.masthead-photo {
  width: 176px;
  height: 220px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 3px;
  outline: 1px solid var(--rule);
  outline-offset: 3px;
}

/* Sections */
section {
  margin-top: 2.25em;
}

section h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent-strong);
  margin: 0 0 0.8em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--rule);
}

.about p {
  font-size: 1.03rem;
}

.about strong {
  font-weight: 600;
  color: var(--accent-strong);
}

/* Publications */
.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pub {
  padding: 0.8em 0;
}

.pub:first-child {
  padding-top: 0;
}

.pub + .pub {
  border-top: 1px solid var(--rule-soft);
}

.pub-body {
  min-width: 0;
}

.pub-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 0.25em;
}

.venue {
  display: inline-block;
  color: #fff;
  background: #6b7280;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  padding: 0.42em 0.6em 0.3em;
  margin-right: 0.45em;
  border-radius: 4px;
  vertical-align: 0.2em;
  white-space: nowrap;
}

.venue-isca   { background: #428bca; }
.venue-asplos { background: #009688; }
.venue-hpca   { background: #9163aa; }
.venue-micro  { background: #c0392b; }

a.venue:hover { opacity: 0.85; text-decoration: none; color: #fff; }

.pub-authors,
.pub-venue,
.pub-links {
  font-size: 0.95rem;
}

.pub-venue {
  color: var(--soft);
}

.pub-authors .me {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.pub-links {
  margin-top: 0.3em;
}

.pub-links a {
  margin-right: 0.85em;
  font-weight: 600;
}

.pub-links a::before {
  content: "[";
  color: var(--bracket);
  font-weight: 400;
}

.pub-links a::after {
  content: "]";
  color: var(--bracket);
  font-weight: 400;
}

/* BibTeX */
.bibtex-container {
  position: relative;
  margin-top: 0.5em;
}

.bibtex {
  display: none;
  margin: 0;
  padding: 0.75em;
  background: var(--code-bg);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-x: auto;
}

.copy-button {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  font: inherit;
  font-size: 12px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}

/* Education / teaching */
.timeline {
  display: grid;
  grid-template-columns: 9em 1fr;
  gap: 0.4em 1em;
  margin: 0;
}

.timeline dt {
  color: var(--muted);
  font-size: 0.95rem;
  padding-top: 0.05em;
  font-variant-numeric: tabular-nums;
}

.timeline dd {
  margin: 0;
}

/* Footer */
.site-footer {
  margin-top: 3em;
  padding-top: 1em;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Small screens */
@media (max-width: 600px) {
  .page {
    padding-top: 2em;
  }

  .top-bar nav a {
    margin-left: 0.75em;
    font-size: 14px;
  }

  .masthead {
    flex-direction: column-reverse;
    gap: 1.25em;
  }

  .masthead-photo {
    width: 128px;
    height: 160px;
  }

  .timeline {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .timeline dd {
    margin-bottom: 0.6em;
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181e;
    --fg: #e3e6eb;
    --muted: #9aa3b2;
    --soft: #b6bdc9;
    --rule: #333a46;
    --rule-soft: #2a303a;
    --accent: #f0f0f0;
    --accent-strong: #f5f5f5;
    --link: #63b3ed;
    --link-hover: #90cdf4;
    --code-bg: #1e222a;
    --bracket: #6b7382;
  }
}
