:root {
  --bg: #fbfaf8;
  --text: #1c1b19;
  --muted: #6b6963;
  --rule: #e4e1da;
  --accent: #1f5fbf;
  --heading: #1f5fbf;
  --code-bg: #f1efea;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-title: 1.08rem;   /* names: companies, projects, papers, schools, posts */
  --fs-body: 1rem;       /* all running text */
  --fs-small: 0.85rem;   /* dates, roles, tools, notes, menu */
  --fs-label: 0.8rem;    /* section labels in capitals */
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --text: #e9e7e1;
    --muted: #9a978f;
    --rule: #2e2d2a;
    --accent: #7fb0f5;
    --heading: #7fb0f5;
    --code-bg: #1f1f1d;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0 auto;
  padding: 0 20px;
  max-width: 920px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
/* Inside a blog post, links stay underlined so they are visible in long text. */
.post p a, .post li a { text-decoration: underline; }

h1, h2, h3 { font-family: var(--sans); line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 3.5rem 0 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
h3 { font-size: var(--fs-title); margin: 0 0 0.35rem; color: var(--heading); }

main p, main li { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.meta, .eyebrow, .post-list li, .plain li { text-align: left; hyphens: manual; -webkit-hyphens: manual; }

.site-header, .site-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-family: var(--sans);
  font-size: var(--fs-small);
}
.site-header { padding: 2rem 0 3.5rem; }
.site-header nav a, .site-footer a { margin-left: 1.25rem; color: var(--muted); text-decoration: none; }
.site-header nav a:first-child { margin-left: 0; }
.site-header nav a:hover, .site-footer a:hover { color: var(--text); }
.site-name { font-weight: 600; color: var(--text); text-decoration: none; }
.site-footer {
  margin-top: 4.5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

.hero { display: grid; grid-template-columns: 1fr 208px; gap: 3.5rem; align-items: start; }
.hero p:last-child { margin-bottom: 0; }
.hero strong { font-weight: 600; }
.hero-text a { color: var(--heading); text-decoration: none; }
.hero-text a:hover { text-decoration: underline; }
.eyebrow {
  margin: 0 0 0.6rem;
  font-family: var(--sans);
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.portrait {
  width: 208px;
  height: 208px;
  margin-top: 0.4rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
  box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px var(--rule);
}

.hero-side { display: flex; flex-direction: column; align-items: center; gap: 1.75rem; }
.logos { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; list-style: none; margin: 0; padding: 0; }
.logos a { display: block; height: 34px; transition: transform 0.15s; }
.logos a:hover { transform: translateY(-2px); }
.logos picture { display: block; height: 100%; }
.logos img { display: block; height: 100%; width: auto; border-radius: 6px; }


.timeline { list-style: none; margin: 0; padding: 0 0 0 1.5rem; border-left: 1px solid var(--rule); }
.timeline > li { position: relative; padding-bottom: 2.25rem; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 5px);
  top: 0.45rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--muted);
}
.timeline > li.current::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.timeline .when { font-family: var(--sans); font-size: var(--fs-small); color: var(--muted); margin-bottom: 0.2rem; }
.timeline h3 { margin-bottom: 0.1rem; }
.timeline h3 a { color: var(--heading); text-decoration: none; }
.timeline h3 a:hover { text-decoration: underline; }
.timeline p { margin: 0.5rem 0 0; }
.timeline p.meta { margin-top: 0; }
.highlights { margin-top: 1rem; border-bottom: 1px solid var(--rule); }
.highlights details { border-top: 1px solid var(--rule); }
.highlights summary { display: flex; align-items: baseline; gap: 0.9rem; padding: 0.6rem 0; cursor: pointer; list-style: none; font-family: var(--sans); }
.highlights summary::-webkit-details-marker { display: none; }
.highlights summary::before { content: "+"; flex: none; width: 0.9rem; color: var(--accent); font-weight: 600; }
.highlights details[open] summary::before { content: "–"; }
.highlights .h-title { flex: none; font-size: var(--fs-body); font-weight: 600; }
.highlights .h-note { margin-left: auto; font-size: var(--fs-small); color: var(--muted); text-align: right; }
.highlights summary:hover .h-title { color: var(--accent); }
.highlights details p { margin: 0 0 0.9rem 1.8rem; font-size: var(--fs-body); }

.projects { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
/* With an odd number of cards, the first one takes the full width, so no card is alone in a row. */
.projects .project:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.more { margin: 1.5rem 0 0; font-family: var(--sans); font-size: var(--fs-small); text-align: left; }
.more a { text-decoration: none; }
.more a:hover { text-decoration: underline; }
.project {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}
.project:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.project h3 span { color: var(--muted); font-weight: 400; transition: color 0.15s; }
.project:hover h3 span { color: var(--accent); }
.project .body { padding: 1.2rem 1.35rem 1.3rem; }
.project .shot { aspect-ratio: 16 / 9; background: #fcfcfb; border-bottom: 1px solid var(--rule); overflow: hidden; }
.project .shot img { display: block; width: 100%; height: 100%; transition: transform 0.3s; }
.project .shot.cover img { object-fit: cover; }
.project .shot.contain img { object-fit: contain; }
.project:hover .shot img { transform: scale(1.03); }
.project p { margin: 0 0 0.6rem; font-size: var(--fs-body); text-align: left; hyphens: manual; -webkit-hyphens: manual; }
.project p:last-child { margin-bottom: 0; }
.project .result { padding-left: 0.9rem; border-left: 2px solid var(--accent); }

.plain { list-style: none; margin: 0; padding: 0; }
.plain li { margin-bottom: 1.1rem; }
.plain li:last-child { margin-bottom: 0; }
.plain strong, .plain .paper { font-family: var(--sans); font-size: var(--fs-title); font-weight: 600; }
.plain .paper, .plain strong { color: var(--heading); }
.plain .paper { text-decoration: none; }
.plain .paper:hover { text-decoration: underline; }
.plain > li > .meta { display: block; margin-top: 0.15rem; line-height: 1.5; }
.plain.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }

.meta, time { font-family: var(--sans); font-size: var(--fs-small); color: var(--muted); }

.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin-bottom: 0.75rem;
}
.post-list.with-summary li { margin-bottom: 1.75rem; }
.post-list a { font-size: var(--fs-title); font-weight: 600; color: var(--heading); text-decoration: none; }
.post-list a:hover { text-decoration: underline; }
.post-list p { flex-basis: 100%; margin: 0.25rem 0 0; color: var(--muted); }

.post header { margin-bottom: 2.5rem; }
.post header h1 { margin-bottom: 0.5rem; }
.post h2 {
  font-size: 1.35rem;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text);
  border-top: 0;
  padding-top: 0;
  margin: 2.5rem 0 0.75rem;
}
.post h3 { margin: 2rem 0 0.5rem; }
.post img { display: block; max-width: 100%; height: auto; margin: 1.75rem auto; border-radius: 8px; border: 1px solid var(--rule); }
.post table { margin: 1.5rem 0; }
.post li { margin-bottom: 0.4rem; }
.back { margin-top: 3rem; font-family: var(--sans); font-size: var(--fs-small); }
.back a { text-decoration: none; }
.back a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 0.85em; }
code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; }
pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; font-size: 1em; }

