:root {
  --photo-width: 1350px;
  --image-offset: calc((100vw - var(--photo-width)) / 2);
  --slice-gap: 40px;
}

body[data-category="concept"] .main-photo-wrapper,
body[data-category="interior"] .main-photo-wrapper {
  margin-bottom: var(--slice-gap);
}

.body {
  background: #212121;
}

/* 1. Метаданные */
.project-meta__content {
  width: 100vw;
  padding: 70px 0 0 var(--image-offset);
}
.project-meta__title {
  position: relative;
  display: inline-block;
  font-size: 40px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.project-meta__title::before {
  content: "";
  position: absolute;
  bottom: -30px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #fff;
}
.project-meta__title::after {
  content: "";
  position: absolute;
  bottom: -29.5px;
  left: 100%;
  width: calc(100vw - var(--image-offset) * 2 - 100%);
  height: 1px;
  background: rgba(224, 224, 224, 0.8);
}

.project-meta__list {
  margin-top: 40px;
}

.project-meta__list p {
  font-size: 22px;
  font-weight: 400;
  color: #fff;
  margin: 4px 0;
}
.project-meta__list p span {
  font-weight: 600;
}

/* 2. Экономические показатели */
.project-economics__content {
  width: 100vw;
  padding: 0 0 30px var(--image-offset);
}
.project-economics__title {
  position: relative;
  display: inline-block;
  font-size: 23px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  margin-top: 0px;
  text-transform: uppercase;
}

.project-economics__list p {
  font-size: 20px;
  color: #ddd;
  margin: 6px 0;
  font-weight: 400;
}
.project-economics__list p strong {
  color: #fff;
  font-weight: 600;
}

/* 3. Главное фото */
.main-photo-wrapper {
  display: block;
  padding-left: var(--image-offset);
  padding-right: var(--image-offset);
  margin: 40px 0;
}

.main-photo {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
}

.project-gallery__content {
  display: flex;
  gap: var(--slice-gap);
  padding: 0 var(--image-offset);
  justify-content: center;
}

/* Общее для всех превью */
.project-gallery__content img {
  width: calc((var(--photo-width) - 3 * var(--slice-gap)) / 4);
  height: 320px; /* или любой фиксированный размер */
  object-fit: cover;
  cursor: pointer;
  position: relative;
  border-radius: 2px;
  flex-shrink: 0; /* чтобы они не сжимались/растягивались */
}

/* Для четвёртого превью-слайса с оверлеем +N */
.project-gallery__content img.overlay::after {
  content: attr(data-extra);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(224, 224, 224, 0.6);
  color: #333;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  content: center;
}

/* 5. Описание */
.project-description__text {
  font-size: 18px;
  line-height: 1.6;
  color: #ddd;
  width: var(--photo-width);
  max-width: 100%;
  margin: 30px auto;
  text-align: justify;
}

/* обёртка для кнопки возврата */
.project-back {
  width: var(--photo-width);
  max-width: 100%;
  margin: 20px auto 60px; /* отступ сверху и снизу */
  text-align: right;
}
.project-back button {
  background: none;
  border: none;
  color: #ddd;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}
.project-back button:hover {
  color: #fff;
}
.project-back svg {
  display: block;
}

.back-text {
  display: inline-block;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  line-height: 1;
}

.project-back__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #ddd;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}

.project-back__link:hover {
  color: #fff;
}

/* Modal overlay & slider */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.modal.hidden {
  display: none;
}

.modal-content {
  position: relative;

  max-width: 90vw;
  max-height: 90vh;
  /* overflow: hidden;  убираем, чтобы не обрезало */
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content img {
  position: absolute;
  max-width: 80vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}

/* arrows */
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 10001;
}
.modal-arrow.prev {
  left: 1rem;
}
.modal-arrow.next {
  right: 1rem;
}
/* close button */
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10001;
}

.thumb-wrapper {
  position: relative;
  width: calc((var(--photo-width) - 3 * var(--slice-gap)) / 4);
  height: 320px;
  flex-shrink: 0;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-wrapper.overlay {
  position: relative;
}

.thumb-wrapper.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  z-index: 1;
  pointer-events: none;
}

.thumb-wrapper.overlay::after {
  content: attr(data-extra);
  position: absolute;
  bottom: 30px;
  right: 30px;
  font-size: 48px;
  font-weight: 500;
  color: #212121;
  font-family: "Montserrat", sans-serif;
  z-index: 2;
  pointer-events: none;
}

.footer-logo {
  margin-top: 60px;
}

@media (max-width: 1600px) {
  :root {
    --photo-width: 1200px;
    --image-offset: calc((100vw - var(--photo-width)) / 2);
  }

  .project-meta__title {
    font-size: 36px;
  }

  .project-meta__list p,
  .project-economics__list p {
    font-size: 20px;
  }

  .project-description__text {
    font-size: 17px;
    line-height: 1.6;
    color: #ddd;
    width: var(--photo-width);
    max-width: 100%;
    margin: 30px auto;
    text-align: justify;
  }

  .thumb-wrapper,
  .project-gallery__content img {
    height: 280px;
  }
}

@media (max-width: 1399px) and (min-width: 1025px) {
  :root {
    --photo-width: 1100px;
    --image-offset: calc((100vw - var(--photo-width)) / 2);
  }

  .project-gallery__content img,
  .thumb-wrapper {
    height: 260px;
  }

  .project-description__text {
    font-size: 16px;
    line-height: 1.6;
    color: #ddd;
    width: var(--photo-width);
    max-width: 100%;
    margin: 30px auto;
    text-align: justify;
  }

  .main-photo {
    padding: 0px 0px;
  }
}

@media (max-width: 1366px) {
  :root {
    --photo-width: 1000px;
    --image-offset: calc((100vw - var(--photo-width)) / 2);
  }

  .project-meta__title {
    font-size: 34px;
  }

  .project-meta__list p,
  .project-economics__list p {
    font-size: 18px;
  }

  .project-description__text {
    font-size: 15px;
    line-height: 1.6;
    color: #ddd;
    width: var(--photo-width);
    max-width: 100%;
    margin: 30px auto;
    text-align: justify;
  }

  .thumb-wrapper,
  .project-gallery__content img {
    height: 240px;
  }

  .main-photo-wrapper {
    padding-left: var(--image-offset);
    padding-right: var(--image-offset);
    margin: 30px 0;
  }

  .main-photo {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 1024px) {
  :root {
    --photo-width: 800px;
    --image-offset: calc((100vw - var(--photo-width)) / 2);
  }

  .project-meta__content,
  .project-economics__content,
  .project-description__text,
  .project-back,
  .site-footer__inner {
    padding-left: var(--image-offset);
    padding-right: var(--image-offset);
    box-sizing: border-box;
  }

  .project-meta__title {
    font-size: 30px;
  }

  .project-meta__list p,
  .project-economics__list p {
    font-size: 16px;
  }

  .project-description__text {
    font-size: 14.5px;
    line-height: 1.4;
  }

  .thumb-wrapper,
  .project-gallery__content img {
    height: 200px;
  }

  .main-photo {
    padding: 0px 0px;
  }

  .project-back__link,
  .project-back button {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  :root {
    --photo-width: 100vw;
    --image-offset: 10px;
  }

  .project-meta__content {
    padding: 90px 25px 0px 25px;
  }

  .project-meta__list {
    margin-top: 20px;
  }

  .project-meta__list p {
    font-size: 18px;
    width: 100%;
    margin: 6px 0;
  }

  .main-photo-wrapper {
    margin-top: 10px;
    margin-bottom: 10px;
  }

  .project-economics__content {
    padding: 0px 25px 20px 25px;
  }

  .project-economics__title {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .project-economics__list p {
    font-size: 15px;
    width: 100%;
    margin: 5px 0;
  }

  .main-photo {
    width: 100%;
    height: 100%;
    align-items: center;
    padding-left: 15px;
    padding-right: 15px;
    margin: 20px 0px 20px;
  }

  .project-meta__title {
    font-size: 25px;
  }

  .project-meta__title::before {
    height: 1.5px;
    bottom: -20px;
  }

  .project-meta__title::after {
    bottom: -19.5px;
    left: 100%;
    width: calc(100vw - 50px - 100%); /* 15px отступ с каждой стороны */
    height: 1px;
    background: rgba(224, 224, 224, 0.8);
    content: "";
    position: absolute;
  }

  .project-gallery__content {
    display: flex;
    flex-wrap: wrap;
    padding: 0 25px;
    gap: 20px;
    justify-content: space-between;
  }

  .thumb-wrapper {
    width: calc(50% - 10px); /* два элемента с 20px gap */
    height: 220px;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
  }

  .thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* overlay-эффект на мобилке */
  .thumb-wrapper.overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 1;
  }

  .modal-content img {
    position: absolute;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: unset;
    transition: transform 0.3s ease;
  }

  .thumb-wrapper.overlay::after {
    content: attr(data-extra);
    position: absolute;
    font-size: 32px;
    font-weight: 600;
    color: #212121;
    font-family: "Montserrat", sans-serif;
    z-index: 2;
    pointer-events: none;
  }

  .modal-arrow {
    display: none;
  }

  body[data-category="concept"] .main-photo-wrapper,
  body[data-category="interior"] .main-photo-wrapper {
    margin-bottom: 5px; /* 40px даже на мобилке */
  }

  .econ-value-break {
    display: block;
    color: #fff;
    margin-top: 4px;
  }

  .project-description__text {
    font-size: 16px;
    font-weight: 400;
    max-width: var(--photo-width);
    margin: 20px auto 30px;
    line-height: 1.2;
    text-align: left;
    padding-left: 25px;
    padding-right: 25px;
  }

  .project-back {
    padding-left: 25px;
    padding-right: 25px;
    text-align: right;
    margin-top: 20px;
  }

  .project-back__link {
    font-size: 14px;
    gap: 6px;
  }

  .project-back__link svg {
    width: 16px;
    height: 16px;
  }

  .back-text {
    font-size: 14px;
  }

  .site-footer__inner {
    margin-left: 0;
    align-items: flex-start;
    text-align: left;
    padding-left: 25px;
    padding-right: 25px;
    font-size: 10px;
  }

  .footer-copy,
  .footer-location {
    font-size: 12px;
  }

  .footer-icons {
    margin-top: 15px;
  }

  .footer-icons a {
    font-size: 16px;
  }

  .footer-icons a img {
    height: 12px;
  }

  .about-text br {
    display: none;
  }

  .footer-logo {
    text-align: center;
    margin: 50px 0 30px;
  }

  .site-footer {
    padding: 10px 0 30px;
  }

  modal-content {
    position: relative;
    overflow: hidden;
  }

  .modal-img-swipe.next-left {
    transform: translateX(-100%);
  }

  .modal-img-swipe.next-right {
    transform: translateX(100%);
  }

  .modal-img-swipe.animate-in {
    transform: translateX(0);
  }

  .modal-img-swipe.animate-out-left {
    transform: translateX(-100%);
  }

  .modal-img-swipe.animate-out-right {
    transform: translateX(100%);
  }

  .modal-img-swipe {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 90vw;
    height: auto;
    max-height: 90vh;
    object-fit: contain;
    transition: transform 0.3s ease;
  }
}
