/* ===== Publications page: compact list, selected section, range filters =====
   Loaded after style.css. Overrides the card layout defined there. */

/* --- Section headings inside the page --- */
.pub-section-head {
  margin-bottom: 1rem;
}

.pub-section-head h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.pub-section-head p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 650px;
}

.pub-section-selected {
  margin-bottom: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
}

/* --- Filters: a single row of range buttons --- */
.pub-filters {
  margin-bottom: 1rem;
  gap: 0.4rem;
}

.pub-filters button {
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.pub-filters button[aria-pressed="true"] {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- Compact list --- */
.pub-list {
  gap: 0;
}

.pub-item {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 0.75rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0.85rem 0;
  transition: none;
}

.pub-item:hover {
  border-color: var(--border);
  box-shadow: none;
}

.pub-item .pub-year {
  grid-column: 1;
  grid-row: 1 / span 3;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--primary-light);
  text-transform: uppercase;
  margin: 0;
  padding-top: 0.2rem;
  line-height: 1.4;
}

/* Year label is only shown on the first entry of each year (set by js/pubs.js). */
.pub-item.pub-item--year-repeat .pub-year {
  visibility: hidden;
}

.pub-item h3 {
  grid-column: 2 / span 2;
  grid-row: 1;
}

.pub-item .authors {
  grid-column: 2 / span 2;
  grid-row: 2;
}

.pub-item .journal {
  grid-column: 2;
  grid-row: 3;
}

.pub-item .pub-doi {
  grid-column: 3;
  grid-row: 3;
  align-self: start;
  justify-self: end;
}

.pub-item h3 {
  font-size: 1rem;
  line-height: 1.45;
  margin-bottom: 0.3rem;
}

.pub-item .authors {
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.15rem;
}

.pub-item .journal {
  font-size: 0.9rem;
  line-height: 1.55;
}

/* DOI affordance: a small badge on the journal row, at the right edge */
.pub-item .pub-doi {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0 0.45rem;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: var(--primary);
  background: var(--accent-light, #e8f3ec);
  border-radius: 4px;
  text-decoration: none;
  vertical-align: 1px;
}

.pub-item .pub-doi:hover,
.pub-item .pub-doi:focus-visible {
  background: var(--primary);
  color: white;
}

/* First entry of each list needs a top hairline so the list reads as one block */
.pub-list .pub-item:first-child {
  border-top: 1px solid var(--border);
}

/* Google Scholar box: tighter than the inline styles on the page */
.pub-scholar {
  margin-top: 2rem;
}

/* --- Phone layout: year label sits above the entry, only for the first entry of a year --- */
@media (max-width: 640px) {
  .pub-item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto auto;
    column-gap: 0.5rem;
    padding: 0.75rem 0;
  }

  .pub-item .pub-year {
    grid-column: 1 / span 2;
    grid-row: 1;
    padding-top: 0;
    margin-bottom: 0.2rem;
  }

  /* The label row collapses entirely on repeats, so nothing is left behind. */
  .pub-item.pub-item--year-repeat {
    grid-template-rows: 0 auto auto auto;
  }

  .pub-item.pub-item--year-repeat .pub-year {
    display: none;
  }

  .pub-item h3 {
    grid-column: 1 / span 2;
    grid-row: 2;
  }

  .pub-item .authors {
    grid-column: 1 / span 2;
    grid-row: 3;
  }

  .pub-item .journal {
    grid-column: 1;
    grid-row: 4;
  }

  .pub-item .pub-doi {
    grid-column: 2;
    grid-row: 4;
  }

  .pub-item h3 {
    font-size: 0.98rem;
  }

  .pub-filters {
    justify-content: flex-start;
  }
}

.pub-item .pub-year {
  cursor: pointer;
}

.pub-item .pub-year:hover,
.pub-item .pub-year:focus-visible {
  text-decoration: underline;
  color: var(--primary);
}

.pub-item--year-repeat .pub-year {
  visibility: visible;
  opacity: 0.45;
}

.pub-item[hidden] {
  display: none !important;
}
