/* Interactive finish for the three experience cards. */
.other-work {
  --experience-gold: #ae8b4d;
  --experience-gold-light: #ddc893;
}

@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  .other-grid {
    perspective: 1500px;
    perspective-origin: 50% 42%;
  }

  .other-link {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    --image-x: 0px;
    --image-y: 0px;
    overflow: hidden;
    transform: translate3d(0, 0, 0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
    transform-style: preserve-3d;
    transform-origin: center;
    will-change: transform;
    transition:
      transform 520ms cubic-bezier(0.16, 1, 0.3, 1),
      border-color 360ms ease,
      box-shadow 520ms cubic-bezier(0.16, 1, 0.3, 1),
      filter 420ms ease;
  }

  .other-link::after {
    content: "";
    position: absolute;
    z-index: 4;
    top: -35%;
    bottom: -35%;
    left: -18%;
    width: 1px;
    pointer-events: none;
    background: rgba(255, 247, 218, 0.92);
    box-shadow: 0 0 9px 2px rgba(201, 169, 98, 0.42);
    opacity: 0;
    transform: rotate(18deg) translateX(-1.5rem);
  }

  .other-link img {
    transform: translate3d(var(--image-x), var(--image-y), 0) scale(1.001);
    will-change: transform;
    transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1), filter 420ms ease;
  }

  .other-link-content {
    position: relative;
    z-index: 3;
    transform: translateZ(20px);
    transition: transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .other-link small {
    position: relative;
    overflow: hidden;
    transition:
      color 300ms ease,
      border-color 300ms ease,
      background-color 300ms ease,
      box-shadow 400ms ease,
      transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .other-link:is(:hover, :focus-visible) {
    z-index: 5;
    border-color: rgba(174, 139, 77, 0.86);
    background: var(--white);
    box-shadow:
      0 34px 70px rgba(37, 27, 13, 0.2),
      0 10px 24px rgba(174, 139, 77, 0.13),
      inset 0 0 0 1px rgba(255, 250, 232, 0.74);
    filter: saturate(1.025);
    transform: translate3d(0, -18px, 48px) scale(1.075) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  }

  .other-link:is(:hover, :focus-visible) img {
    filter: contrast(1.025) saturate(1.035);
    transform: translate3d(var(--image-x), var(--image-y), 26px) scale(1.105);
  }

  .other-link:is(:hover, :focus-visible) .other-link-content {
    transform: translateZ(36px);
  }

  .other-link:is(:hover, :focus-visible) small {
    border-color: var(--experience-gold);
    background: rgba(255, 252, 243, 0.92);
    box-shadow: 0 7px 22px rgba(174, 139, 77, 0.15);
    transform: translate3d(0.35rem, -0.15rem, 16px);
  }

  .other-link:is(:hover, :focus-visible)::after {
    animation: experience-shine 850ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .other-grid:has(.other-link:hover) .other-link:not(:hover) {
    filter: saturate(0.88) brightness(0.97);
    transform: translate3d(0, 5px, -16px) scale(0.965);
  }

  .other-grid:has(.other-link:hover) .other-link:first-child:not(:hover) {
    translate: -0.4rem 0;
  }

  .other-grid:has(.other-link:hover) .other-link:last-child:not(:hover) {
    translate: 0.4rem 0;
  }
}

@keyframes experience-shine {
  0% { left: -18%; opacity: 0; }
  22% { opacity: 0.7; }
  70% { opacity: 0.34; }
  100% { left: 118%; opacity: 0; }
}

@media (max-width: 560px) {
  .other-work {
    padding-top: 2.6rem;
    padding-bottom: 2.8rem;
    overflow: hidden;
  }

  .other-work .section-heading {
    margin-bottom: 1.15rem;
  }

  .other-work .section-heading .eyebrow {
    margin-bottom: 0.45rem;
    font-size: 0.67rem;
  }

  .other-work .section-heading h2 {
    max-width: 19ch;
    margin-bottom: 0;
    font-size: clamp(1.65rem, 8.2vw, 2.05rem);
    line-height: 1.03;
  }

  .other-grid {
    display: flex;
    width: calc(100% + 1.25rem);
    gap: 0.72rem;
    margin-right: -1.25rem;
    padding: 0.55rem 1.3rem 1.1rem 0.15rem;
    overflow-x: auto;
    overflow-y: visible;
    scroll-padding-left: 0.15rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .other-grid::-webkit-scrollbar {
    display: none;
  }

  .other-link,
  .other-link:last-child {
    flex: 0 0 min(72vw, 17.5rem);
    grid-column: auto;
    scroll-snap-align: start;
    border-color: rgba(174, 139, 77, 0.38);
    box-shadow: 0 10px 24px rgba(34, 27, 16, 0.07);
    transform: translate3d(0, 0, 0) scale(0.975);
    transition:
      transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
      border-color 300ms ease,
      box-shadow 420ms ease;
  }

  .other-link img {
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }

  .other-link-content {
    gap: 0.75rem;
    min-height: 8.3rem;
    padding: 0.9rem;
  }

  .other-link-content > span {
    font-size: 1.25rem;
    line-height: 1.08;
  }

  .other-link small {
    gap: 0.38rem;
    min-height: 2.45rem;
    padding: 0.56rem 0.65rem;
    font-size: 0.61rem;
    letter-spacing: 0.06em;
  }

  .other-link.is-active {
    z-index: 2;
    border-color: rgba(174, 139, 77, 0.78);
    box-shadow: 0 16px 30px rgba(51, 37, 17, 0.14), 0 0 0 1px rgba(221, 200, 147, 0.3);
    transform: translate3d(0, -0.3rem, 0) scale(1);
  }

  .other-link.is-active::before {
    opacity: 1;
    box-shadow: 0 0 8px rgba(174, 139, 77, 0.4);
  }

  .other-link.is-active small {
    border-color: var(--experience-gold);
    background: rgba(255, 251, 240, 0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .other-link,
  .other-link img,
  .other-link-content,
  .other-link small,
  .other-grid .other-link {
    transition-duration: 0.01ms !important;
    animation: none !important;
    transform: none !important;
    translate: none !important;
  }
}
