:root {
  --photo-width: 1400px;
  --image-offset: calc((100vw - var(--photo-width)) / 2);
}

.body {
  background: #212121;
  color: #e0e0e0;
}

.bim-content {
  max-width: 100%;
  padding: 70px var(--image-offset) 5px var(--image-offset);
  width: 100vw;
}

.bim-title {
  position: relative;
  display: inline-block;
  font-size: 40px;
  font-weight: 500;
}
.bim-title::before {
  content: "";
  position: absolute;
  bottom: -30px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #fff;
}
.bim-title::after {
  content: "";
  position: absolute;
  bottom: -29.5px;
  left: 100%;
  width: calc(100vw - var(--image-offset) - var(--image-offset) - 100%);
  height: 1px;
  background: rgba(224, 224, 224, 0.8);
}

.bim-second-title {
  font-size: 25px;
  font-weight: 700;
  margin: 30px auto 20px;
  text-transform: uppercase;
}

.bim-text {
  font-size: 20px;
  font-weight: 400;
  margin: 0px auto 20px auto;
  text-align: justify;
}

.bim-gallery {
  padding: 15px var(--image-offset) 0px;
}

.bim-gallery-slider {
  position: relative;
  max-width: var(--photo-width);
  margin: 0 auto;
  background: #fff;
  max-height: 1000px; /* ✅ задаём максимальную высоту контейнера */
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: width 0.6s ease-in-out; /* или другой подходящий параметр */
}

.bim-gallery-slider.expanded {
  padding: 60px 0; /* Больше отступы при раскрытии */
}

.bim-gallery-wrapper {
  width: 100%;
}

.bim-slide {
  display: none;
  width: 100%;
  height: auto;
  justify-content: center;
  align-items: center;
  transition: transform 0.6s ease, width 0.6s ease;
}

.bim-slide.active {
  display: flex;
}

.bim-slide img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  transition: width 0.6s ease-in-out;
}

.bim-gallery-slider.expanded .bim-slide img {
  transform: scale(0.95);
}

.bim-gallery-slider.photo-expanded .bim-slide.active img {
  width: 1300px;
  transition: width 0.6s ease-in-out;
}

.bim-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 36px;
  cursor: pointer;
  z-index: 10;
  color: #333;
}

.bim-left {
  left: 10px;
}

.bim-right {
  right: 10px;
}

.bim-down {
  position: absolute;
  bottom: -35%;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  font-size: 36px;
  color: #333;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.bim-down.rotated {
  transform: translateX(-50%) rotate(180deg);
}

.bim-alt-text {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 12px;
  color: #212121;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 5;
}

.bim-expanded-slide img {
  max-width: 100%;
  margin: 40px auto;
  display: block;
  width: 60%;
}

.bim-expanded-slide {
  display: none; /* сначала скрыта */
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.4s ease;
  text-align: center;
}

.bim-expanded-slide.active {
  display: block;
  opacity: 1;
  max-height: 1000px; /* или auto, но лучше анимировать фиксированное */
}

.bim-separator {
  border: none;
  height: 1px;
  background: rgba(224, 224, 224, 0.8);
  width: var(--photo-width);
  margin: 30px auto;
}

.bim-content2 {
  max-width: 100%;
  padding: 0px var(--image-offset) 5px var(--image-offset);
  width: 100vw;
}

.bim-accordion {
  padding: 20px 0px;
  max-width: var(--photo-width);
  margin: 0 auto;
}

.accordion-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.accordion-icon {
  width: 35px;
  height: 30px;
}

.accordion-item {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  font-family: "Montserrat", sans-serif;
  opacity: 1;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(20px);
  transition: max-height 0.6s ease, opacity 0.5s ease, transform 0.5s ease;
}

.accordion-item.hidden {
  display: none !important; /* 🛑 скрывает полностью */
  max-height: 0 !important;
  opacity: 0 !important;
  transform: translateY(20px);
}

.accordion-item img {
  width: 490px; /* БОЛЬШАЯ картинка */
  height: 300px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 4px;
}

.accordion-text {
  flex: 1;
}

.accordion-text h3 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 15px;
  text-transform: uppercase;
}

.accordion-text p {
  font-size: 18px;
  line-height: 1.8;
  margin: 0;
}

/* Видимые */
.accordion-item.visible {
  display: flex;
  max-height: 1000px; /* или больше, если контент длинный */
  opacity: 1;
  transform: translateY(0);
}

.accordion-toggle:hover {
  background: #2a2a2a;
  border-color: #fff;
}

.accordion-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  max-width: var(--photo-width);
  margin: 10px auto 0;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.accordion-toggle-wrapper svg {
  transition: transform 0.3s ease;
}

.accordion-toggle-wrapper.expanded svg {
  transform: rotate(180deg);
}

.bim-separator2 {
  border: none;
  height: 1px;
  background: rgba(224, 224, 224, 0.8);
  width: var(--photo-width);
  margin: 20px auto 20px;
}

