/*
 * Publications page (publications/index.html).
 * Complements the stylesheet of the site (_sass/site.scss) and uses its custom
 * properties (colours, fonts, widths of the two columns).
 */

.pub-summary {
  margin: 0 0 20px;
  color: var(--muted);
}

/* ---- search and filters ------------------------------------------------- */

.pub-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.pub-toolbar .pub-search {
  flex: 1 1 260px;
  min-width: 0;
  height: 36px;
  padding: 0 12px 0 36px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a1b0' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.7-3.7'/%3E%3C/svg%3E") no-repeat 13px 50%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}

.pub-toolbar .pub-search::placeholder {
  color: var(--faint);
}

.pub-toolbar .pub-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 87, 167, .16);
}

.pub-seg {
  display: flex;
  align-items: center;
  padding: 3px;
  white-space: nowrap;
  background: var(--surface);
  border-radius: 10px;
}

.pub-seg-label {
  margin: 0 8px 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.pub-seg button {
  padding: 0 13px;
  font: inherit;
  font-size: 13px;
  line-height: 30px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.pub-seg button:hover {
  color: var(--ink);
}

.pub-seg button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(20, 27, 38, .14);
}

/* Type filters, as a row of tabs on a hairline. */
.pub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin-top: 14px;
  box-shadow: inset 0 -1px 0 var(--line);
}

.pub-chip {
  padding: 7px 0 8px;
  font: inherit;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
  white-space: nowrap;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.pub-chip:hover {
  color: var(--ink);
}

.pub-chip[aria-pressed="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.pub-chip-count {
  margin-left: 2px;
  font-size: 11.5px;
  color: var(--faint);
}

.pub-count {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.pub-count:empty {
  display: none;
}

/* ---- list ---------------------------------------------------------------- */

/* Same two columns as the page: the year (or type) on the left, its publications on the right. */
.pub-list {
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: start;
  margin-top: 14px;
}

/* A group (one year or one type), made by publications.js: same two columns. */
.pub-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: var(--label) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: start;
}

.pub-group-title {
  grid-column: 1;
  padding-top: 18px;
  font: 600 20px/26px var(--serif);
}

/* The label stays under the top bar while the publications of its group are scrolled. */
.pub-group > .pub-group-title {
  position: sticky;
  top: var(--bar);
}

.pub-group-count {
  margin-left: 3px;
  font: 500 12px/1 var(--sans);
  color: var(--faint);
  vertical-align: 7px;
}

ul.pubs {
  grid-column: 2;
  position: relative;
  margin: 0 0 16px;
  padding: 9px 0 0;
  list-style: none;
}

/* hairline above each group, across the two columns */
ul.pubs::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: calc(-1 * (var(--label) + var(--gap)));
  border-top: 1px solid var(--line);
}

/* (not above the first one: the hairline of the filters is just over it) */
.pub-list > ul.pubs:first-of-type::before,
.pub-group:first-child > ul.pubs::before {
  display: none;
}

/* Each entry has a band on its left, in the colour of its type (same as the dot of its badge). */
li.pub {
  --c: var(--faint);
  margin: 10px 0 14px;
  padding: 1px 0 1px 16px;
  border-left: 3px solid var(--c);
}

