/* A finite growth transition, layered over the native three-radio viewer. */
.evolution-viewer[data-evolution-enhanced] {
  --evolution-accent: var(--teal, #8ad7c3);
  --evolution-step: 0;
  --evolution-ease: cubic-bezier(.18, .7, .22, 1);
  isolation: isolate;
  border-color: #e8c58766;
  background: linear-gradient(135deg, #2a455b, #152b40 40%, #0c1d30);
  box-shadow: 0 26px 52px -27px #000b, inset 0 1px 0 #f6dfbd26, 0 0 0 4px #0b1b2b80;
}
.evolution-viewer[data-evolution-stage="1"] { --evolution-step: 1; --evolution-accent: #e7d8ad; }
.evolution-viewer[data-evolution-stage="2"] { --evolution-step: 2; --evolution-accent: var(--gold, #f0c47d); }
.evolution-viewer[data-evolution-enhanced] > label {
  position: relative;
  background: linear-gradient(#152c42, #102236);
  box-shadow: inset 0 1px 0 #ffffff08;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.evolution-viewer[data-evolution-enhanced] > .evolution-choice:checked + label {
  background: linear-gradient(140deg, #ffe2a7, var(--gold, #f0c47d));
  box-shadow: inset 0 1px 0 #fff1c9a3, 0 3px 10px #050c173d;
  border-color: #ffe1a3;
}
.evolution-viewer[data-evolution-enhanced] > .evolution-choice:not(:checked) + label:hover {
  border-color: #c0d5e252;
  color: #e5edf4;
}
.evolution-viewer[data-evolution-enhanced] .evolution-display {
  touch-action: pan-y pinch-zoom;
  isolation: isolate;
  border-color: #b5d2e24d;
  box-shadow: inset 0 0 0 1px #ffffff10, 0 8px 20px -14px #000b;
}
.evolution-viewer[data-evolution-enhanced] .evolution-stage {
  transition: opacity 320ms ease, visibility 0s linear 320ms;
}
.evolution-viewer[data-evolution-enhanced] .evolution-stage img {
  transform-origin: 50% 60%;
  backface-visibility: hidden;
}

/* The three quiet lights are a position indicator, never a second control. */
.evolution-viewer[data-evolution-enhanced] .evolution-display::before {
  content: "";
  position: absolute;
  z-index: 4;
  top: 18px;
  right: 14px;
  width: 78px;
  height: 26px;
  border: 1px solid #b4d5ec38;
  border-radius: 999px;
  background:
    radial-gradient(circle at 14px 12px, #b5c9d06b 0 3px, transparent 3.5px),
    radial-gradient(circle at 39px 12px, #b5c9d06b 0 3px, transparent 3.5px),
    radial-gradient(circle at 64px 12px, #b5c9d06b 0 3px, transparent 3.5px),
    #081a2ce8;
  box-shadow: 0 4px 12px #05101d38;
  pointer-events: none;
}
.evolution-viewer[data-evolution-enhanced] .evolution-display::after {
  content: "";
  position: absolute;
  z-index: 5;
  top: 27px;
  right: 74px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--evolution-accent);
  box-shadow: 0 0 0 3px #f4dba51f, 0 0 10px #f4dba580;
  transform: translateX(calc(var(--evolution-step) * 25px));
  transition: transform 320ms var(--evolution-ease), background-color 260ms ease;
  pointer-events: none;
}

.evolution-viewer[data-evolution-motion]::after {
  content: "";
  position: absolute;
  z-index: 6;
  inset: -1px;
  border: 1px solid var(--evolution-accent);
  border-radius: inherit;
  box-shadow: inset 0 0 20px #e9dca914, 0 0 14px #e9dca91a;
  pointer-events: none;
  opacity: 0;
}
.evolution-viewer[data-evolution-motion="a"] { animation: home-evolution-frame-a 620ms linear; }
.evolution-viewer[data-evolution-motion="b"] { animation: home-evolution-frame-b 620ms linear; }
.evolution-viewer[data-evolution-motion]::after { animation: home-evolution-rim 620ms ease-out; }
.evolution-viewer[data-evolution-motion][data-evolution-stage="0"] .stage-0 img {
  animation: home-evolution-hatchling 560ms var(--evolution-ease) both;
}
.evolution-viewer[data-evolution-motion][data-evolution-stage="1"] .stage-1 img {
  animation: home-evolution-young 560ms var(--evolution-ease) both;
}
.evolution-viewer[data-evolution-motion][data-evolution-stage="2"] .stage-2 img {
  animation: home-evolution-adult 560ms var(--evolution-ease) both;
}
.evolution-viewer[data-evolution-motion][data-evolution-stage="0"] .stage-0 .evolution-stage-caption,
.evolution-viewer[data-evolution-motion][data-evolution-stage="1"] .stage-1 .evolution-stage-caption,
.evolution-viewer[data-evolution-motion][data-evolution-stage="2"] .stage-2 .evolution-stage-caption {
  animation: home-evolution-caption 360ms 120ms var(--evolution-ease) both;
}
/* Alternate names restart the finite border response without a forced layout. */
@keyframes home-evolution-frame-a {
  from, to { border-color: #e8c58766; }
  22% { border-color: var(--evolution-accent); }
}
@keyframes home-evolution-frame-b {
  from, to { border-color: #e8c58766; }
  22% { border-color: var(--evolution-accent); }
}
@keyframes home-evolution-rim { 0% { opacity: 0; } 22% { opacity: .78; } 100% { opacity: 0; } }
@keyframes home-evolution-hatchling {
  from { opacity: .76; transform: translateY(12px) scale(.975); }
  75% { opacity: 1; transform: translateY(-1px) scale(1.002); }
  to { opacity: 1; transform: none; }
}
@keyframes home-evolution-young {
  from { opacity: .72; transform: translateX(12px) scale(1.025); }
  to { opacity: 1; transform: none; }
}
@keyframes home-evolution-adult {
  from { opacity: .76; transform: scale(1.06); }
  to { opacity: 1; transform: none; }
}
@keyframes home-evolution-caption {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}
.evolution-viewer[data-evolution-visible="false"],
.evolution-viewer[data-evolution-visible="false"]::after,
.evolution-viewer[data-evolution-visible="false"] .evolution-stage img,
.evolution-viewer[data-evolution-visible="false"] .evolution-stage-caption {
  animation: none;
}
.home-page-hidden .evolution-viewer[data-evolution-enhanced],
.home-page-hidden .evolution-viewer[data-evolution-enhanced]::after,
.home-page-hidden .evolution-viewer[data-evolution-enhanced] .evolution-stage img,
.home-page-hidden .evolution-viewer[data-evolution-enhanced] .evolution-stage-caption {
  animation-play-state: paused;
}
@media (max-width: 800px) {
  .evolution-viewer[data-evolution-enhanced] { box-shadow: 0 18px 35px -24px #000b, inset 0 1px 0 #f6dfbd26, 0 0 0 3px #0b1b2b80; }
  .evolution-viewer[data-evolution-enhanced] .evolution-display::before { top: 12px; right: 10px; }
  .evolution-viewer[data-evolution-enhanced] .evolution-display::after { top: 21px; right: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .evolution-viewer[data-evolution-enhanced],
  .evolution-viewer[data-evolution-enhanced]::after,
  .evolution-viewer[data-evolution-enhanced] .evolution-stage img,
  .evolution-viewer[data-evolution-enhanced] .evolution-stage-caption { animation: none; }
  .evolution-viewer[data-evolution-enhanced] > label,
  .evolution-viewer[data-evolution-enhanced] .evolution-stage,
  .evolution-viewer[data-evolution-enhanced] .evolution-display::after { transition: none; }
}
