/* Experiences archive — infinite parallax grid */

body.projects-experiences-page {
  overflow: hidden;
}

body.projects-experiences-page .site-main--projects-archive {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
}

.projects-exp {
  --exp-phi: 1.618;
  --exp-tile-h-base: 200px;
  --exp-tile-w-base: calc(var(--exp-tile-h-base) * var(--exp-phi));
  --exp-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #0a0c12;
  color: #f5f1ec;
}

.projects-exp__chrome {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 3vw, 1.75rem);
}

.projects-exp__chrome > * {
  pointer-events: auto;
}

.projects-exp__back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245, 241, 236, 0.55);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(8px);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.projects-exp__back:hover {
  color: #f5f1ec;
  border-color: rgba(91, 140, 255, 0.4);
  text-decoration: none;
}

.projects-exp__back--inline {
  margin-top: 1rem;
}

.projects-exp__head {
  margin-top: auto;
  max-width: 28rem;
}

.projects-exp__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(91, 140, 255, 0.75);
}

.projects-exp__title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.projects-exp__hint {
  position: absolute;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(245, 241, 236, 0.28);
  pointer-events: none;
}

.projects-exp__viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.projects-exp__plane {
  display: grid;
  grid-template-columns: repeat(var(--exp-cols, 6), var(--exp-tile-w, var(--exp-tile-w-base)));
  grid-template-rows: repeat(var(--exp-rows, 5), var(--exp-tile-h, var(--exp-tile-h-base)));
  gap: var(--exp-gap, 22px);
  width: max-content;
  flex-shrink: 0;
  will-change: transform;
}

/* Server-rendered fallback before JS initializes parallax */
.projects-exp__plane:not([data-exp-ready]) {
  grid-template-columns: repeat(6, var(--exp-tile-w-base));
  grid-auto-rows: var(--exp-tile-h-base);
}

.projects-exp__plane[data-exp-ready] {
  position: absolute;
  left: 0;
  top: 0;
  flex-shrink: unset;
}

.projects-exp__vignette {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 50% 50%, transparent 30%, rgba(10, 12, 18, 0.55) 100%),
    linear-gradient(180deg, rgba(10, 12, 18, 0.65) 0%, transparent 22%, transparent 72%, rgba(10, 12, 18, 0.8) 100%);
}

.projects-exp__empty {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: rgba(245, 241, 236, 0.6);
}

.projects-exp__empty-hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  max-width: 22rem;
  line-height: 1.5;
  color: rgba(245, 241, 236, 0.4);
}

/* ——— Tiles ——— */
.projects-exp-tile {
  display: flex;
  flex-direction: column;
  width: var(--exp-tile-w, var(--exp-tile-w-base));
  height: var(--exp-tile-h, var(--exp-tile-h-base));
  border-radius: 6px;
  overflow: hidden;
  background: #161a24;
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.45s var(--exp-ease),
    border-color 0.35s ease,
    box-shadow 0.45s ease;
  transform: translateZ(0);
}

/* Each tile surfaces and recedes on its own rhythm — memories in motion. */
.projects-exp__plane[data-exp-ready] .projects-exp-tile {
  --exp-presence-dur: calc(13s + var(--tile-phase, 0) * 1.65s);
  animation: exp-tile-presence var(--exp-presence-dur) ease-in-out infinite;
  animation-delay: calc(var(--tile-i, 0) * -1.15s);
}

@keyframes exp-tile-presence {
  0%,
  100% {
    opacity: 0.18;
    filter: brightness(0.62) blur(1.2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  }

  14% {
    opacity: 0.92;
    filter: brightness(1) blur(0);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  }

  48% {
    opacity: 1;
    filter: brightness(1.04) blur(0);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.38);
  }

  68% {
    opacity: 0.22;
    filter: brightness(0.68) blur(0.8px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  }
}

.projects-exp-tile:hover {
  animation-play-state: paused;
  opacity: 1 !important;
  filter: brightness(1.08) blur(0) !important;
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(91, 140, 255, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  text-decoration: none;
  color: inherit;
}

.projects-exp-tile__media {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1e2433 0%, #12151d 100%);
}

.projects-exp-tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--exp-ease), filter 0.4s ease;
}

.projects-exp-tile:hover .projects-exp-tile__img {
  transform: scale(1.06);
  filter: brightness(1.08);
}

.projects-exp-tile__placeholder {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(91, 140, 255, 0.12) 0%, transparent 50%),
    linear-gradient(145deg, #1e2433 0%, #12151d 100%);
}

.projects-exp-tile__body {
  flex: 0 0 auto;
  padding: 0.55rem 0.75rem 0.65rem;
  background: rgba(12, 14, 20, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.projects-exp-tile__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projects-exp-tile__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  line-height: 1.35;
  color: rgba(245, 241, 236, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
  .projects-exp__plane {
    transform: none !important;
  }

  .projects-exp__plane[data-exp-ready] .projects-exp-tile {
    animation: none;
    opacity: 1;
    filter: none;
  }

  .projects-exp-tile,
  .projects-exp-tile__img {
    transition: none;
  }
}

@media (max-width: 640px) {
  .projects-exp__head {
    max-width: 16rem;
  }

  .projects-exp__title {
    font-size: 1.75rem;
  }
}
