/* The journal identifiers occupy a full-width row, independently of the footer columns. */
html:root footer .footer-inner:has(> .issn) {
  flex-wrap: wrap;
}

html:root body footer :is(.footer-inner, .zh-foot-links) > .issn,
html:root body footer.zh-foot > .issn,
html:root body header > .mnko-article-issn {
  display: grid !important;
  grid-column: 1 / -1 !important;
  grid-template-columns: minmax(0, 1fr) !important;
  flex: 0 0 100% !important;
  order: 4;
  width: 100% !important;
  align-self: stretch !important;
  justify-self: stretch !important;
  gap: 3px !important;
  margin-inline: 0 !important;
  text-align: center !important;
}

html:root body :is(footer .issn, header .mnko-article-issn) > .footer-issn-line {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  white-space: normal !important;
}

/* Keep the existing line break in the React-rendered footer. */
html:root body footer :is(.footer-inner, .zh-foot-links) > .issn:has(> br),
html:root body footer.zh-foot > .issn:has(> br) {
  display: block !important;
  white-space: normal !important;
}

html:root body .site.home-page #journal-footer-preview .footer-inner > .issn {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  justify-self: stretch !important;
  text-align: center !important;
}

@media (min-width: 701px) and (max-width: 1000px) {
  html:root body .site.home-page #journal-footer-preview .footer-inner > .issn {
    grid-row: 7 !important;
  }
}

@media (min-width: 1001px) {
  html:root body .site.home-page #journal-footer-preview .footer-inner > .issn {
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    grid-column: 3 !important;
    grid-row: 1 !important;
    width: auto !important;
    max-width: 100%;
    justify-self: end !important;
    align-self: start !important;
    text-align: right !important;
  }

  html:root body .site.home-page #journal-footer-preview .issn > .footer-issn-line {
    text-align: right !important;
  }
}

@media (max-width: 700px) {
  html:root[lang^="zh"] body .site.home-page #journal-footer-preview .footer-inner > .footer-contact-group {
    grid-column: 1 / -1 !important;
    grid-row: 2 / span 2 !important;
  }
}

header:has(> .mnko-article-issn) {
  flex-wrap: wrap;
}

footer.zh-foot {
  justify-content: center;
}

footer.zh-foot > .footer-brand {
  display: flex;
  flex: 0 0 100%;
  justify-content: center;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

footer.zh-foot .footer-mark {
  flex: 0 0 48px;
  width: 48px;
  height: 46px;
  background: -60.96px -32.2625px / 425.76px 197.3575px no-repeat url("/assets/clear-symbol-reference.png");
}

footer.zh-foot .footer-brand > div {
  min-width: 0;
  text-align: left;
}

footer.zh-foot .footer-brand strong {
  display: block;
  color: #244f5b;
  font: 400 16px Georgia, serif;
}

footer.zh-foot .footer-brand p {
  margin: 5px 0 0;
  color: #416772;
  font: 400 9px Arial, "Segoe UI", sans-serif;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  html[data-center-footer-contacts] .site-footer .footer-inner > a[href^="mailto:"],
  html[data-center-footer-contacts] .site-footer .footer-inner > span:not(.issn) {
    grid-column: 1 / -1;
    justify-self: center;
    text-align: center;
  }

  footer.zh-foot .footer-brand strong {
    font-size: 15px;
  }

  footer.zh-foot .footer-brand p {
    font-size: 8px;
  }
}

/* Align the two lines of the journal name with the original square mark. */
html[lang] body footer .footer-brand:has(> .footer-mark) {
  align-items: center !important;
  flex-direction: row !important;
  gap: 10px !important;
}

html[lang] body footer .footer-brand > .footer-mark {
  display: block !important;
  flex: 0 0 48px !important;
  width: 48px !important;
  height: 48px !important;
  margin: 0 !important;
}

html[lang] body footer .footer-brand > div:has(> strong + p, > p + strong) {
  display: grid !important;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 2px !important;
  min-width: 0;
  min-height: 48px;
  max-width: 222px;
  text-align: left !important;
}

html[lang] body footer .footer-brand > div > p {
  grid-row: 1;
  margin: 0 !important;
  font: 400 10px/1.2 Arial, sans-serif !important;
  letter-spacing: .04em !important;
}

html[lang] body footer .footer-brand > div > strong {
  grid-row: 2;
  margin: 0 !important;
  font: 400 16px/1.1 Georgia, serif !important;
  white-space: normal !important;
}

@media (max-width: 480px) {
  html[lang] body footer .footer-brand > div > strong {
    font-size: 15px !important;
  }
}

html[lang] body footer .footer-brand > div > :is(p, strong) {
  text-align: left !important;
}

@media (max-width: 700px) {
  html:root body footer.site-footer:not(.home-integrated-footer) .footer-brand {
    justify-content: center !important;
  }

  html:root body footer.site-footer:not(.home-integrated-footer) .footer-navigation {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px 12px !important;
    width: 100% !important;
    justify-items: center;
    text-align: center;
  }

  html:root body footer.site-footer:not(.home-integrated-footer) .footer-navigation a {
    margin: 0 !important;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 350px) {
  html[lang] body footer .footer-brand > div > p {
    font-size: 9px !important;
  }
}

/* Use the approved wordmark in the branded footer, with contrast for each background. */
@media screen and (forced-colors: none) {
  html[lang]:not([data-accessible="true"]) body footer .footer-brand:has(> .footer-mark) {
    --footer-wordmark: url("/assets/mnko-footer-title-ru.png");
    --footer-wordmark-ratio: 415 / 65;
  }

  html[lang^="en"]:not([data-accessible="true"]) body footer .footer-brand:has(> .footer-mark) {
    --footer-wordmark: url("/assets/mnko-header-en-original-fragments.png");
    --footer-wordmark-ratio: 525 / 65;
  }

  html[lang]:not([data-accessible="true"]) body footer .footer-brand > .footer-mark {
    background: center / contain no-repeat url("/assets/mnko-footer-mark.png") !important;
  }

  html[lang]:not([data-accessible="true"]) body footer .footer-brand > div:has(> strong + p, > p + strong) {
    flex: 0 1 270px;
    width: 270px;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr);
  }

  html[lang]:not([data-accessible="true"]) body footer .footer-brand > div > strong {
    font-size: 0 !important;
    line-height: 0 !important;
    max-height: 36px;
    overflow: hidden;
    -webkit-text-fill-color: transparent;
  }

  html[lang]:not([data-accessible="true"]) body footer .footer-brand > div > strong::before {
    content: "";
    display: block;
    width: 100%;
    max-height: 36px;
    aspect-ratio: var(--footer-wordmark-ratio);
    background: var(--footer-wordmark) left center / contain no-repeat;
    filter: var(--footer-wordmark-filter, none);
  }

  html[lang]:not([data-accessible="true"]) body footer.site-footer:not(.home-integrated-footer) .footer-brand > span[aria-hidden]:not(.footer-mark) {
    display: none !important;
  }

  html[lang]:not([data-accessible="true"]) body footer.site-footer:not(.home-integrated-footer) .footer-brand > div > p {
    -webkit-text-fill-color: #eff8fb;
  }

  html[lang]:not([data-accessible="true"]) body footer.site-footer:not(.home-integrated-footer) {
    --footer-wordmark-filter: brightness(0) invert(94%) sepia(7%) saturate(480%) hue-rotate(153deg) brightness(105%);
  }
}

/* Align the approved text signature on each public home page. */
@media screen and (forced-colors: none) {
  html[lang]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand {
    --home-footer-name-width: 217px;
    --home-footer-subtitle-spacing: .065em;
    align-items: start !important;
    gap: 10px !important;
  }

  html[lang^="en"]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand {
    --home-footer-name-width: 270px;
  }

  html[lang]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand > div:has(> strong + p, > p + strong) {
    grid-template-rows: auto auto;
    align-content: space-between;
    gap: 0 !important;
    flex: 0 1 var(--home-footer-name-width);
    width: var(--home-footer-name-width);
    max-width: var(--home-footer-name-width) !important;
    min-width: 0;
    height: 48px;
    min-height: 48px;
  }

  html[lang]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand > div > p {
    grid-row: 1;
    margin: 0 !important;
    font: 400 10px/14px Arial, sans-serif !important;
    letter-spacing: var(--home-footer-subtitle-spacing) !important;
    text-align: left !important;
    white-space: nowrap;
  }

  html[lang]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand > div > strong {
    grid-row: 2;
    margin: 0 !important;
    display: block !important;
    font: 400 16px/16px Georgia, serif !important;
    color: #244f5b !important;
    -webkit-text-fill-color: currentColor;
    max-height: none;
    overflow: visible;
  }

  html[lang]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand > div > strong::before {
    content: none;
  }

  @media (max-width: 350px) {
    html[lang]:not([data-accessible="true"]) body .site.home-page #journal-footer-preview .footer-brand > div > p {
      font-size: 8px !important;
      letter-spacing: .06em !important;
    }
  }
}

