/* Shared text scale for page content and the editorial columns on the home page. */
:root {
  --rrg-content-font-size: 1rem;
  --rrg-content-line-height: 1.5;
  --rrg-h1-size: 1.875rem;
  --rrg-h2-size: 1.5rem;
  --rrg-h3-size: 1.25rem;
  --rrg-h4-size: 1.125rem;
  --rrg-small-size: .875rem;
  --rrg-text-gap: 1rem;
  --rrg-section-gap: 2rem;
}

@media (max-width: 767px) {
  :root {
    --rrg-h1-size: 1.625rem;
    --rrg-h2-size: 1.375rem;
    --rrg-h3-size: 1.125rem;
    --rrg-h4-size: 1.0625rem;
    --rrg-section-gap: 1.5rem;
  }
}

body { font-family: var(--rrg-font); }

:is(#content, .rrg-content) {
  font: 400 var(--rrg-content-font-size)/var(--rrg-content-line-height) var(--rrg-font);
  color: var(--rrg-text);
  overflow-wrap: break-word;
}

/* Legacy component rules specify their own families. Keep the icon glyphs and charts. */
:is(#content, .rrg-content) :where(
  a, button, div, input, label, li, p, select, span, table, td, textarea, th
):not(:where(svg *, .highcharts-container *, .fa, .fab, .far, .fas, [class^="icon-"]:empty)) {
  font-family: var(--rrg-font);
}

:is(#content, .rrg-content) :is(h1, .h1, h2, .h2, h3, .h3, h4, h5, h6) {
  font: 700 var(--rrg-heading-size)/1.25 var(--rrg-font);
  margin-block: var(--rrg-heading-before) var(--rrg-heading-after);
}

:is(#content, .rrg-content) :where(h1, .h1) {
  --rrg-heading-size: var(--rrg-h1-size);
  --rrg-heading-before: 0px;
  --rrg-heading-after: 1.5rem;
  color: var(--rrg-accent);
}

:is(#content, .rrg-content) :where(h2, .h2) {
  --rrg-heading-size: var(--rrg-h2-size);
  --rrg-heading-before: var(--rrg-section-gap);
  --rrg-heading-after: .75rem;
}

:is(#content, .rrg-content) :where(h1, h2) { text-wrap: balance; }

:is(#content, .rrg-content) :where(h3, .h3, h4, h5, h6) {
  --rrg-heading-size: var(--rrg-h3-size);
  --rrg-heading-before: 1.5rem;
  --rrg-heading-after: .5rem;
}

:is(#content, .rrg-content) :where(h4, h5, h6) {
  --rrg-heading-size: var(--rrg-h4-size);
}

:is(#content, .rrg-content) :is(h1, h2, h3, h4, h5, h6) :where(a, span, strong, b, em) {
  font-size: inherit;
}

:is(#content, .rrg-content) :where(p, blockquote) {
  font-size: var(--rrg-content-font-size);
  line-height: var(--rrg-content-line-height);
  margin-block: 0 var(--rrg-text-gap);
}

:is(#content, .rrg-content) :where(p, li, td, th) > :where(a, span, strong, b, em) {
  font-size: inherit;
}

:is(#content, .rrg-content) :where(li, td, th) { font-size: var(--rrg-content-font-size); }
:is(#content, .rrg-content) :where(strong, b, th) { font-weight: 700; }

/* Imported HTML sometimes stores typography inline or uses the obsolete font tag. */
:is(#content, .rrg-content) :is([style*="font" i], font):not(svg *, .highcharts-container *) {
  font-family: var(--rrg-font) !important;
}

:is(#content, .rrg-content) :where(h1, h2, h3, h4, h5, h6)[style] {
  font-size: var(--rrg-heading-size) !important;
  line-height: 1.25 !important;
}

:is(#content, .rrg-content) :where(p, li, td, th)[style] {
  font-size: var(--rrg-content-font-size) !important;
  line-height: var(--rrg-content-line-height) !important;
}

:is(#content, .rrg-content) :where(
  span, a, em, strong, b, i, font
):is([style*="font-size" i], [style*="font:" i], font) {
  font-size: inherit !important;
  line-height: inherit !important;
}

/* The legacy icon stylesheet also targets text wrapped in <i>. */
:is(#content, .rrg-content) :where(em, i:not(:empty, .fa, .fab, .far, .fas)) {
  font-family: inherit !important;
  font-style: italic;
  font-weight: inherit;
  line-height: inherit;
}

/* Lists without component classes are editorial; custom menus retain their own layout. */
:is(#content, .rrg-content) :where(ul, ol):not(:where(
  [id], [class], .object-list-controller *, .map-controller *, .sorter *, .feedback-form__errors *
)) {
  margin-block: 0 var(--rrg-text-gap);
  padding-inline-start: 1.5em;
  font-size: var(--rrg-content-font-size);
  line-height: var(--rrg-content-line-height);
}

:is(#content, .rrg-content) ul:not(:where(
  [id], [class], .object-list-controller *, .map-controller *, .sorter *, .feedback-form__errors *
)) { list-style: disc outside; }

:is(#content, .rrg-content) :where(ul, ol):not(:where(
  [id], [class], .object-list-controller *, .map-controller *, .sorter *, .feedback-form__errors *
)) > li {
  margin-block: 0 .375rem;
}

:is(#content, .rrg-content) :where(ul, ol):not(:where(
  [id], [class], .object-list-controller *, .map-controller *, .sorter *, .feedback-form__errors *
)) > li::marker { color: var(--rrg-accent); }

:is(#content, .rrg-content) li > :where(ul, ol):not([id], [class]) {
  margin-block: .375rem 0;
}

:is(#content, .rrg-content) li > ul:not([id], [class]) { list-style-type: circle; }
:is(#content, .rrg-content) li > p { margin-block-end: .375rem; }

:is(#content, .rrg-content) :where(.news-date, .newsdate, .review_date) {
  font-size: var(--rrg-small-size);
  color: var(--rrg-text-muted);
}

:is(#content, .rrg-content) h1.newsheader { --rrg-heading-after: .5rem; }

#content :is(.items > .view, .object-list, .object-tile__body) :is(h2, h3) {
  --rrg-heading-before: .5rem;
  --rrg-heading-after: .5rem;
}

:is(#content, .rrg-content).news-index h3 { --rrg-heading-before: .5rem; }

:is(#content, .rrg-content).news-index h2,
:is(#content .newreviews, .rrg-content.newreviews) > h3 { --rrg-heading-before: 0px; }
