/* Тёмная Марга: единая геометрия, визуальный баланс и responsive-полировка. */

.home-page .lede {
  margin-inline: auto;
}

body.editorial-page.article-page main,
body.editorial-page.topic-page main,
body.editorial-page.book-page main {
  max-width: 920px;
}

@media (min-width: 900px) {
  .site-footer {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 32px;
  }

  .site-footer .footer-brand {
    justify-self: start;
  }

  .site-footer .footer-nav {
    width: 100%;
    justify-self: center;
    justify-content: center;
    flex-wrap: nowrap;
    text-align: center;
  }

  .site-footer .footer-copy {
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
  }

  .site-footer .email-protected {
    margin-top: 0;
  }

  .article-page .site-footer,
  .topic-page .site-footer {
    padding-right: 28px !important;
    padding-left: 28px !important;
  }
}

@media (max-width: 860px) {
  .site-masthead {
    grid-template-columns: minmax(0, 1fr);
  }

  .masthead-brand,
  .masthead-nav {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
  }

  .masthead-nav {
    display: grid;
    grid-template-columns: repeat(4, auto);
    align-items: center;
    justify-content: space-between;
    justify-self: center;
    max-width: 520px;
    gap: 0;
    overflow: visible;
  }
}

@media (max-width: 899px) {
  .site-footer {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 14px;
    padding: 22px 16px 24px;
  }

  .site-footer .footer-brand,
  .site-footer .footer-nav,
  .site-footer .footer-copy {
    justify-self: start;
  }

  .site-footer .footer-nav {
    justify-content: flex-start;
    flex-wrap: wrap;
    text-align: left;
  }

  .site-footer .footer-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
  }

  .site-footer .email-protected {
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  body.editorial-page {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-x: clip;
  }

  body.editorial-page main,
  .guide-page main {
    box-sizing: border-box;
    width: 100%;
    margin-inline: auto;
    padding-inline: max(8px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  body.editorial-page .page,
  body.editorial-page .shell,
  .guide-page .guide-shell {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin-inline: auto;
  }

  .site-masthead {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  .masthead-nav {
    margin: 0;
    padding: 10px 0 0;
    scrollbar-width: none;
  }

  .masthead-nav a {
    min-width: 0;
    padding: 8px 0;
    font-size: 0.6875rem;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
  }

  .site-footer {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin-inline: 0;
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 340px) {
  .masthead-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .masthead-nav a:nth-child(odd) {
    text-align: left;
  }

  .masthead-nav a:nth-child(even) {
    text-align: right;
  }
}