@media (min-width: 1001px) {
  html[lang] body .site.home-page #journal-footer-preview .footer-inner > :is(.footer-contact-group, .issn) {
    display: grid !important;
    grid-template-rows: 20px 20px;
    align-items: start;
    align-content: space-between;
    gap: 0 !important;
    height: 48px;
    margin-block: 0 !important;
    line-height: 20px !important;
  }

  html[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-contact-group > * {
    margin-block: 0 !important;
    line-height: 20px !important;
  }

  html[lang] body .site.home-page #journal-footer-preview .footer-inner > .issn > .footer-issn-line {
    margin-block: 0 !important;
    line-height: 20px !important;
  }
}

/* The home page has its own center column, independently of the ISSN. */
html:root body .site.home-page #journal-footer-preview .footer-inner > .footer-contact-group {
  justify-self: center !important;
  align-items: center !important;
  justify-items: center !important;
  text-align: center !important;
}
html:root body .site.home-page #journal-footer-preview .footer-contact-group > :is(a, .journal-channel) {
  width: fit-content !important;
  max-width: 100%;
  margin-inline: auto !important;
  text-align: center !important;
}
html:root body .site.home-page #journal-footer-preview .footer-inner > .footer-region {
  justify-self: center !important;
  text-align: center !important;
}
@media (max-width: 1000px) {
  html:root body .site.home-page #journal-footer-preview .footer-inner > .footer-contact-group {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }
}
@media (max-width: 700px) {
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-contact-group {
    grid-row: 2 !important;
  }
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-region {
    grid-row: 3 !important;
  }
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .issn {
    grid-row: 4 !important;
  }
}

html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-contact-group {
  display: grid !important;
  grid-template-rows: 19px 19px;
  align-content: space-between !important;
  align-items: start !important;
  height: 48px;
  gap: 0 !important;
}
html:root[lang] body .site.home-page #journal-footer-preview .footer-contact-group > :is(a, .journal-channel),
html:root[lang] body .site.home-page #journal-footer-preview .footer-contact-group .journal-channel > a {
  line-height: 20px !important;
  margin-block: 0 !important;
}
@media (min-width: 701px) and (max-width: 1000px) {
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-region {
    grid-row: 3 !important;
  }
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-policy-links {
    grid-row: 4 !important;
  }
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .footer-navigation {
    grid-row: 5 !important;
  }
  html:root[lang] body .site.home-page #journal-footer-preview .footer-inner > .issn {
    grid-row: 6 !important;
  }
}