:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --bg: #ffffff;
  --text: #2d3748;
  --heading: #111827;
  --meta: #6b7280;
  --border: #e2e8f0;
  --accent: #065f46;
  --accent-hover: #047857;

  --content-width: 1000px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

header {
  margin-bottom: 2.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.headshot {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-text {
  min-width: 0;
}

h1 {
  color: var(--heading);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 0.4rem;
}

.title {
  color: var(--meta);
  font-size: 1.05rem;
  margin: 0 0 1rem;
}

.contact {
  margin: 0;
  font-size: 0.95rem;
  color: var(--meta);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0;
  line-height: 1.9;
}

.contact a,
.contact .email {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.contact .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--meta);
}

.contact a:hover .icon {
  color: var(--accent-hover);
}

.contact .sep {
  color: var(--border);
  margin: 0 0.55rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

section {
  margin-top: 2.75rem;
  scroll-margin-top: 2rem;
}

/* Minimal left table of contents (wide screens only) */
.toc {
  position: fixed;
  top: 50%;
  left: calc(50% - var(--content-width) / 2 - 8.5rem);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  z-index: 10;
}

.toc a {
  color: var(--meta);
  border-bottom: none;
}

.toc a:hover {
  color: var(--accent-hover);
  border-bottom: none;
}

.toc a.active {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 1279px) {
  .toc {
    display: none;
  }
}

h2 {
  color: var(--heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 1.25rem;
}

#bio p {
  margin: 0 0 1rem;
}

#bio p:last-child {
  margin-bottom: 0;
}


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

.pubs > li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.25rem 0.5rem;
  margin-bottom: 1.1rem;
}

.pubs > li:last-child {
  margin-bottom: 0;
}

.pub-icon {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  color: var(--meta);
  padding-top: 0.2rem;
}

.pub-icon svg {
  width: 16px;
  height: 16px;
}

.pubs > li.pub-patent .pub-icon {
  color: var(--accent);
}

.pubs > li.pub-code .pub-icon {
  color: var(--text);
}

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

.pubs .authors,
.pubs .venue {
  color: var(--meta);
}

.pubs .authors {
  display: block;
}

.pubs .authors strong {
  color: var(--text);
  font-weight: 600;
}

/* Writing: borderless blog-roll tiles */
.wr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 1.25rem;
}

.wr-card {
  min-width: 0;
}

.wr-thumb {
  display: block;
  border-bottom: none;
  aspect-ratio: 40 / 21;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.6rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wr-thumb:hover {
  border-bottom: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.12);
}

.wr-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wr-title {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--heading);
  margin-bottom: 0.15rem;
  line-height: 1.35;
}

.wr-title:hover {
  color: var(--accent-hover);
}

.wr-card .meta {
  display: block;
  color: var(--meta);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.3rem;
}

.wr-desc {
  margin: 0;
  color: var(--text);
  font-size: 0.83rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 700px) {
  .wr-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 701px) and (max-width: 900px) {
  .wr-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Highlights: card grid with featured hero */
.hl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.hl-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 0.85rem;
  align-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hl-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.1);
}

.hl-thumb {
  display: block;
  border-bottom: none;
  aspect-ratio: 40 / 21;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.hl-thumb:hover {
  border-bottom: none;
}

.hl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.hl-body .date {
  display: block;
  color: var(--meta);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.25rem;
}

.hl-body .event {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.hl-featured {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 320px) 1fr;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.hl-featured .hl-thumb {
  height: 100%;
  aspect-ratio: auto;
  min-height: 170px;
  border-radius: 0;
}

.hl-featured .hl-body {
  padding: 1rem 1.25rem;
}

.hl-featured .hl-body .event {
  font-size: 1rem;
}

@media (max-width: 700px) {
  .hl-grid {
    grid-template-columns: 1fr;
  }

  .hl-featured {
    grid-template-columns: 1fr;
  }

  .hl-featured .hl-thumb {
    aspect-ratio: 40 / 21;
    min-height: 0;
  }
}

.timeline-wrap {
  position: relative;
}

.timeline-scroll {
  max-height: 22rem;
  overflow-y: scroll;
  padding-right: 1rem;
  scrollbar-gutter: stable;
  mask-image: linear-gradient(
    to bottom,
    black,
    black calc(100% - 3rem),
    transparent
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    black,
    black calc(100% - 3rem),
    transparent
  );
  scrollbar-width: thin;
  scrollbar-color: var(--meta) var(--border);
}

.timeline-scroll::-webkit-scrollbar {
  width: 10px;
}

.timeline-scroll::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 5px;
}

.timeline-scroll::-webkit-scrollbar-thumb {
  background: var(--meta);
  border-radius: 5px;
  border: 2px solid var(--border);
}

.timeline-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--heading);
}

.timeline-hint {
  position: absolute;
  bottom: 0.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  color: var(--meta);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  pointer-events: none;
  letter-spacing: 0.02em;
}

