/* Homepage assembly intro. Active only while html.ffs-assemble is set by the homepage script. */

html.ffs-assemble,
html.ffs-assemble:not(.ffs-assemble-playing) body {
  background: var(--ffs-deep-ink, #0b1114);
}

html.ffs-assemble,
html.ffs-assemble body {
  overflow: hidden;
  overscroll-behavior: none;
}

html.ffs-assemble-playing .ffs-header.ffs-asm-quiet {
  border-bottom-color: transparent;
}

html.ffs-assemble .ffs-wrap {
  visibility: hidden;
}

html.ffs-assemble.ffs-assemble-playing .ffs-wrap {
  visibility: visible;
}

html.ffs-assemble-playing .ffs-asm-piece {
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(1.06);
  filter: blur(8px);
}

html.ffs-assemble-playing .ffs-asm-piece.is-in {
  opacity: 1;
  transform: none;
  filter: none;
  transition:
    opacity 320ms ease,
    transform 460ms cubic-bezier(0.16, 0.84, 0.24, 1),
    filter 340ms ease;
}

body > .ffs-assemble {
  display: none;
}

html.ffs-assemble .ffs-assemble {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--ffs-deep-ink, #0b1114);
  color: var(--ffs-warm-white, #f3f0e8);
}

html.ffs-assemble.ffs-assemble-playing .ffs-assemble {
  background: transparent;
  pointer-events: none;
}

.ffs-assemble__field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
}

html.ffs-assemble .ffs-assemble__field {
  display: block;
}

.ffs-assemble__btn {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: auto;
  max-width: calc(100vw - 2rem);
  min-height: 3.25rem;
  margin: 0;
  padding: 0.75rem 1.15rem 0.7rem;
  border: 0;
  background: var(--ffs-electric-teal, #27c7b8);
  color: var(--ffs-deep-ink, #0b1114);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  image-rendering: pixelated;
  box-shadow:
    0 0 0 4px var(--ffs-deep-ink, #0b1114),
    0 0 0 8px var(--ffs-burnt-coral, #f2694b),
    8px 8px 0 0 rgba(0, 0, 0, 0.55);
  animation: ffs-play-flash 800ms steps(2, end) infinite;
}

.ffs-assemble__play {
  width: 12px;
  height: 21px;
  flex: none;
  background:
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 0 / 3px 3px no-repeat,
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 3px / 6px 3px no-repeat,
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 6px / 9px 3px no-repeat,
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 9px / 12px 3px no-repeat,
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 12px / 9px 3px no-repeat,
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 15px / 6px 3px no-repeat,
    linear-gradient(var(--ffs-deep-ink, #0b1114), var(--ffs-deep-ink, #0b1114)) 0 18px / 3px 3px no-repeat;
}

.ffs-assemble__word {
  display: block;
}

@media (max-width: 420px) {
  .ffs-assemble__btn {
    gap: 0.55rem;
    padding: 0.8rem 0.9rem 0.75rem;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
  }
}

@keyframes ffs-play-flash {
  0%,
  49% {
    opacity: 1;
    box-shadow:
      0 0 0 4px var(--ffs-deep-ink, #0b1114),
      0 0 0 8px var(--ffs-burnt-coral, #f2694b),
      0 0 0 10px var(--ffs-deep-ink, #0b1114),
      0 0 0 12px var(--ffs-warm-white, #f3f0e8),
      8px 8px 0 0 rgba(0, 0, 0, 0.55);
  }

  50%,
  100% {
    opacity: 0.62;
    box-shadow:
      0 0 0 4px var(--ffs-deep-ink, #0b1114),
      0 0 0 8px var(--ffs-burnt-coral, #f2694b),
      8px 8px 0 0 rgba(0, 0, 0, 0.55);
  }
}

.ffs-assemble__btn:hover {
  background: var(--ffs-warm-white, #f3f0e8);
}

.ffs-assemble__btn:focus {
  outline: none;
}

.ffs-assemble__btn:focus-visible {
  outline: 3px solid var(--ffs-warm-white, #f3f0e8);
  outline-offset: 10px;
}

html.ffs-assemble-playing .ffs-assemble__btn {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  html.ffs-assemble-playing .ffs-asm-piece,
  html.ffs-assemble-playing .ffs-asm-piece.is-in {
    transform: none;
    filter: none;
    transition: none;
  }

  .ffs-assemble__btn {
    animation: none;
    opacity: 1;
  }
}
