/*!
 * lbnz-decode — letter-scramble wordmark
 */

.lbnz-decode {
  --lbnz-cell: 120px;
  --lbnz-font: 120px;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;

  color: #fff;
  font-family: "Roboto Flex", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 200;
  font-size: clamp(2rem, 9vw, 12rem);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  contain: layout style;
}

.lbnz-decode__row {
  display: flex;
  justify-content: center;
  height: calc(var(--lbnz-cell) * 1.12);
}

.lbnz-decode__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--lbnz-cell);
  height: 100%;
  font-size: var(--lbnz-font);
  line-height: 1;
  opacity: 0.55;
  transition: opacity 120ms linear;
  will-change: contents;
}

.lbnz-decode__cell.is-locked {
  opacity: 1;
  animation: lbnz-lock 260ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes lbnz-lock {
  0% {
    opacity: 0.35;
    transform: scale(1.06);
    filter: blur(1.5px);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: none;
  }
}

/* Cells listed in data-bold flash to bold as they lock, then resolve back
   to the light weight so the finished word stays even. */
.lbnz-decode__cell.is-bold.is-locked {
  animation: lbnz-lock-flash 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes lbnz-lock-flash {
  0% {
    opacity: 0.35;
    font-variation-settings: "wght" 200;
    transform: scale(1.06);
    filter: blur(1.5px);
  }
  28% {
    opacity: 0.92;
    font-variation-settings: "wght" 400;
    transform: scale(1.015);
    filter: blur(0.3px);
  }
  62% {
    opacity: 1;
    font-variation-settings: "wght" 300;
    transform: scale(1);
    filter: none;
  }
  100% {
    opacity: 1;
    font-variation-settings: "wght" 200;
    transform: scale(1);
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lbnz-decode {
    cursor: default;
  }

  .lbnz-decode__cell,
  .lbnz-decode__cell.is-locked,
  .lbnz-decode__cell.is-bold.is-locked {
    opacity: 1;
    transition: none;
    animation: none;
  }
}
