#magistrates-house :is(#property-history, #soviet-history) .article-photo > img:first-child,
#magistrates-house .beshtau-watercolor > img:first-child {
  aspect-ratio: auto;
  height: auto;
}

#magistrates-house .beshtau-balcony {
  width: min(100%, 430px);
  justify-self: center;
  position: relative;
}

#magistrates-house .beshtau-balcony > img:first-child {
  aspect-ratio: auto;
  height: auto;
  border-radius: var(--article-photo-radius);
  object-fit: contain;
}

#magistrates-house .beshtau-watercolor > img:first-child {
  filter: contrast(1.04) saturate(1.06);
}

/* Full-frame gallery role, also used by the Pyatigorsk museum article.
   Keep the shared photo track and controls; round the actual image edges. */
#magistrates-house .story-g__slide:has(> .beshtau-gallery-full):not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--article-gallery-photo-height) auto;
}

#magistrates-house .story-g__slide > .beshtau-gallery-full {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  place-self: center;
  object-fit: contain;
}

#magistrates-house .article-beige-band {
  display: flow-root;
  margin-block-start: 24px;
  isolation: isolate;
  --beshtau-band-raise: calc(var(--article-section-space) + 56px);
  --beshtau-band-drop: 48px;
}

#magistrates-house #construction {
  margin-block-start: calc(-1 * var(--article-section-space));
  padding-block-start: 16px;
}

#magistrates-house #construction .article-split {
  align-items: start;
}

#magistrates-house .article-beige-band::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--beshtau-band-raise)) 0 calc(-1 * var(--beshtau-band-drop));
  background: var(--g-paper);
  z-index: -1;
  pointer-events: none;
}

#magistrates-house .article-beige-band > .story-g__edge:first-child {
  top: calc(-1 * var(--beshtau-band-raise));
}

#magistrates-house .article-beige-band > .story-g__edge:last-child {
  bottom: calc(-1 * var(--beshtau-band-drop));
}

.g-readable #magistrates-house .article-beige-band::before {
  background: white;
}

#magistrates-house figcaption a {
  color: inherit;
  text-decoration: none;
}

#magistrates-house figcaption a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.g-readable #magistrates-house figcaption a {
  text-decoration: underline;
}

#magistrates-house .beshtau-papers .article-paper-icon {
  z-index: 2;
}

#magistrates-house .beshtau-paper-tower {
  top: calc(50% - 12px);
  left: 50%;
  right: auto;
  width: 240px;
  transform: translate(-50%, -50%);
}

#magistrates-house .beshtau-paper-tower img {
  max-height: none;
  height: auto;
}

#magistrates-house .beshtau-papers .article-paper-icon img {
  display: block;
}

@media (min-width: 640px) {
  #magistrates-house .beshtau-paper-tower {
    width: 290px;
  }
}

@media (min-width: 1024px) {
  #magistrates-house .beshtau-balcony {
    width: min(100%, 520px);
  }
  #magistrates-house .beshtau-paper-tower {
    width: 340px;
    top: calc(50% - 24px);
  }
  #magistrates-house #view .article-photo {
    position: relative;
  }
  #magistrates-house #view .article-photo figcaption {
    position: absolute;
    inset: 100% 0 auto;
  }
}

#magistrates-house .beshtau-hero-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

@media (min-width: 1024px) and (max-width: 1279px) {
  #magistrates-house .beshtau-paper-tower {
    left: calc(50% + 112px);
  }
}

#magistrates-house .story-g__hero-background {
  object-position: 100% 50%;
  transform: scale(1.3);
  transform-origin: right center;
}
