/* Shared card proportions and navigation for all external-fiction galleries. */
.modern-site .external-work-grid {
  grid-auto-rows: 1fr;
  align-items: stretch;
}
.modern-site .external-related-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.modern-site .external-related-item > .external-match-reason {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.5;
  height: 3em;
  margin-bottom: 12px;
}
.modern-site .external-work-card {
  box-sizing: border-box;
  height: 100%;
  min-width: 0;
}
.modern-site .external-related-item > .external-work-card {
  flex: 1;
  height: auto;
}
.modern-site .external-work-card > .library-eyebrow {
  display: block;
  line-height: 1.5;
  height: 1.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modern-site .external-work-card :is(h2, h3) {
  flex: none;
  line-height: 1.3;
  height: 2.6em;
  margin: 12px 0 16px;
}
.modern-site .external-work-card :is(h2, h3) > a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.modern-site .external-work-card .external-byline {
  flex: none;
  height: 3.2em;
  line-height: 1.6;
  margin: 0 0 16px;
}
.modern-site .external-work-card .external-byline > span {
  display: block;
  height: 1.6em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modern-site .external-work-card .external-card-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  flex: none;
  height: 6.4em;
  line-height: 1.6;
  margin: 0 0 18px;
}
.modern-site .external-work-card .external-meta {
  flex: none;
  height: 1.6em;
  line-height: 1.6;
  margin: 0 0 16px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.modern-site .external-work-card .external-tags-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, 32px);
  align-items: start;
  gap: 6px;
  flex: none;
  height: 70px;
  margin: 0 0 18px;
  overflow: hidden;
}
.modern-site .external-tags-compact > :is(span, a) {
  display: block;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  width: max-content;
  height: 32px;
  padding: 6px 9px;
  font-size: .75rem;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}
.modern-site .external-tags-compact > .external-tags-more {
  color: var(--accent-text);
}
.modern-site .external-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: 14px;
  width: 100%;
  min-width: 0;
}
.modern-site .external-work-card .external-actions {
  margin-top: auto;
  padding-top: 8px;
}
.modern-site .external-actions > .library-button {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 5px;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: 220px;
  min-height: 48px;
  padding: 12px 14px;
  font-size: .8125rem;
  line-height: 1.4;
  white-space: nowrap;
}
.modern-site .external-actions > .library-button > span:first-child {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.modern-site .external-actions > .library-button > span:last-child {
  flex: none;
}
.modern-site .external-actions > .external-about-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-height: 44px;
  min-width: 0;
  font-size: .8125rem;
  line-height: 1.4;
  white-space: nowrap;
}
.modern-site .external-detail .external-actions {
  max-width: 420px;
}

/* Directory text starts on the same axis, regardless of title length. */
.modern-site .library-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  align-items: stretch;
}
.modern-site .library-directory > a {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  text-align: left;
}
.modern-site .library-directory > a > span:only-child {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
}
.modern-site .library-directory :is(strong, small) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-left: 0;
  text-align: left;
  line-height: 1.5;
  height: 3em;
}
.modern-site .library-directory small {
  margin-top: 7px;
}
.modern-site .resource-directory-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-width: 0;
  min-height: 112px;
  padding: 22px 24px;
  text-align: left;
}
.modern-site .resource-directory-copy {
  display: block;
  flex: 1;
  min-width: 0;
  margin: 0;
  text-align: left;
}
.modern-site .resource-directory-copy > :is(strong, span) {
  display: block;
  text-align: left;
}
@media (max-width: 767px) {
  .modern-site .library-directory { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .modern-site .external-work-card { padding: 20px; }
  .modern-site .external-actions { column-gap: 10px; }
  .modern-site .external-actions > .library-button { padding-inline: 10px; }
  .modern-site .resource-directory-card { padding: 20px; }
}