.bim-model-3d {
  max-width: var(--photo-width);
  margin: 0 auto;
  padding: 0;
  cursor: grab;

  position: relative; /* чтобы `overflow: visible` работало */
  overflow: visible;

  background-image: url("/assets/img/model-back.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.bim-model-3d model-viewer {
  width: 100%;
  height: 800px; /* было 800px — увеличим высоту */
  background: transparent;
  outline: none;
  cursor: grab;
  transform: scale(1.3); /* увеличивает модель визуально */
  transform-origin: center;
}

.bim-model-3d model-viewer {
  cursor: pointer, grab;
}

.model-container {
  width: var(--photo-width);
  max-width: 100%;
  height: 800px;
  overflow: hidden;
  position: relative;
  margin: 0 auto;

  background-image: url("/assets/img/model-back.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;

  border-radius: 8px;
}

.model-container model-viewer {
  width: 100%;
  height: 100%;
  background: transparent;
  outline: none;
  transform: scale(1.3);
  transform-origin: center;
  cursor: grab;
  pointer-events: auto;
}

.cursor-hint {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: auto;
  z-index: 20;
  pointer-events: none;
  opacity: 2;
  transition: opacity 0.3s ease;
}

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

  .bim-title {
    font-size: 36px;
  }

  .bim-second-title {
    font-size: 23px;
  }

  .bim-text {
    font-size: 18px;
  }

  .accordion-text p {
    font-size: 17px;
  }

  .accordion-item img {
    height: 280px;
  }

  .model-container {
    height: 700px;
  }

  .model-container model-viewer {
    transform: scale(1.2);
  }
}

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

  .bim-title {
    font-size: 34px;
  }

  .bim-second-title {
    font-size: 21px;
  }

  .bim-text {
    font-size: 17px;
  }

  .accordion-text p {
    font-size: 16px;
  }

  .accordion-item img {
    height: 260px;
  }

  .model-container {
    height: 650px;
  }

  .model-container model-viewer {
    transform: scale(1.15);
  }
}

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

  .bim-title {
    font-size: 32px;
  }

  .bim-second-title {
    font-size: 20px;
  }

  .bim-text {
    font-size: 16px;
  }

  .accordion-text p {
    font-size: 15.5px;
  }

  .accordion-item img {
    height: 240px;
  }

  .model-container {
    height: 600px;
  }

  .model-container model-viewer {
    transform: scale(1.1);
  }
}

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

  .bim-title {
    font-size: 28px;
  }

  .bim-second-title {
    font-size: 19px;
  }

  .bim-text {
    font-size: 15px;
  }

  .accordion-text p {
    font-size: 14.5px;
  }

  .accordion-item img {
    height: 200px;
  }

  .bim-content,
  .bim-content2,
  .bim-accordion,
  .model-container,
  .site-footer__inner {
    padding-left: var(--image-offset);
    padding-right: var(--image-offset);
    box-sizing: border-box;
  }

  .model-container {
    height: 550px;
  }

  .model-container model-viewer {
    transform: scale(1);
  }
}

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

  .bim-content {
    padding: 90px 25px 0px 25px;
  }

  .bim-title {
    font-size: 25px;
    margin-bottom: 15px;
  }

  .bim-title::before {
    height: 1.5px;
    bottom: -20px;
  }

  .bim-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;
  }

  .bim-second-title {
    font-size: 20px;
    margin-top: 25px;
  }

  .bim-text {
    font-size: 16px;
    margin-top: 15px;
    text-align: left;
    margin-bottom: 10px;
  }

  .bim-gallery {
    padding: 10px 25px;
  }

  .bim-gallery-slider {
    height: 40vh;
  }

  .bim-separator {
    width: calc(100vw - 50px);
    margin-bottom: 0px;
  }

  .bim-separator2 {
    width: calc(100vw - 50px);
    margin-bottom: 0px;
    margin-top: 10px;
  }

  .bim-gallery-slider.expanded {
    height: 80vh;
  }

  .bim-slide img {
    transform: scale(1); /* не увеличиваем — чтобы не обрезалось */
  }

  .bim-content2 {
    padding: 0px 25px 0px 25px;
  }

  /* стрелки */
  .bim-arrow {
    font-size: 32px;
  }

  .bim-down {
    font-size: 28px;
    bottom: -20%;
  }

  /* подпись к картинке */
  .bim-alt-text {
    font-size: 10px;
    padding: 2px 4px;
  }

  /* раскрывающаяся большая картинка */
  .bim-expanded-slide img {
    width: 90%;
    margin: 20px auto;
  }

  /* accordion (раскрывающаяся часть) */
  .bim-accordion {
    padding: 10px 25px;
  }

  .accordion-list {
    gap: 25px;
  }
  .accordion-icon {
    width: 24px;
    height: 22px;
  }

  .accordion-item {
    flex-direction: column;
    gap: 20px;
    max-height: 0;
  }

  .accordion-item.visible {
    max-height: 1500px; /* больше высота, т.к. вертикально */
  }

  .accordion-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
  }

  /* текст */
  .accordion-text h3 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  .accordion-text p {
    font-size: 16px;
    line-height: 1.2;
    text-align: left;
    margin-top: 10px;
  }

  /* кнопка раскрытия */
  .accordion-toggle-wrapper {
    font-size: 14px;
    justify-content: right;
    padding: 20px 0 0px;
    gap: 5px;
  }

  /* 3D модель */
  .model-container {
    width: 100%;
    height: 400px;
    padding-left: 25px;
    padding-right: 25px;
    margin-top: 10px;
  }

  .model-container model-viewer {
    height: 400px;
    transform: scale(1); /* убираем масштабирование */
  }

  /* подсказка курсора */
  .cursor-hint {
    bottom: 10px;
    right: 10px;
    width: 35px;
  }

  .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;
  }
}
