/* Parts of the new site that the old CSS has no rules for: pop-up windows and content blocks. */

/* Pop-up windows (includes/request_dialog.html) in place of fancybox. */
dialog.popup {
  position: fixed;
  padding: 0;
  border: none;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  overflow: visible;
}

dialog.popup::backdrop {
  background: rgba(0, 0, 0, .6);
}

@media (prefers-reduced-motion: no-preference) {
  dialog.popup[open],
  dialog.popup[open]::backdrop { animation: popup-appear 160ms ease-out; }

  dialog.popup.is-closing,
  dialog.popup.is-closing::backdrop { animation: popup-disappear 160ms ease-in forwards; }
}

@keyframes popup-appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes popup-disappear { from { opacity: 1; } to { opacity: 0; } }

.popup__close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  color: #333;
  background: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  cursor: pointer;
}

@media (max-width: 500px) {
  .popup__close { top: 6px; right: 6px; }
}

#zayavka .username-class {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
}

#zayavka_success_msg {
  font-family: var(--rrg-font);
  font-size: 15px;
}

#zayavka_success_msg h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.zayavka-consent {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--rrg-text-muted);
}

.popup--media {
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  background: #000;
}

.popup__media img,
.popup__media video {
  display: block;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
}

.popup__media--frame iframe {
  display: block;
  width: min(800px, calc(100vw - 40px));
  aspect-ratio: 16 / 9;
  border: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.rrg-employee {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  align-items: start;
  margin-bottom: 60px;
  overflow-wrap: anywhere;
}

.rrg-employee__photo img {
  width: 140px;
}

.rrg-employee:nth-child(n + 5) {
  grid-template-columns: min(180px, 50%) minmax(0, 1fr);
}

.rrg-employee:nth-child(n + 5) .rrg-employee__photo img {
  max-width: 140px;
}

#content h2.rrg-employee__name {
  margin: 0 0 8px;
  color: #e36c09;
}

.rrg-team-photo {
  padding-left: 40px;
}

@media (min-width: 1024px) {
  .rrg-employee,
  .rrg-employee:nth-child(n + 5) {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .rrg-employee__photo img,
  .rrg-employee:nth-child(n + 5) .rrg-employee__photo img {
    width: 180px;
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .rrg-employee {
    grid-template-columns: 39% minmax(0, 1fr);
    margin-bottom: 24px;
  }
}

@media (max-width: 767px) {
  .rrg-employee,
  .rrg-employee:nth-child(n + 5) {
    grid-template-columns: minmax(0, 1fr);
  }

  .rrg-employee__photo img,
  .rrg-employee:nth-child(n + 5) .rrg-employee__photo img {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: 16px;
  }
}

/* Content blocks (rrg/templates/blocks). */
.block-image {
  margin: 0 0 15px;
}

.block-image figcaption,
.block-video figcaption {
  margin-top: 5px;
  font-size: var(--rrg-small-size);
  color: var(--rrg-text-muted);
}

.block-video {
  margin: 0 0 15px;
}

.block-video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
}

.block-video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.block-video video {
  max-width: 100%;
}

.block-table {
  overflow-x: auto;
  margin: 0 0 15px;
}

/* Error lines of the forms take no room until there is an error (Yii hid them with display:none). */
.errorMessage:empty {
  display: none;
}

.offer-categories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.offer-category {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 2px;
  text-align: center;
  overflow-wrap: anywhere;
}

#content .offer-category__link {
  display: block;
  color: var(--rrg-accent);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

.offer-category__image {
  display: block;
  width: 100%;
  margin-bottom: 12px;
}

#content .offer-category__notice {
  margin: 6px 0 0;
  font-size: .875rem;
  line-height: 1.45;
}

@media (max-width: 991px) {
  .offer-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 599px) {
  .offer-categories { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* Лента миниатюр Fotorama на 3px шире экрана телефона и давала горизонтальную прокрутку. */
.object-gallery { overflow-x: clip; }

.partner-projects {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.partner-projects .object-tile__body {
  flex: 1;
}

#content .partner-projects .object-tile__title {
  margin: 0;
  overflow-wrap: anywhere;
}

.partner-projects__link {
  align-self: flex-start;
  margin-top: auto;
  padding-top: 8px;
}

@media (max-width: 767px) {
  .partner-projects { grid-template-columns: minmax(0, 1fr); }
}

.analytic-article-body { display: flow-root; }

.analytic-lead-image {
  display: block;
  float: left;
  width: 500px;
  max-width: 100%;
  margin: 0 36px 12px 0;
  cursor: zoom-in;
}

.analytic-lead-image img { display: block; width: 100%; height: auto; }

@media (min-width: 769px) {
  /* Keep the image clickable where a wrapping list's box overlaps it. */
  .analytic-lead-image { position: relative; z-index: 1; }

  /* Offset the lines after float layout, reserving the same space at the far edge. */
  #content .analytic-article-body:has(> .analytic-lead-image) :is(ul, ol):not(li *) {
    position: relative;
    inset-inline-start: 32px;
    margin-inline-end: 32px;
    padding-inline-start: 0;
  }
}

@media (max-width: 768px) {
  .analytic-lead-image { float: none; width: 100%; margin: 0 0 12px; }
}

.popup--fullscreen .popup__media img {
  width: min(calc(100vw - 40px), calc((100dvh - 40px) * var(--image-ratio)));
  height: auto;
  border-radius: 4px;
}
