/* Carrusel editorial de proyectos: card protagonista + vecinas en perspectiva. */
.projects {
  position: relative;
  overflow: hidden;
  padding-bottom: clamp(54px, 6vw, 82px);
}

.projects .section-heading {
  margin-bottom: 18px;
}

.projects .section-heading h2 {
  font-size: clamp(38px, 4.4vw, 64px);
}

.projects .section-heading > p:last-child {
  margin-top: 14px;
  max-width: 680px;
}

.project-carousel {
  position: relative;
  left: 50%;
  width: 100vw;
  height: clamp(455px, 44vw, 530px);
  margin-left: -50vw;
  overflow: hidden;
  perspective: 1500px;
  user-select: none;
  touch-action: pan-y;
}

.project-track {
  position: relative;
  width: min(100%, 1280px);
  height: calc(100% - 70px);
  margin: 0 auto;
  transform-style: preserve-3d;
}

.project-carousel .project-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(340px, 40vw, 540px);
  height: clamp(350px, 31vw, 410px);
  min-height: 0 !important;
  padding: clamp(20px, 2vw, 26px);
  transform-origin: center center;
  transform-style: preserve-3d;
  transition:
    transform .58s cubic-bezier(.2,.8,.2,1),
    opacity .45s ease,
    filter .45s ease,
    box-shadow .35s ease;
  will-change: transform, opacity, filter;
  cursor: pointer;
}

.project-carousel .project-card:hover {
  box-shadow: var(--shadow);
}

.project-carousel .project-card[data-position="0"] {
  z-index: 5;
  opacity: 1;
  filter: none;
  transform: translate3d(-50%, -50%, 0) scale(1) rotateY(0deg);
  cursor: pointer;
}

.project-carousel .project-card[data-position="-1"] {
  z-index: 3;
  opacity: .62;
  filter: blur(1.2px) saturate(.84);
  transform: translate3d(-122%, -50%, -90px) scale(.82) rotateY(10deg);
}

.project-carousel .project-card[data-position="1"] {
  z-index: 3;
  opacity: .62;
  filter: blur(1.2px) saturate(.84);
  transform: translate3d(22%, -50%, -90px) scale(.82) rotateY(-10deg);
}

.project-carousel .project-card[data-position="-2"] {
  z-index: 1;
  opacity: .24;
  filter: blur(2.4px) saturate(.72);
  transform: translate3d(-184%, -50%, -180px) scale(.64) rotateY(16deg);
}

.project-carousel .project-card[data-position="2"] {
  z-index: 1;
  opacity: .24;
  filter: blur(2.4px) saturate(.72);
  transform: translate3d(84%, -50%, -180px) scale(.64) rotateY(-16deg);
}

.project-carousel .project-card[data-position="hidden"] {
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, -50%, -240px) scale(.55);
}

.project-carousel .project-card:not([data-position="0"]) .project-copy span {
  opacity: .72;
}

.project-carousel .project-visual {
  min-height: 0;
  flex: 1 1 auto;
}

.project-carousel .project-main {
  grid-row: auto;
}

.project-carousel .project-copy h3 {
  font-size: clamp(28px, 2.8vw, 42px);
}

.project-carousel .score-card {
  padding: 24px;
}

.project-carousel .score-card strong {
  font-size: clamp(22px, 2vw, 30px);
}

.project-carousel .dash-shell {
  width: min(100%, 240px);
  height: 138px;
}

.project-carousel .canvas-card {
  width: 108px;
  height: 108px;
  font-size: 42px;
}

.carousel-controls {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 46px minmax(120px, 260px) 46px;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.carousel-arrow {
  width: 46px;
  height: 46px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

.carousel-arrow:hover,
.carousel-arrow:focus-visible {
  background: var(--ink);
  color: #fff;
  transform: scale(1.06);
}

.carousel-arrow:focus-visible,
.carousel-dot:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: width .28s ease, background .28s ease, transform .28s ease;
}

.carousel-dot.is-active {
  width: 28px;
  background: var(--purple);
}

.carousel-hint {
  position: absolute;
  right: max(22px, calc((100vw - min(100vw, 1280px)) / 2 + 18px));
  bottom: 58px;
  z-index: 7;
  margin: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6c6874;
}

@media (max-width: 700px) {
  .projects {
    padding-top: 58px;
    padding-bottom: 52px;
  }

  .projects .section-heading {
    margin-bottom: 8px;
    padding-inline: 18px;
  }

  .projects .section-heading h2 {
    font-size: clamp(36px, 11vw, 48px);
  }

  .projects .section-heading > p:last-child {
    font-size: 15px;
    line-height: 1.5;
  }

  .project-carousel {
    height: 500px;
  }

  .project-track {
    height: 425px;
  }

  .project-carousel .project-card {
    width: calc(100vw - 54px);
    max-width: 390px;
    height: 390px;
    padding: 20px;
  }

  .project-carousel .project-card[data-position="-1"] {
    opacity: .34;
    filter: blur(1.8px) saturate(.78);
    transform: translate3d(-128%, -50%, -90px) scale(.78) rotateY(9deg);
  }

  .project-carousel .project-card[data-position="1"] {
    opacity: .34;
    filter: blur(1.8px) saturate(.78);
    transform: translate3d(28%, -50%, -90px) scale(.78) rotateY(-9deg);
  }

  .project-carousel .project-card[data-position="-2"],
  .project-carousel .project-card[data-position="2"] {
    opacity: 0;
    pointer-events: none;
  }

  .project-carousel .project-copy h3 {
    font-size: 30px;
  }

  .project-carousel .project-copy span {
    font-size: 14px;
  }

  .carousel-controls {
    grid-template-columns: 42px minmax(110px, 200px) 42px;
    gap: 12px;
  }

  .carousel-arrow {
    width: 42px;
    height: 42px;
  }

  .carousel-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-carousel .project-card,
  .carousel-arrow,
  .carousel-dot {
    transition: none !important;
  }
}
