/* ==========================================================================
   Francis Davis Millet Institute - Affiliated Websites page
   (view "affiliated", template page-affiliated-websites.php).
   Loaded after tokens.css and base.css.
   Figma: file wo9RmPUccR2OeLvr749rXQ, frame 267:693.

   Adapted from build/affiliated/affiliated.css. What changed: a site's
   description arrives as ready-made paragraphs, so the text class sits on
   their wrapper; an introduction that holds a link is printed whole.

   The entry card has the same measurements as the bibliography entry card
   (bibliography.css, fdm-bib-entry). It is a native <details> element, so it
   opens and closes without JavaScript.

   Contents
    1. Page values     3. Sections
    2. Page head       4. Entry card (closed and open)
                       5. Phone
   ========================================================================== */

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

/* Drawn only on this page and missing from tokens.css; move them there if
   another page needs them. */
.fdm-affiliated,
.fdm-affiliated-head {
  --fdm-affiliated-heading-lh: 39px;     /* section heading: 32px, automatic line height */
  --fdm-affiliated-subtitle-lh: 23px;    /* section subtitle: 18px, automatic line height */
  --fdm-affiliated-subtitle-max: 900px;  /* section subtitle width */
  --fdm-affiliated-chevron-width: 16px;  /* chevron box, 16 x 10 */
  --fdm-affiliated-chevron-height: 10px;
  --fdm-affiliated-entry-pad-x: var(--fdm-space-32);
  --fdm-affiliated-entry-pad-closed: var(--fdm-space-22);  /* closed card is 75px tall */
  --fdm-affiliated-entry-pad-open: var(--fdm-space-32);
  --fdm-affiliated-entry-gap: var(--fdm-space-14);         /* name, description, links */
  --fdm-affiliated-section-gap: var(--fdm-space-56);       /* between two sections */
}

/* 2. Page head ------------------------------------------------------------- */

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

/* The smaller note on links under the lead: 17/26 muted, as wide as the lead */
.fdm-affiliated-head__note {
  max-width: var(--fdm-measure-lead);
}

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

/* 3. Sections -------------------------------------------------------------- */

.fdm-affiliated {
  display: flex;
  flex-direction: column;
  gap: var(--fdm-affiliated-section-gap);
  padding-top: var(--fdm-space-8);
  padding-bottom: var(--fdm-space-72);
}

/* Heading, subtitle and cards, all 20px apart. */
.fdm-affiliated__section,
.fdm-affiliated__list {
  display: flex;
  flex-direction: column;
  gap: var(--fdm-space-20);
}

.fdm-affiliated__heading {
  line-height: var(--fdm-affiliated-heading-lh);
}

.fdm-affiliated__subtitle {
  max-width: var(--fdm-affiliated-subtitle-max);
  line-height: var(--fdm-affiliated-subtitle-lh);
  color: var(--fdm-color-text-muted);
}

/* Shown in place of the sections when the page has no site yet. */
.fdm-affiliated__empty {
  font-size: var(--fdm-fs-19);
  line-height: var(--fdm-lh-19);
  color: var(--fdm-color-text-muted);
}

/* A site reached by its address (#fdm-site-...) stops clear of the window edge. */
.fdm-affiliated__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-affiliated-entry {
  --fdm-card-padding: 0;
  --fdm-card-padding-phone: 0;
}

.fdm-affiliated-entry__summary {
  display: flex;
  align-items: center;
  gap: var(--fdm-space-24);
  padding: var(--fdm-affiliated-entry-pad-closed) var(--fdm-affiliated-entry-pad-x);
  border-radius: var(--fdm-radius-8);
  list-style: none;
  cursor: pointer;
}

.fdm-affiliated-entry__summary::-webkit-details-marker {
  display: none;
}

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

/* A site with nothing to open: the name alone, not a control. */
.fdm-affiliated-entry__summary--plain {
  cursor: default;
}

/* The heading only carries the level; it reads as body text, 19/150%. */
.fdm-affiliated-entry__name {
  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-affiliated-entry__chevron {
  flex: none;
  width: var(--fdm-affiliated-chevron-width);
  height: var(--fdm-affiliated-chevron-height);
  overflow: visible;
  color: var(--fdm-green-900);
  transition: transform var(--fdm-duration) var(--fdm-ease);
}

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

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

/* Description: 18/165% muted. The class is on the wrapper of the ready-made
   paragraphs; two paragraphs sit as far apart as the description and the links. */
.fdm-affiliated-entry__text {
  font-size: var(--fdm-fs-18);
  line-height: var(--fdm-lh-18-loose);
  color: var(--fdm-color-text-muted);
  overflow-wrap: anywhere;
}

.fdm-affiliated-entry__text > * + * {
  margin-top: var(--fdm-affiliated-entry-gap);
}

/* Links: one per row. A link that carries a note has it in a second column,
   18px to the right, and the notes of one entry line up. */
.fdm-affiliated-entry__links {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--fdm-space-8) var(--fdm-space-18);
}

.fdm-affiliated-entry__links > li {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: baseline;
}

.fdm-affiliated-entry__links .fdm-link {
  justify-self: start;
  overflow-wrap: anywhere;
}

/* Note beside a link: 17/150% muted */
.fdm-affiliated-entry__link-note {
  font-size: var(--fdm-fs-17);
  line-height: var(--fdm-lh-17);
  color: var(--fdm-color-text-muted);
  overflow-wrap: anywhere;
}

/* 5. Phone ----------------------------------------------------------------- */

/* Tablet and phone: the note goes under its link. */
@media (max-width: 1023.98px) {
  .fdm-affiliated-entry__links {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 599.98px) {
  .fdm-affiliated,
  .fdm-affiliated-head {
    --fdm-affiliated-heading-lh: var(--fdm-lh-24-heading);
    --fdm-affiliated-subtitle-lh: var(--fdm-lh-17-menu);
    --fdm-affiliated-entry-pad-x: var(--fdm-space-20);
    --fdm-affiliated-entry-pad-closed: var(--fdm-space-18);
    --fdm-affiliated-entry-pad-open: var(--fdm-space-20);
    --fdm-affiliated-entry-gap: var(--fdm-space-12);
    --fdm-affiliated-section-gap: var(--fdm-space-40);
  }

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

  .fdm-affiliated {
    padding-top: var(--fdm-space-12);
    padding-bottom: var(--fdm-space-48);
  }

  .fdm-affiliated__section,
  .fdm-affiliated__list {
    gap: var(--fdm-space-14);
  }

  /* Section heading: 24/115% */
  .fdm-affiliated__heading {
    font-size: var(--fdm-fs-24);
  }

  .fdm-affiliated__subtitle {
    font-size: var(--fdm-fs-17);
  }

  .fdm-affiliated-entry__summary {
    gap: var(--fdm-space-16);
  }

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

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

  .fdm-affiliated-entry__link-note {
    font-size: var(--fdm-fs-16);
    line-height: var(--fdm-lh-16);
  }
}
