/* ═══════════════════════════════════════════════════════
   USM Steps — Horizontal timeline nav, text left, gallery right
═══════════════════════════════════════════════════════ */

.steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ═══════════════════════════════════════════════════════
   HORIZONTAL NAVIGATION (top) with arrows
═══════════════════════════════════════════════════════ */

.steps-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 0;
}

/* Arrows */
.steps-nav__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}

.steps-nav__arrow:hover {
  background: rgba(247, 197, 30, 0.08);
  border-color: var(--accent, #F7C51E);
}

.steps-nav__arrow:active {
  transform: scale(0.95);
}

.steps-nav__arrow img {
  width: 24px;
  height: 24px;
}

.steps-nav__arrow:hover img {
  filter: brightness(0.8);
}

/* Track */
.steps-nav__track {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex: 1;
  gap: 4px;
  min-width: 0;
  position: relative;
  padding-top: 12px;
}

/* Step item */
.steps-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  flex: 1;
  max-width: 120px;
}

/* Number in circle - positioned above the line */
.steps-nav__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted, #525252);
  background: #f1f5f9;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: 50%;
  transition: border-color 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Active: circle with accent (yellow from theme) - filled background to cover line */
.steps-nav__item.is-active .steps-nav__num {
  color: var(--text, #1C1C1C);
  border-color: var(--accent, #F7C51E);
  background: var(--accent, #F7C51E);
  box-shadow: 0 0 0 3px rgba(247, 197, 30, 0.25);
}

/* Completed steps (before active) - yellow line connection */
.steps-nav__item.is-completed .steps-nav__num {
  border-color: var(--accent, #F7C51E);
  background: var(--accent, #F7C51E);
  color: var(--text, #1C1C1C);
}

/* Hover on number */
.steps-nav__item:hover .steps-nav__num {
  color: var(--text, #1C1C1C);
  border-color: var(--accent, #F7C51E);
}

/* Connecting line from prev button to this button (before) */
.steps-nav__item:not(:first-child)::before {
  content: '';
  position: absolute;
  top: 22px;
  right: calc(50% + 18px);
  width: calc(100% - 18px);
  height: 2px;
  background: rgba(0, 0, 0, 0.15);
  z-index: 0;
  pointer-events: none;
}

/* Line color: yellow if this step is completed or active (path to this step is done) */
.steps-nav__item.is-completed:not(:first-child)::before,
.steps-nav__item.is-active:not(:first-child)::before {
  background: var(--accent, #F7C51E);
}

/* Title: no animation, instant show/hide */
.steps-nav__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #525252);
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 140px;
  white-space: normal;
  pointer-events: none;
  display: none;
}

/* Default: title above */
.steps-nav__title {
  bottom: 100%;
  margin-bottom: 4px;
}

/* Active: title below, accent color */
.steps-nav__item.is-active .steps-nav__title {
  bottom: auto;
  top: 100%;
  margin-top: 4px;
  margin-bottom: 0;
  display: block;
  color: var(--text, #1C1C1C);
  font-weight: 600;
}

/* Hover on inactive: show title above */
.steps-nav__item:not(.is-active):hover .steps-nav__title {
  display: block;
}

/* Disabled arrows */
.steps-nav__arrow:disabled,
.steps-nav__arrow.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.steps-nav__arrow:disabled:hover,
.steps-nav__arrow.is-disabled:hover {
  background: transparent;
  border-color: rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════════════
   BODY: Text left + Gallery right
═══════════════════════════════════════════════════════ */

.steps-timeline__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

/* Left: Text content */
.steps-contents {
  position: relative;
}

.steps-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.steps-content.is-active {
  display: flex;
}

.steps-content__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text, #1C1C1C);
}

.steps-content__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted, #525252);
}

/* Right: Gallery */
.steps-gallery {
  position: relative;
  min-height: 400px;
}

.steps-gallery__item {
  display: none;
}

.steps-gallery__item.is-active {
  display: block;
}

/* Grid: 2 top images + 1 bottom spanning full width */
.steps-gallery__grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Top row: left + right side by side */
.steps-gallery__top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Image slots */
.steps-gallery__slot {
  border-radius: 12px;
  overflow: hidden;
  background: #f1f5f9;
  min-height: 160px;
  position: relative;
}

.steps-gallery__slot.is-empty {
  background: linear-gradient(135deg, #f1f5f9 0%, #e8ecf1 100%);
}

.steps-gallery__slot.is-empty::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath fill='%23cbd5e1' d='M20 0h20v20H20zM0 20h20v20H0z'/%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.steps-gallery__slot {
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  cursor: pointer;
}

.steps-gallery__slot:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.steps-gallery__slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 160px;
}

/* Specific slot sizes */
.steps-gallery__slot--left,
.steps-gallery__slot--right {
  aspect-ratio: 1 / 0.75;
}

.steps-gallery__slot--bottom {
  aspect-ratio: 2 / 0.75;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .steps-timeline__body {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .steps-gallery {
    order: 1; /* Move gallery after text */
    min-height: auto;
  }

  .steps-contents {
    order: 0; /* Keep text first */
  }

  .steps-nav__track {
    gap: 4px;
  }

  .steps-nav__item {
    padding: 8px 12px;
  }

  .steps-content__title {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .steps-timeline {
    gap: 20px;
  }

  .steps-timeline__body {
    gap: 20px;
  }

  .steps-gallery__top {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Скрыть названия шагов на мобильных */
  .steps-nav__title {
    display: none;
  }

  .steps-nav__item {
    padding: 8px;
    min-width: 40px;
    font-size: 12px;
  }

  .steps-nav__track {
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  .steps-gallery__slot--left,
  .steps-gallery__slot--right {
    aspect-ratio: 4 / 3;
    min-height: auto;
    border-radius: 8px;
  }

  .steps-gallery__slot--bottom {
    aspect-ratio: 16 / 9;
    min-height: auto;
    border-radius: 8px;
  }

  .steps-gallery__grid {
    gap: 8px;
  }

  .steps-gallery__slot {
    min-height: 80px;
    border: 1px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
  }

  .steps-gallery__slot:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
  }

  /* Compact navigation for mobile */
  .steps-nav {
    gap: 4px;
    padding: 8px 0;
  }

  .steps-nav__arrow {
    width: 28px;
    height: 28px;
  }

  .steps-nav__arrow img {
    width: 16px;
    height: 16px;
  }

  /* Mobile line position */
  .steps-nav__track {
    padding-top: 6px;
    gap: 2px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }

  .steps-nav__track::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }

  .steps-nav__item:not(:first-child)::before {
    top: 14px;
    right: calc(50% + 12px);
    width: calc(100% - 24px);
  }

  .steps-nav__num {
    width: 28px;
    height: 28px;
    font-size: 11px;
    border-width: 1px;
  }

  .steps-nav__item {
    padding: 4px 8px;
    min-width: fit-content;
    flex-shrink: 0;
  }

  /* Mobile visibility transitions */
  .steps-nav__item {
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .steps-nav__title {
    display: none; /* Hide all titles on mobile */
  }

  .steps-nav__item.is-active .steps-nav__title {
    display: none; /* Show active title */
    font-size: 10px;
    margin-left: 4px;
  }

  .steps-nav__item:not(.is-active):hover .steps-nav__title {
    display: none; /* Hide hover title on mobile */
  }

  .steps-content__title {
    font-size: 20px;
  }

  .steps-content__text {
    font-size: 15px;
  }
}
