.idea-lab {
  margin-top: 55px;
}

.idea-lab.is-interactive {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.64fr);
  align-items: center;
  gap: clamp(35px, 7vw, 110px);
}

.idea-lab .work-postscript {
  margin-top: 0;
}

.idea-lamp {
  position: relative;
  max-width: 380px;
  width: 100%;
  justify-self: end;
  text-align: center;
  --bulb-tilt: 0deg;
  --bulb-scroll-tilt: 0deg;
  --bulb-rise: 0px;
  --bulb-glint: 0px;
  --bulb-power: 0;
}

.bulb-eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
}

.idea-switch {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 8px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.idea-switch:focus-visible {
  outline: 0;
}

.idea-switch:focus-visible .bulb-switch-caption {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.idea-switch[aria-disabled="true"] {
  cursor: wait;
}

.bulb-drawing {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.bulb-suspension {
  transform-box: view-box;
  transform-origin: 180px 0;
  transform: translate3d(0, var(--bulb-rise), 0)
    rotate(calc(var(--bulb-tilt) + var(--bulb-scroll-tilt)));
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.bulb-cord,
.bulb-cord-highlight {
  stroke: var(--ink);
  stroke-width: 3;
}

.bulb-cord-highlight {
  stroke: #fffdf3;
  stroke-width: 0.7;
  opacity: 0.6;
}

.bulb-socket > path:first-child {
  fill: var(--ink);
}

.bulb-socket-ridges {
  stroke: #f3f0e875;
  stroke-width: 1.2;
}

.bulb-socket-mark {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.bulb-glass {
  fill: url(#idea-glass-shade);
  stroke: #8b8475;
  stroke-width: 1.5;
}

.bulb-glass-part {
  opacity: 0;
  transform-box: view-box;
  transform-origin: 180px 190px;
  transition: transform 800ms var(--ease);
}

.bulb-warmth,
.bulb-aura,
.bulb-floor-light,
.bulb-rays {
  opacity: var(--bulb-power);
  transition: opacity 400ms ease;
}

.bulb-reflection {
  stroke: #fffdf3;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.8;
  translate: var(--bulb-glint) 0;
  transition: translate 240ms ease;
}

.bulb-reflection-small {
  stroke-width: 8;
  opacity: 0.45;
}

.bulb-stem {
  stroke: #8b8475;
  stroke-width: 1;
}

.bulb-filament,
.bulb-broken-filament,
.bulb-stitch {
  stroke: #76684e;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 300ms ease;
}

.bulb-broken-filament,
.bulb-crack,
.bulb-stitch,
.bulb-smoke,
.bulb-sparks,
.bulb-repair-tool {
  opacity: 0;
  pointer-events: none;
}

.bulb-crack {
  stroke: #625c50;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.bulb-rays {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.bulb-smoke {
  stroke: #6b696180;
  stroke-width: 2;
  stroke-linecap: round;
}

.bulb-sparks {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.bulb-repair-tool {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linejoin: round;
  transform: translate(285px, 250px) rotate(25deg);
}

.bulb-switch-caption {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.bulb-state-dot {
  width: 6px;
  height: 6px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  transition: background 200ms ease;
}

.bulb-switch-arrow {
  margin-left: 9px;
  color: var(--accent);
  transition: transform 240ms ease;
}

.idea-switch:hover .bulb-switch-arrow {
  transform: rotate(45deg);
}

.bulb-status {
  min-height: 3.3em;
  max-width: 300px;
  margin: 3px auto 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: balance;
}

.idea-lamp[data-state="on"] {
  --bulb-power: 1;
}

.idea-lamp[data-state="on"] .bulb-filament {
  stroke: #fffdf0;
  stroke-width: 2.4;
  filter: drop-shadow(0 0 3px #de9c21);
}

.idea-lamp[data-state="on"] .bulb-state-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.idea-lamp[data-state="broken"] .bulb-glass-left {
  transform: translate(-2px, 2px) rotate(1deg);
}

.idea-lamp[data-state="broken"] .bulb-glass-right {
  transform: translate(2px, 3px) rotate(-1deg);
}

.idea-lamp:is([data-state="broken"], [data-state="repairing"]) .bulb-filament,
.idea-lamp:is([data-state="broken"], [data-state="repairing"])
  .bulb-glass-whole {
  opacity: 0;
}

.idea-lamp:is([data-state="broken"], [data-state="repairing"])
  .bulb-broken-filament,
.idea-lamp:is([data-state="broken"], [data-state="repairing"]) .bulb-crack,
.idea-lamp:is([data-state="broken"], [data-state="repairing"])
  .bulb-glass-part {
  opacity: 1;
}

.idea-lamp[data-state="broken"] .bulb-smoke {
  animation: idea-smoke 1500ms ease-out both;
}

.idea-lamp[data-state="broken"] .bulb-sparks {
  animation: idea-spark 550ms ease-out both;
}

.idea-lamp[data-state="broken"] .bulb-suspension {
  animation: idea-startle 650ms ease-out;
}

.idea-lamp[data-state="broken"] .bulb-status {
  color: var(--ink);
}

.idea-lamp[data-state="repairing"] .bulb-repair-tool {
  animation: idea-repair 2000ms var(--ease) both;
}

.idea-lamp[data-state="repairing"] .bulb-stitch {
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 55;
  animation: idea-stitch 1200ms 350ms ease both;
}

.idea-lamp[data-state="repairing"] .bulb-crack {
  animation: idea-seal 1800ms ease both;
}

.idea-lamp.just-repaired .bulb-rays {
  animation: idea-ready 750ms ease-out both;
}

@keyframes idea-smoke {
  from {
    opacity: 0.7;
    translate: 0 6px;
  }
  to {
    opacity: 0;
    translate: 0 -26px;
  }
}

@keyframes idea-spark {
  from {
    opacity: 0.8;
  }
  to {
    opacity: 0;
  }
}

@keyframes idea-startle {
  0%,
  100% {
    rotate: 0deg;
  }
  25% {
    rotate: -4deg;
  }
  65% {
    rotate: 2deg;
  }
}

@keyframes idea-repair {
  0%,
  100% {
    opacity: 0;
    transform: translate(285px, 250px) rotate(25deg);
  }
  22%,
  38% {
    opacity: 1;
    transform: translate(207px, 202px) rotate(-20deg);
  }
  50% {
    opacity: 1;
    transform: translate(207px, 202px) rotate(8deg);
  }
  64%,
  76% {
    opacity: 1;
    transform: translate(207px, 202px) rotate(-20deg);
  }
}

@keyframes idea-stitch {
  from {
    opacity: 1;
    stroke-dashoffset: 55;
  }
  80% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  to {
    opacity: 0;
    stroke-dashoffset: 0;
  }
}

@keyframes idea-seal {
  0%,
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes idea-ready {
  from {
    stroke-width: 3;
  }
  to {
    stroke-width: 1.5;
  }
}

@media (max-width: 760px) {
  .idea-lab.is-interactive {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .idea-lamp {
    max-width: 320px;
    justify-self: center;
  }
  .idea-lab .work-postscript {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .idea-lamp *,
  .idea-lamp *::before,
  .idea-lamp *::after {
    animation: none !important;
    transition: none !important;
  }
  .bulb-suspension {
    transform: none;
  }
  .bulb-reflection {
    translate: none;
  }
  .idea-lamp[data-state="repairing"] .bulb-repair-tool {
    opacity: 1;
    transform: translate(235px, 205px) rotate(-20deg);
  }
}
