/* ============================================
   CASE DETAIL PAGE - Pixel Perfect
   ============================================ */

.case-detail {
  position: relative;
  width: 100%;
  background: #010101;
  min-height: 100vh;
}

/* Sticky Navigation Sidebar */
.case-detail__nav {
  position: fixed;
  left: 51px; /* точная позиция из Figma layout_UZ2BNR */
  bottom: 50px; /* отступ снизу 50px */
  z-index: 100;
  width: 170px; /* изменено по запросу пользователя */
  height: fit-content;
  margin-top: 0; /* будет установлено через JS относительно секции context */
}

.case-detail__nav-inner {
  display: flex;
  flex-direction: column;
  gap: 1px; /* точный gap из Figma layout_5YLQVX */
  background: rgba(8, 8, 11, 0.8); /* fill_QW630M */
  backdrop-filter: blur(20px); /* effect_AC4PXQ */
  border-radius: 14px; /* borderRadius из Figma */
  padding: 2px; /* padding из Figma */
  border: 1px solid rgba(245, 247, 251, 0.05);
}

.case-detail__nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* текст слева как в Figma */
  gap: 10px; /* gap из Figma layout_U238UJ */
  padding: 10px 14px; /* padding для неактивного из Figma layout_U238UJ */
  width: 166px; /* изменено по запросу пользователя */
  height: 38px; /* точная высота из Figma */
  background: transparent; /* нет фона у неактивных */
  border: none;
  border-radius: 12px; /* borderRadius из Figma */
  font-family: 'Random Grotesque Standard', var(--font-primary), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 500; /* style_5HTS9T */
  font-size: 17px; /* точный размер из Figma */
  line-height: 1em; /* точный line-height из Figma */
  letter-spacing: 0.02em; /* 2% из Figma */
  color: rgba(255, 255, 255, 0.8); /* fill_OASLKO для неактивных */
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-base);
}

.case-detail__nav-item--active {
  padding: 10px 14px 10px 12px; /* padding для активного из Figma layout_656D8K */
  color: #FFFFFF; /* fill_QMKS4V для активного */
  background: rgba(245, 247, 251, 0.05); /* fill_UC3DWK - только у активного */
}

.case-detail__nav-item:hover {
  background: rgba(245, 247, 251, 0.08);
}

.case-detail__nav-item svg {
  flex-shrink: 0;
  width: 3.5px; /* layout_1DG3TW */
  height: 7px;
  display: none; /* скрываем по умолчанию */
}

.case-detail__nav-item--active svg {
  display: block; /* показываем только для активного */
}

/* Main Content */
.case-detail__content {
  width: 100%;
  padding-left: 0;
}

.case-detail__container {
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 120px; /* gap из Figma layout_12IR50 */
  padding: 0 50px 120px; /* боковые отступы и нижний */
}

/* Hero Section */
.case-detail__hero {
  width: calc(100% + 100px); /* расширяем на padding контейнера */
  margin-left: -50px; /* компенсируем padding контейнера */
  margin-right: -50px; /* компенсируем padding контейнера */
  display: flex;
  flex-direction: column;
  gap: 80px; /* gap из Figma */
  align-items: center;
}

.case-detail__hero-images {
  position: relative;
  width: 1820px; /* как header__container */
  max-width: calc(100% - 100px); /* отступы по 50px с каждой стороны как у header */
  height: 861px; /* точная высота из Figma */
  margin: 0 auto; /* центрирование */
}

.case-detail__hero-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 30px; /* borderRadius из Figma */
  overflow: hidden;
  border: 1px solid rgba(245, 247, 251, 0.05); /* stroke_FLRLQK */
}

.case-detail__hero-image-wrapper:first-child {
  filter: blur(150px); /* effect_IN78B5 */
  opacity: 0.3; /* уменьшаем прозрачность размытого фона */
  z-index: 1;
}

.case-detail__hero-image-wrapper--gradient {
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 78%, rgba(0, 0, 0, 1) 100%);
}