li.pub[data-group="journal"] { --c: var(--accent); }
li.pub[data-group="conference"] { --c: #e0a100; }
li.pub[data-group="book"] { --c: var(--c-postdocs); }
li.pub[data-group="other"] { --c: var(--line-strong); }

li.pub:target {
  padding-top: 8px;
  padding-bottom: 8px;
  padding-right: 12px;
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
}

li.pub p {
  margin: 0;
  line-height: 1.45;
}

.pub-title {
  font-size: 14.5px;
}

.pub-title,
.pub-title a {
  font-weight: 600;
}

.pub-title a {
  text-decoration: none;
}

.pub-title a:hover {
  text-decoration: underline;
}

.pub-authors {
  margin-top: 2px;
  font-size: 13.5px;
}

li.pub .pub-authors {
  margin-top: 2px;
}

.pub-me {
  color: var(--ink);
}

.pub-venue {
  font-size: 12.5px;
  color: var(--muted);
}

li.pub .pub-venue {
  margin-top: 2px;
}

/* Type of publication: a coloured dot and a small label before the reference. */
.pub-badge {
  margin-right: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pub-badge::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.pub-badge-journal::before {
  background: var(--accent);
}

.pub-badge-conference::before {
  background: #e0a100;
}

.pub-badge-book::before {
  background: var(--c-postdocs);
}

.pub-badge-other::before {
  background: none;
  border: 1.5px solid var(--faint);
}

.pub-lang {
  margin-left: 3px;
  padding: 0 6px;
  font-size: 11px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
}

li.pub .pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Links and buttons of a publication: same pills as the profile links of the home page. */
.pub-link {
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  line-height: 21px;
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.pub-link:hover {
  color: var(--accent);
  text-decoration: none;
  border-color: var(--accent);
}

.pub-link-pdf {
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.pub-toggle[aria-expanded="true"],
.pub-toggle[aria-expanded="true"]:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

/* ---- abstract / BibTeX panels ------------------------------------------- */

.pub-panel {
  margin: 10px 0 4px;
}

.pub-abstract {
  padding: 12px 16px;
  font-size: 13.5px;
  background: var(--surface);
  border-radius: 10px;
}

li.pub .pub-abstract p {
  line-height: 1.6;
}

.pub-abstract p + p {
  margin-top: 8px;
}

.pub-bibtex {
  position: relative;
}

.pub-bibtex pre {
  margin: 0;
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
}

.pub-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0 11px;
  font: inherit;
  font-size: 12px;
  line-height: 22px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

.pub-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pub-empty {
  grid-column: 1 / -1;
  margin: 40px 0;
  color: var(--muted);
  text-align: center;
}

/* ---- index of the years, in a third column of wide screens ---------------- */

.pub-rail {
  display: none;
}

@media (min-width: 1100px) {
  main {
    grid-template-columns: var(--label) minmax(0, 1fr) 104px;
  }

  main > .pub-list {
    grid-column: 1 / 3;
  }

  /* beside the title, the filters and the list; stays in view while the list is read */
  .pub-rail {
    grid-column: 3;
    grid-row: 1 / span 3;
    position: sticky;
    top: calc(var(--bar) + 24px);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--bar) - 48px);
    overflow-y: auto;
    scrollbar-width: none;
    border-left: 1px solid var(--line);
  }

  .pub-rail::-webkit-scrollbar {
    display: none;
  }

  .pub-rail a {
    margin-left: -1px;
    padding: 1px 0 1px 14px;
    font-size: 12px;
    line-height: 19px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    border-left: 1px solid transparent;
  }

  .pub-rail a:hover {
    color: var(--ink);
    text-decoration: none;
  }

  .pub-rail a[aria-current] {
    font-weight: 600;
    color: var(--ink);
    border-left-color: var(--accent);
  }
}

/* ---- small screens and print -------------------------------------------- */

@media (max-width: 860px) {
  .pub-list,
  .pub-group {
    display: block;
  }

  .pub-list {
    margin-top: 6px;
  }

  .pub-list .pub-group-title {
    position: static;
    padding-top: 22px;
    font-size: 22px;
    border-top: 1px solid var(--line);
  }

  .pub-list > .pub-group-title:first-child,
  .pub-group:first-child > .pub-group-title {
    border-top: 0;
  }

  ul.pubs {
    padding-top: 4px;
  }

  ul.pubs::before {
    display: none;
  }
}

@media (max-width: 600px) {
  /* the tabs scroll sideways instead of wrapping */
  .pub-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .pub-chips::-webkit-scrollbar {
    display: none;
  }

  .pub-seg {
    flex: 1 1 100%;
  }

  .pub-seg-label {
    margin-right: auto;
  }
}

@media print {
  .pub-toolbar,
  .pub-toggle,
  .pub-panel,
  .pub-rail {
    display: none !important;
  }

  .pub-list .pub-group-title {
    position: static;
  }
}
