/* Gelasio (SIL OFL 1.1), self-hosted: see fonts/README.txt. Variable font: one file covers 400-700. */
@font-face {
  font-family: "Gelasio";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/gelasio-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Gelasio";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/gelasio-latin-italic.woff2") format("woff2");
}

/* Design tokens (taken from the Figma file). */
:root {
  --bg: #fff8f3;
  --ink: #2a2524;       /* titles */
  --ink-2: #7a716a;     /* body copy */
  --ink-3: #a7a09a;     /* meta, links row */
  --brand: #4b1500;     /* name, footer bar */
  --heading: #58210d;   /* section headings */
  --accent: #f26900;    /* hover, footer bar */
  --line: #e7e5e4;      /* dividers, thumbnail placeholder */
  --hover: #f2e4d9;     /* background of a hovered publication row / project card */
  --radius: 16px;
  --radius-hover: 24px;
  --font: "Gelasio", Georgia, "Times New Roman", serif;
  --gutter: 20px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 16px/1.265 var(--font);
}

.page {
  flex: 1 0 auto;
  width: min(1024px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: 20px 0 60px;
}

a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* ---- Intro ---------------------------------------------------------------------------------- */
.intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
}
.avatar {
  grid-area: 1 / 1;
  display: block;
  width: 100px;
  height: 100px;
  border: 4px solid #fff;
  border-radius: var(--radius);
  background: var(--line);
  object-fit: cover;
}
.intro__text { grid-area: 1 / 2; align-self: center; }
.intro h1 {
  margin: 0;
  color: var(--brand);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
}
.tagline { margin: 8px 0 0; font-size: 12px; text-wrap: balance; }
.links {
  grid-area: 2 / 1 / 2 / -1;
  margin: 20px 0 0;
  color: var(--ink-3);
  font-size: 16px;
}
.links a { text-decoration: none; }
.links a:hover,
.links a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-position: from-font; }

.bio {
  margin-top: 20px;
  font-size: 16px;
  text-align: justify;
  hyphens: auto; /* keeps justified lines tidy on narrow screens; switched off on desktop below */
}
.bio :is(p, ul, h2, h3) { margin: 0; }
.bio :is(p, ul) + :is(p, ul) { margin-top: 0.6em; }
.bio a { color: var(--accent); text-underline-position: from-font; }

/* ---- Sections ------------------------------------------------------------------------------- */
.section {
  margin-top: 28px;
  padding-top: 30px;
  border-top: 2px solid var(--line);
}
.section + .section { margin-top: 28px; }

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
  padding-inline: 10px;
}
.section__head h2 {
  margin: 0;
  color: var(--heading);
  font-size: 20px;
  font-weight: 500;
}
.more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 12px;
  text-underline-position: from-font;
}
.more:hover,
.more:focus-visible { color: var(--accent); }
.arrow { flex: none; }

/* ---- Thumbnails ----------------------------------------------------------------------------- */
.thumb {
  display: block;
  flex: none;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: var(--radius);
  background: var(--line);
}
.thumb :is(img, video) { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---- Publications --------------------------------------------------------------------------- */
.pubs, .cards { margin: 0; padding: 0; list-style: none; }
.pubs { display: grid; gap: 40px; }

.pub { display: flex; flex-direction: column; gap: 20px; color: inherit; text-decoration: none; }
.pub .thumb { width: 100%; height: 200px; }
/* The 5px bottom padding keeps the last text line clear of the hover background's bottom edge. */
.pub__text { min-width: 0; padding: 0 10px 5px; }
.pub__title { margin: 0; color: var(--ink); font-size: 16px; font-weight: 400; }
.pub__venue { margin: 10px 0 0; color: var(--ink-3); font-size: 12px; }
.pub__authors { margin: 10px 0 0; font-size: 14px; font-style: italic; }
.author { white-space: nowrap; }
.me { font-weight: 600; text-decoration: underline; text-decoration-skip-ink: none; text-underline-position: from-font; }

/* ---- Projects ------------------------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 30px 32px;
}
.card { display: block; padding-bottom: 5px; color: inherit; text-decoration: none; }
.card .thumb { width: 100%; height: 240px; }
.card__title { margin: 15px 0 0; padding-inline: 10px; color: var(--ink); font-size: 16px; font-weight: 400; }
.card__desc { margin: 10px 0 0; padding-inline: 10px; font-size: 14px; }

/* Hover / focus: a rounded background that bleeds 8px beyond the whole row or card.
   It is a pseudo-element behind the content, so the layout itself never shifts. */
.pub, .card { position: relative; isolation: isolate; }
.pub::before,
.card::before {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: var(--radius-hover);
  background: var(--hover);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .pub::before, .card::before { transition: opacity 120ms ease; }
}
/* :hover only on devices that can really hover, so a tap never leaves a stuck highlight. */
@media (hover: hover) {
  .pub:hover::before, .card:hover::before { opacity: 1; }
}
.pub:focus-visible::before, .card:focus-visible::before { opacity: 1; }
.pub:focus-visible, .card:focus-visible { outline-offset: 8px; border-radius: var(--radius-hover); }

/* ---- Footer bars ---------------------------------------------------------------------------- */
.bars::before, .bars::after { content: ""; display: block; height: 10px; }
.bars::before { background: var(--accent); }
.bars::after { background: var(--brand); }

/* ---- Tablet: 641px and up ------------------------------------------------------------------- */
@media (min-width: 641px) {
  :root { --gutter: 40px; }
  .page { padding-top: 48px; }

  .intro { grid-template-rows: 1fr auto auto 1fr; column-gap: 24px; }
  .avatar { grid-area: 1 / 1 / -1 / 2; width: 160px; height: 160px; }
  .intro__text { grid-area: 2 / 2; align-self: auto; }
  .intro h1 { font-size: 44px; line-height: 1.27; }
  .tagline { margin-top: 8px; font-size: 18px; }
  .links { grid-area: 3 / 2; margin-top: 8px; font-size: 18px; }

  .bio { margin-top: 24px; font-size: 18px; }

  .section__head h2 { font-size: 28px; }
  .more { font-size: 14px; }

  .pubs { gap: 20px; }
  .pub { flex-direction: row; gap: 20px; }
  .pub .thumb { width: 240px; height: 160px; }
  .pub__text { padding: 20px 10px 5px 0; }
  .pub__title { font-size: 20px; }
  .pub__venue { margin-top: 5px; font-size: 14px; }
  .pub__authors { font-size: 15px; }

  .section + .section { margin-top: 38px; }
  .cards { gap: 40px 32px; }
  .card__title { font-size: 20px; }
  .card__desc { font-size: 15px; }
}

/* ---- Desktop: 1000px and up (the 1512px design) --------------------------------------------- */
@media (min-width: 1000px) {
  .page { padding-top: 96px; }

  .intro { column-gap: 30px; }
  .avatar { width: 200px; height: 200px; }
  .intro h1 { font-size: 64px; }
  .tagline { margin-top: 11px; font-size: 24px; }
  .links { margin-top: 10px; font-size: 24px; }

  .bio { margin-top: 30px; font-size: 24px; hyphens: manual; }

  .section__head h2 { font-size: 32px; }
  .more { font-size: 16px; }

  .pub__title { font-size: 24px; }
  .pub__venue { font-size: 16px; }
  .pub__authors { font-size: 16px; }

  .card__title { font-size: 24px; }
  .card__desc { font-size: 16px; }
}
