/* ==========================================================================
   Francis Davis Millet Institute - one research entry
   Requires tokens.css and base.css; lists.css is loaded before this file
   and gives the gold "Featured now" tag (fdm-listing__tag--now).
   Template: single-unpublished-research.php. Figma: frame 267:605.

   From build/research-article/research-article.css. What differs: the
   reading width and the title width are the shared tokens
   --fdm-measure-reading and --fdm-listing-title-max (the same 760px and
   1000px), and part 3 has two new rules: a wide table scrolls inside the
   column, and the line shown for an entry that cannot be read.

   Contents
    1. Page values     3. Article body
    2. Head            4. Phone
   ========================================================================== */

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

/* Drawn only on this page and missing from tokens.css; move them there if
   another page needs them. */
.fdm-research-article {
  --fdm-research-article-lh: 32px;           /* 20 / 160% */
  --fdm-research-article-lh-phone: 29px;     /* 18 / 160% */
  --fdm-research-article-figure-max: 640px;  /* tallest a featured image is shown */
}

/* 2. Head ------------------------------------------------------------------ */

/* fdm-page-head sets 64px above, 32px below and 14px between the back link,
   the tag and the title. */

/* "← Back to Research": 17px on a 22px line */
.fdm-research-article__back {
  line-height: var(--fdm-lh-17-menu);
}

.fdm-research-article__title {
  max-width: var(--fdm-listing-title-max);
  overflow-wrap: break-word;
}

/* 3. Article body ---------------------------------------------------------- */

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

/* A rule above and below; 40px over the text, 48px under the button, 28px
   between the picture, the text and the button. */
.fdm-research-article__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--fdm-space-28);
  padding-block: var(--fdm-space-40) var(--fdm-space-48);
  border-block: var(--fdm-border);
}

/* Featured image (optional): above the text, in the reading column, whole
   and at its own proportions. */
.fdm-research-article__figure {
  width: 100%;
  max-width: var(--fdm-measure-reading);
}

.fdm-research-article__figure img,
.fdm-research-article__text img {
  max-width: 100%;
  height: auto;
  border-radius: var(--fdm-radius-image);
}

/* A tall picture is scaled down to fit, never cropped. */
.fdm-research-article__figure img {
  width: auto;
  max-height: var(--fdm-research-article-figure-max);
}

/* Pictures inside a paragraph of the text sit side by side and wrap, as
   they did on the old site (3 Nov 2026: the articles moved from there have
   rows of up to 22 small scans in one paragraph). base.css makes every img
   a block, which stacked them one per line. */
.fdm-research-article__text p img {
  display: inline-block;
  margin: 0 var(--fdm-space-8) var(--fdm-space-8) 0;
  vertical-align: top;
}

/* Reading column: Crimson Text 20/160%, 760px wide, 18px between paragraphs */
.fdm-research-article__text {
  width: 100%;
  max-width: var(--fdm-measure-reading);
  font-size: var(--fdm-fs-20);
  line-height: var(--fdm-research-article-lh);
  color: var(--fdm-ink);
  overflow-wrap: break-word;
}

.fdm-research-article__text > * + * {
  margin-top: var(--fdm-space-18);
}

.fdm-research-article__text > * + :is(h2, h3, h4) {
  margin-top: var(--fdm-space-36);
}

/* A table or a wide embed scrolls inside the column instead of widening the page. */
.fdm-research-article__text > table {
  display: block;
  overflow-x: auto;
}

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

/* Shown in place of the text when the entry cannot be read */
.fdm-research-article__missing {
  font-style: italic;
  color: var(--fdm-color-text-muted);
}

/* 4. Phone ----------------------------------------------------------------- */

@media (max-width: 599.98px) {
  .fdm-research-article__wrap {
    padding-bottom: var(--fdm-space-40);
  }

  .fdm-research-article__body {
    gap: var(--fdm-space-24);
    padding-block: var(--fdm-space-24) var(--fdm-space-32);
  }

  .fdm-research-article__text {
    font-size: var(--fdm-fs-18);
    line-height: var(--fdm-research-article-lh-phone);
  }

  .fdm-research-article__text > * + * {
    margin-top: var(--fdm-space-16);
  }

  .fdm-research-article__text > * + :is(h2, h3, h4) {
    margin-top: var(--fdm-space-28);
  }
}
