.lifecycle {
  background: #eef1e9;
  border-bottom: 1px solid var(--line);
}

.lifecycle h2 {
  margin-bottom: 0;
}

.lifecycle .section-head > p {
  margin-bottom: 0;
  max-width: 39ch;
}

.lifecycle-demo {
  padding: clamp(14px, 2.2vw, 28px);
  border: 1px solid #ccd9d0;
  border-radius: 16px;
  background: var(--paper);
}

.lifecycle-stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 16px;
}

.lifecycle-stages button {
  padding: 11px 8px;
  background: #e5ece1;
  font-size: 13px;
  line-height: 1.3;
}

.lifecycle-stages button[aria-pressed="true"] {
  background: var(--teal);
  color: white;
  box-shadow: inset 0 -3px var(--lime);
}

.lifecycle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(17px, 3.5vw, 42px);
  align-items: start;
}

.lifecycle-figure {
  margin: 0;
}

.lifecycle-scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 8 / 5;
  border-radius: 10px;
  background: radial-gradient(ellipse at 51% 61%, #315653, #142d35 72%);
}

.lifecycle-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(#afc9bf17 1px, transparent 1px), linear-gradient(90deg, #afc9bf17 1px, transparent 1px);
  background-size: 7% 11%;
  mask-image: radial-gradient(ellipse, black, transparent 78%);
}

.lifecycle-carton,
.lifecycle-body,
.lifecycle-cartridge,
.lifecycle-cap {
  position: absolute;
  transform: translate(-50%, -50%);
  transition: left .85s cubic-bezier(.22,.76,.27,1), top .85s cubic-bezier(.22,.76,.27,1), opacity .45s ease;
}

