/* Flapboard — visual styling for the split-flap mechanism. */
[data-flap] {
  display: inline-flex;
  flex-wrap: wrap;
  line-height: 1;
}
.flap-space { display: inline-block; width: 0.5em; flex: none; }
.flap-word { display: inline-flex; flex-wrap: nowrap; }

.flap-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1.32em;
  margin: 0 0.045em;
  background: var(--flap-bg, #0b0b0c);
  border-radius: 0.08em;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 1px 0 rgba(0, 0, 0, 0.6);
  overflow: hidden;
  flex: none;
  perspective: 6em;
}
.flap-cell::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: calc(50% - 0.4px);
  height: 0.8px;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2;
  pointer-events: none;
}
.flap-glyph {
  display: block;
  font: inherit;
  color: var(--flap-ink, #ffffff);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
}
/* Promoted only while it turns. A standing will-change made every glyph on
   the page its own compositor layer: a few hundred on a page like Led
   Motion, all re-uploaded on every frame the rail moved. */
.flap-cell.is-flipping .flap-glyph {
  will-change: transform;
  animation: flapTurn var(--flap-step-ms, 70ms) linear;
}
@keyframes flapTurn {
  0%   { transform: rotateX(0deg); }
  49%  { transform: rotateX(-90deg); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .flap-cell.is-flipping .flap-glyph { animation: none; }
}

/* light-on-dark board (default) vs dark-on-light variant for white sections */
.flap-board--onlight {
  --flap-bg: #101010;
  --flap-ink: #ffffff;
}
