/*
 * Additions to the old theme (app.min.css and custom.css are kept byte for byte).
 *
 * Rich text: the theme resets all margins (*{margin:0}); on the old site gaps between paragraphs
 * came from empty <p><br></p> the editor inserted by hand. Markdown has no empty paragraphs, so
 * the gap is now set here, one line, the same height those spacers had.
 */
.news-detail__text > * + *,
.text > * + *,
.accordion__item-desc > * + *,
.career__col > p + p {
  margin-top: 1.5em;
}

.news-detail__text li + li,
.text li + li {
  margin-top: 0.5em;
}

/* Astro writes the image's own width and height into <img>; the theme stretches article images
   to the column width, so the height must follow. */
.news-detail__text img {
  height: auto !important;
}

/*
 * Offer in the middle of an article (src/components/ArticlePromo.astro): the dark card of the home
 * page «Новости» banner (.news-front__fixed), without its blurred spots: in every article at the
 * same place they read as a halo around an ad.
 */
.news-detail__text > .article-promo {
  margin: 3rem 0;
}

.news-detail__text > .article-promo:last-child {
  margin-bottom: 0;
}

.article-promo {
  max-width: 50rem;
  padding: 2.5rem;
  border-radius: 2.5rem 0;
  background: #1d1f2a;
  color: #fff;
}

.article-promo__title {
  margin-bottom: 1rem;
  font-size: 2rem;
  font-weight: 500;
  line-height: 2.5rem;
}

.news-detail__text .article-promo__text {
  margin-bottom: 2rem;
  /* Lighter than the banner's #9ea5ad: the price in this line must read at a glance. */
  color: #d0d4d9;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.5rem;
}

.article-promo__btn {
  text-align: center;
}

/* Touch screens keep :hover after a tap, and the button would stay white when the reader comes back. */
@media (hover: none) {
  .article-promo__btn:hover {
    background: #9747ff;
    color: #fff;
  }
}

.article-promo__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 991.98px) {
  .article-promo {
    border-radius: 1.25rem 0;
  }
  .article-promo__title {
    font-size: 1.5rem;
    line-height: 1.75rem;
  }
  .news-detail__text .article-promo__text {
    font-size: 1rem;
  }
}

@media (max-width: 575.98px) {
  .news-detail__text > .article-promo {
    margin: 2rem 0;
  }
  .article-promo {
    padding: 1.5rem 1.5rem 2rem;
  }
  .article-promo__btn {
    display: flex;
    width: 100%;
  }
}

