/* Shared stylesheet for every page of the site.
   Edit a value here and it changes on all pages at once. */

/* Always reserve room for the scrollbar, so the sidebar does not shift
   sideways between a short page (Home) and a long one (Research). */
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: #ffffff;
  color: #1a1a1a;
  font-family: Arial, Helvetica, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: #14418a;
}

a:visited {
  color: #5a3a8a;
}

a:focus-visible {
  outline: 2px solid #14418a;
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  margin: 1rem;
}

/* --- Page layout ---------------------------------------------------------
   Wide screens: grey sidebar (name, photo, contact) on the left; tabs and
   content on the right. Narrow screens: the sidebar sits above the
   content (see the end of this file). */

.container {
  display: grid;
  grid-template-columns: 16rem minmax(0, 42rem);
  column-gap: 2.5rem;
  justify-content: center;
  margin: 2.5rem auto 3rem;
  padding: 0 1.25rem;
}

.sidebar {
  align-self: start;
  box-sizing: border-box;
  position: sticky;
  top: 2.5rem;
  padding: 1.75rem 1.5rem;
  background: #f5f5f3;
  text-align: center;
}

/* --- Photograph ------------------------------------------------------ */

.portrait {
  display: block;
  width: 10rem;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin: 0 auto 1.25rem;
  border: 1px solid #cccccc;
}

/* The photo is a link to the full-size file; keep the link the photo's size. */
.portrait-link {
  display: block;
  width: fit-content;
  margin: 0 auto;
}

/* --- Contact links: icon + label, icons lined up under one another ---- */

.contact {
  display: inline-block;
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  font-size: 0.95rem;
}

.contact li {
  margin: 0 0 0.45rem;
}

.contact a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.icon {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: #555555;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The email link has a short label ("Email") used only on narrow screens. */
.contact .short {
  display: none;
}

.address {
  margin: 1.1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #dddddd;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #555555;
}

/* Second copy of the address, at the foot of the page; shown only on
   narrow screens, where the sidebar copy is hidden to keep it short. */
.address-end {
  display: none;
}

/* --- Name (in the sidebar) and tabs, repeated on every page ------------- */

h1 {
  font-size: 1.55rem;
  font-weight: bold;
  line-height: 1.2;
  margin: 0 0 0.35rem;
}

.subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #444444;
}

nav.tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 2rem;
  border-bottom: 1px solid #dddddd;
}

nav.tabs a,
nav.tabs .here {
  padding: 0.45rem 1rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: #666666;
  text-decoration: none;
}

nav.tabs a:hover {
  color: #1a1a1a;
}

nav.tabs .here {
  color: #1a1a1a;
  font-weight: bold;
  border-bottom-color: #1a1a1a;
}

/* --- Text ------------------------------------------------------------ */

p {
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: bold;
  margin: 2rem 0 0.9rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #cccccc;
}

h2:first-of-type {
  margin-top: 0;
}

ul {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.5rem;
}

.dates,
.note {
  font-style: italic;
}

.small {
  font-size: 0.9rem;
}

.updated {
  margin-top: 2.5rem;
  font-size: 0.9rem;
  color: #666666;
}

/* --- Papers ---------------------------------------------------------- */

.paper {
  margin-bottom: 1.6rem;
}

.paper .title {
  font-weight: bold;
  margin-bottom: 0.15rem;
}

.paper .byline,
.paper .note {
  margin-bottom: 0.15rem;
}

.paper .jmp {
  margin-bottom: 0.4rem;
}

/* The [PDF] link beside a paper's title: plain weight, so the title stands out. */
.paper .title .pdf {
  font-weight: normal;
  font-size: 0.92rem;
}

.links {
  font-size: 0.92rem;
}

details > summary {
  cursor: pointer;
  list-style: none;
  display: inline;
  color: #14418a;
  font-size: 0.92rem;
}

details[open] > summary .show,
details:not([open]) > summary .hide {
  display: none;
}

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

details > summary:hover {
  text-decoration: underline;
}

details > summary:focus-visible {
  outline: 2px solid #14418a;
  outline-offset: 2px;
}

.abstract {
  font-size: 0.95rem;
  margin: 0.5rem 0 0;
  padding-left: 1.5rem;
}

/* --- Work in progress: a small caret in place of the bullet; clicking the
       title shows the abstract underneath ----------------------------- */

.wip {
  list-style: none;
  padding-left: 0;
}

.wip details > summary,
.wip .plain {
  display: block;
  position: relative;
  padding-left: 1.4rem;
  color: inherit;
  font-size: inherit;
}

.wip details > summary::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.48em;
  width: 0.38em;
  height: 0.38em;
  border-right: 1.5px solid #777777;
  border-bottom: 1.5px solid #777777;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.wip details[open] > summary::before {
  transform: rotate(45deg);
}

.wip .abstract {
  margin: 0.35rem 0 1rem;
  padding-left: 1.4rem;
}

@media (prefers-reduced-motion: reduce) {
  .wip details > summary::before {
    transition: none;
  }
}

/* --- Narrow screens: a slim grey band above the content - small photo on
       the left; name, title and a single row of links on the right ------- */

@media (max-width: 52rem) {
  .container {
    grid-template-columns: minmax(0, 42rem);
    margin-top: 1rem;
    padding: 0 1rem;
  }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 4.75rem minmax(0, 1fr);
    column-gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    text-align: left;
  }
  .portrait-link {
    grid-column: 1;
    grid-row: 1 / span 3;
  }
  .portrait {
    width: 4.75rem;
    margin: 0;
  }
  .sidebar h1 {
    grid-column: 2;
    font-size: 1.3rem;
    margin: 0;
  }
  .subtitle {
    grid-column: 2;
    margin: 0.1rem 0 0.35rem;
    font-size: 0.82rem;
    line-height: 1.35;
  }
  .contact {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1rem;
    font-size: 0.9rem;
  }
  .contact li {
    margin: 0;
  }
  .contact a {
    gap: 0.3rem;
  }
  .contact .long,
  .sidebar .address {
    display: none;
  }
  .contact .short {
    display: inline;
  }
  .address-end {
    display: block;
    margin-top: 2rem;
    padding-top: 0.75rem;
    border-top: 1px solid #dddddd;
    font-size: 0.82rem;
    color: #555555;
  }
  nav.tabs {
    margin-bottom: 1.25rem;
  }
}

/* --- Print ------------------------------------------------------------ */

@media print {
  .container {
    display: block;
    margin: 0;
    padding: 0;
  }
  body {
    font-size: 11pt;
  }
  .sidebar {
    position: static;
    padding: 0;
    background: none;
    text-align: left;
  }
  a {
    color: #000000;
  }
  .portrait,
  .icon,
  nav.tabs,
  .skip {
    display: none;
  }
  details > summary {
    display: none;
  }
  .wip details > summary {
    display: block;
  }
  .wip details > summary::before {
    display: none;
  }
  /* Closed toggles hide their text from the printer unless told otherwise. */
  details::details-content {
    content-visibility: visible;
  }
  .abstract {
    display: block;
  }
  h2 {
    page-break-after: avoid;
  }
  .paper {
    page-break-inside: avoid;
  }
}
