.rn-works {
  --rn-works-brown: #452711;
  --rn-works-yellow: #ffb400;
  max-width: 1180px;
  margin: 48px auto 72px;
  padding: 38px;
  border-radius: 24px;
  background: #fffaf0;
  color: var(--rn-works-brown);
  box-shadow: 0 16px 42px rgba(69, 39, 17, .09);
}

.rn-works__intro {
  max-width: 760px;
  margin-bottom: 26px;
}

.rn-works__kicker {
  margin: 0 0 8px;
  color: #9b6800;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rn-works h2 {
  margin: 0 0 10px;
  color: var(--rn-works-brown);
  font-size: clamp(28px, 3.5vw, 42px);
  line-height: 1.12;
}

.rn-works__intro > p:last-child {
  margin: 0;
  color: #6e5847;
  font-size: 17px;
  line-height: 1.55;
}

.rn-works__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.rn-works-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #eadccf;
  border-radius: 16px;
  background: #fff;
  color: var(--rn-works-brown);
  text-align: left;
  cursor: zoom-in;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.rn-works-card:hover,
.rn-works-card:focus-visible {
  border-color: var(--rn-works-yellow);
  box-shadow: 0 10px 24px rgba(69, 39, 17, .12);
  outline: none;
  transform: translateY(-2px);
}

.rn-works-card__image {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: #2f2b27;
}

.rn-works-card__image img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  object-fit: contain;
}

.rn-works-card__caption {
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.rn-works-card__caption > span {
  color: #9b6800;
  font-size: 12px;
  letter-spacing: .08em;
}

body.rn-works-modal-open {
  overflow: hidden;
}

.rn-works-modal[hidden] {
  display: none;
}

.rn-works-modal {
  --rn-works-yellow: #ffb400;
  position: fixed;
  z-index: 10050;
  inset: 0;
  display: grid;
  padding: 28px;
  place-items: center;
}

.rn-works-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(22, 15, 10, .88);
  cursor: zoom-out;
}

.rn-works-modal__panel {
  position: relative;
  z-index: 1;
  max-width: min(1180px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
}

.rn-works-modal figure {
  margin: 0;
}

.rn-works-modal__image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 108px);
  margin: 0 auto;
  border-radius: 12px;
  background: #211d1a;
  object-fit: contain;
}

.rn-works-modal figcaption {
  margin: 10px auto 0;
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.rn-works-modal__close {
  position: absolute;
  z-index: 2;
  top: -18px;
  right: -18px;
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--rn-works-yellow);
  color: #2f1f0f;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.rn-works-modal__close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

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

@media (max-width: 767px) {
  .rn-works {
    margin: 32px auto 48px;
    padding: 24px 16px;
    border-radius: 18px;
  }

  .rn-works__grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .rn-works-card--portrait .rn-works-card__image {
    aspect-ratio: 3 / 4;
  }

  .rn-works-modal {
    padding: 16px;
  }

  .rn-works-modal__panel {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
  }

  .rn-works-modal__image {
    max-height: calc(100vh - 88px);
  }

  .rn-works-modal__close {
    top: 8px;
    right: 8px;
  }
}