/* The whole service row opens the accordion (src/components/Services.astro), not only the "+". */
.accordion__item-top { cursor: pointer; }
.accordion__item-top:focus-visible { outline: 2px solid #9747ff; outline-offset: 4px; }

/* Smooth scrolling for in-page links. The theme scrolls <body>, so the rule goes on both. */
@media (prefers-reduced-motion: no-preference) {
  html, body { scroll-behavior: smooth; }
}

.to-top {
  position: fixed;
  right: 24px;
  bottom: calc(24px + var(--to-top-lift, 0px));
  /* under the mobile menu (.menu, z-index 9) */
  z-index: 8;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #1d1f2a;
  border-radius: 16px 0 16px 0;
  background: #f6f7f9;
  color: #1d1f2a;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.to-top[hidden] { display: none; }
.to-top:hover { background: #9747ff; border-color: #9747ff; color: #fff; }
.to-top:focus-visible { outline: 2px solid #9747ff; outline-offset: 3px; }
@media (max-width: 767px) {
  .to-top { right: 16px; bottom: calc(16px + var(--to-top-lift, 0px)); width: 44px; height: 44px; }
}

/*
 * Article page (src/components/ArticleBody.astro): a readable measure (about 70 characters), 18px
 * text, subheadings the build made from the editors' bold lines (.article-h, src/lib/article.ts),
 * lists, images, tables and PDF links, «Читайте также», and on wide screens a sticky side column
 * with the contents and the offer.
 */
.content-wrap:has(> .article) {
  margin-top: 2.5rem;
}

.article {
  margin-bottom: 6rem;
}

.article__title {
  margin: 0;
  font-size: 2.75rem;
  font-weight: 500;
  line-height: 3.25rem;
  text-wrap: balance;
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin-top: 1rem;
  color: #485867;
  font-size: 1rem;
  line-height: 1.5rem;
}

.article__meta > * + *::before {
  content: '·';
  margin: 0 0.625rem;
  color: #9ea5ad;
}

.article__cat {
  color: #9747ff;
  font-weight: 600;
}

.article__head {
  margin-bottom: 2.5rem;
}

.article .news-detail__text p,
.article .news-detail__text li {
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.article .news-detail__text > * + * {
  margin-top: 1.25rem;
}

.article .news-detail__text ul,
.article .news-detail__text ol {
  padding-left: 1.5rem;
}

.article .news-detail__text ul li {
  margin-bottom: 0;
}

.article .news-detail__text li + li {
  margin-top: 0.625rem;
}

.article .news-detail__text li::marker {
  color: #9747ff;
  font-weight: 600;
}

.article .news-detail__text strong,
.article .news-detail__text b {
  font-weight: 600;
}

.article .news-detail__text li a,
.article .news-detail__text p a {
  text-decoration-color: #9747ff;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.3s;
}

.article .news-detail__text li a:hover,
.article .news-detail__text p a:hover {
  color: #9747ff;
}

.article .news-detail__text img {
  display: block;
  border-radius: 1rem 0;
}

.article .news-detail__text > p:has(> img:only-child) {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.article .news-detail__text > .article-h {
  margin-top: 3rem;
}

.article .news-detail__text > .article-h:first-child {
  margin-top: 0;
}

.article .news-detail__text > .article-h + * {
  margin-top: 1rem;
}

.article-h {
  font-size: 1.625rem;
  font-weight: 500;
  line-height: 2.125rem;
  text-wrap: balance;
  /* Room under the sticky header of the theme when a contents link jumps here. */
  scroll-margin-top: 2rem;
}

h3.article-h {
  font-size: 1.3125rem;
  line-height: 1.75rem;
}

.article .news-detail__text blockquote {
  padding-left: 1.25rem;
  border-left: 0.1875rem solid #9747ff;
}

.article-table {
  overflow-x: auto;
}

.article-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.5rem;
}

.article-table th,
.article-table td {
  padding: 0.75rem 1rem 0.75rem 0;
  border-bottom: 1px solid #d7dbe0;
  text-align: left;
  vertical-align: top;
}

.article-table th {
  font-weight: 600;
}

/* A downloadable guide: the editors link a PDF by its file name, which already says ".pdf". */
.article .news-detail__text a.article-file {
  color: #9747ff;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.article .news-detail__text > .article-promo {
  margin: 3rem 0;
}

/* «Читайте также» (src/components/RelatedArticles.astro): rows with the cover on a white tile. */
.related {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid #d7dbe0;
}

.related__title {
  margin-bottom: 1.5rem;
  font-size: 1.625rem;
  font-weight: 500;
  line-height: 2rem;
}

.related__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related__item + .related__item {
  margin-top: 1.25rem;
}

.related__link {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  color: #1d1f2a;
  text-decoration: none;
}

.related__img {
  display: block;
  overflow: hidden;
  aspect-ratio: 660 / 290;
  border-radius: 1rem 0;
  background: #fff;
}

.related__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.related__name {
  display: block;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.625rem;
  transition: color 0.3s;
}

.related__date {
  display: block;
  margin-top: 0.5rem;
  color: #9ea5ad;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.related__link:hover .related__name {
  color: #9747ff;
}

.related__link:hover .related__img img {
  transform: scale(1.05);
}

.related__link:focus-visible {
  outline: 2px solid #9747ff;
  outline-offset: 4px;
}

@media (max-width: 991.98px) {
  .article__title {
    font-size: 2.25rem;
    line-height: 2.75rem;
  }
}

@media (max-width: 575.98px) {
  .content-wrap:has(> .article) {
    margin-top: 1.5rem;
  }
  /* The last crumb repeats the title right under it and took three lines on a phone. */
  .breadcrumbs:has(+ .content-wrap > .article) li:last-child {
    display: none;
  }
  .breadcrumbs:has(+ .content-wrap > .article) li:nth-last-child(2)::after {
    display: none;
  }
  .breadcrumbs:has(+ .content-wrap > .article) ul li,
  .breadcrumbs:has(+ .content-wrap > .article) ul a {
    font-size: 1rem;
  }
  .article {
    margin-bottom: 4rem;
  }
  .article__title {
    font-size: 1.875rem;
    line-height: 2.375rem;
  }
  .article__meta {
    margin-top: 0.75rem;
    font-size: 0.9375rem;
  }
  .article__head {
    margin-bottom: 2rem;
  }
  .article .news-detail__text p,
  .article .news-detail__text li {
    font-size: 1.0625rem;
    line-height: 1.625rem;
  }
  .article .news-detail__text ul,
  .article .news-detail__text ol {
    padding-left: 1.25rem;
  }
  .article .news-detail__text > .article-h {
    margin-top: 2.25rem;
  }
  .article-h {
    font-size: 1.375rem;
    line-height: 1.75rem;
  }
  h3.article-h {
    font-size: 1.1875rem;
    line-height: 1.5rem;
  }
  .article .news-detail__text > .article-promo {
    margin: 2.25rem 0;
  }
  .related {
    margin-top: 3rem;
    padding-top: 2rem;
  }
  .related__title {
    font-size: 1.375rem;
    line-height: 1.75rem;
  }
  .related__link {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 1rem;
  }
  .related__name {
    font-size: 1.0625rem;
    line-height: 1.375rem;
  }
  .related__date {
    margin-top: 0.25rem;
  }
}

/* Side column: from 1200px, when the article has at least two subheadings (ArticleBody.astro). */
.article__grid {
  max-width: 45rem;
}

.article__rail {
  display: none;
}

@media (min-width: 1200px) {
  .article_has-rail .article__grid {
    display: grid;
    grid-template-columns: minmax(0, 44rem) 20rem;
    grid-template-rows: auto 1fr;
    column-gap: 6rem;
    max-width: none;
  }
  .article_has-rail .article__head,
  .article_has-rail .article__main {
    grid-column: 1;
  }
  .article_has-rail .article__rail {
    display: block;
    position: sticky;
    top: 2rem;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    /* A long contents list must not push the offer below a short laptop screen for good. */
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-top: 0.5rem;
    scrollbar-width: thin;
  }
  .article_has-rail .news-detail__text > .article-promo {
    display: none;
  }
  /* The text after the hidden offer would get the gap of the offer's sibling. */
  .article_has-rail .news-detail__text > .article-promo + * {
    margin-top: 1.25rem;
  }
}

.article-toc__title {
  margin-bottom: 1rem;
  color: #485867;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5rem;
}

.article-toc__list {
  margin: 0;
  padding: 0;
  border-left: 0.125rem solid #d7dbe0;
  list-style: none;
}

.article-toc__item a {
  display: block;
  margin-left: -0.125rem;
  padding: 0.375rem 0 0.375rem 1.125rem;
  border-left: 0.125rem solid transparent;
  color: #485867;
  font-size: 1rem;
  line-height: 1.375rem;
  text-decoration: none;
  transition: color 0.3s, border-color 0.3s;
}

.article-toc__item_sub a {
  padding-left: 2rem;
  font-size: 0.9375rem;
}

.article-toc__item a:hover,
.article-toc__item a:focus-visible {
  border-left-color: #9747ff;
  color: #9747ff;
}

.article-toc + .article-promo {
  margin-top: 2.5rem;
}

.article-promo_rail {
  padding: 1.75rem;
}

.article-promo_rail .article-promo__title {
  font-size: 1.375rem;
  line-height: 1.75rem;
}

.article-promo_rail .article-promo__text {
  margin-bottom: 1.5rem;
  color: #d0d4d9;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.375rem;
}

.article-promo_rail .article-promo__btn {
  display: flex;
  width: 100%;
  white-space: normal;
}

/*
 * Header dropdowns (src/components/Nav.astro). The theme styles every `.header__nav ul li` and
 * `li a` (flex row, wide gaps, 18px bold, and `li.active a` with pointer-events: none), so the
 * panel resets them, and the current group is marked with `.is-current`, not the theme's `.active`.
 */
.nav-group { position: relative; }
.nav-group__toggle {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: 0;
  border: 0;
  background: none;
  color: #1d1f2a;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.125rem;
  cursor: pointer;
  transition: color .3s;
}
.nav-group__chevron { transition: transform .2s; }
/* the theme shrinks header links to 16px below 1200px; the toggles follow */
@media (max-width: 1199.98px) {
  .header__nav .nav-group__toggle { font-size: 1rem; line-height: 1rem; }
}
.nav-group__toggle:hover,
.nav-group.is-current > .nav-group__toggle,
.header__nav .nav-link.is-current a { color: #9747ff; }
.nav-group.is-open > .nav-group__toggle .nav-group__chevron { transform: rotate(180deg); }
.nav-group__toggle:focus-visible,
.nav-group__panel a:focus-visible { outline: 2px solid #9747ff; outline-offset: 3px; }

.header__nav .nav-group__panel {
  position: absolute;
  top: calc(100% + 1rem);
  left: -1.5rem;
  z-index: 20;
  min-width: 18rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid #e3e5ea;
  border-radius: 1rem 0 1rem 0;
  background: #fff;
  box-shadow: 0 18px 40px -18px rgba(29, 31, 42, .25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  /* closes a moment later, so the pointer can cross the gap without the panel vanishing */
  transition: opacity .15s, transform .15s, visibility 0s linear .15s;
}
/* the gap between the button and the panel still counts as hovering the group */
.header__nav .nav-group__panel::before { content: ''; position: absolute; left: 0; right: 0; top: -1rem; height: 1rem; }
.header__nav .nav-group_wide .nav-group__panel { width: min(58rem, calc(100vw - 3rem)); }
.header__nav .nav-group.is-open > .nav-group__panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .15s, transform .15s, visibility 0s;
}
@media (hover: hover) and (pointer: fine) {
  .header__nav .nav-group:hover > .nav-group__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .15s .08s, transform .15s .08s, visibility 0s .08s;
  }
  .header__nav .nav-group:hover > .nav-group__toggle .nav-group__chevron { transform: rotate(180deg); }
}

.nav-group__columns { display: grid; gap: 2rem; }
.nav-group_wide .nav-group__columns { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); }
.nav-group_wide .nav-group__column + .nav-group__column { padding-left: 2rem; border-left: 1px solid #e3e5ea; }
.nav-group__title {
  margin: 0 0 .75rem;
  color: #8a94a6;
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.2;
}
.header__nav .nav-group__links,
.menu__nav .nav-group__links { display: grid; gap: .875rem; margin: 0; padding: 0; }
.header__nav .nav-group__links_split { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; gap: .75rem 1.5rem; }
.header__nav .nav-group__links li,
.menu__nav .nav-group__links li { margin: 0; list-style: none; }
.header__nav .nav-group__links a,
.menu__nav .nav-group__links a {
  display: grid;
  gap: .25rem;
  color: #1d1f2a;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  pointer-events: auto;
}
.nav-group__label { transition: color .2s; }
.nav-group__links a:hover .nav-group__label { color: #9747ff; }
.nav-group__note { color: #6b7385; font-size: .8125rem; font-weight: 400; line-height: 1.35; }
.header__nav a.nav-group__all,
.menu__nav a.nav-group__all {
  display: inline-block;
  margin-top: 1.25rem;
  color: #9747ff;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

/* Mobile menu: groups open as an accordion inside the theme's full-screen menu. */
.menu { overflow-y: auto; }
.menu__nav .nav-groups > li { margin-bottom: 1.25rem; }
.menu__nav .nav-group__toggle { width: 100%; justify-content: space-between; }
.menu__nav .nav-group__panel { display: none; padding: 1rem 0 .25rem 1rem; }
.menu__nav .nav-group.is-open > .nav-group__panel { display: block; }
.menu__nav .nav-group__columns { gap: 1.5rem; }
.menu__nav .nav-group_wide .nav-group__columns { grid-template-columns: 1fr; }
.menu__nav .nav-group_wide .nav-group__column + .nav-group__column { padding-left: 0; border-left: 0; }
.menu__nav .nav-link.is-current a { color: #9747ff; }
