/* Site styles, following the paper companion pages: serif reading text,
   small sans UI labels, hairline rules, and a single green accent. */

:root {
  --paper: #fff;
  --ink: #222;
  --text: #333;
  --soft: #444;
  --muted: #62665f;
  --faint: #7a8073;
  --line: #e1e3dc;
  --rule: #cfd6c8;
  --green: #76b900;
  --green-ink: #477300;
  --green-line: #c9d7b6;
  --selection: #dcefba;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Helvetica Neue', Arial, sans-serif;
  --page-width: 1040px;
  --text-width: 780px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #131512;
  --ink: #ecede8;
  --text: #d3d6ce;
  --soft: #c0c4ba;
  --muted: #9ba193;
  --faint: #868c7f;
  --line: #2a2e27;
  --rule: #3d4438;
  --green-ink: #a4d65e;
  --green-line: #4d6232;
  --selection: #3b4d22;
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.8 var(--serif);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
img, video, svg { display: block; }
::selection { background: var(--selection); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--green-ink);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font: 13px var(--sans);
  opacity: 0;
  pointer-events: none;
}

.skip-link:focus {
  opacity: 1;
  pointer-events: auto;
}

.column {
  width: min(var(--text-width), calc(100% - 64px));
  margin-inline: auto;
}

/* Header */
.site-header,
.site-footer {
  width: min(var(--page-width), calc(100% - 96px));
  margin-inline: auto;
}

.site-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.site-home {
  font: 600 20px var(--serif);
  letter-spacing: -0.5px;
  color: var(--ink);
}


.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font: 12px var(--sans);
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover { color: var(--ink); }

.theme-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

:root[data-theme="dark"] .icon-moon,
:root:not([data-theme="dark"]) .icon-sun { display: none; }

/* Intro: portrait beside name, then the bio */
.intro { padding-top: 48px; }

.intro-head {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.portrait {
  flex-shrink: 0;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  object-fit: cover;
}

.intro h1 {
  font: 400 28px/1.2 var(--serif);
  letter-spacing: -0.3px;
}

.intro-title {
  margin-top: 4px;
  font: 400 16px/1.5 var(--serif);
}

.intro-affiliations {
  font: 14.5px/1.6 var(--serif);
  color: var(--muted);
}

.icon-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 8px 0 0 -6px;
}

.icon-links a {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  transition: color 0.2s;
}

.icon-links a:hover { color: var(--ink); }

.icon-links svg {
  width: 17px;
  height: 17px;
}

.icon-fill { fill: currentColor; }

.icon-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Publication link buttons */
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font: 12px/1.2 var(--sans);
  color: var(--ink);
  transition: border-color 0.2s, color 0.2s;
}

a.pub-link:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.pub-link svg {
  width: auto;
  height: 14px;
}

.pub-link.pending {
  border-style: dashed;
  color: var(--faint);
  cursor: default;
}

.pub-link.pending svg { opacity: 0.7; }

.pub-link.pending small {
  font-size: 10.5px;
  color: var(--faint);
}

/* Reading text */
.prose {
  font: 16px/1.8 var(--serif);
  color: var(--text);
  text-align: justify;
  hyphens: auto;
}

.prose p + p { margin-top: 15px; }

.prose strong {
  font-weight: 600;
  color: var(--ink);
}

.prose a,
.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 4px;
}

.prose a:hover,
.link:hover { text-decoration-color: var(--ink); }

/* Sections */
.section { padding-top: 40px; }

.section h2,
.cv-section h2 {
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font: 400 19px/1.3 var(--serif);
}

/* News timeline: a hairline rail with hollow marks; pointing at one item lets the rest recede */
.timeline {
  position: relative;
  list-style: none;
  padding: 0 0 0 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(var(--paper), var(--rule) 32px, var(--rule) calc(100% - 32px), var(--paper));
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 11px 0;
  font: 16px/1.65 var(--serif);
  color: var(--text);
  transition: opacity 0.15s;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -30px;
  top: calc(11px + 0.825em - 5px);
  width: 9px;
  height: 9px;
  border: 1px solid var(--faint);
  border-radius: 50%;
  background: var(--paper);
  transition: background-color 0.15s, border-color 0.15s;
}

.timeline:hover li:not(:hover) { opacity: 0.45; }

.timeline li:hover::before {
  background: var(--ink);
  border-color: var(--ink);
}

.timeline time {
  font: 12.5px/1.65 var(--sans);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.timeline strong { font-weight: 600; color: var(--ink); }

/* Rows separated by hairlines: entries, publications */
.rows { list-style: none; padding: 0; }

.rows > * + * { border-top: 1px solid var(--line); }

.entries > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  align-items: baseline;
  padding: 11px 0;
  font: 16px/1.65 var(--serif);
  color: var(--text);
}

