/* Сервисная панель, по типу "Кузовной ремонт" */
/* показываем .popup при активации */
.popup.active {
  display: block;
}


/* фон и блюр задника для сервисной панели */
.popup.service-panel {
  background: rgba(0, 0, 0, .45);
  z-index: 999;
  /* выше хедера */
  display: none;
}

/* контейнер панели */
.service-panel__content {
  position: relative;
  width: min(1100px, 92vw);
  height: auto;
  background: rgba(20, 20, 20, .88);
  color: #fff;
  border-radius: 16px;
  padding: 28px 28px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  display: flex;
  /* добавил flex для распределения высоты */
  flex-direction: column;
  overflow: hidden;
  /* скролл внутри body */
}

/* шапка панели */
.service-panel__header h2 {
  margin: 0 0 .25em;
  font-size: 28px;
  font-weight: 700;
}

.service-panel__lead {
  margin: 0 0 16px;
  opacity: .9;
}

.service-panel__body {
  flex: 1 1 auto;
  /* занимает всё оставшееся место */
  min-height: 0;
  /* обязательно, чтобы flex не обрезал */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 18px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(221, 185, 111, .4) transparent;
  scrollbar-gutter: stable both-edges;
}

/* убираем лишний отступ у последнего блока контента */
.service-panel__body> :last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* контент внутри */
.service-section {
  margin-bottom: 22px;
}

.service-section h3 {
  margin: 0 0 .5em;
  font-size: 20px;
}

.service-list {
  margin: 0;
  padding-left: 1.2em;
}

.service-list li {
  margin: .25em 0;
}


.price {
  width: 100%;
  border-collapse: collapse;
}

.price td {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.price td:last-child {
  text-align: right;
  font-weight: 600;
}

/* контейнер панели создаёт свой контекст наложения */
.service-panel__content {
  position: relative;
  z-index: 1;
}


/* универсальная кнопка закрытия (основной попап) */
:root {
  /* один общий регулятор: насколько кружок меньше кнопки */
  --popup-close-hover-gap: 4px;
}

/* базовый крестик */
.popup-close {
  position: fixed;
  top: 32px !important;
  right: 32px !important;

  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #DDB96F;

  font-size: 24px;
  line-height: 1;

  z-index: 100000;
  transform: translateZ(0);
  transform-origin: center;
  will-change: transform, filter;
}

/* кружок ховера — ЗАВИСИТ от width/height кнопки */
.popup-close::before {
  content: "";
  position: absolute;

  /* центрируем */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: calc(100% - var(--popup-close-hover-gap));
  height: calc(100% - var(--popup-close-hover-gap));

  border-radius: 50%;
  background: transparent;

  opacity: 1;
  transition: opacity .36s cubic-bezier(.22, .61, .36, 1),
              box-shadow .36s cubic-bezier(.22, .61, .36, 1);
}

/* ховер — ОДИН на всех */
.popup-close:hover::before {
  background: transparent;
  opacity: 0;
  box-shadow: none;
}


/* Фографии-примеры внутри вкладок */
/* Типографика и отступы внутри панели */
.service-panel__header h2 {
  font-size: 30px;
  line-height: 1.25;
}

.service-panel__lead {
  margin-top: 4px;
  margin-bottom: 18px;
  opacity: .9;
}

.service-section {
  margin: 20px 0 22px;
}

.service-section h3 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
}

.service-list {
  margin: 0;
  padding-left: 1.2em;
}

.service-list li {
  margin: .3em 0;
  line-height: 1.5;
}

/* Текст-описание после списка */
.service-desc p {
  margin: 0 0 10px;
  line-height: 1.6;
  opacity: .95;
}

.service-bullets {
  margin: 0;
  padding-left: 1.2em;
}

.service-bullets {
  line-height: 1.3;
}

.service-bullets li {
  margin: .55em 0;
}

/* Таблица цен чуть контрастнее */
.price {
  width: 100%;
  border-collapse: collapse;
}

