.works-gallery-legacy {
  display: none !important;
}

.works-modern-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin-top: 44px;
}

.works-card {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.works-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid #e4ddd3;
  border-radius: 6px;
  background: #f4f1ed;
}

.works-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.works-card-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(31, 27, 24, 0.52);
  color: #fff;
  font-size: 17px;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.works-card:hover .works-card-overlay,
.works-card:focus-visible .works-card-overlay {
  opacity: 1;
}

.works-card:hover .works-card-media img {
  transform: scale(1.025);
}

.works-card-title {
  margin: 14px 2px 0;
  color: #2c2926;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.45;
}

.works-modal {
  width: min(1080px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.works-modal::backdrop {
  background: rgba(18, 16, 14, 0.72);
}

.works-modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #514b46;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.works-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  min-height: 520px;
}

.works-modal-image {
  display: grid;
  place-items: center;
  padding: 28px;
  background: #f3f0ec;
}

.works-modal-image img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.works-modal-copy {
  align-self: center;
  padding: 54px 42px;
}

.works-modal-copy h3 {
  margin: 0 0 20px;
  color: #282421;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.35;
}

.works-modal-copy p {
  margin: 0;
  color: #77706a;
  font-size: 17px;
  line-height: 1.9;
}

@media (max-width: 1100px) {
  .works-modern-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .works-modern-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .works-card-title {
    font-size: 17px;
  }

  .works-modal-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .works-modal-image {
    padding: 18px;
  }

  .works-modal-copy {
    padding: 28px;
  }

  .works-modal-copy h3 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .works-modern-gallery {
    grid-template-columns: 1fr;
  }

  .works-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
}