.entries dt {
  font: 12.5px/1.65 var(--sans);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.entries dd span { display: block; }

.entry-meta {
  font-size: 14.5px;
  color: var(--muted);
}

/* Publications */
.pub {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 24px 0;
}

.pub-media {
  display: block;
  aspect-ratio: 18 / 11;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: border-color 0.2s;
}

.pub-media:hover { border-color: var(--soft, #888); }

/* Publication thumbnails, drawn by thumbs.js. All three share one style: ink and grey for the scene,
   the paper's accent (its project page's colour) for what the method picks, red only for failure.
   Each is complete at rest and plays once (class .play) when scrolled into view or pointed at. */
.thumb {
  width: 100%;
  height: 100%;
  font-family: var(--sans);
  --accent: var(--green);
  --accent-ink: var(--green-ink);
  --fail: #d0433d;
}

.thumb[data-thumb="vlmrb"] { --accent: #c24168; --accent-ink: #a8325a; }
.thumb[data-thumb="miso"] { --accent: #599714; --accent-ink: #4a7f10; }
:root[data-theme="dark"] .thumb { --fail: #e0605a; }
:root[data-theme="dark"] .thumb[data-thumb="vlmrb"] { --accent: #e0678c; --accent-ink: #e27d9c; }
:root[data-theme="dark"] .thumb[data-thumb="miso"] { --accent: #7cb342; --accent-ink: #8fcb4a; }

.t-badge { fill: var(--accent); }
.t-cross-disc { fill: var(--fail); }
.t-mark { fill: none; stroke: var(--paper); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.t-label { font-size: 20px; font-weight: 700; fill: var(--accent-ink); }
.t-arrow { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.t-arrow.hi { stroke: var(--accent); stroke-width: 4.5; }
.t-dim { opacity: 0.4; }
.t-faint { opacity: 0.45; }

/* CodeTriage: failing programs, the edits proposed for each, and each edit's score */
.t-card { fill: var(--paper); stroke: var(--soft); stroke-width: 2.5; }
.t-code { fill: none; stroke: var(--rule); stroke-width: 6; stroke-linecap: round; }
.t-code.thin { stroke-width: 5; }
.t-code.bug { stroke: var(--fail); }
.t-code.fix { stroke: var(--accent); }
.t-chip { fill: var(--paper); stroke: var(--rule); stroke-width: 2.5; }
.t-chip.pick { stroke: var(--accent); stroke-width: 4; }
.t-link { fill: none; stroke: var(--rule); stroke-width: 2.5; }
.t-score { fill: none; stroke: var(--rule); stroke-width: 7; }
.t-score.top { stroke: var(--accent); }
.t-go { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* VLM-RB: pick-and-place clips, the VLM that looks at them, and what replay does with them */
.t-shot { fill: var(--paper); stroke: var(--rule); stroke-width: 2; }
.t-shot.good { stroke: var(--accent); stroke-width: 5; }
.t-table { fill: none; stroke: var(--soft); stroke-width: 3; }
.t-pad { fill: none; stroke: var(--faint); stroke-width: 6; }
.t-cube { fill: var(--soft); }
.t-grip { fill: none; stroke: var(--ink); stroke-width: 3.5; }
.t-box { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.t-eye { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }
.t-pupil { fill: var(--accent); }

/* MISO: a road, a stopped car, the averaged plan and MISO's distinct plans */
.t-road { fill: none; stroke: var(--rule); stroke-width: 3; }
.t-lane { fill: none; stroke: var(--rule); stroke-width: 2.5; stroke-dasharray: 14 10; }
.t-car { fill: var(--ink); }
.t-stopped { fill: var(--faint); }
.t-glass { fill: var(--paper); opacity: 0.55; }
.t-mean { fill: none; stroke: var(--muted); stroke-width: 4; stroke-dasharray: 9 7; }
.t-plan { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; opacity: 0.45; }
.t-plan.best { stroke-width: 5.5; opacity: 1; }
.t-plan.stop { stroke-width: 4; }

.thumb.play .t-pop { animation: t-pop 0.45s var(--d) both; }
.thumb.play .t-fade { animation: t-fade 0.6s var(--d) both; }
.thumb.play .t-draw { stroke-dasharray: 1 2; animation: t-draw 0.7s var(--d) ease-in-out both; }
.thumb.play .t-dim { animation: t-dim 0.4s var(--d) both; }
.thumb.play .t-look { animation: t-look 1.6s var(--d) ease-in-out both; }
.t-pop, .t-look { transform-box: fill-box; transform-origin: center; }

@keyframes t-pop { from { opacity: 0; scale: 0.4; } }
@keyframes t-fade { from { opacity: 0; } }
@keyframes t-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes t-dim { from { opacity: 1; } }
@keyframes t-look { 0% { translate: 6px 0; } 25% { translate: -7px -4px; } 55% { translate: -7px 4px; } 100% { translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .thumb.play * { animation: none !important; }
}

.pub h3 {
  font: 400 16.5px/1.45 var(--serif);
}

.pub h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }

.pub-authors {
  margin-top: 6px;
  font: 15px/1.6 var(--serif);
  color: var(--soft);
}

.pub-authors strong {
  font-weight: 600;
  color: var(--ink);
}

.pub-venue {
  font: italic 15px/1.6 var(--serif);
  color: var(--muted);
}

.pub-summary {
  margin-top: 6px;
  font: 15px/1.6 var(--serif);
  color: var(--text);
  text-align: justify;
  hyphens: auto;
}

/* CV */
.cv { padding-top: 44px; }

.cv-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.cv-head h1 {
  font: 400 28px/1.2 var(--serif);
  letter-spacing: -0.3px;
}

.cv-subtitle {
  margin-top: 4px;
  font: 15px/1.5 var(--serif);
  color: var(--muted);
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 8px;
  font: 12.5px/1.6 var(--sans);
}

.cv-contact a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--soft);
}

.cv-contact a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cv-contact svg { width: 13px; height: 13px; }

.cv-print {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font: 12px/1.2 var(--sans);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.cv-print:hover { border-color: var(--ink); color: var(--ink); }
.cv-print svg { width: 12px; height: 12px; }

.cv-section { padding-top: 26px; }

.cv-lead {
  font: 15px/1.7 var(--serif);
  color: var(--text);
  text-align: justify;
  hyphens: auto;
}

.cv-entries {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font: 15px/1.6 var(--serif);
  color: var(--text);
}

.cv-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.cv-entry-title { color: var(--ink); font-weight: 600; }

.cv-when {
  flex-shrink: 0;
  font: 12px/1.6 var(--sans);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cv-venue { font: italic 14px/1.6 var(--serif); }

.cv-entry-sub {
  font-size: 14.5px;
  color: var(--muted);
}

.cv-entry-sub strong { font-weight: 600; color: var(--ink); }

.cv-entry ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 14.5px;
  line-height: 1.6;
  text-align: justify;
  hyphens: auto;
}

.cv-entry li::marker { color: var(--faint); }

.cv-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 15px/1.6 var(--serif);
}

.cv-grid div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: baseline;
}

.cv-grid dt { font: 12.5px/1.6 var(--sans); color: var(--muted); }
.cv-grid dd { margin: 0; color: var(--text); }

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 72px;
  padding: 22px 0 29px;
  border-top: 1px solid var(--line);
  font: 12px var(--serif);
  color: var(--faint);
}

.site-footer div {
  display: flex;
  gap: 22px;
}

.site-footer a:hover { color: var(--ink); }

/* Responsive */
@media (max-width: 850px) {
  .site-header,
  .site-footer { width: calc(100% - 64px); }

  .site-nav { gap: 18px; }
  .intro { padding-top: 40px; }
}

@media (max-width: 600px) {
  .site-header,
  .site-footer,
  .column { width: calc(100% - 40px); }

  .site-header { height: 57px; }
  .site-nav a { display: none; }

  .intro { padding-top: 32px; }

  .intro-head {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .portrait {
    width: 108px;
    height: 108px;
  }

  .intro h1 { font-size: 26px; }
  .intro-title { font-size: 15.5px; }
  .intro-affiliations { font-size: 14px; }
  .icon-links { justify-content: center; margin-left: 0; }

  .prose { font-size: 15px; text-align: left; }

  .section { padding-top: 34px; }

  .timeline li { grid-template-columns: 1fr; gap: 0; font-size: 15px; }
  .timeline li::before { top: 16px; } /* centred on the date line, which now sits on top */

  .entries > div {
    grid-template-columns: 1fr;
    gap: 2px;
    font-size: 15px;
  }


  .pub {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 0;
  }

  .pub-media { aspect-ratio: 16 / 7; }
  .pub-authors, .pub-venue, .pub-summary { font-size: 14px; }
}

@media (max-width: 600px) {
  .cv { padding-top: 28px; }
  .cv-head { flex-direction: column; gap: 14px; }
  .cv-entry-head { flex-direction: column; gap: 0; }
  .cv-grid div { grid-template-columns: 1fr; gap: 0; }
  .cv-lead, .cv-entry ul { text-align: left; }
}

/* Print / Save as PDF: light palette, no chrome, the CV on one Letter page */
@media print {
  :root,
  :root[data-theme="dark"] {
    --paper: #fff;
    --ink: #222;
    --text: #333;
    --soft: #444;
    --muted: #62665f;
    --faint: #7a8073;
    --line: #e1e3dc;
    --rule: #cfd6c8;
    --green-ink: #477300;
    color-scheme: light;
  }

  @page { size: letter; margin: 0.5in; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-header, .site-footer, .cv-print, .skip-link { display: none !important; }
  .column { width: 100%; }
  .cv { padding: 0; }
  .cv-head { padding-bottom: 8px; }
  .cv-head h1 { font-size: 22px; }
  .cv-subtitle, .cv-lead, .cv-entries, .cv-grid { font-size: 11.5px; line-height: 1.45; }
  .cv-contact, .cv-when, .cv-grid dt { font-size: 10px; }
  .cv-venue { font-size: 11px; }
  .cv-entry-sub, .cv-entry ul { font-size: 11px; line-height: 1.4; }
  .cv-section { padding-top: 10px; }
  .section h2, .cv-section h2 { font-size: 14px; margin-bottom: 4px; padding-bottom: 3px; }
  .cv-entries { gap: 5px; }
  .cv-grid { gap: 3px; }
  .cv-section, .cv-entry, .cv-entry-head { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