.lifecycle-carton {
  top: 73%;
  left: 53%;
  width: 60%;
  height: 24%;
  border: 1px solid #bdcfc6;
  border-radius: 4px;
  background: linear-gradient(175deg, #9fb8b2, #e9efe9 18%, #cbd9d0);
  box-shadow: 0 13px 23px #061c27aa;
}

.lifecycle-lid {
  position: absolute;
  inset: -1px;
  z-index: 4;
  border: 1px solid #dde8df;
  border-radius: 4px;
  background: linear-gradient(90deg, #f7f8ee 0 83%, #50918d 83% 100%);
  transform-origin: top;
  transform: rotateX(0deg);
  transition: transform .6s ease;
}

.lifecycle-lid::after {
  content: "";
  position: absolute;
  top: 35%;
  left: 12%;
  width: 12%;
  height: 20%;
  border-radius: 2px;
  background: #548b84;
}

.lifecycle-panel {
  position: absolute;
  top: 100%;
  left: 1%;
  width: 98%;
  height: 14%;
  background: #84a39d;
  transform-origin: top;
  transform: skewX(-23deg);
}

.lifecycle-body {
  z-index: 1;
  left: 38%;
  top: 34%;
  width: 43%;
  height: 13%;
  border: 1px solid #7899a3;
  border-radius: 35px 7px 7px 35px;
  background: linear-gradient(180deg, #567581, #203f51 31%, #172f42 73%, #3d5b65);
  box-shadow: 0 12px 18px #091e2d88, inset 0 0 9px #152b3d;
}

.lifecycle-body::before {
  content: "";
  position: absolute;
  inset: 12% auto 12% 10%;
  width: 4%;
  border-radius: 5px;
  background: #6d918e;
}

.lifecycle-body i {
  position: absolute;
  top: 28%;
  right: 8%;
  width: 46%;
  height: 44%;
  border: 1px solid #799398;
  border-radius: 10px;
  background: #102735;
}

.lifecycle-cartridge {
  z-index: 2;
  left: 78%;
  top: 34%;
  width: 23%;
  height: 6%;
  border: 1px solid #cce6df;
  border-radius: 14% / 30%;
  background: linear-gradient(180deg, #effef5db, #78c5bda8 24%, #5cb3a8dc 67%, #ddf3e2cf);
  box-shadow: 0 4px 12px #132e38c0;
  transition-property: left, top, opacity, scale;
}

.lifecycle-cartridge::before,
.lifecycle-cartridge::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 13%;
  border-radius: 3px;
  background: #b3cfca;
}

.lifecycle-cartridge::after {
  left: auto;
  right: 0;
  background: #abc4c5;
}

.lifecycle-cartridge i {
  position: absolute;
  inset: 22% 18% 39%;
  border-radius: 8px;
  background: #ddf9e5a8;
}

.lifecycle-cap {
  z-index: 3;
  left: 21%;
  top: 52%;
  width: 17%;
  height: 13%;
  border: 1px solid #668992;
  border-radius: 7px 26px 26px 7px;
  background: linear-gradient(90deg, #59a4a2 0 14%, #ffffff00 14%),
    linear-gradient(180deg, #547783, #224052 31%, #172f42 73%, #415d67);
  box-shadow: 0 9px 16px #091e2d88;
}

.lifecycle-part {
  position: absolute;
  z-index: 5;
  color: #e6f1e9;
  padding: 2px 7px;
  border-radius: 4px;
  background: #17313a;
  font-size: clamp(10px, 1.15vw, 12px);
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: top .85s ease, left .85s ease, opacity .35s ease;
}

.lifecycle-part-device { top: 18%; left: 36%; }
.lifecycle-part-drug { top: 18%; left: 78%; }
.lifecycle-part-pack { top: 91%; left: 53%; }

.lifecycle-photo {
  position: absolute;
  z-index: 6;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .65s ease;
}

.lifecycle-demo[data-stage="1"] .lifecycle-body { left: 38%; top: 49%; }
.lifecycle-demo[data-stage="1"] .lifecycle-cap { left: 62%; top: 49%; }
.lifecycle-demo[data-stage="1"] .lifecycle-cartridge { left: 86%; top: 25%; opacity: .42; }
.lifecycle-demo[data-stage="1"] .lifecycle-carton { top: 87%; opacity: .28; }
.lifecycle-demo[data-stage="1"] .lifecycle-part-device { top: 29%; left: 45%; }
.lifecycle-demo[data-stage="1"] .lifecycle-part-drug,
.lifecycle-demo[data-stage="1"] .lifecycle-part-pack { opacity: 0; }

:is(.lifecycle-demo[data-stage="2"], .lifecycle-demo[data-stage="3"]) .lifecycle-body { left: 42%; top: 49%; }
:is(.lifecycle-demo[data-stage="2"], .lifecycle-demo[data-stage="3"]) .lifecycle-cartridge { left: 49%; top: 49%; scale: .74; }
:is(.lifecycle-demo[data-stage="2"], .lifecycle-demo[data-stage="3"]) .lifecycle-cap { left: 65%; top: 49%; }
.lifecycle-demo[data-stage="2"] .lifecycle-carton { top: 87%; opacity: .28; }
.lifecycle-demo[data-stage="2"] .lifecycle-part-device,
.lifecycle-demo[data-stage="2"] .lifecycle-part-pack { opacity: 0; }
.lifecycle-demo[data-stage="2"] .lifecycle-part-drug { top: 27%; left: 50%; }

.lifecycle-demo[data-stage="3"] .lifecycle-carton,
.lifecycle-demo[data-stage="4"] .lifecycle-carton { top: 58%; left: 51%; width: 69%; z-index: 4; }
.lifecycle-demo[data-stage="3"] .lifecycle-lid { animation: close-injector-carton 1.65s both; }
.lifecycle-demo[data-stage="3"] :is(.lifecycle-body, .lifecycle-cartridge, .lifecycle-cap) {
  z-index: 5;
  top: 58%;
  animation: seat-injector-in-carton 1.65s both;
}
.lifecycle-demo[data-stage="3"] .lifecycle-part-pack { top: 83%; left: 51%; }
.lifecycle-demo[data-stage="3"] :is(.lifecycle-part-device, .lifecycle-part-drug),
.lifecycle-demo[data-stage="4"] .lifecycle-part { opacity: 0; }
.lifecycle-demo[data-stage="4"] .lifecycle-photo { opacity: 1; }

@keyframes close-injector-carton {
  0%, 53% { transform: rotateX(79deg); }
  100% { transform: rotateX(0deg); }
}

@keyframes seat-injector-in-carton {
  0%, 52% { opacity: 1; }
  90%, 100% { opacity: 0; }
}

.lifecycle-figure figcaption,
.lifecycle-note {
  margin: 8px 0 0;
  color: #4f6665;
  font-size: 13px;
}

.lifecycle-context {
  margin: 0 0 9px;
  color: #486551;
  font-size: 13px;
  font-weight: 760;
}

.lifecycle-copy h3 {
  margin: 0 0 15px;
  font-size: clamp(21px, 2.25vw, 31px);
}

.lifecycle-copy dl { margin: 0; }
.lifecycle-copy dl div { padding: 9px 0; border-top: 1px solid var(--line); }
.lifecycle-copy dt { font-weight: 750; }
.lifecycle-copy dd { margin: 2px 0 0; font-size: 14px; line-height: 1.55; }

.lifecycle-controls,
.lifecycle-step-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lifecycle-controls { margin-top: 17px; }
.lifecycle-controls button { padding: 9px 12px; font-size: 13px; }
.lifecycle-step-controls button { background: #e5ece1; }
.lifecycle-step-controls button:disabled { opacity: .46; cursor: default; transform: none; }
#lifecycle-count { min-width: 54px; text-align: center; font-size: 13px; }

@media (max-width: 810px) {
  .lifecycle-layout { grid-template-columns: 1fr; }
}

@media (max-width: 550px) {
  .lifecycle-stages { display: flex; flex-wrap: wrap; }
  .lifecycle-stages button { flex: 1 0 28%; }
  .lifecycle-controls { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .lifecycle-demo[data-stage="3"] .lifecycle-lid { animation: none; }
  .lifecycle-demo[data-stage="3"] :is(.lifecycle-body, .lifecycle-cartridge, .lifecycle-cap) {
    animation: none;
    opacity: 0;
  }
}

.lifecycle-demo[data-stage="4"] .lifecycle-carton { top: 48%; z-index: auto; }
.lifecycle-demo[data-stage="4"] .lifecycle-body { top: 73%; left: 42%; }
.lifecycle-demo[data-stage="4"] .lifecycle-cartridge { top: 73%; left: 49%; scale: .74; }
.lifecycle-demo[data-stage="4"] .lifecycle-cap { top: 73%; left: 65%; }

@media (min-width: 951px) and (max-width: 1100px) {
  header nav { gap: 14px; }
}