.case-detail__hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.case-detail__hero-image.loaded {
  opacity: 1;
}

/* Пока skeleton активен, изображение должно быть полностью скрыто */
.case-detail__hero-image.skeleton,
.case-detail__gallery-image.skeleton,
.case-detail__result-image.skeleton,
.case-detail__other-works-card-image.skeleton {
  opacity: 0 !important;
  /* Skeleton фон должен быть виден */
  background: #1a1a1a !important;
  visibility: visible !important;
}

/* Когда изображение загружено, но skeleton еще есть, делаем плавный переход */
.case-detail__hero-image.skeleton.loaded {
  opacity: 1 !important;
}

/* Skeleton loading - стили теперь в skeleton.css */

/* Description Section */
.case-detail__description {
  width: 100%;
  max-width: 1872px;
  display: flex;
  flex-direction: column;
  gap: 80px; /* gap из Figma layout_OSRG22 */
  align-items: center;
}

.case-detail__description-content {
  width: 100%;
  max-width: 1360px; /* ширина контента из Figma */
  display: flex;
  flex-direction: column;
  gap: 80px;
}

.case-detail__description-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 357px; /* gap из Figma layout_0U4B4D */
  width: 100%;
}

.case-detail__logo {
  display: flex;
  align-items: center;
  gap: 7.157894611358643px; /* gap из Figma layout_AU1R4R */
  transform: scale(1.25); /* увеличение в 1.25 раза */
  transform-origin: left center; /* точка трансформации слева */
}

.case-detail__description-text {
  font-family: var(--font-primary);
  font-weight: 600; /* style_W6DBRF */
  font-size: 34px; /* точный размер из Figma */
  line-height: 0.9699999865363625em; /* точный line-height из Figma */
  letter-spacing: -0.02em; /* -2% из Figma */
  color: #FFFFFF; /* fill_JU47LT */
  max-width: 600px; /* layout_49KDXI */
  margin: 0;
}

.case-detail__divider {
  width: 100%;
  max-width: 1378px; /* layout_P30YK3 */
  height: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08); /* stroke_YFQCD7 */
}

/* Section Common Styles */
.case-detail__section {
  width: 100%;
  max-width: 1872px;
  display: flex;
  flex-direction: column;
  gap: 80px; /* gap из Figma layout_OSRG22 */
  align-items: center;
}

.case-detail__section-header {
  width: 100%;
  max-width: 1360px; /* ширина контента */
  display: flex;
  justify-content: space-between;
  gap: 213px; /* gap из Figma layout_8I3KFL */
  align-items: flex-start;
}

.case-detail__section-title {
  font-family: var(--font-primary);
  font-weight: 600; /* style_5960Z6 */
  font-size: 34px; /* точный размер из Figma */
  line-height: 0.7099999820484835em; /* точный line-height из Figma */
  letter-spacing: -0.02em; /* -2% из Figma */
  color: #FFFFFF; /* fill_JU47LT */
  margin: 0;
  white-space: nowrap;
}

.case-detail__section-content {
  flex: 1;
  max-width: 600px; /* layout_G788LR */
  display: flex;
  flex-direction: column;
  gap: 30px; /* gap из Figma */
}

.case-detail__section-text {
  font-family: var(--font-primary);
  font-weight: 400; /* style_6T04IP */
  font-size: 20px; /* точный размер из Figma */
  line-height: 1.2100000381469727em; /* точный line-height из Figma */
  letter-spacing: 0.03em; /* 3% из Figma */
  color: rgba(239, 245, 255, 0.8); /* fill_8SMR17 */
  margin: 0;
}

.case-detail__section-tags {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  gap: 6px; /* gap из Figma layout_IHRD3H */
  flex-wrap: wrap;
}

