/* R21: responsive text and controls; shared by the complete journal. */
html, body { max-width: 100%; }
body :where(img, svg, video, iframe) { max-width: 100%; }
body :where(input, select, textarea, button) { box-sizing: border-box; max-width: 100%; }
.journal-page :where(.journal-layout, .journal-sidebar, .sidebar-box, .topic-list,
  .journal-content, .section-heading, .heading-actions, .journal-sort,
  .article-content, .article-cta, .related-grid, .related-card) { min-width: 0; }
.journal-page :where(h1, h2, h3, p, li, td, th, .related-card strong) {
  max-width: 100%; overflow-wrap: break-word;
}

/* Category labels may wrap; their numeric counts must always stay on one line. */
.journal-page .topic-filter {
  min-width: 0 !important;
  align-items: flex-start !important;
  gap: 10px !important;
}
.journal-page .topic-filter > span {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: auto;
}
.journal-page .topic-filter > small {
  display: inline-block !important;
  flex: 0 0 auto !important;
  width: max-content !important;
  min-width: 3ch !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* Sorting toolbar: it wraps as a unit instead of shrinking the native select. */
.journal-page .section-heading--all {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-end !important;
  gap: 16px 24px !important;
}
.journal-page .section-heading--all > div:first-child {
  flex: 1 1 440px !important;
  min-width: 0 !important;
}
.journal-page .section-heading--all .heading-actions {
  flex: 1 1 350px !important;
  min-width: 0 !important;
  max-width: 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px 14px !important;
  white-space: normal !important;
}
.journal-page .section-heading--all .journal-sort {
  display: grid !important;
  grid-template-columns: max-content minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
  flex: 1 1 260px !important;
  width: auto !important;
  min-width: 0 !important;
  white-space: normal !important;
}
.journal-page .section-heading--all .journal-sort label {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}
.journal-page .section-heading--all .journal-sort select {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 250px !important;
  min-height: 46px !important;
  padding: 10px 36px 10px 13px !important;
  border: 1px solid #d6e1ed !important;
  border-radius: 12px !important;
  background-color: #fff !important;
  color: #29415a !important;
  font: 600 14px/1.3 Manrope, "Segoe UI", Arial, sans-serif !important;
  letter-spacing: 0 !important;
  text-overflow: clip !important;
}
.journal-page .section-heading--all .result-count {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

@media (max-width: 980px) {
  .journal-page .section-heading--all > div:first-child { flex-basis: 100% !important; }
  .journal-page .section-heading--all .heading-actions {
    flex: 1 1 100% !important;
    width: 100% !important;
    justify-content: flex-end !important;
  }
  .journal-page .section-heading--all .journal-sort { flex: 1 1 260px !important; }
  .journal-page .section-heading--all .journal-sort select { max-width: none !important; }
}
@media (max-width: 760px) {
  .journal-page .section-heading--all .heading-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
  }
  .journal-page .section-heading--all .journal-sort {
    display: grid !important;
    grid-template-columns: max-content minmax(0, 1fr) !important;
    width: 100% !important;
    flex: none !important;
  }
  .journal-page .section-heading--all .journal-sort select {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    font-size: 14px !important;
  }
  .journal-page .section-heading--all .result-count {
    justify-self: end !important;
    font-size: 12px !important;
  }
}
@media (max-width: 360px) {
  .journal-page .section-heading--all .journal-sort {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .journal-page .section-heading--all .journal-sort label { white-space: normal !important; }
}
