/* ==========================================================================
   Francis Davis Millet Institute - Annotated Bibliography page
   (view "bibliography", template page-annotated-bibliography.php).
   Loaded after tokens.css and base.css.
   Figma: file wo9RmPUccR2OeLvr749rXQ, frames 48:131 (all closed),
   183:299, 183:368 and 183:437 (one entry open).

   Adapted from build/bibliography/bibliography.css. What changed: an entry
   is a native <details> (the summary is the line to press), so it opens and
   closes without JavaScript; the page head can carry a smaller note under
   the lead; an entry may show more than one PDF.

   Contents
    1. Page values          4. Entry card (closed and open)
    2. Page head and tools  5. Without JavaScript
    3. Groups and list      6. Phone
   ========================================================================== */

/* 1. Page values ----------------------------------------------------------- */

/* Sizes drawn only on this page. They are not in tokens.css; move them there
   if another page needs them. */
.fdm-bib,
.fdm-bib-head {
  --fdm-bib-search-width: 520px;     /* search field, 520 x 60 */
  --fdm-bib-switch-width: 40px;      /* switch track, 40 x 22 */
  --fdm-bib-switch-height: 22px;
  --fdm-bib-switch-knob: 16px;       /* white knob, 3px from the track edge */
  --fdm-bib-switch-travel: 18px;     /* 40 - 16 - 3 - 3 */
  --fdm-bib-filters-height: 32px;    /* chip row */
  --fdm-bib-chevron-width: 16px;     /* chevron box, 16 x 10 */
  --fdm-bib-chevron-height: 10px;
  --fdm-bib-no-pdf-pad-y: 9px;       /* "PDF unavailable" chip is 42px tall */
  --fdm-bib-entry-pad-x: var(--fdm-space-32);
  --fdm-bib-entry-pad-closed: var(--fdm-space-22);   /* closed card is 75px tall */
  --fdm-bib-entry-pad-open: var(--fdm-space-32);
  --fdm-bib-entry-gap: var(--fdm-space-14);          /* citation, note, action row */
  --fdm-bib-group-gap: var(--fdm-space-40);          /* between two groups */
}

/* 2. Page head and tools --------------------------------------------------- */

/* Page head: 64px above, 28px below (the shared default is 32px). */
.fdm-bib-head {
  --fdm-page-head-pb: var(--fdm-space-28);
}

/* The smaller note under the lead: 17/26 muted, as wide as the lead. The
   same pair as on the Affiliated Websites page. */
.fdm-bib-head__note {
  max-width: var(--fdm-measure-lead);
}

/* An introduction that is printed whole (it holds a link or a list). */
.fdm-bib-head__intro > * + * {
  margin-top: var(--fdm-space-14);
}

.fdm-bib {
  padding-bottom: var(--fdm-space-72);
}

/* Search field above, filter row below: 16px apart, 28px before the list. */
.fdm-bib__tools {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--fdm-space-16);
  padding-bottom: var(--fdm-space-28);
}

.fdm-bib__search {
  width: 100%;
  max-width: var(--fdm-bib-search-width);
  cursor: text;
}

/* Chips, switch and count on one 32px row; the count sits at the right. */
.fdm-bib__filters {
  --fdm-chips-gap: var(--fdm-space-10);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fdm-space-10);
  width: 100%;
  min-height: var(--fdm-bib-filters-height);
}

/* "Available as a PDF" switch: a real checkbox with role="switch". It is
   printed once at least one entry has an uploaded PDF. */
.fdm-bib-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--fdm-space-10);
  font-size: var(--fdm-fs-17);
  line-height: var(--fdm-lh-17);
  color: var(--fdm-ink);
  cursor: pointer;
}

.fdm-bib-switch__input {
  position: absolute;
  top: 50%;
  left: 0;
  width: var(--fdm-bib-switch-width);
  height: var(--fdm-bib-switch-height);
  margin: 0;
  opacity: 0;
  transform: translateY(-50%);
  cursor: pointer;
}

.fdm-bib-switch__track {
  flex: none;
  width: var(--fdm-bib-switch-width);
  height: var(--fdm-bib-switch-height);
  padding: var(--fdm-space-3);
  border-radius: var(--fdm-radius-12);
  background: var(--fdm-rule);
  transition: background-color var(--fdm-duration) var(--fdm-ease);
}

.fdm-bib-switch__track::after {
  content: "";
  display: block;
  width: var(--fdm-bib-switch-knob);
  height: var(--fdm-bib-switch-knob);
  border-radius: 50%;
  background: var(--fdm-white);
  transition: transform var(--fdm-duration) var(--fdm-ease);
}

.fdm-bib-switch__input:checked + .fdm-bib-switch__track {
  background: var(--fdm-green-900);
}

.fdm-bib-switch__input:checked + .fdm-bib-switch__track::after {
  transform: translateX(var(--fdm-bib-switch-travel));
}

.fdm-bib-switch__input:focus-visible + .fdm-bib-switch__track {
  outline: var(--fdm-focus-width) solid var(--fdm-color-focus);
  outline-offset: var(--fdm-focus-offset);
}

/* "96 of 96 entries": Crimson Text SemiBold 17/150% */
.fdm-bib__count {
  margin-left: auto;
  font-size: var(--fdm-fs-17);
  font-weight: var(--fdm-weight-semibold);
  line-height: var(--fdm-lh-17);
  color: var(--fdm-ink);
  white-space: nowrap;
}

/* 3. Groups and list ------------------------------------------------------- */

.fdm-bib__groups {
  display: flex;
  flex-direction: column;
  gap: var(--fdm-bib-group-gap);
}

