/* CSS Reset: http://meyerweb.com/eric/tools/css/reset */

html, body, div, span, h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}

/**************************************************/

#body {
  font-family: 'Asap', roboto, sans-serif;
  font-size: 1em;
  line-height: 1.5em;
  color: var(--text);
  /* Light paper texture: soft blue base with subtle SVG grain. */
  background-color: var(--page);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

#main {
  max-width: 60em;
  margin: 0px auto;
  position: relative;
  min-height: 100vh;
  padding: 0 1.25em 6em;
  box-sizing: content-box;
}

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

a:hover {
  text-decoration: underline;
}

i {
  font-style: italic;
}

b {
  font-weight: 600;
}

h1 {
  font-size: 2.4em;
  line-height: 2.4em;
  font-weight: 500;
}

p {
  margin-bottom: 1em;
}

/**************************************************/
/* Profile image and description. */

#intro {
  padding-top: 3em;
  display: flex;
}

#intro-text {
  width: 30em;
  flex-grow: 1;
  min-width: 0;
  float: left;
  /* Lets .mission scale its font to the width of this column. */
  container-type: inline-size;
}

#intro-text h1 {
  font-size: min(2.4em, 6cqw);
  line-height: 1.25;
  margin-bottom: 0.15em;
  white-space: nowrap;
}

.intro-name {
  width: max-content;
  text-align: center;
  margin-bottom: 1.5em;
}

.name-pronunciation {
  margin: 0;
  text-align: center;
  font-size: 0.85em;
  color: var(--muted);
}

/* The mission statement must always render as exactly 3 lines, one per
   span. The widest line is ~26.5em, so when the text column is narrower
   than that, scale the font down instead of letting lines rewrap
   (100cqw / 26.5em-per-em ~= 3.7cqw). */
.mission span {
  display: block;
  white-space: nowrap;
}

.mission {
  padding: 0.85em 1em;
  border: 1px solid var(--blue-bg);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--callout-bg);
  color: var(--callout-text);
  font-size: 0.95em;
  line-height: 1.5;
}

#intro-image {
  margin: 0 0 0 2em;
  width: 18em;
  max-width: 100%;
  align-self: flex-start;
  float: left;
  flex-shrink: 0;
}

#intro-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.3em;
}

/**************************************************/
/* Content sections. */

.site-footer {
  margin-top: 4em;
  text-align: center;
  font-size: 0.75em;
  color: var(--muted);
}