.case-detail__tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px; /* gap из Figma */
  padding: 6px 10px 7px; /* padding из Figma layout_3EP9S3 */
  background: rgba(245, 247, 251, 0.05); /* fill_3ORHH1 */
  backdrop-filter: blur(16px); /* effect_4V2S8U */
  border-radius: 30px; /* borderRadius из Figma */
  font-family: var(--font-primary);
  font-weight: 500; /* style_CLUZA4 */
  font-size: 18px; /* точный размер из Figma */
  line-height: 1.1000000635782878em; /* точный line-height из Figma */
  letter-spacing: 0.03em; /* 3% из Figma */
  color: rgba(239, 245, 255, 0.8); /* fill_8SMR17 */
}

/* Gallery Sections */
.case-detail__section-gallery {
  width: 100%;
  max-width: 1384px; /* ширина контента из Figma */
  margin-top: 20px; /* gap из Figma layout_ZDNYZQ */
}

.case-detail__gallery-wrapper {
  display: flex;
  flex-direction: row;
  gap: 20px; /* gap из Figma layout_ZDNYZQ */
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  padding-bottom: 10px;
  scroll-behavior: auto; /* Отключаем автоматический smooth scroll для программного управления */
}

.case-detail__gallery-wrapper::-webkit-scrollbar {
  height: 4px;
}

.case-detail__gallery-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.case-detail__gallery-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.case-detail__gallery-item {
  flex: 0 0 400px; /* layout_OZU92G - ширина из Figma */
  height: 380px; /* высота из Figma */
  scroll-snap-align: start;
  border-radius: 30px; /* borderRadius из Figma */
  overflow: hidden;
  background: transparent; /* убрано по запросу для SurfAi */
}

.case-detail__gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.case-detail__gallery-image.loaded {
  opacity: 1;
}

/* Пока skeleton активен, изображение должно быть полностью скрыто */

/* Когда изображение загружено, но skeleton еще есть, делаем плавный переход */
.case-detail__gallery-image.skeleton.loaded {
  opacity: 1 !important;
}

/* Skeleton loading - стили теперь в skeleton.css */

/* Full Width Gallery (для SurfAi "Часть шотов") */
.case-detail__gallery-wrapper--full-width {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px; /* gap из Figma layout_J891KS */
  overflow: visible !important;
  flex-direction: unset !important;
  align-items: stretch !important;
  padding-bottom: 0 !important;
  scroll-snap-type: none !important;
}

.case-detail__gallery-item--full-width {
  flex: none !important;
  width: 100% !important;
  height: 380px; /* высота из Figma layout_5EE8BY */
  border-radius: 30px; /* borderRadius из Figma */
  overflow: hidden;
  background: transparent; /* убрано по запросу для SurfAi */
}

.case-detail__gallery-item--full-width .case-detail__gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Final Shots Gallery */
.case-detail__section-gallery--final {
  width: 100%;
  max-width: 1384px; /* ширина из Figma layout_RRDMRG */
}

.case-detail__gallery-wrapper--final {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px; /* gap из Figma layout_QVJ1DI */
  overflow: visible;
}

.case-detail__gallery-item--final {
  flex: none;
  width: 100%;
  height: 320px; /* высота из Figma layout_QVJ1DI */
  border-radius: 30px; /* borderRadius из Figma */
  overflow: hidden;
  background: transparent; /* убрано по запросу для автокаскада */
}

/* Result Gallery */
.case-detail__result-gallery {
  width: 100%;
  max-width: 1384px;
  margin-top: 20px;
}

.case-detail__result-gallery-wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px; /* gap из Figma */
}

.case-detail__result-item {
  width: 100%;
  height: 320px; /* высота из Figma */
  border-radius: 30px; /* borderRadius из Figma */
  overflow: hidden;
  background: #F6F5F8; /* fill_FNI04I */
  border: 1px solid rgba(245, 247, 251, 0.05);
}

.case-detail__result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.case-detail__result-image.loaded {
  opacity: 1;
}

/* Пока skeleton активен, изображение должно быть полностью скрыто */

