.hero--portfolio-home {
  min-height: calc(100dvh - 103px);
  box-sizing: border-box;
  padding: 50px 0 8px;
  overflow: hidden;
  display: flex;
}

.hero--portfolio-home .container {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: calc(100dvh - 103px - 32px);
}

.home-intro {
  max-width: 1240px;
  margin: 0 0 6px;
  flex: 0 0 auto;
}

.home-intro h1 {
  margin: 0 0 4px;
  max-width: 20ch;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 0.94;
}

.home-intro .lead {
  margin: 0;
}

.home-gallery {
  display: grid;
  gap: 8px;
  margin: 0;
  margin-top: auto;
  flex: 0 0 auto;
}

.home-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: center;
  margin: 0;
  margin-bottom: 16px;
}

.home-filter {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: var(--fs-1);
  color: var(--muted);
  cursor: pointer;
  transition: color .2s ease, opacity .2s ease;
  line-height: 1.1;
}

.home-filter:hover,
.home-filter.is-active {
  color: var(--text);
}

.home-filter__dot {
  --filter-color: #c8c8c8;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--filter-color);
  flex: 0 0 8px;
  transition: background-color .2s ease, transform .2s ease;
}

.home-filter.is-active .home-filter__dot {
  transform: scale(1.06);
}

.home-gallery__rows {
  display: grid;
  gap: 8px;
}

.home-gallery__viewport {
  position: relative;
  overflow: hidden;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.home-gallery__track {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: max-content;
  will-change: transform;
}

.home-gallery__track.is-animated {
  animation: homeGalleryMarquee 84s linear infinite;
}

.home-gallery__track--row2.is-animated {
  animation-direction: reverse;
}

.home-gallery__track--row3.is-animated {
  animation-duration: 76s;
}

.home-gallery__viewport:hover .home-gallery__track.is-animated {
  animation-play-state: paused;
}

@keyframes homeGalleryMarquee {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

.home-gallery__item {
  flex: 0 0 auto;
  height: clamp(110px, 10.5vw, 178px);
  width: auto;
  display: block;
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
}

.home-gallery__item img {
  height: 100%;
  width: auto;
  display: block;
  transition: transform .45s ease;
}

.home-gallery__item:hover img {
  transform: scale(1.03);
}

.home-gallery__caption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease;
  z-index: 2;
}

.home-gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0) 45%);
  opacity: 0;
  transition: opacity .25s ease;
}

.home-gallery__item:hover::after,
.home-gallery__item:hover .home-gallery__caption {
  opacity: 1;
  transform: translateY(0);
}

.home-gallery__empty {
  width: 100%;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-1);
}

@media (max-width: 980px) {
  .hero--portfolio-home {
    min-height: calc(100dvh - 95px);
    padding: 22px 0 8px;
  }

  .hero--portfolio-home .container {
    min-height: calc(100dvh - 95px - 30px);
  }

  .home-intro h1 {
    font-size: clamp(1.95rem, 4.2vw, 3.2rem);
  }

  .home-gallery__track.is-animated {
    animation-duration: 74s;
  }

  .home-gallery__track--row3.is-animated {
    animation-duration: 67s;
  }

  .home-gallery__item {
    height: clamp(98px, 10vw, 142px);
  }
}

@media (max-width: 640px) {
  .hero--portfolio-home {
    min-height: calc(100dvh - 88px);
    padding: 18px 0 8px;
  }

  .hero--portfolio-home .container {
    min-height: calc(100dvh - 88px - 26px);
  }

  .home-intro {
    margin-bottom: 6px;
  }

  .home-intro h1 {
    font-size: clamp(1.65rem, 7vw, 2.35rem);
    margin-bottom: 4px;
  }

  .home-gallery {
    gap: 8px;
  }

  .home-gallery__rows {
    gap: 8px;
  }

  .home-filters {
    gap: 8px 12px;
  }

  .home-filter {
    font-size: var(--fs-0);
  }

  .home-gallery__item {
    height: 74px;
  }

  .home-gallery__caption {
    left: 10px;
    right: 10px;
    bottom: 8px;
    font-size: 0.76rem;
  }

  .home-gallery__track.is-animated {
    animation-duration: 64s;
  }

  .home-gallery__track--row3.is-animated {
    animation-duration: 58s;
  }
}