@property --scr-a {
  syntax: '<color>';
  inherits: false;
  initial-value: #01796f;
}

@property --scr-b {
  syntax: '<color>';
  inherits: false;
  initial-value: #013f3a;
}

.switch {
  display: block;
  --sw-a: #1a2433;
  --sw-b: #0d1117;
}

body:has(.bouquet-scene) {
  background: #013f3a;
}

main.bouquet-scene {
  --bg: #01584f;
  --fg: #eafff4;
  --glow: rgb(140 255 200 / 0.3);
  --scr-a: #01796f;
  --scr-b: #013f3a;

  min-height: 100dvh;
  margin: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at center, var(--scr-a) 0%, var(--scr-b) 80%);
  box-shadow: inset 0 0 18vmin rgb(0 0 0 / 0.45);
  animation:
    phosphor 1s linear both,
    jolt 1s steps(1, end) both;

  --flower-yellow: #ffe27a;
  --flower-pink: #ffb8dc;
  --flower-red: #ff9a9a;
  --flower-violet: #dcc2ff;
  --flower-white: #ffffff;
  --stem: #a9f2b7;
  --bow: #ff9fd0;

  --cycle: 17s;
  --grow: 2.6s;
  --lines: 26;
  --intro: 0.9s;

  overflow: hidden;
  padding: 1rem;
}

.bouquet {
  margin: 0;
  font-family: var(--font);

  font-size: min(4.2vw, 2.9vh, 1.75rem);
  line-height: 1.15;
  color: var(--fg);
  text-shadow: 0 0 0.3em var(--glow);

  animation: cycle var(--cycle) steps(var(--lines), end) var(--intro) infinite both;
}

.bouquet .s {
  color: var(--stem);
}
.bouquet .k {
  opacity: 0.85;
}
.bouquet .b {
  color: var(--bow);
  font-weight: 700;
}

.bouquet .y,
.bouquet .p,
.bouquet .r,
.bouquet .v,
.bouquet .w {
  font-weight: 700;
  animation: bloom 3s ease-in-out calc(var(--intro) + var(--grow)) infinite alternate;
}
.bouquet .y {
  color: var(--flower-yellow);
}
.bouquet .p {
  color: var(--flower-pink);
  animation-duration: 3.6s;
}
.bouquet .r {
  color: var(--flower-red);
  animation-duration: 4.2s;
}
.bouquet .v {
  color: var(--flower-violet);
  animation-duration: 3.3s;
}
.bouquet .w {
  color: var(--flower-white);
  animation-duration: 3.9s;
}

.petals span {
  position: absolute;
  top: -2rem;
  font-family: var(--font);
  font-size: 1.5rem;
  color: var(--flower-pink);
  text-shadow: 0 0 0.4em currentColor;
  opacity: 0;
  animation: fall 9s linear var(--intro) infinite;
}
.petals span:nth-child(1) {
  left: 8%;
  animation-delay: calc(var(--intro) + 0s);
}
.petals span:nth-child(2) {
  left: 22%;
  color: var(--flower-yellow);
  animation-duration: 11s;
  animation-delay: calc(var(--intro) + 3s);
}
.petals span:nth-child(3) {
  left: 35%;
  color: var(--flower-violet);
  animation-duration: 8s;
  animation-delay: calc(var(--intro) + 6s);
}
.petals span:nth-child(4) {
  left: 50%;
  animation-duration: 12s;
  animation-delay: calc(var(--intro) + 1.5s);
}
.petals span:nth-child(5) {
  left: 64%;
  color: var(--flower-red);
  animation-duration: 10s;
  animation-delay: calc(var(--intro) + 4.5s);
}
.petals span:nth-child(6) {
  left: 76%;
  color: var(--flower-yellow);
  animation-delay: calc(var(--intro) + 7s);
}
.petals span:nth-child(7) {
  left: 88%;
  color: var(--flower-violet);
  animation-duration: 11s;
  animation-delay: calc(var(--intro) + 2s);
}
.petals span:nth-child(8) {
  left: 94%;
  animation-duration: 8.5s;
  animation-delay: calc(var(--intro) + 5s);
}

.home-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 1;
  padding: 0.5rem;
  font-family: var(--font);
  font-size: var(--subtitle-size);
  letter-spacing: 0.05em;
  text-shadow: 0 0 0.3em var(--glow);
  animation: glow-in 2s ease-out calc(var(--intro) + var(--grow)) both;
}

@keyframes phosphor {
  0% {
    --scr-a: #1a2433;
    --scr-b: #0d1117;
  }
  18% {
    --scr-a: #0b3a3a;
    --scr-b: #061d1f;
  }
  45% {
    --scr-a: #01564f;
    --scr-b: #022b28;
  }
  78% {
    --scr-a: #02a896;
    --scr-b: #01584f;
  }
  100% {
    --scr-a: #01796f;
    --scr-b: #013f3a;
  }
}

@keyframes cycle {
  0% {
    clip-path: inset(100% -2ch -1em -2ch);
  }
  15.3% {
    clip-path: inset(0 -2ch -1em -2ch);
  }
  15.4%,
  85.8% {
    clip-path: inset(-1em -2ch -1em -2ch);
  }
  85.9% {
    clip-path: inset(0 -2ch -1em -2ch);
  }
  94.1%,
  100% {
    clip-path: inset(100% -2ch -1em -2ch);
  }
}

@keyframes glow-in {
  from {
    visibility: hidden;
    opacity: 0;
    text-shadow: none;
  }
  60% {
    opacity: 1;
    text-shadow:
      0 0 0.3em var(--fg),
      0 0 0.9em var(--glow);
  }
  to {
    visibility: visible;
    opacity: 1;
    text-shadow: 0 0 0.3em var(--glow);
  }
}

@keyframes bloom {
  from {
    text-shadow: 0 0 0.15em currentColor;
  }
  to {
    text-shadow:
      0 0 0.35em currentColor,
      0 0 0.9em currentColor;
  }
}

@keyframes fall {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg);
  }
  10%,
  80% {
    opacity: 0.8;
  }
  50% {
    transform: translate(2rem, 50vh) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: translate(-1rem, 105vh) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bouquet,
  .bouquet .y,
  .bouquet .p,
  .bouquet .r,
  .bouquet .v,
  .bouquet .w,
XX
  .petals {
    display: none;
  }
}