/* Когда изображение загружено, но skeleton еще есть, делаем плавный переход */
.case-detail__result-image.skeleton.loaded {
  opacity: 1 !important;
}

/* Skeleton loading - стили теперь в skeleton.css */

/* Other Works Section */
.case-detail__other-works {
  width: 100%;
  max-width: 1384px; /* layout_EQRCTN */
  display: flex;
  flex-direction: column;
  gap: 60px; /* gap из Figma */
}

.case-detail__other-works-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 60px; /* gap из Figma layout_NHFQ7A */
  width: 100%;
}

.case-detail__other-works-title {
  font-family: var(--font-primary);
  font-weight: 500; /* style_ET6ZN4 */
  font-size: 34px; /* точный размер из Figma */
  line-height: 0.7099999820484835em; /* точный line-height из Figma */
  letter-spacing: -0.02em; /* -2% из Figma */
  color: #FFFFFF; /* fill_JU47LT */
  margin: 0;
}

.case-detail__other-works-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px; /* gap из Figma layout_R3X35A */
  padding: 3px 12px 6px; /* padding из Figma layout_R3X35A (обновлено с 10px на 12px) */
  height: 37px; /* точная высота из Figma */
  background: rgba(245, 247, 251, 0.05); /* fill_LOTOXM - обновлено с красного на серый */
  border: none;
  border-radius: 10px; /* borderRadius из Figma (обновлено с 8px на 10px) */
  font-family: 'Random Grotesque Standard Semibold', var(--font-primary), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600; /* style_O2Y2TE - обновлено с 500 на 600 */
  font-size: 16px; /* точный размер из Figma style_O2Y2TE (обновлено с 17px на 16px) */
  line-height: 1.26em; /* точный line-height из Figma style_O2Y2TE */
  color: #FFFFFF; /* fill_PKXB5W - обновлено с красного на белый */
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.case-detail__other-works-btn:hover {
  background: rgba(245, 247, 251, 0.1);
}

.case-detail__other-works-btn-icon {
  width: 12px; /* точный размер из Figma layout_RQIK3R */
  height: 12px;
  flex-shrink: 0;
  display: block;
}

.case-detail__other-works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 45px; /* gap из Figma layout_3E51N8 */
  width: 100%;
}

.case-detail__other-works-card {
  display: flex;
  flex-direction: column;
  gap: 30px; /* gap из Figma layout_JD43N6 */
  cursor: pointer;
  transition: transform var(--transition-base);
  border-radius: 0px 0px 30px 30px; /* borderRadius из Figma - скругление только снизу */
  overflow: hidden;
  background: var(--color-bg-primary);
}

.case-detail__other-works-card:hover {
  transform: translateY(-4px);
}

.case-detail__other-works-card-image-wrapper {
  position: relative;
  width: 100%;
  height: 450px; /* стандартная высота карточек кейсов */
  overflow: hidden;
  border-radius: 30px; /* скругление со всех сторон для изображения */
  border: 1px solid rgba(245, 247, 251, 0.05);
}

/* Теги на картинке */
.case-detail__other-works-card-tags {
  position: absolute;
  top: 22px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px; /* gap из Figma */
  align-items: flex-end;
}

.case-detail__other-works-card-tags-row {
  display: flex;
  gap: 6px; /* gap из Figma */
  justify-content: flex-end;
}

