:root {
  /* Dark is the default theme; light is opt-in via [data-theme="light"]. */
  color-scheme: dark;
  --bg: #0a0a0a;
  --fg: #e9e9e9;
  --muted: #b6b6b6;
  --rule: #2a2a2a;
  --accent: #ff4d8f;
  --link: #e9e9e9;
  --btn-bg: #141414;
  --serif: "Newsreader", Charter, "Iowan Old Style", "Source Serif Pro",
    Georgia, serif;
  --display: "Playfair Display", "Newsreader", Charter, Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fcfcfa;
  --fg: #17171b;
  --muted: #5b5b64;
  --rule: #deded8;
  --accent: #d61f69;
  --link: #17171b;
  --btn-bg: #f3f3ee;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

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

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
}

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

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

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Show the icon for the theme you would switch *to*. */
.theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Layout */
.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 32px 56px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 72px;
}

.content {
  min-width: 0;
}

/* Sidebar identity block */
.identity {
  width: max-content;
  max-width: 100%;
}

.name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 8.4vw, 38px);
  line-height: 1.1;
  letter-spacing: 0.2px;
  margin: 0 0 20px;
  white-space: nowrap;
}

.avatar {
  margin: 0 auto 22px;
  padding: 0;
  width: 190px;
  height: 190px;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--rule);
}

/* Plain text, not a mailto link, so scrapers can't harvest it. */
.email {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--fg);
  margin: 0;
}

.divider {
  border: none;
  border-top: 1px solid var(--fg);
  margin: 14px 0 18px;
  width: 100%;
}

.affiliation {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--fg);
  margin: 0 0 18px;
}

.affiliation p {
  margin: 0;
}

.accent {
  color: var(--accent);
}

/* Socials */
.socials {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: flex;
  gap: 16px;
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s ease;
}

.socials svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.socials a:hover {
  color: var(--accent);
}

/* Bio */
.bio p {
  margin: 0 0 18px;
  /* Avoids leaving a lone short word on the last line of a paragraph. */
  text-wrap: pretty;
}

/* Line the bio's first line up with the cap top of the name. A block's cap
   top sits below its own box top by half-leading + (ascender - capHeight),
   which scales with font size:

     .name  38px/1.10 Playfair Display  ->  9.785px
     .bio p 17px/1.65 Newsreader        ->  6.630px

   so the bio needs the 3.155px difference to start at the same y. */
.bio p:first-child {
  margin-top: 3.155px;
}

.bio p:last-child {
  margin-bottom: 0;
}

/* Research */
.research {
  margin-top: 56px;
}

.research h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

.note {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 22px;
}

.pub {
  padding: 18px 0;
  border-top: 1px solid var(--rule);
}

.pub:first-of-type {
  border-top: none;
  padding-top: 8px;
}

.pub-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17.5px;
  line-height: 1.35;
  margin: 0 0 8px;
  color: var(--fg);
}

.authors {
  margin: 0 0 4px;
  font-size: 15.5px;
  color: var(--fg);
}

.authors .me {
  color: var(--accent);
}

.venue {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 12px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--muted);
}

.pub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.btn {
  display: inline-block;
  padding: 4px 10px;
  font-size: 13px;
  font-family: var(--serif);
  color: var(--fg);
  background: var(--btn-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  text-decoration: none;
}

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

/* Responsive */
@media (max-width: 920px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    max-width: 680px;
    padding: 56px 24px 48px;
  }

  .sidebar {
    position: static;
    top: auto;
  }
}

@media (max-width: 560px) {
  .layout {
    padding: 48px 18px 32px;
    gap: 32px;
  }

  .avatar {
    width: 140px;
    height: 140px;
  }

  .research h2 {
    font-size: 26px;
  }

  .email,
  .affiliation {
    font-size: 12.5px;
  }
}
