/* THE CONFETTI ROOM — the party ended. the room did not get the memo. */

:root {
  --cf-bg: #1a1030;
}

body.confetti {
  background: linear-gradient(180deg, #2a1a4a, var(--cf-bg));
  color: #fff4f0;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem 6rem;
}

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

/* bunting — a string of triangle flags */
.bunting {
  position: relative;
  z-index: 3;
  display: flex;
  gap: 4px;
  margin: 1.5rem 0;
  border-top: 2px dashed rgba(255,255,255,0.3);
  padding-top: 2px;
}
.flag {
  width: 26px;
  height: 34px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  animation: sway 3s ease-in-out infinite;
  transform-origin: top center;
}
.flag:nth-child(6n+1) { background: #ff2fd6; animation-delay: 0s; }
.flag:nth-child(6n+2) { background: #ffe62f; animation-delay: 0.2s; }
.flag:nth-child(6n+3) { background: #2fe0ff; animation-delay: 0.4s; }
.flag:nth-child(6n+4) { background: #6dff2f; animation-delay: 0.6s; }
.flag:nth-child(6n+5) { background: #ff8a2f; animation-delay: 0.8s; }
.flag:nth-child(6n+6) { background: #b25aff; animation-delay: 1s; }

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

/* the cake */
.cake {
  position: relative;
  z-index: 3;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.blow-toggle { position: absolute; opacity: 0; pointer-events: none; }

.candles {
  display: flex;
  gap: 14px;
  margin-bottom: -4px;
}
.candle {
  width: 5px;
  height: 26px;
  background: repeating-linear-gradient(0deg, #ff2fd6 0 4px, #f4e9ff 4px 8px);
  position: relative;
}
.candle::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 14px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 30%, #fff6c8, #ffb020 60%, #ff5b20 100%);
  filter: blur(0.3px);
  animation: candle-flicker 1.6s infinite;
}
.candle:nth-child(2n)::before { animation-delay: 0.3s; }
.candle:nth-child(3n)::before { animation-delay: 0.6s; }
.candle:nth-child(4n)::before { animation-delay: 0.9s; }

/* click the cake — the candles go out. clicking again relights them,
   because nothing in this building stays fixed for long */
.cake:has(.blow-toggle:checked) .candle::before {
  animation: none;
  opacity: 0.12;
  transform: translateX(-50%) scaleY(0.4);
  background: radial-gradient(circle at 50% 60%, #999, transparent 70%);
  box-shadow: none;
}

@keyframes candle-flicker {
  0%, 100% { opacity: 1; transform: translateX(-50%) scaleY(1); }
  45% { opacity: 0.85; transform: translateX(-50%) scaleY(0.92) rotate(-2deg); }
  55% { opacity: 1; transform: translateX(-50%) scaleY(1.05) rotate(2deg); }
  80% { opacity: 0.9; }
}

.tier {
  width: 220px;
  height: 46px;
  border-radius: 6px 6px 2px 2px;
}
.tier.top {
  width: 170px;
  background: linear-gradient(180deg, #ffe1ef, #ff9fc9);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.08);
}
.tier.bottom {
  width: 220px;
  background: linear-gradient(180deg, #fff2d6, #ffd27a);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.08);
  margin-top: 4px;
}
.plate {
  width: 260px;
  height: 10px;
  border-radius: 50%;
  background: #e8e0f0;
  margin-top: 4px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
}

.cf-caption {
  position: relative;
  z-index: 3;
  text-align: center;
  max-width: 38ch;
  margin-top: 2rem;
  font-size: 0.8rem;
  opacity: 0.7;
}
.cf-caption .est {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

.cf-caption .out { display: none; }
body:has(.blow-toggle:checked) .cf-caption .lit { display: none; }
body:has(.blow-toggle:checked) .cf-caption .out { display: inline; }

/* falling confetti, infinite, pure CSS */
.fall-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.piece {
  position: absolute;
  top: -5%;
  width: 8px;
  height: 14px;
  opacity: 0.9;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0deg); }
  to   { transform: translateY(110vh) rotate(900deg); }
}