.site-footer p {
  margin-bottom: 0;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.section {
  margin-top: 2em;
}

h2 {
  font-size: 1.15em;
  line-height: 1.75em;
  margin-bottom: 0.5em;
  color: var(--text);
}

/* News timeline. */

.news-list {
  list-style: none;
}

.news-item {
  display: grid;
  grid-template-columns: 6em minmax(0, 1fr);
  column-gap: 1.25em;
}

.news-date {
  padding-top: 1em;
  font-size: 0.85em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.news-content {
  position: relative;
  padding: 0.75em 0 1em 1.5em;
  border-left: 1px solid var(--border);
}

.news-content::before {
  content: "";
  position: absolute;
  top: 1.3em;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
}

.news-item + .news-item .news-content {
  border-top: 1px solid var(--divider);
}

.news-tag {
  display: inline-block;
  padding: 0.1em 0.65em;
  border-radius: 4px;
  font-size: 0.72em;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.news-paper {
  color: var(--blue-text);
  background: var(--blue-bg);
}

.news-talk {
  color: var(--tan-text);
  background: var(--tan-bg);
}

.news-update {
  color: var(--green-text);
  background: var(--green-bg);
}

.news-content p {
  margin: 0.35em 0 0;
  overflow-wrap: anywhere;
}

@media (max-width: 540px) {
  .news-item {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.75em 0;
  }

  .news-item + .news-item {
    border-top: 1px solid var(--divider);
  }

  .news-date {
    padding-top: 0;
  }

  .news-content {
    padding: 0.35em 0 0;
    border-left: 0;
  }

  .news-item + .news-item .news-content {
    border-top: 0;
  }

  .news-content::before {
    display: none;
  }
}

/* Recent work list. */

.list-item {
  width: 100%;
  margin-top: 0.25em;
  display: flex;
}

.list-item p.date {
  order: 2;
  margin-left: auto;
  padding-left: 1em;
  margin-bottom: 0;
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
}

/* Publications. */

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

h3 {
  font-size: 1em;
  margin-bottom: 0.5em;
  line-height: 1.5em;
  font-weight: 400;
  display: flex;
}

.pub-meta {
  margin-left: auto;
  padding-left: 1em;
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
}

.publication {
  display: grid;
  grid-template-columns: 13em minmax(0, 1fr);
  gap: 1.5em;
  align-items: stretch;
  padding: 1.25em 0;
}

.publication + .publication {
  border-top: 1px solid var(--divider);
}

.publication-media {
  align-self: center;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-sizing: border-box;
}

.publication-teaser {
  display: block;
  width: 100%;
  height: auto;
}

.teaser-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9em;
}

.teaser-placeholder span {
  font-size: 0.8em;
}

.publication-details {
  min-width: 0;
  overflow-wrap: anywhere;
}

.publication h3 {
  display: block;
  margin-bottom: 0.35em;
  font-size: 1.05em;
  font-weight: 600;
  line-height: 1.4;
}

.publication p {
  margin: 0.3em 0 0;
  font-size: 0.92em;
}

.publication-venue {
  font-style: italic;
}

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

.publication .publication-summary {
  margin-top: 0.65em;
  color: var(--muted);
}

@media (max-width: 600px) {
  .publication {
    grid-template-columns: minmax(0, 1fr);
    gap: 1em;
  }

  .publication-media {
    width: 100%;
    max-width: 20em;
  }
}

/**************************************************/
/* Mobile layout. The breakpoint is where the side-by-side intro would
   squeeze the text column below the 30em it needs to keep the mission
   statement's 3 lines intact: 30em text + 2em gap + 18em image + 2.5em
   page padding = 52.5em = 840px. */

@media (max-width: 840px) {
  #intro {
    padding-top: 3em;
    flex-direction: column-reverse;
  }

  #intro-text {
    width: auto;
  }

  #intro-image {
    margin: 0 0 1.5em 0;
  }

  /* Stack dates and citations below their titles. */
  h3 {
    display: block;
  }

  .pub-meta {
    display: block;
    padding-left: 0;
    text-align: left;
    white-space: normal;
  }

  .list-item {
    display: block;
  }

  .list-item p.date {
    display: block;
    padding-left: 0;
    text-align: left;
  }
}

/* Theme palettes and switch. */
:root {
  color-scheme: light;
  --page: #f5fbfc;
  --text: #150c21;
  --link: #146ebe;
  --muted: #6b6870;
  --border: #dcd5ce;
  --divider: #e9e2db;
  --dot: #81756b;
  --accent: #507e98;
  --callout-bg: #e8f2f7;
  --callout-text: #284f66;
  --blue-bg: #cbdfe9;
  --blue-text: #285b78;
  --tan-bg: #e8d5b8;
  --tan-text: #725127;
  --green-bg: #d0dfc8;
  --green-text: #46654b;
  --switch-bg: #dfebf0;
  --switch-thumb: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #141e26;
  --text: #e7eef3;
  --link: #8dc8f5;
  --muted: #aab7c2;
  --border: #3b4c58;
  --divider: #2d3e49;
  --dot: #8a9eac;
  --accent: #84b9d6;
  --callout-bg: #203643;
  --callout-text: #d3e9f5;
  --blue-bg: #a8cddd;
  --blue-text: #203f52;
  --tan-bg: #dcc49e;
  --tan-text: #503b20;
  --green-bg: #b3cfb2;
  --green-text: #294831;
  --switch-bg: #283c4b;
  --switch-thumb: #4b687c;
}

.theme-controls {
  display: flex;
  justify-content: center;
  padding-top: 1em;
}

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 112px;
  height: 44px;
  padding: 0 11.5px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--switch-bg);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--switch-thumb);
  box-shadow: 0 1px 4px #0002;
  transform: translateX(68px);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), background-color 420ms ease;
}

.theme-toggle[hidden] {
  display: none;
}

[data-theme="dark"] .theme-toggle::before {
  transform: translateX(0);
}

.theme-toggle svg {
  position: relative;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle::before {
    transition: none;
  }
}
