:root {
  --bg: #f7f5ef;
  --ink: #191919;
  --muted: #60605c;
  --line: #d9d5ca;
  --link: #255c99;
  --link-hover: #143d6b;
  --panel: #fffdfa;
  --edge: clamp(34px, 7vw, 96px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

a:hover,
a:focus {
  color: var(--link-hover);
  text-decoration: underline;
}

.page-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 45rem);
  gap: calc(2cm - 10px);
  justify-content: center;
  padding: clamp(28px, 6vw, 76px) clamp(20px, 3vw, 40px);
}

.profile {
  align-self: stretch;
}

.profile-inner {
  max-width: 330px;
  position: sticky;
  top: clamp(28px, 6vw, 76px);
}

.portrait {
  display: block;
  width: min(310px, 82vw);
  aspect-ratio: 1;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--panel);
  object-fit: cover;
  object-position: 69% 34%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin: 0 auto 10px;
  width: min(310px, 82vw);
  container-type: inline-size;
  text-align: center;
}

/* sizes the name to ~fill its box (the portrait / CV-line width) at any screen
   size; 1cqi = 1% of the h1's width. Lower this to shrink, raise to fill more. */
.name {
  display: inline-block;
  font-size: 12.75cqi;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.profile-section {
  width: min(310px, 82vw);
  margin-left: auto;
  margin-right: auto;
  padding: 0;
  text-align: left;
}

.profile-section + .profile-section {
  margin-top: 14px;
}

.profile-section-title {
  margin: 0 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.profile-link {
  margin: 0;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.contact {
  margin: 0;
  margin-left: 0.2cm;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.postal-address {
  margin: 0;
  margin-left: 0.2cm;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.45;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 14px;
  margin: 0;
  margin-left: 0.2cm;
  padding-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.profile-link a,
.contact a,
.social-links a {
  color: inherit;
}

.profile-link a:hover,
.profile-link a:focus,
.contact a:hover,
.contact a:focus,
.social-links a:hover,
.social-links a:focus {
  color: var(--ink);
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.scholar-icon .stroke-path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.content {
  min-width: 0;
}

.section {
  padding-bottom: 0;
  margin-bottom: 28px;
  /* shared reading width: paragraphs and the paper button rows both end here,
     so body text and the Abstract/Draft buttons are right-aligned */
  max-width: 45rem;
}

h2 {
  margin-bottom: 18px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 19px;
  line-height: 1.2;
  font-weight: 600;
}

.welcome-section p {
  margin-bottom: 0;
  color: var(--muted);
  text-align: justify;
  text-justify: inter-word;
}

.paper {
  padding: 0 0 8px;
  margin-bottom: 8px;
}

.section > :last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

.paper-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px 10px;
  margin-bottom: 0;
}

.paper h3 {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  color: #4a4a45;
}

.paper-head h3 {
  margin-bottom: 0;
}

#work-in-progress .paper h3 {
  white-space: nowrap;
  font-size: 14px;
}

.authors,
.status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.rr {
  font-style: italic;
}

.cond {
  font-style: italic;
}

.journal {
  font-style: italic;
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.paper-actions a,
.toggle,
.media-menu > summary {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  color: var(--link);
  font: inherit;
  line-height: 1.2;
  text-decoration: none;
}

.paper-actions a:hover,
.paper-actions a:focus,
.toggle:hover,
.toggle:focus,
.media-menu > summary:hover,
.media-menu > summary:focus {
  border-color: color-mix(in srgb, var(--link) 42%, var(--line));
  background: var(--panel);
  color: var(--link-hover);
  text-decoration: none;
}

.compact {
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.toggle {
  margin: 0;
  cursor: pointer;
}

.media-menu {
  position: relative;
}

.media-menu > summary {
  list-style: none;
  cursor: pointer;
}

.media-menu > summary::-webkit-details-marker {
  display: none;
}

.media-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.media-popover a {
  padding: 4px 6px;
  border-radius: 4px;
}

.media-popover a:hover,
.media-popover a:focus {
  background: color-mix(in srgb, var(--panel) 50%, white);
}

.toggle::after {
  content: "";
}

.toggle[aria-expanded="true"]::after {
  content: "";
}

.abstract {
  margin-top: 8px;
  padding-top: 8px;
  padding-left: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.abstract p {
  margin-bottom: 0;
  text-align: justify;
  text-justify: inter-word;
}

.award-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@media (max-width: 800px) {
  body {
    overflow: auto;
  }

  .page-shell {
    display: block;
    height: auto;
    overflow: visible;
    padding-top: 28px;
  }

  .profile-inner {
    position: static;
    max-width: none;
    padding-bottom: 28px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--line);
  }

  .content {
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  /* phone only: stack the action buttons UNDER the (wrapping) title and
     right-align them, instead of the desktop title+buttons-on-one-row layout */
  .paper-head {
    flex-direction: column;
    align-items: stretch;
  }

  .paper-head h3 {
    flex-basis: auto;
  }

  .paper-actions {
    justify-content: flex-start;
    margin-left: 0;
  }

  /* let Work-in-progress titles wrap on phones (they're nowrap on desktop,
     where they fit; on a narrow screen nowrap overflows the viewport) */
  #work-in-progress .paper h3 {
    white-space: normal;
  }

  .portrait {
    width: min(240px, 70vw);
    margin-left: auto;
    margin-right: auto;
  }

  h1 {
    width: min(240px, 70vw);
  }

  .side-about,
  .profile-section,
  .profile-link,
  .contact,
  .postal-address,
  .social-links {
    width: auto;
    padding-left: 0;
    padding-right: 0;
  }
}