.case-detail__other-works-card-tag {
  padding: 8px 10px 9px; /* padding из Figma */
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 16px; /* точный размер из Figma */
  line-height: 1.1em; /* точный line-height из Figma */
  letter-spacing: 0.03em; /* 3% из Figma */
  color: rgba(1, 1, 1, 0.85); /* fill_5FD0N0 для темного текста на светлом фоне */
  background: rgba(245, 247, 251, 0.8); /* fill_C88DO1 для светлого фона */
  backdrop-filter: blur(16px); /* effect_4NHZ2J */
  border-radius: 30px; /* borderRadius из Figma */
  height: 30px; /* точная высота из Figma */
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.case-detail__other-works-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.case-detail__other-works-card-image.loaded {
  opacity: 1;
}

/* Пока skeleton активен, изображение должно быть полностью скрыто */

/* Когда изображение загружено, но skeleton еще есть, делаем плавный переход */
.case-detail__other-works-card-image.skeleton.loaded {
  opacity: 1 !important;
}

/* Skeleton loading - стили теперь в skeleton.css */

/* Контент карточки (логотип и текст) */
.case-detail__other-works-card-content {
  display: flex;
  flex-direction: column;
  gap: 18px; /* gap из Figma layout_QJSKPW */
  padding: 0 16px 30px; /* padding из Figma layout_QJSKPW + нижний отступ для скругления */
}

.case-detail__other-works-card-logo {
  display: flex;
  align-items: center;
  gap: 4px; /* gap из Figma layout_TTT90G */
}

.case-detail__other-works-card-logo img {
  width: auto;
  height: auto;
  max-width: none;
  display: block;
  object-fit: contain;
}

.case-detail__other-works-card-text {
  font-family: var(--font-primary);
  font-weight: 500; /* style_DH5IF5 */
  font-size: 24px; /* точный размер из Figma */
  line-height: 1.2em; /* точный line-height из Figma */
  letter-spacing: -0.03em; /* -3% из Figma */
  color: #FFFFFF; /* fill_KAFALF */
  margin: 0;
}

/* Responsive */
@media (max-width: 1920px) {
  .case-detail__container {
    padding: 0 5% 120px;
  }
  
  .case-detail__hero-images,
  .case-detail__hero-image-wrapper {
    max-width: 100%;
    height: auto;
    aspect-ratio: 1820 / 861;
  }
}

@media (max-width: 1440px) {
  .case-detail__nav {
    display: none; /* скрываем навигацию на мобильных */
  }
  
  .case-detail__container {
    gap: 80px;
  }
  
  .case-detail__description-header {
    flex-direction: column;
    gap: 40px;
  }
  
  .case-detail__section-header {
    flex-direction: column;
    gap: 40px;
  }
  
  .case-detail__gallery-wrapper--final {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .case-detail__result-gallery-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .case-detail__other-works-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
}

@media (min-width: 1400px) and (max-width: 1440px) {
  .case-detail {
    top: -30px;
  }
  
  /* Только --final галереи и other-works-grid 3 в ряд для 1440-1400px */
  /* Обычный .case-detail__gallery-wrapper остается с горизонтальной прокруткой */
  
  .case-detail__gallery-wrapper--final {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  
  .case-detail__other-works-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 45px;
  }
}

@media (max-width: 1024px) {
  .case-detail__container {
    gap: 60px;
    padding: 0 2rem 80px;
  }
  
  .case-detail__gallery-wrapper--final {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .case-detail__result-gallery-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .case-detail__other-works-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .case-detail__description-text {
    font-size: clamp(1.5rem, 4vw, 34px);
  }
  
  .case-detail__section-title,
  .case-detail__other-works-title {
    font-size: clamp(1.5rem, 4vw, 34px);
  }
  
  .case-detail__gallery-item {
    flex: 0 0 350px;
    height: 332px;
  }
}

@media (max-width: 768px) {
  .case-detail__container {
    gap: 40px;
    padding: 0 1rem 60px;
  }
  
  .case-detail__hero {
    gap: 40px;
  }
  
  .case-detail__description,
  .case-detail__section {
    gap: 40px;
  }
  
  .case-detail__gallery-wrapper--final {
    grid-template-columns: 1fr;
  }
  
  .case-detail__result-gallery-wrapper {
    grid-template-columns: 1fr;
  }
  
  .case-detail__gallery-item {
    flex: 0 0 280px;
    height: 266px;
  }
  
  .case-detail__gallery-item--final,
  .case-detail__result-item {
    height: 240px;
  }
}