.price td {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.price td:first-child {
  opacity: .95;
}

.price td:last-child {
  text-align: right;
  font-weight: 600;
}




/* Галерея в панели "Кузовной ремонт" */
.gallery.gallery--bodyshop {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 0;
  align-items: center;
}



/* Главное фото */
.gallery.gallery--bodyshop .gallery__main {
  position: relative;
  max-width: 870px;
  justify-self: center;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 14px;
  overflow: hidden;

  background: rgba(255, 255, 255, .04);
  box-shadow:
    0 20px 32px rgba(0, 0, 0, 0.14),
    0 8px 20px rgba(0, 0, 0, 0.12),
    0 0 4px rgba(0, 0, 0, 0.18);

}

/* Мягкая анимация текста */
.gallery-caption [data-role="gtitle"],
.gallery-caption [data-role="gdesc"] {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity .38s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform .38s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Состояние скрыто — для перезапуска анимации */
.gallery-caption.is-fading [data-role="gtitle"],
.gallery-caption.is-fading [data-role="gdesc"] {
  opacity: 0;
  transform: translateY(4px);
}

/* курсор */
.gallery__main img {
  cursor: zoom-in;
}

/* контейнер */
.gallery__main {
  position: relative;
  overflow: hidden;
}

/* Глобальная плавность */
.gallery__main img {
  transition: transform .25s ease, filter .25s ease;
  transform-origin: center center;
  will-change: transform;
}

/* подпись к фото */
.gallery-caption {
  margin-bottom: 14px;
}

/* панель */
.gallery.gallery--bodyshop .gallery__main img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translateY(-0.5px) scale(1.005);
  transform-origin: center;

  transition:
    transform .28s cubic-bezier(0.22, 0.61, 0.36, 1),
    filter .28s ease;
}

/* hover */
.gallery.gallery--bodyshop .gallery__main img:hover {
  transform: translateY(-0.5px) scale(1.035);
  filter: saturate(1.03) contrast(1.03);
}




/* Правая/левая колонка — вертикальные стрелки */
.gallery__side-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gallery__side-nav--left {
  margin-right: -10px;
}

.gallery__side-nav--right {
  margin-left: -10px;
}


/* Кнопки-стрелки, в стиле навигации лайтбокса */
.gallery__nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #DDB96F;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  font-size: 24px;
  line-height: 1;

  transition: background .22s ease, transform .22s ease, box-shadow .22s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.gallery__nav-btn:hover {
  background: rgba(134, 134, 134, 0.1);
  transform: scale(1.04);
}










/* Миниатюры снизу главного фото */
.gallery.gallery--bodyshop .gallery__thumbs {
  --thumb-w: 80px;
  --thumb-h: 54px;
  --gap: 10px;
  --visible: 9;

  grid-column: 1 / -1;
  margin-top: 16px;

  /* КОНТЕЙНЕР ВСЕГДА 100% */
  width: 100%;
  max-width: 100%;

  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
  justify-content: center;

  overflow-x: hidden;
  box-sizing: border-box;
  padding: 8px 6px 9px;
}

/* миниатюры */
.gallery.gallery--bodyshop .gallery__thumbs img {
  width: var(--thumb-w);
  height: var(--thumb-h);
  flex: 0 0 auto;

  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;

  opacity: .7;

  border: 1px solid rgba(255, 255, 255, .1);

  box-shadow: 0 0 0 2px rgba(221, 185, 111, 0);

  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  transition:
    opacity .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .25s ease;
  /* на hover */
}

/* Hover — только мышь/тачпад (десктоп) */
@media (hover: hover) and (pointer: fine) {
  .gallery.gallery--bodyshop .gallery__thumbs img:hover {
    opacity: 1;
    transform: translateY(-1px) scale(1.02) translateZ(0);
    box-shadow:
      inset 0 0 0 1px rgba(221, 185, 111, .62),
      0 2px 6px rgba(0, 0, 0, .22);
  }
}

.gallery.gallery--bodyshop .gallery__thumbs img.is-active {
  opacity: 1;
  border-color: rgba(221, 185, 111, .95);
  /* Внутренняя рамка не обрезается контейнером ленты. */
  box-shadow: inset 0 0 0 1px rgba(221, 185, 111, .62);
}

@media (hover: hover) and (pointer: fine) {
  .gallery.gallery--bodyshop .gallery__thumbs img.is-active {
    transform: translateY(-1px) scale(1.02) translateZ(0);
    box-shadow:
      inset 0 0 0 1px rgba(221, 185, 111, .62),
      0 2px 6px rgba(0, 0, 0, .22);
  }
}




/* SCROLL MODE: только когда >9 */
.gallery.gallery--bodyshop .gallery__thumbs.is-scroll9 {
  flex-wrap: nowrap;
  justify-content: flex-start;

  overflow-x: auto;
  overflow-y: hidden;

  max-width: calc(var(--thumb-w) * var(--visible) + var(--gap) * (var(--visible) - 1));
  margin-left: auto;
  margin-right: auto;

  padding: 8px var(--gap) 9px;
  box-sizing: content-box;

  user-select: none;

  scrollbar-width: thin;
  scrollbar-color: rgba(221, 185, 111, .6) rgba(255, 255, 255, .08);
}






/* Одно фото без миниатюр */
.gallery.gallery--bodyshop.gallery--single {
  grid-template-columns: minmax(0, 1fr) !important;
}

.gallery.gallery--bodyshop.gallery--single .gallery__side-nav {
  display: none !important;
}

.gallery.gallery--bodyshop.gallery--single .gallery__thumbs {
  display: none !important;
}

.gallery.gallery--bodyshop.gallery--single .gallery__main {
  max-width: 960px;
  margin: 0 auto;
}







/* аккуратный скролл внутри панели */
.service-panel__body {
  scrollbar-width: thin;
  /* Firefox */
  scrollbar-color: rgb(229 197 128) transparent;
}

/* Chrome, Edge, Safari */
.service-panel__body::-webkit-scrollbar {
  width: 10px;
}

.service-panel__body::-webkit-scrollbar-track {
  background: transparent;
}

.service-panel__body::-webkit-scrollbar-thumb {
  background-color: rgba(221, 185, 111, .4);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color .2s ease;
}

.service-panel__body::-webkit-scrollbar-thumb:hover {
  background-color: rgba(221, 185, 111, .6);
}

.service-panel__body::-webkit-scrollbar-corner {
  background: transparent;
}






/* фон под заголовком внутри панели */
.service-panel__header {

  position: sticky;
  top: 0;
  z-index: 5;
  background: rgb(215 215 215 / 40%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 16px 20px 12px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px 12px 0 0;
}

/* оформление текста в шапке */
.service-panel__header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #000000;
}

.service-panel__lead {
  margin: 4px 0 0;
  font-size: 17px;
  color: rgba(0, 0, 0, 0.9);
}

.header-toggle-hit {
  display: none;
}



/* Оверлей: только fade, без transform */
.popup.service-panel {
  display: block;
  position: fixed;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear .45s;
  z-index: 999;
}

/* блюр и затемнение — отдельным слоем, не анимируем transform на родителе */
.popup.service-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  opacity: 0;
  transition: opacity .32s ease,
              background .32s ease,
              -webkit-backdrop-filter .32s ease,
              backdrop-filter .32s ease;
  pointer-events: none;
}

