/* 2.0 Transformer. Rest is empty. The heading click brings the
   stacked weight grids: a 4×4 of 4×4, five layers offset in
   space. Localhost sliders write --weights-* on the object. */

html.talk .weights {
  --weights-size: 22;
  --weights-stack: 0.35;
  --weights-tilt: 54;
  --weights-turn: -18;
  --weights-depth: 48;
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: 1;
  width: calc(var(--weights-size) * 1rem);
  height: calc(var(--weights-size) * 1rem);
  max-width: 46vw;
  max-height: 46vw;
  translate: -50% -50%;
  perspective: 64rem;
  opacity: 0;
  pointer-events: none;
}

html.talk .mode-paper.is-heading .weights {
  opacity: 1;
}

html.talk .weights-stage {
  width: 100%;
  height: 100%;
  transform:
    rotateX(calc(var(--weights-tilt) * 1deg))
    rotateZ(calc(var(--weights-turn) * 1deg));
  transform-style: preserve-3d;
}

html.talk .weights-slab {
  position: absolute;
  inset: 0;
  z-index: var(--d);
  opacity: 0;
  transform:
    translate3d(
      calc(var(--ox) * var(--weights-stack) * 1px),
      calc(var(--oy) * var(--weights-stack) * 1px),
      calc((var(--d) - 2) * var(--weights-depth) * 1px)
    );
  transform-style: preserve-3d;
}

html.talk .mode-paper.is-heading .weights-slab {
  opacity: calc(0.16 + var(--d) * 0.17);
}

html.talk .weights-grid,
html.talk .weights-cell {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  width: 100%;
  height: 100%;
}

html.talk .weights-grid {
  gap: 4px;
}

html.talk .weights-cell {
  gap: 1.5px;
  box-shadow: inset 0 0 0 1px rgba(232, 234, 239, 0.38);
}

html.talk .weights-cell i {
  display: block;
  box-shadow: inset 0 0 0 1px rgba(232, 234, 239, 0.55);
}

html.talk .mode-paper.is-play-heading .weights-slab {
  animation: weights-slab-in 0.95s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--d) * 0.08s);
}

@keyframes weights-slab-in {
  from {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.86);
  }
  to {
    opacity: calc(0.16 + var(--d) * 0.17);
    transform:
      translate3d(
        calc(var(--ox) * var(--weights-stack) * 1px),
        calc(var(--oy) * var(--weights-stack) * 1px),
        calc((var(--d) - 2) * var(--weights-depth) * 1px)
      )
      scale(1);
  }
}

.weights-tune {
  position: fixed;
  left: 0.85rem;
  bottom: 0.85rem;
  z-index: 40;
  width: 16.5rem;
  padding: 0.7rem 0.85rem 0.8rem;
  border: 1px solid rgba(232, 234, 239, 0.22);
  background: rgba(10, 12, 16, 0.92);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #e8eaef;
}

.weights-tune[hidden] {
  display: none;
}

.weights-tune p {
  margin: 0 0 0.55rem;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(232, 234, 239, 0.62);
}

.weights-tune label {
  display: grid;
  grid-template-columns: 3.4rem 2.4rem 1fr;
  align-items: center;
  gap: 0.4rem;
  margin: 0.28rem 0;
}

.weights-tune output {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0;
  color: #fff;
}

.weights-tune input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #e8eaef;
}

@media (max-width: 860px) {
  html.talk .weights {
    --weights-size: 14;
    top: 38%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.talk .mode-paper.is-play-heading .weights-slab {
    animation: none;
  }

  html.talk .mode-paper.is-heading .weights-slab {
    opacity: calc(0.16 + var(--d) * 0.17);
    transform:
      translate3d(
        calc(var(--ox) * var(--weights-stack) * 1px),
        calc(var(--oy) * var(--weights-stack) * 1px),
        calc((var(--d) - 2) * var(--weights-depth) * 1px)
      );
  }
}
