/* Board styling and mechanical half-flips adapted from the supplied React Bits CSS. */
/* Copyright (c) 2026 David Haz. See REACT-BITS-LICENSE.md. */
.split-flap-text {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  --split-flap-tile-color: #171a1e;
  --split-flap-text-color: #b2b7be;
  color: var(--split-flap-text-color);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 700;
  font-synthesis: weight;
  line-height: 1;
  letter-spacing: 0.035em;
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

.split-flap-text__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.split-flap-text__tile {
  position: relative;
  flex: none;
  width: 0.78em;
  height: 1.08em;
  overflow: hidden;
  border-radius: 4px;
  background: var(--split-flap-tile-color);
  box-shadow: 0 0.035em 0.08em #ffffff14 inset, 0 -0.05em 0.1em #0006 inset, 0 0.16em 0.38em #0004;
  perspective: 10em;
  transform-style: preserve-3d;
  isolation: isolate;
}

.split-flap-text__tile::before {
  content: "";
  position: absolute;
  z-index: 8;
  top: calc(50% - 0.5px);
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ffffff2e 18%, #000a 50%, #ffffff24 82%, transparent);
  box-shadow: 0 -1px 0 #ffffff14, 0 1px 0 #0008;
  pointer-events: none;
}

.split-flap-text__tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  border: 1px solid #ffffff14;
  border-radius: inherit;
  pointer-events: none;
}

.split-flap-text__half,
.split-flap-text__flap {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff12, transparent 34%), var(--split-flap-tile-color);
  backface-visibility: hidden;
}

.split-flap-text__half--top,
.split-flap-text__flap--front {
  top: 0;
}

.split-flap-text__half--bottom,
.split-flap-text__flap--back {
  bottom: 0;
  background: linear-gradient(0deg, #ffffff0f, transparent 38%), #15181c;
}

.split-flap-text__char {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--split-flap-text-color);
  text-shadow: 0 0.025em 0 #ffffff29, 0 0.09em 0.16em #0007;
}

.split-flap-text__half--top .split-flap-text__char,
.split-flap-text__flap--front .split-flap-text__char {
  top: 0;
}

.split-flap-text__half--bottom .split-flap-text__char,
.split-flap-text__flap--back .split-flap-text__char {
  bottom: 0;
}

.split-flap-text__flap {
  z-index: 6;
  will-change: transform, filter;
  transform-style: preserve-3d;
}

.split-flap-text__flap--front {
  transform-origin: center bottom;
  animation: split-flap-front 0.12s linear both;
}

.split-flap-text__flap--back {
  transform-origin: center top;
  transform: rotateX(90deg);
  animation: split-flap-back 0.12s linear both;
}

@keyframes split-flap-front {
  0% { transform: rotateX(0deg); filter: brightness(1.08); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }
  50%, 100% { transform: rotateX(-90deg); filter: brightness(0.52); }
}

@keyframes split-flap-back {
  0%, 50% { transform: rotateX(90deg); filter: brightness(0.58); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
  100% { transform: rotateX(0deg); filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  .split-flap-text__flap { animation: none; }
}