.timeline-hint svg {
  width: 12px;
  height: 12px;
}

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

.timeline > li {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
  align-items: center;
}

.timeline > li:first-child {
  border-top: none;
}

.timeline .date {
  color: var(--meta);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

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

.timeline .thumb-link {
  display: block;
  flex-shrink: 0;
  border-bottom: none;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.timeline .thumb-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.15);
  border-bottom: none;
}

.timeline .thumb {
  display: block;
  width: 96px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Milestone rows: starred */
.timeline > li.milestone .date::after {
  content: " ★";
  color: var(--accent);
  font-size: 0.8em;
}

.timeline-legend {
  margin: 0.6rem 0 0;
  color: var(--meta);
  font-size: 0.78rem;
}

.timeline-legend .legend-star {
  color: var(--accent);
}

/* Featured talk embed */
.video-embed {
  aspect-ratio: 16 / 9;
  max-width: 400px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--border);
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-caption {
  margin: 0.6rem 0 0;
  color: var(--meta);
  font-size: 0.85rem;
}

.pubs .cites {
  display: inline;
  margin-left: 0.4rem;
  color: var(--meta);
  font-size: 0.85rem;
}

footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--meta);
  font-size: 0.85rem;
}

footer p {
  margin: 0;
}

/* Education & Experience: horizontal timeline */
.exp-timeline {
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--meta) transparent;
}

.exp-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr) 0.5fr;
  grid-template-rows: auto 12px auto;
  min-width: 800px;
}

.exp-track::before {
  content: "";
  grid-row: 2;
  grid-column: 1 / -1;
  align-self: center;
  height: 2px;
  background: var(--border);
}

.exp-track > li {
  display: contents;
}

.exp-dot {
  grid-row: 2;
  align-self: center;
  justify-self: start;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--heading);
  border: 2px solid var(--bg);
  z-index: 1;
}

.exp-track > li.exp-school .exp-dot {
  background: var(--accent);
}

.exp-body {
  grid-row: 3;
  align-self: start;
  padding: 0.6rem 1.1rem 0 0;
  display: flex;
  flex-direction: column;
}

.exp-track > li:nth-child(even) .exp-body {
  grid-row: 1;
  align-self: end;
  padding: 0 1.1rem 0.6rem 0;
}

.exp-track > li:nth-child(1) .exp-dot { grid-column: 1; }
.exp-track > li:nth-child(2) .exp-dot { grid-column: 2; }
.exp-track > li:nth-child(3) .exp-dot { grid-column: 3; }
.exp-track > li:nth-child(4) .exp-dot { grid-column: 4; }
.exp-track > li:nth-child(5) .exp-dot { grid-column: 5; }
.exp-track > li:nth-child(6) .exp-dot { grid-column: 6; }
.exp-track > li:nth-child(7) .exp-dot { grid-column: 7; }

.exp-track > li:nth-child(1) .exp-body { grid-column: 1 / span 2; }
.exp-track > li:nth-child(2) .exp-body { grid-column: 2 / span 2; }
.exp-track > li:nth-child(3) .exp-body { grid-column: 3 / span 2; }
.exp-track > li:nth-child(4) .exp-body { grid-column: 4 / span 2; }
.exp-track > li:nth-child(5) .exp-body { grid-column: 5 / span 2; }
.exp-track > li:nth-child(6) .exp-body { grid-column: 6 / span 2; }
.exp-track > li:nth-child(7) .exp-body { grid-column: 7 / span 2; }

.exp-years {
  color: var(--meta);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.15rem;
  white-space: nowrap;
}

.exp-role {
  color: var(--heading);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.35;
}

.exp-org {
  font-size: 0.85rem;
  line-height: 1.35;
}

.exp-loc {
  color: var(--meta);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.exp-legend {
  margin: 0.5rem 0 0;
  color: var(--meta);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.exp-legend .dot-school,
.exp-legend .dot-work {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.exp-legend .dot-school {
  background: var(--accent);
}

.exp-legend .dot-work {
  background: var(--heading);
  margin-left: 0.8rem;
}

@media (max-width: 600px) {
  main {
    padding: 2.5rem 1.25rem 4rem;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .headshot {
    width: 96px;
    height: 96px;
  }

  h1 {
    font-size: 1.85rem;
  }

  .contact {
    font-size: 0.9rem;
  }

  .timeline > li {
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.75rem;
    align-items: start;
  }

  .timeline .date {
    grid-column: 1;
    grid-row: 1;
  }

  .timeline .event {
    grid-column: 1;
    grid-row: 2;
  }

  .timeline .thumb-link {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .timeline .thumb {
    width: 72px;
    height: 48px;
  }

  .hl-card {
    grid-template-columns: 92px 1fr;
    gap: 0.7rem;
  }
}
