.projects {
  --projects-orange: #f25301;
  --projects-ink: #04182d;
  --projects-muted: #6b7785;
  --projects-line: #e4e9ef;

  position: relative;
  max-width: 1920px;
  margin-inline: auto;
  background: #f5f7fa;
  color: var(--projects-ink);
  font-family: Manrope, sans-serif;
  overflow: hidden;
}

.projects__bg {
  position: absolute;
  inset: 0;
  background: url("../../img/projects/bg-realise-projects.webp") center top / cover no-repeat;
  pointer-events: none;
}

.projects__inner {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  padding: 48px 52px 56px;
}

.projects__eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
}

.projects__eyebrow-num {
  color: var(--projects-orange);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}

.projects__eyebrow-line {
  flex: none;
  width: 36px;
  height: 2px;
  background: var(--projects-orange);
}

.projects__eyebrow-label {
  color: #8d97a3;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.projects__title {
  margin: 0;
  color: var(--projects-ink);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  white-space: nowrap;
}

.projects__title-accent {
  color: var(--projects-orange);
}

.projects__lead {
  margin: 16px 0 0;
  color: var(--projects-muted);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
}

.projects__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 28px;
}

.projects__card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 18px 16px 14px;
  border: 1px solid var(--projects-line);
  border-radius: 18px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.projects__card {
  cursor: pointer;
}

.projects__card:hover {
  border-color: #d5dce4;
}

.projects__card:hover .projects__arrow {
  background: #ff6a1f;
}

.projects__card:focus-visible {
  outline: 2px solid var(--projects-orange);
  outline-offset: 3px;
}

.projects__name {
  margin: 0 0 14px;
  color: var(--projects-ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.projects__cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 515 / 227;
  object-fit: cover;
  border-radius: 12px;
}

.projects__thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.projects__thumbs img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 124 / 145;
  object-fit: cover;
  border-radius: 8px;
}

.projects__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--projects-line);
}

.projects__thumbs + .projects__foot {
  margin-top: 14px;
}

.projects__more {
  color: #4e5b6a;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.projects__arrow {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--projects-orange);
  color: #fff;
}

.projects__arrow svg {
  width: 16px;
  height: 10px;
}

.projects__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
}

.projects__all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 56px;
  padding: 0 28px;
  border: 1px solid var(--projects-orange);
  border-radius: 12px;
  background: var(--projects-orange);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.projects__all-arrow {
  flex: none;
  width: 22px;
  height: 12px;
}

.projects__all:hover {
  border-color: #ff6a1f;
  background: #ff6a1f;
}

.projects__all:focus-visible {
  outline: 2px solid var(--projects-ink);
  outline-offset: 3px;
}

@media (max-width: 1279px) {
  .projects__inner {
    padding: 32px 20px 40px;
  }

  .projects__title,
  .projects__name {
    white-space: normal;
  }

  .projects__grid {
    grid-template-columns: 1fr;
  }

  .projects__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 767px) {
  .projects__title {
    font-size: 32px;
  }
}

.gallery {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 16px 20px 20px;
  border: 0;
  background: #06121c;
  color: #fff;
  user-select: none;
}

.gallery[open] {
  animation: gallery-in 0.35s ease both;
}

.gallery::backdrop {
  background: rgba(6, 18, 28, 0.92);
  animation: gallery-fade 0.35s ease both;
}

@keyframes gallery-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes gallery-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes gallery-next {
  from {
    opacity: 0;
    transform: translateX(28px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes gallery-prev {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.gallery__top {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 44px;
}

.gallery__title,
.gallery__count {
  margin: 0;
}

.gallery__title {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.gallery__count {
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.gallery__close,
.gallery__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.gallery__close {
  position: relative;
}

.gallery__close span {
  position: absolute;
  top: 21px;
  left: 12px;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.gallery__close span:first-child {
  transform: rotate(45deg);
}

.gallery__close span:last-child {
  transform: rotate(-45deg);
}

.gallery__close:hover,
.gallery__nav:hover {
  border-color: #fd6000;
  color: #fd6000;
}

.gallery__nav svg {
  width: 18px;
  height: 18px;
}

.gallery__stage {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  justify-items: center;
  gap: 12px;
  height: calc(100% - 60px);
  margin-top: 12px;
}

.gallery__img {
  width: auto;
  height: auto;
  max-width: min(100%, 1200px);
  max-height: 80vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery__img.is-next {
  animation: gallery-next 0.35s ease;
}

.gallery__img.is-prev {
  animation: gallery-prev 0.35s ease;
}

@media (max-width: 767px) {
  .gallery {
    padding: 12px 12px 16px;
  }

  .gallery__title {
    font-size: 15px;
  }

  .gallery__stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) 44px;
    gap: 12px 16px;
    height: calc(100% - 56px);
  }

  .gallery__img {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    max-height: 80vh;
  }

  .gallery__nav--prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }

  .gallery__nav--next {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }
}

.projects--animate:not(.is-inview) .projects__eyebrow,
.projects--animate:not(.is-inview) .projects__title,
.projects--animate:not(.is-inview) .projects__lead,
.projects--animate:not(.is-inview) .projects__card,
.projects--animate:not(.is-inview) .projects__actions {
  opacity: 0;
  transform: translateY(40px);
}

.projects--animate.is-inview .projects__eyebrow,
.projects--animate.is-inview .projects__title,
.projects--animate.is-inview .projects__lead,
.projects--animate.is-inview .projects__card,
.projects--animate.is-inview .projects__actions {
  animation: services-rise 0.8s ease both;
}

.projects--animate.is-inview .projects__title {
  animation-delay: 0.08s;
}

.projects--animate.is-inview .projects__lead {
  animation-delay: 0.16s;
}

.projects--animate.is-inview .projects__card:nth-child(1) { animation-delay: 0.24s; }
.projects--animate.is-inview .projects__card:nth-child(2) { animation-delay: 0.32s; }
.projects--animate.is-inview .projects__card:nth-child(3) { animation-delay: 0.4s; }
.projects--animate.is-inview .projects__card:nth-child(4) { animation-delay: 0.48s; }
.projects--animate.is-inview .projects__card:nth-child(5) { animation-delay: 0.56s; }
.projects--animate.is-inview .projects__card:nth-child(6) { animation-delay: 0.64s; }

.projects--animate.is-inview .projects__actions {
  animation-delay: 0.72s;
}

.projects--animate.is-inview .projects__card.is-shown,
.projects--animate.is-inview .projects__actions.is-shown {
  animation: none;
  opacity: 1;
  transform: none;
}
