.portfolio-tile__overlay {
  isolation: isolate;
  background: transparent;
  opacity: 1;
}

.portfolio-tile__overlay::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(226, 226, 226, .78), rgba(226, 226, 226, .96));
  content: "";
  transform: translateX(-101%);
  transition: transform .5s cubic-bezier(.22,.7,.2,1);
}

.portfolio-tile:hover .portfolio-tile__overlay::before,
.portfolio-tile:focus-within .portfolio-tile__overlay::before {
  animation: project-panel-enter .55s cubic-bezier(.22,.7,.2,1) both;
}

@keyframes project-panel-enter {
  from { transform: translateX(-101%); }
  to { transform: translateX(0); }
}

.portfolio-tile__actions button,
.portfolio-tile__actions a {
  opacity: 0;
  transform: translateY(-48px);
  transition: opacity .36s ease, transform .48s cubic-bezier(.22,1,.36,1), background-color .3s ease, border-color .3s ease, color .3s ease;
}

.portfolio-tile__caption h3,
.portfolio-tile__caption p {
  opacity: 0;
  transform: translateX(-70px);
  transition: opacity .36s ease, transform .52s cubic-bezier(.22,1,.36,1);
}

@keyframes project-text-enter {
  from { opacity: 0; transform: translateX(-70px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes project-button-enter {
  from { opacity: 0; transform: translateY(-48px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes lightbox-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightbox-image-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes lightbox-thumb-in {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-lightbox[open]::backdrop {
  animation: lightbox-backdrop-in .32s ease-out both;
}

.project-lightbox figure.is-image-loading {
  opacity: 0;
}

.project-lightbox figure.is-revealing {
  animation: lightbox-image-in .48s cubic-bezier(.22,.7,.2,1) both;
}

.project-lightbox[open] .project-lightbox__rail button {
  animation: lightbox-thumb-in .48s cubic-bezier(.22,.7,.2,1) var(--rail-delay, 0ms) both;
}

.portfolio-tile > img {
  transition: filter .5s ease, transform .6s cubic-bezier(.2,.7,.2,1);
}

.portfolio-tile:hover .portfolio-tile__overlay,
.portfolio-tile:focus-within .portfolio-tile__overlay {
  opacity: 1;
}

.portfolio-tile:hover .portfolio-tile__caption h3,
.portfolio-tile:focus-within .portfolio-tile__caption h3 {
  animation: project-text-enter .68s cubic-bezier(.22,1,.36,1) .04s both;
}

.portfolio-tile:hover .portfolio-tile__caption p,
.portfolio-tile:focus-within .portfolio-tile__caption p {
  animation: project-text-enter .68s cubic-bezier(.22,1,.36,1) .16s both;
}

.portfolio-tile:hover .portfolio-tile__actions button,
.portfolio-tile:focus-within .portfolio-tile__actions button {
  animation: project-button-enter .64s cubic-bezier(.22,1,.36,1) .10s both;
}

.portfolio-tile:hover .portfolio-tile__actions a,
.portfolio-tile:focus-within .portfolio-tile__actions a {
  animation: project-button-enter .64s cubic-bezier(.22,1,.36,1) .20s both;
}

.portfolio-tile:hover .portfolio-tile__actions button,
.portfolio-tile:hover .portfolio-tile__actions a,
.portfolio-tile:focus-within .portfolio-tile__actions button,
.portfolio-tile:focus-within .portfolio-tile__actions a,
.portfolio-tile:hover .portfolio-tile__caption h3,
.portfolio-tile:hover .portfolio-tile__caption p,
.portfolio-tile:focus-within .portfolio-tile__caption h3,
.portfolio-tile:focus-within .portfolio-tile__caption p {
  opacity: 1;
  transform: none;
}

.portfolio-tile:hover > img,
.portfolio-tile:focus-within > img {
  filter: saturate(.95);
  transform: scale(1.025);
}

.project-lightbox button {
  transition: background-color .3s ease, color .3s ease;
}

.portfolio-tile__actions button:hover,
.portfolio-tile__actions a:hover,
.portfolio-tile__actions button:focus-visible,
.portfolio-tile__actions a:focus-visible {
  background: var(--color-white);
  border-color: var(--color-white);
  color: var(--color-action);
}

.project-lightbox button:hover,
.project-lightbox button:focus-visible {
  background: #eef5f8;
}

@media (hover: none) and (pointer: coarse) {
  .portfolio-tile__overlay {
    background: linear-gradient(180deg, transparent 30%, var(--color-line-overlay));
  }

  .portfolio-tile__overlay::before {
    display: none;
  }

  .portfolio-tile__actions {
    opacity: .95;
  }

  .portfolio-tile__actions button,
  .portfolio-tile__actions a,
  .portfolio-tile__caption h3,
  .portfolio-tile__caption p {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

/* El propietario solicita este movimiento aun cuando Windows marque
   reducir movimiento; la excepción queda limitada a Proyectos. */
@media (prefers-reduced-motion: reduce) and (hover: hover) {
  .projects-page .portfolio-tile__overlay::before {
    animation-duration: .55s !important;
    transition-duration: .5s !important;
  }

  .projects-page .portfolio-tile > img {
    transition-duration: .6s !important;
  }

  .projects-page .portfolio-tile__caption h3,
  .projects-page .portfolio-tile__caption p {
    animation-duration: .68s !important;
    transition-duration: .52s !important;
  }

  .projects-page .portfolio-tile__actions button,
  .projects-page .portfolio-tile__actions a {
    animation-duration: .64s !important;
    transition-duration: .48s !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-lightbox[open]::backdrop {
    animation-duration: .32s !important;
  }

  .project-lightbox figure.is-revealing,
  .project-lightbox[open] .project-lightbox__rail button {
    animation-duration: .48s !important;
  }
}