/* Group label, then the cards, all 20px apart. */
.fdm-bib__group,
.fdm-bib__list {
  display: flex;
  flex-direction: column;
  gap: var(--fdm-space-20);
}

.fdm-bib__empty {
  font-size: var(--fdm-fs-19);
  line-height: var(--fdm-lh-19);
  color: var(--fdm-color-text-muted);
}

/* An entry reached by its address (#bib-...) stops clear of the window edge. */
.fdm-bib__item {
  scroll-margin-top: var(--fdm-space-24);
}

/* 4. Entry card ------------------------------------------------------------ */

/* The card is .fdm-card; its padding moves onto the summary and the panel so
   the whole closed card is the click target. */
.fdm-bib-entry {
  --fdm-card-padding: 0;
  --fdm-card-padding-phone: 0;
}

/* The line to press: the <summary> of the entry. */
.fdm-bib-entry__toggle {
  display: flex;
  align-items: center;
  gap: var(--fdm-space-24);
  padding: var(--fdm-bib-entry-pad-closed) var(--fdm-bib-entry-pad-x);
  border-radius: var(--fdm-radius-8);
  list-style: none;
  cursor: pointer;
}

.fdm-bib-entry__toggle::-webkit-details-marker {
  display: none;
}

.fdm-bib-entry[open] > .fdm-bib-entry__toggle {
  padding: var(--fdm-bib-entry-pad-open) var(--fdm-bib-entry-pad-x) 0;
}

/* The heading only carries the level; it reads as body text, 19/150%. */
.fdm-bib-entry__heading {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--fdm-font-body);
  font-size: var(--fdm-fs-19);
  font-weight: var(--fdm-weight-regular);
  line-height: var(--fdm-lh-19);
  color: var(--fdm-ink);
  overflow-wrap: anywhere;
}

/* Chevron: 16 x 10, 1.75px line. It turns over when the entry is open. */
.fdm-bib-entry__chevron {
  flex: none;
  width: var(--fdm-bib-chevron-width);
  height: var(--fdm-bib-chevron-height);
  overflow: visible;
  color: var(--fdm-green-900);
  transition: transform var(--fdm-duration) var(--fdm-ease);
}

.fdm-bib-entry[open] > .fdm-bib-entry__toggle .fdm-bib-entry__chevron {
  transform: rotate(180deg);
}

/* Open part: note, then the action row, 14px apart. */
.fdm-bib-entry__panel {
  display: flex;
  flex-direction: column;
  gap: var(--fdm-bib-entry-gap);
  padding: var(--fdm-bib-entry-gap) var(--fdm-bib-entry-pad-x) var(--fdm-bib-entry-pad-open);
}

/* Note: 18/165% muted */
.fdm-bib-entry__note {
  font-size: var(--fdm-fs-18);
  line-height: var(--fdm-lh-18-loose);
  color: var(--fdm-color-text-muted);
  overflow-wrap: anywhere;
}

.fdm-bib-entry__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--fdm-space-10) var(--fdm-space-18);
}

/* "PDF unavailable": muted chip, 42px tall, Crimson Text Italic 16/150% */
.fdm-bib-entry__no-pdf {
  display: inline-flex;
  align-items: center;
  padding: var(--fdm-bib-no-pdf-pad-y) var(--fdm-space-16);
  border-radius: var(--fdm-radius-control);
  background: var(--fdm-paper-200);
  color: var(--fdm-color-text-muted);
  font-size: var(--fdm-fs-16);
  font-style: italic;
  line-height: var(--fdm-lh-16);
  white-space: nowrap;
}

/* 5. Without JavaScript ---------------------------------------------------- */

/* Every entry still opens and closes (it is a <details>), and the PDF and
   "Read online" links work. Search, chips, switch, count and Copy citation
   need the script, so they are not shown without it. */
html:not(.fdm-js) .fdm-bib__tools,
html:not(.fdm-js) .fdm-bib-entry__actions [data-fdm-bib-copy] {
  display: none;
}

/* 6. Phone ----------------------------------------------------------------- */

@media (max-width: 599.98px) {
  .fdm-bib,
  .fdm-bib-head {
    --fdm-bib-entry-pad-x: var(--fdm-space-20);
    --fdm-bib-entry-pad-closed: var(--fdm-space-18);
    --fdm-bib-entry-pad-open: var(--fdm-space-20);
    --fdm-bib-entry-gap: var(--fdm-space-12);
    --fdm-bib-group-gap: var(--fdm-space-32);
  }

  .fdm-bib-head__note {
    font-size: var(--fdm-fs-16);
    line-height: var(--fdm-lh-16);
  }

  .fdm-bib {
    padding-bottom: var(--fdm-space-48);
  }

  .fdm-bib__tools {
    gap: var(--fdm-space-14);
    padding-bottom: var(--fdm-space-24);
  }

  .fdm-bib__search {
    max-width: none;
  }

  /* Chips take the first row; the switch and the count share the second. */
  .fdm-bib__filters {
    --fdm-chips-gap: var(--fdm-space-8);
    row-gap: var(--fdm-space-12);
  }

  .fdm-bib__filters .fdm-chips {
    flex: 1 0 100%;
  }

  .fdm-bib__group,
  .fdm-bib__list {
    gap: var(--fdm-space-14);
  }

  .fdm-bib-entry__heading {
    font-size: var(--fdm-fs-18);
    line-height: var(--fdm-lh-18-ui);
  }

  .fdm-bib-entry__toggle {
    gap: var(--fdm-space-16);
  }

  .fdm-bib-entry__note {
    font-size: var(--fdm-fs-17);
    line-height: var(--fdm-lh-17);
  }

  .fdm-bib-entry__actions {
    column-gap: var(--fdm-space-16);
  }
}
