/* ===== Fonts (self-hosted, SIL OFL 1.1, see assets/fonts/OFL.txt) ===== */

@font-face {
  font-display: swap;
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  src: url(assets/fonts/newsreader-roman.woff2) format('woff2');
}

@font-face {
  font-display: swap;
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  src: url(assets/fonts/newsreader-italic.woff2) format('woff2');
}

@font-face {
  font-display: swap;
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  src: url(assets/fonts/jetbrains-mono.woff2) format('woff2');
}

/* ===== Design tokens ===== */

:root {
  --bg: #f4f4f1;
  --ink: #15171c;
  --ink-2: #3d4049;
  --muted: #5f636d;
  --line: #dcdcd6;
  --card: #fff;
  --accent: #3535c8;
  --accent-soft: #b9b9ec;
  --accent-hover: #1f1f8a;
  --tint: #ebebf7;
  --now: #d4401f;
  --now-text: #b8361a;
  --footer-muted: #a7aab3;
  --serif: 'Newsreader', georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, menlo, monospace;
}

/* ===== Base ===== */

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

body {
  background: var(--bg);
  color: var(--ink);
  font: 19px/1.6 var(--serif);
  margin: 0;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}

ol,
ul {
  list-style: none;
  padding: 0;
}

img {
  display: block;
  height: auto;
  max-width: 100%;
}

h1 {
  font: 500 clamp(40px, 8vw, 64px)/1.04 var(--serif);
  letter-spacing: -1.5px;
}

h2 {
  font: 500 32px/1.25 var(--serif);
  letter-spacing: -0.5px;
}

h3 {
  font: 600 21px/1.25 var(--serif);
}

a {
  color: var(--accent);
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentcolor;
}

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

/* ===== Layout ===== */

.wrap {
  margin-inline: auto;
  max-width: 1160px;
  padding-inline: 28px;
}

main > .wrap {
  padding-block: 48px;
}

main > .intro {
  padding-top: 72px;
}

.lede {
  color: var(--ink-2);
  font-size: 21px;
  margin-top: 24px;
  max-width: 34em;
}

.intro h1 {
  margin-top: 16px;
}

/* Hero: text left, card right; wraps on narrow screens */

.hero {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 56px;
}

.hero > div {
  flex: 999 1 520px;
  min-width: 0;
}

.hero > aside {
  flex: 1 1 300px;
  max-width: 380px;
  min-width: 0;
  padding: 22px;
}

.hero h1 {
  max-width: 14ch;
}

.speaker {
  align-items: flex-start;
}

.speaker > aside {
  max-width: 320px;
  padding: 20px;
}

.speaker h2 {
  margin-top: 40px;
}

.speaker h2 + .lede {
  font-size: 20px;
  margin-top: 10px;
  max-width: 36em;
}

/* ===== Header + footer ===== */

body > header {
  border-bottom: 1px solid var(--line);
}

body > header > .wrap {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-block: 14px;
}

body > header > .wrap > div {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
}

.name {
  align-items: center;
  color: var(--ink);
  display: flex;
  font: 600 22px/1.6 var(--serif);
  letter-spacing: -0.3px;
  min-height: 44px;
  text-decoration: none;
}

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

.social {
  display: flex;
}

.social a {
  align-items: center;
  display: flex;
  height: 44px;
  justify-content: center;
  width: 40px;
}

.social img {
  border-radius: 3px;
  height: 18px;
  width: 18px;
}

body > header nav {
  display: flex;
  flex-wrap: wrap;
  font: 14px/1.6 var(--mono);
  gap: 0 4px;
}

body > header nav a {
  padding: 12px 10px;
  text-decoration: none;
}

