/* Christmas fairy lights. Decorative only: fixed to the viewport edges,
   no layout shift, and it never captures clicks. */

.fairy-lights {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.fairy-lights-edge {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  pointer-events: none;
}

.fairy-lights-edge::before {
  content: "";
  position: absolute;
  background: #8A6238;
  opacity: 0.85;
  pointer-events: none;
}

.fairy-lights-top,
.fairy-lights-bottom {
  left: 0;
  right: 0;
  height: 14px;
  flex-direction: row;
}

.fairy-lights-top { top: 0; }
.fairy-lights-bottom { bottom: 0; }

.fairy-lights-top::before,
.fairy-lights-bottom::before {
  left: 8px;
  right: 8px;
  height: 1.5px;
  top: 50%;
  transform: translateY(-50%);
}

.fairy-lights-left,
.fairy-lights-right {
  top: 14px;
  bottom: 14px;
  width: 14px;
  flex-direction: column;
}

.fairy-lights-left { left: 0; }
.fairy-lights-right { right: 0; }

.fairy-lights-left::before,
.fairy-lights-right::before {
  top: 0;
  bottom: 0;
  width: 1.5px;
  left: 50%;
  transform: translateX(-50%);
}

.fairy-lights-bulb {
  --bulb: #FFF4D2;
  position: relative;
  flex: 0 0 auto;
  width: 7px;
  height: 9px;
  border-radius: 50% 50% 45% 45%;
  background:
    radial-gradient(circle at 32% 28%, #fff 0 18%, var(--bulb) 42%, color-mix(in srgb, var(--bulb) 65%, #3a1a10) 100%);
  box-shadow: 0 0 5px var(--bulb);
  z-index: 1;
  animation: fairy-twinkle 2.8s ease-in-out infinite;
}

.fairy-lights-bulb::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 3.5px;
  height: 2.5px;
  margin-left: -1.75px;
  border-radius: 1px;
  background: #6B4E28;
}

.fairy-lights-bulb-0 { --bulb: #FFF4D2; }
.fairy-lights-bulb-1 { --bulb: #E8B84A; }
.fairy-lights-bulb-2 { --bulb: #D94B4B; }
.fairy-lights-bulb-3 { --bulb: #3E9A62; }
.fairy-lights-bulb-4 { --bulb: #C17DE8; }

.fairy-lights-bulb:nth-child(5n+1) { animation-delay: 0s; }
.fairy-lights-bulb:nth-child(5n+2) { animation-delay: 0.45s; }
.fairy-lights-bulb:nth-child(5n+3) { animation-delay: 0.9s; }
.fairy-lights-bulb:nth-child(5n+4) { animation-delay: 1.4s; }
.fairy-lights-bulb:nth-child(5n+5) { animation-delay: 1.95s; }

@keyframes fairy-twinkle {
  0%, 100% { opacity: 1; filter: brightness(1); }
  40% { opacity: 0.55; filter: brightness(0.75); }
  60% { opacity: 1; filter: brightness(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .fairy-lights-bulb {
    animation: none;
    opacity: 0.92;
    filter: none;
  }
}

[data-theme="dark"] .fairy-lights-edge::before {
  background: #C9A36A;
}

[data-theme="dark"] .fairy-lights-bulb {
  box-shadow: 0 0 7px var(--bulb), 0 0 2px rgba(255, 255, 255, 0.35);
}

/* Phones: a narrow top string only, so side padding and the
   back-to-top / Quick exit controls stay clear. */
@media (max-width: 700px) {
  .fairy-lights-top {
    height: 11px;
  }

  .fairy-lights-bulb {
    width: 6px;
    height: 8px;
    box-shadow: 0 0 4px var(--bulb);
  }

  .fairy-lights-left,
  .fairy-lights-right,
  .fairy-lights-bottom {
    display: none;
  }
}