/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  --bg:        light-dark(white, #2F3645);
  --accent-bg: light-dark(lightgrey, #3B4048);
  --text:      light-dark(black, #EEEDEB);
  --link:      hotpink;

  --measure: 1000px;
  --gutter: 1em;

  --nav-breakpoint: 768px;
}

/* ------------------------------------------------------------------ base */

body {
  font-family: Inter, system-ui, sans-serif;
  font-weight: 300;

  max-width: var(--measure);
  margin: 0 auto;

  background-color: var(--bg);
  color: var(--text);

  h1, h2, h3, h4, h5, h6, p, ul, tr {
    line-height: 1.8
  }

  a {
    color: var(--link);
  }
}

main {
  padding: 0 var(--gutter);
}

/* ------------------------------------------------------------------- nav */

nav {
  padding: 0 var(--gutter);

  .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1em 0;
    position: relative;
  }

  .website-title {
    font-weight: 500;
  }

  /* Visually hidden, but still reachable by keyboard. */
  #menu-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .menu ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  a {
    text-decoration: none;
    color: inherit;

    &:hover {
      text-decoration: underline;
    }
  }

  .active {
    font-weight: 500;
    text-decoration: underline;
  }

  .hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    gap: 5px;
    padding: 4px;
    border-radius: 4px;

    div {
      width: 25px;
      height: 3px;
      background-color: var(--text);
    }
  }

  #menu-toggle:focus-visible ~ .hamburger {
    outline: 2px solid var(--link);
    outline-offset: 2px;
  }

  @media (max-width: 768px) {
    .hamburger {
      display: flex;
    }

    .menu {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      z-index: 10;

      padding: 0.5em 0;
      border-radius: 8px;
      background-color: var(--accent-bg);
    }

    #menu-toggle:checked ~ .menu {
      display: block;
    }

    .menu ul {
      flex-direction: column;
      gap: 0;
    }

    .menu a {
      display: block;
      padding: 0.75em 1em;

      &:hover {
        background-color: var(--bg);
        text-decoration: none;
      }
    }
  }
}

/* ---------------------------------------------------------------- footer */

footer {
  padding: 0 var(--gutter);

  .footer-container {
    display: flex;
    justify-content: space-between;
    /*gap: 1em;*/
    padding: 1em 0;
  }

  p {
    font-size: smaller;
    margin: 0;
  }
}

/* ------------------------------------------------------------ about page */

.about {
  display: grid;
  grid-template-columns: 28% 1fr;
  gap: 2rem;
  align-items: start;
  padding-top: 2em;

  .profile-pic {
    display: block;
    width: 100%;
    height: auto;
  }

  .social-links {
    margin: 1em 0 0;
    font-size: 2em;
    text-align: center;

    a {
      color: inherit;
      margin-inline: 0.1em;
    }
  }

  h1 {
    margin-top: 0;
  }

  @media (max-width: 640px) {
    grid-template-columns: 1fr;
    gap: 1rem;

    .about-media {
      max-width: 220px;
      margin-inline: auto;
    }
  }
}

/* --------------------------------------------------------------- cv page */

.cv {
  .cv-item {
    display: block;
    margin-bottom: 1rem;
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th {
    text-align: left;
  }

  th, td {
    overflow-wrap: break-word;
  }

  ul {
    padding-inline-start: 20px;

    /* Justifying a narrow column opens rivers between words. */
    @media (max-width: 640px) {
      text-align: start;
    }
  }

  td.description {
    padding-block-start: 0.5rem;
  }
}

/* ------------------------------------- citations (from pandoc's default) */

div.csl-entry {
  /*clear: both;*/
  margin-bottom: 1em;

  .bib-abstract p {
    font-style: italic;
  }

  p {
    margin-top: 0;
  }

  .bib-title {
    font-weight: 500;
    font-size: larger;
    margin-bottom: 0.5em;
  }

  .bold-author {
    text-decoration: underline;
  }
}

div.csl-left-margin {
  min-width: 2em;
  float: left;
}

div.csl-right-inline {
  margin-left: 1em;
  padding-left: 1em;
}

div.csl-indent {
  margin-left: 2em;
}