body > header nav [aria-current='page'] {
  color: var(--ink);
  text-decoration: underline var(--now);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

body > footer {
  background: var(--ink);
  margin-top: 72px;
}

body > footer p {
  color: var(--footer-muted);
  font: 12px/1.6 var(--mono);
  padding-block: 28px;
}

/* Grayscale until hovered: social icons and the Play screenshot */

.social img,
.play img {
  filter: grayscale(1);
  opacity: 0.7;
  transition: filter 0.15s, opacity 0.15s;
}

.social a:hover img,
.social a:focus-visible img,
.play:hover img,
.play:focus-within img {
  filter: none;
  opacity: 1;
}

/* ===== Shared components ===== */

.label {
  color: var(--muted);
  font: 12px/1.6 var(--mono);
  letter-spacing: 1px;
}

.intro .label:first-child {
  font-size: 13px;
  letter-spacing: 0.5px;
}

.label [aria-hidden] {
  color: var(--now);
}

.links {
  font: 13px/1.6 var(--mono);
  margin-top: 16px;
}

.section-head {
  align-items: baseline;
  border-top: 1px solid var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-top: 16px;
}

.section-head a {
  font: 14px/1.6 var(--mono);
  padding-block: 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
}

.card :where(p:not([class])) {
  color: var(--ink-2);
  font: 17px/1.5 var(--serif);
}

/* Feature: media left, text right */

.feature {
  display: flex;
  flex-wrap: wrap;
}

.feature + .feature {
  margin-top: 28px;
}

.feature > .media {
  flex: 1 1 420px;
  min-width: 0;
}

.feature > div:last-child {
  flex: 999 1 380px;
  min-width: 0;
  padding: 32px 36px;
}

.feature .label + * {
  margin-top: 10px;
}

.feature :is(h2, h3) {
  font: 500 34px/1.12 var(--serif);
  letter-spacing: -0.5px;
}

.feature :where(p:not([class])) {
  font-size: 18px;
  margin-top: 16px;
}

/* Media: 16:9 box for photos, screenshots and figures */

.media {
  aspect-ratio: 16 / 9;
  background: var(--tint);
  display: block;
  position: relative;
}

.media img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.media span {
  background: var(--card);
  border-radius: 50%;
  color: var(--accent);
  display: grid;
  font-size: 22px;
  height: 56px;
  inset: 0;
  margin: auto;
  place-items: center;
  position: absolute;
  width: 56px;
}

/* Teaser figures are diagrams: never crop them */

img[src*='/teasers/'] {
  background: var(--card);
  object-fit: contain;
}

.media img[src*='/teasers/'] {
  padding: 16px;
}

/* Portrait with four corner brackets (two per element) */

.frame {
  padding: 10px;
  position: relative;
}

.frame img {
  aspect-ratio: 1;
  object-fit: cover;
  width: 100%;
}

.frame::before,
.frame::after,
.frame > div::before,
.frame > div::after {
  border: 0 solid var(--accent);
  content: '';
  height: 18px;
  position: absolute;
  width: 18px;
}

.frame::before {
  border-width: 2px 0 0 2px;
  left: 0;
  top: 0;
}

.frame::after {
  border-width: 2px 2px 0 0;
  right: 0;
  top: 0;
}

.frame > div::before {
  border-width: 0 0 2px 2px;
  bottom: 0;
  left: 0;
}

.frame > div::after {
  border-width: 0 2px 2px 0;
  bottom: 0;
  right: 0;
}

.frame + .label {
  margin-top: 16px;
}

.btn {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  display: inline-flex;
  min-height: 48px;
  padding: 0 20px;
  text-decoration: none;
}

.btn,
.btn:hover {
  color: var(--bg);
}

.btn.ghost {
  background: none;
  color: var(--ink);
}

.btn.ghost:hover {
  color: var(--accent-hover);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  font: 14px/1.6 var(--mono);
  gap: 12px;
  margin-top: 32px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  font: 13px/1.6 var(--mono);
  gap: 10px;
  margin-top: 32px;
}

.chip {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  text-decoration: none;
}

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

/* ===== Home ===== */

/* Character sheet */

dl {
  display: grid;
  font: 13px/1.5 var(--mono);
  gap: 8px 16px;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 12px;
}

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

.about {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
}

.about > div {
  flex: 999 1 460px;
  max-width: 640px;
  min-width: 0;
}

.about > div p + p {
  margin-top: 18px;
}

.talk {
  align-self: flex-start;
  flex: 1 1 340px;
  min-width: 0;
  padding: 24px;
}

.talk h3 {
  font: 500 24px/1.2 var(--serif);
  letter-spacing: -0.3px;
  margin-top: 8px;
}

.talk .media {
  margin-top: 16px;
}

.talk .media + p {
  margin-top: 14px;
}

/* The path so far: logo boxes joined by a dashed trail */

.path {
  display: grid;
  gap: 32px 0;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.path li {
  min-width: 0;
  padding-right: 16px;
  position: relative;
}

.path li:not(.now)::after {
  border-top: 2px dashed var(--accent-soft);
  content: '';
  inset: 29px 16px auto 72px;
  position: absolute;
}

.path span {
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  height: 60px;
  justify-content: center;
  width: 60px;
}

.path span img {
  border-radius: 6px;
  height: 36px;
  object-fit: contain;
  width: 36px;
}

.path .label {
  letter-spacing: 0.5px;
  margin-top: 16px;
}

.path h3 {
  font-size: 20px;
  margin-top: 4px;
}

.path h3 + p {
  color: var(--ink-2);
  font: 16px/1.45 var(--serif);
  margin-top: 4px;
}

.path .now span {
  border: 2px solid var(--now);
}

.path .now .label {
  color: var(--now-text);
}

/* Selected research cards */

.cards {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.cards .media {
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--line);
}

.cards .card > div:last-child {
  padding: 20px 22px 24px;
}

.cards .label {
  letter-spacing: 0.5px;
}

.cards h3 {
  font: 600 22px/1.2 var(--serif);
  margin-top: 8px;
}

.cards h3 + p {
  margin-top: 8px;
}

.cards .links {
  margin-top: 14px;
}

/* ===== Research ===== */

.papers {
  margin-top: -24px;
}

main > .wrap:has(> .papers) {
  padding-bottom: 16px;
}

.papers li {
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding-block: 24px;
}

.papers .aside {
  flex: 1 1 280px;
  max-width: 350px;
}

.papers .aside img {
  aspect-ratio: 8 / 5;
  border: 1px solid var(--line);
  margin-top: 12px;
  padding: 10px;
  width: 100%;
}

.papers li > div:last-child {
  flex: 999 1 320px;
  min-width: 0;
}

.papers h3 {
  line-height: 1.3;
}

.venue {
  color: var(--muted);
  font: 13px/1.6 var(--mono);
  margin-top: 4px;
}

.authors {
  color: var(--ink-2);
  font: 17px/1.5 var(--serif);
  margin-top: 6px;
}

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

.award {
  color: var(--now-text);
  margin-top: 6px;
}

.papers .links {
  margin-top: 10px;
}

/* Abstracts: native <details>, styled like the link row */

summary {
  color: var(--accent);
  cursor: pointer;
  font: 13px/1.6 var(--mono);
  list-style: none;
  padding-block: 6px;
  width: fit-content;
}

summary::before {
  content: '▸ ';
}

details[open] summary::before {
  content: '▾ ';
}

summary:hover {
  color: var(--accent-hover);
}

details p {
  color: var(--ink-2);
  font: 17px/1.55 var(--serif);
  margin-top: 10px;
  max-width: 40em;
}

/* ===== Small screens ===== */

@media (max-width: 640px) {
  .feature > div:last-child {
    padding: 24px 22px;
  }

  .papers .aside {
    flex-basis: 100%;
  }
}
