/* ==========================================================================
   The look of the whole site. One plain file, nothing to build.
   Colours and fonts are set once, in the two blocks just below.
   ========================================================================== */

:root {
  --bg: #fcfbf8;          /* page background */
  --text: #1c1d20;        /* main text */
  --muted: #5b5e66;       /* secondary text: co-authors, outlets, dates */
  --accent: #1a5e4a;      /* links and the current menu item */
  --rule: #e2dfd7;        /* thin separating lines */

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light dark;
}

/* Colours used when the visitor's device is set to dark mode.
   To keep the light look everywhere: delete this block, change
   "color-scheme: light dark" just above to "color-scheme: light", and delete
   the second theme-color line in _layouts/default.html. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181b;
    --text: #e8e6e0;
    --muted: #a4a7ad;
    --accent: #86cfb5;
    --rule: #2d3137;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-variant-numeric: lining-nums;   /* full-height digits for dates and postal codes */
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

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

img {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  left: -999rem;
  top: 0.75rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.9rem;
  z-index: 10;
}

.skip-link:focus {
  left: 0.75rem;
}

/* ---------- Page frame: sidebar on the left, content on the right ---------- */

.page {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  column-gap: 4.5rem;
  max-width: 66rem;
  margin: 0 auto;
  padding: 4rem 2rem 3rem;
}

.sidebar {
  align-self: start;
  font-family: var(--sans);
}

/* The sidebar stays in view while the page scrolls, when the window is tall enough. */
@media (min-width: 56.0625em) and (min-height: 44em) {
  .sidebar {
    position: sticky;
    top: 4rem;
  }
}

/* With profile links (_config.yml) the sidebar is taller: it needs a taller window. */
@media (min-width: 56.0625em) and (max-height: 51.9375em) {
  .sidebar-with-links {
    position: static;
  }
}

/* More than five profile links: the sidebar is too tall to stay in view, so it scrolls with the page. */
.sidebar:has(.links li:nth-child(7)) {
  position: static;
}

.portrait {
  display: block;
  width: 100%;
  border-radius: 6px;
  background: var(--rule);
}

.name {
  margin: 1.3rem 0 0.3rem;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.name a {
  color: inherit;
  text-decoration: none;
}

.role {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.menu {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.menu ul,
.links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu a {
  display: block;
  padding: 0.3rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--text);
  font-size: 0.98rem;
  text-decoration: none;
}

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

.menu a[aria-current="page"] {
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.links {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.84rem;
}

.links li + li {
  margin-top: 0.3rem;
}

.links a {
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

/* ---------- Content ---------- */

main {
  min-width: 0;
  max-width: 43rem;
}

main > :first-child {
  margin-top: 0;
}

main h1 {
  margin: 0 0 1.75rem;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* Section labels: WORKING PAPERS, CONTACT, ... */
main h2 {
  margin: 2.75rem 0 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

main h1 + h2 {
  margin-top: 0;
}

/* Paper titles */
main h3 {
  margin: 1.9rem 0 0.25rem;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.35;
}

main h2 + h3 {
  margin-top: 0;
}

/* The line under a paper title: co-authors, journal, prize */
main h3 + p {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.97rem;
}

main h2,
main h3 {
  scroll-margin-top: 1.5rem;
}

main p {
  margin: 0 0 1rem;
}

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

/* Lists (the media page): the link carries the title, the rest is quieter. */
main li {
  margin-bottom: 0.6rem;
  padding-left: 0.15rem;
  color: var(--muted);
}

main li::marker {
  color: var(--muted);
}

main li a {
  color: var(--text);
  text-decoration-color: var(--muted);
}

main li a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ---------- Abstracts that open on click ---------- */

details {
  margin: 0.35rem 0 0;
}

summary {
  display: inline-block;
  cursor: pointer;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
}

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

/* The second "content" line keeps screen readers from reading the sign aloud. */
summary::before {
  content: "+";
  content: "+" / "";
  display: inline-block;
  width: 0.9em;
  font-weight: 400;
}

details[open] > summary::before {
  content: "\2212";
  content: "\2212" / "";
}

details > p {
  margin: 0.6rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  font-size: 0.97rem;
}

/* ---------- Footer ---------- */

.site-footer {
  grid-column: 2;
  max-width: 43rem;
  margin-top: 3.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
}

/* On wide screens the e-mail is already in the sidebar. */
.footer-email {
  display: none;
}

/* ---------- Phones and narrow windows ---------- */

@media (max-width: 56em) {
  .page {
    display: block;
    max-width: 45.5rem;   /* the text column plus the two side margins: centred on tablets */
    padding: 1.5rem 1.25rem 2.5rem;
  }

  .sidebar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
  }

  .portrait {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
  }

  .name {
    margin: 0 0 0.2rem;
    font-size: 1.5rem;
  }

  .menu {
    grid-column: 1 / -1;
    margin-top: 1.1rem;
    padding-top: 0.7rem;
  }

  .menu ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1.4rem;
  }

  .menu a {
    padding: 0.35rem 0;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .menu a[aria-current="page"] {
    border-bottom-color: var(--accent);
  }

  /* On phones the e-mail and profile links move to the footer. */
  .links {
    display: none;
  }

  .footer-email {
    display: inline;
  }

  main h1 {
    font-size: 1.7rem;
  }

  .site-footer {
    margin-top: 2.5rem;
  }
}

/* ---------- Paper ---------- */

@media print {
  .page {
    display: block;
    padding: 0;
  }

  /* Landscape paper is wide enough for the screen layout: keep the phone spacing and the footer e-mail. */
  .sidebar {
    position: static;
    margin-bottom: 2rem;
  }

  .footer-email {
    display: inline;
  }

  .menu,
  .links,
  .skip-link,
  .sidebar picture {
    display: none;
  }

  a {
    color: inherit;
  }
}

/* ---------- Windows contrast themes ---------- */

/* Only the current page keeps its marker in the menu. */
@media (forced-colors: active) {
  .menu a {
    border-color: Canvas;
  }

  .menu a[aria-current="page"] {
    border-color: LinkText;
  }
}
