/* paolomartellini.com */

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-ext-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("fonts/source-sans-3-latin-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --text: #231f20;
  --heading: #183b68;
  --link: #173f61;
  --accent: #2f6f73;
  --muted: #5a6772;
  --rule: #dee2e6;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: #fff;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 76px 36px 40px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover { color: var(--accent); }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 14px;
  background: #fff;
}
.skip-link:focus { left: 12px; top: 12px; z-index: 10; }

h1, h2, h3 { color: var(--heading); letter-spacing: -0.015em; }

h1 {
  margin: -2px 0 21px;
  font-size: 2.05rem;
  line-height: 1.15;
  font-weight: 600;
}

h2 {
  margin: 47px 0 17px;
  padding-bottom: 8.5px;
  border-bottom: 1px solid var(--rule);
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 600;
}

/* Profile */

.profile {
  display: grid;
  /* The portrait gives up width (280px down to 200px) before the bio's first
     sentence has to wrap: 116px = page padding + gap, 720px = that sentence
     plus room for a scrollbar. */
  grid-template-columns: clamp(200px, calc(100vw - 116px - 720px), 280px) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}
.profile.no-photo { grid-template-columns: minmax(0, 1fr); }

.profile-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.profile-copy p { margin: 0 0 15px; text-wrap: pretty; }
.profile-contact { margin-top: 18px; }
.profile-contact p { margin: 0 0 7.5px; }

/* Papers */

.paper { margin: 0 0 26px; scroll-margin-top: 24px; }
.paper:last-child { margin-bottom: 0; }

.paper-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 7px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 700;
}

.paper-title-text { color: var(--heading); text-decoration: none; }
a.paper-title-text:hover { color: var(--heading); text-decoration: underline; }

.paper-resources {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0 5px;
}

.paper-resource {
  font-size: 0.86em;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--accent);
  white-space: nowrap;
}
.paper-resource::before { content: "["; }
.paper-resource::after { content: "]"; }

.paper-resource a,
.abstract-toggle {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
.paper-resource a:hover,
.abstract-toggle:hover { color: var(--heading); }

.abstract-toggle {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.abstract-toggle[aria-expanded="true"] { text-decoration-style: dotted; }

.paper-authors { margin: 4px 0 0; line-height: 1.45; }
.paper-status { margin: 3px 0 0; line-height: 1.45; }

.paper-abstract {
  margin: 8px 0 0;
  text-align: justify;
  hyphens: auto;
}
.paper-abstract[hidden] { display: none; }

/* Footer */

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 36px 36px;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--muted);
}

/* Medium windows: too narrow for the first sentence to fit beside the
   portrait, so the portrait sits next to the name and the bio runs full width. */

@media (min-width: 761px) and (max-width: 1035px) {
  .profile:not(.no-photo) {
    grid-template-columns: 150px minmax(0, 1fr);
    column-gap: 32px;
    row-gap: 0;
    align-items: center;
  }
  .profile:not(.no-photo) .profile-copy { display: contents; }
  .profile:not(.no-photo) .profile-photo { grid-column: 1; grid-row: 1; margin-bottom: 26px; }
  .profile:not(.no-photo) h1 { grid-column: 2; grid-row: 1; margin: 0 0 26px; }
  .profile:not(.no-photo) .profile-copy > p,
  .profile:not(.no-photo) .profile-contact { grid-column: 1 / -1; }
  .profile:not(.no-photo) .profile-contact { margin-top: 3px; }
}

/* Small screens */

@media (max-width: 760px) {
  main { padding: 36px 20px 32px; }
  footer { padding: 18px 20px 28px; }
  .profile { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .profile-photo img { width: min(260px, 70vw); height: auto; aspect-ratio: 4 / 5; }
  .paper-abstract { text-align: left; hyphens: manual; }
  .paper-resource { padding: 3px 0; }
}

@media print {
  .paper-abstract[hidden] { display: block; }
  .abstract-toggle, .skip-link { display: none; }
  .paper-resource:has(.abstract-toggle) { display: none; }
  main { padding-top: 0; }
}
