/* THE DISCO FLOOR — nobody is dancing. the floor doesn't need anybody to. */

@property --tile-hue {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

:root {
  --disco-bg: #0a0612;
}

body.disco {
  background: var(--disco-bg);
  color: #f0e6ff;
  min-height: 100vh;
  padding: 3rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.disco-header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  z-index: 3;
}
.disco-header h1 {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.8rem;
}
.disco-header p {
  max-width: 40ch;
  margin: 0.75rem auto 0;
  font-size: 0.8rem;
  opacity: 0.75;
}

/* the ball */
.ball-rig {
  position: relative;
  height: 90px;
  display: flex;
  justify-content: center;
  z-index: 3;
}
.ball-rig::before {
  content: '';
  width: 1px;
  height: 60px;
  background: #444;
}
.ball-rig { cursor: pointer; }
.ball-toggle { position: absolute; opacity: 0; pointer-events: none; }
/* click the ball, it goes wild until you click it again */
.ball-rig:has(.ball-toggle:checked) .ball {
  animation-duration: 0.5s;
}

.ball {
  position: absolute;
  top: 56px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    #cfd3da 0deg 7deg,
    #8890a0 7deg 14deg
  );
  box-shadow: 0 0 50px 10px rgba(255,255,255,0.25), inset -10px -10px 30px rgba(0,0,0,0.5);
  animation: ball-spin 6s linear infinite;
}
@keyframes ball-spin {
  from { background-position: 0 0; }
  to { background-position: 90px 0; }
}

/* sweeping colored beams, screen-blended over everything below */
.beams {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.5;
}
.beam {
  position: absolute;
  top: -10%;
  left: 50%;
  width: 3px;
  height: 130%;
  transform-origin: top center;
  background: linear-gradient(to bottom, currentColor, transparent 70%);
  animation: sweep 7s ease-in-out infinite;
}
.beam:nth-child(1) { color: #ff2fd6; animation-delay: 0s; }
.beam:nth-child(2) { color: #2fe0ff; animation-delay: -1.6s; }
.beam:nth-child(3) { color: #ffe62f; animation-delay: -3.2s; }
.beam:nth-child(4) { color: #6dff2f; animation-delay: -4.8s; }

@keyframes sweep {
  0%, 100% { transform: rotate(-55deg); }
  50% { transform: rotate(55deg); }
}

/* the floor: a grid of tiles, each cycling hue with a staggered delay so
   the whole thing reads as a chase pattern radiating outward */
.floor {
  position: relative;
  z-index: 1;
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  width: min(92vw, 560px);
  aspect-ratio: 8 / 5;
  perspective: 700px;
  transform: rotateX(45deg);
  transform-origin: bottom;
}

.tile {
  background: hsl(calc(var(--tile-hue) * 1deg) 90% 55%);
  animation: tile-hue 3s linear infinite;
  animation-delay: calc(var(--i) * 60ms);
}

@keyframes tile-hue {
  from { --tile-hue: 0; }
  to   { --tile-hue: 360; }
}

.disco-hint {
  position: relative;
  z-index: 3;
  max-width: 40ch;
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.7;
}
