.christmas-lights {
  display: flex;
  height: 60px;
  overflow: hidden;
  --cord: var(--colour-muted);
}

.christmas-lights__socket {
  position: relative;
  flex: 1 0 48px;
  height: 100%;
  background: linear-gradient(var(--cord), color-mix(in srgb, var(--cord) 50%, var(--colour-text))) center 4px / 10px 9px no-repeat;
  --bulb-colour: var(--colour-accent);
  --glass: var(--bulb-colour);
  --lit: color-mix(in srgb, var(--glass) 35%, white);
}

/* Keep the palette's hue and give the lit glass a saturated filament colour. */
@supports (color: hsl(from red h 95% 62%)) {
  .christmas-lights__socket {
    --glass: hsl(from var(--bulb-colour) h 95% 62%);
  }
}

.christmas-lights__socket:nth-child(4n + 2) { --bulb-colour: var(--colour-highlight); }
.christmas-lights__socket:nth-child(4n + 3) { --bulb-colour: var(--colour-status-active); }
.christmas-lights__socket:nth-child(4n) { --bulb-colour: var(--colour-status-quiet); }

/* The cord dips between the caps. */
.christmas-lights__socket::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 100%;
  height: 18px;
  border-bottom: 2px solid var(--cord);
  border-radius: 50%;
}

.christmas-lights__socket::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  translate: -50% 0;
  width: 13px;
  height: 26px;
  border-radius: 45% 45% 55% 55%;
  background: radial-gradient(ellipse at 40% 35%, var(--lit) 5%, var(--glass) 55%);
  box-shadow: 0 0 6px 1px var(--glass),
              0 4px 22px 4px color-mix(in srgb, var(--glass) 75%, transparent);
}

@media (prefers-reduced-motion: no-preference) {
  .christmas-lights__socket::after {
    animation: christmas-lights-glow 2s ease-in-out infinite;
    animation-delay: calc((var(--phase) - 8) * 0.25s);
  }
}

@keyframes christmas-lights-glow {
  0%, 25%, 100% { opacity: 1; }
  55%, 80% { opacity: 0.3; }
}