.popup.service-panel.is-preparing {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
}

.popup.service-panel.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: visibility 0s;
}

.popup.service-panel.active::before {
  opacity: 1;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.popup.service-panel.is-closing::before {
  opacity: 0;
  background: rgba(0, 0, 0, 0);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
}

@media (min-width: 769px) {
  #panel-kontakti.popup.service-panel,
  .popup.service-panel.is-compact {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #panel-kontakti.popup.service-panel .service-panel__content,
  .popup.service-panel.is-compact .service-panel__content {
    margin: 4vh auto;
    max-height: 92vh;
  }
}

/* Контент: анимируем его (въезд), не оверлей */
.service-panel__content {
  position: relative;
  margin: 6vh auto 4vh;
  width: min(1100px, 92vw);
  max-height: calc(100vh - 10vh);
  background: rgb(255 255 255);
  color: #000000;
  border-radius: 16px;
  padding: 28px 28px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  overflow: hidden;

  /* стартовое состояние */
  opacity: 0;
  transform: translateY(14px) scale(.995);
  transition: opacity .45s ease, transform .45s ease;

  /* хинты рендереру */
  backface-visibility: hidden;
}

@media (min-width: 769px) {
  .service-panel__body {
    font-size: 18px;
    line-height: 1.55;
  }
}

.popup.service-panel.is-closing {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: visibility 0s;
}

.popup.service-panel.active .service-panel__content {
  opacity: 1;
  transform: translateY(0) scale(1);
  will-change: opacity, transform;
}

.popup.service-panel.is-closing .service-panel__content {
  opacity: 0;
  transform: translateY(8px) scale(.998);
  transition-duration: .24s;
}

.popup.service-panel.active .service-panel__content.is-entering {
  animation: service-panel-content-enter .45s ease both;
}

@keyframes service-panel-content-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.995);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* уважение системных настроек */
@media (prefers-reduced-motion: reduce) {

  .popup.service-panel,
  .popup.service-panel.active,
  .popup.service-panel .service-panel__content {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}


/* ЛАЙТБОКС ГАЛЕРЕИ СЕРВИС-ПАНЕЛЕЙ (СТИЛЬ КАК У НОМЕРОВ/СЕРТИФИКАТОВ) */

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* только opacity, без visibility в transition,
     и transition задаём один раз, а не в .active */
  transition: opacity .35s ease;

  z-index: 9999;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(0, 0, 0, .6);

  transform: scale(.96);
  opacity: 1;

  /* чуть помогаем GPU, чтобы не дёргалось на мобилках */
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  transition: transform .35s ease, opacity .35s ease;

  cursor: zoom-out;
}

.lightbox.active img {
  transform: scale(1);
}

/* Стрелки (как у room-photos-lightbox, только для .lightbox) */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #DDB96F;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: background .22s ease, transform .22s ease;
  user-select: none;
}

.lightbox__nav--prev {
  left: 32px;
}

.lightbox__nav--next {
  right: 32px;
}

.lightbox__nav:hover {
  background: rgba(134, 134, 134, 0.1);
  transform: translateY(-50%) scale(1.04);
}

.lightbox.is-single .lightbox__nav {
  display: none !important;
}