.post table { display: block; overflow-x: auto; border-collapse: collapse; font-family: var(--sans); font-size: 0.85rem; }
th, td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--rule); color: var(--muted); }

@media (max-width: 700px) {
  body { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  .site-header { padding-bottom: 2.5rem; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-side { order: -1; align-items: flex-start; }
  .projects { grid-template-columns: 1fr; }
  .highlights summary { flex-wrap: wrap; gap: 0 0.9rem; }
  .highlights .h-note { flex-basis: 100%; margin-left: 1.8rem; text-align: left; }
  .highlights details p { margin-left: 0; }
  .portrait { width: 120px; height: 120px; margin-top: 0; }
  .hero-side { flex-direction: row; align-items: center; gap: 1.5rem; }
  .logos { flex-direction: row; gap: 12px; }
  .logos a { height: 28px; }
  .site-header nav { display: flex; justify-content: space-between; width: 100%; font-size: 0.85rem; }
  .site-header nav a { margin-left: 0; }
  /* A narrow column leaves wide gaps between words when it is justified. */
  main p, main li { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .project, .project .shot img { transition: none; }
  .project:hover .shot img { transform: none; }
  .project:hover { transform: none; }
}

@media (max-width: 380px) {
  .hero-side { gap: 1rem; }
  .portrait { width: 100px; height: 100px; }
  .logos { gap: 10px; }
  .logos a { height: 24px; }
  .site-header nav { font-size: 0.8rem; }
}
