.hero-motion {
  position: absolute;
  top: 10%;
  right: max(20px, calc((100vw - 1220px) / 2));
  z-index: 0;
  width: min(620px, 48vw);
  height: min(560px, 68vh);
  overflow: hidden;
  pointer-events: none;
  opacity: 0.95;
}

.hero-motion::before,
.hero-motion::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
}

.hero-motion::before {
  background:
    linear-gradient(90deg, rgba(15, 143, 104, 0.13) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15, 143, 104, 0.09) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, transparent 0%, #000 18%, #000 92%, transparent 100%);
  animation: motionGrid 11s linear infinite;
}

.hero-motion::after {
  display: none;
}

.motion-panel,
.motion-link,
.motion-scan {
  position: absolute;
  display: block;
}

.motion-panel {
  overflow: hidden;
  border: 1px solid rgba(15, 143, 104, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.62)),
    rgba(255, 255, 255, 0.54);
  box-shadow: 0 18px 44px rgba(17, 20, 18, 0.09);
  padding: 11px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.motion-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.motion-card-head strong {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1;
}

.motion-card-head span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.74);
}

.motion-panel ul {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.motion-panel li {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(17, 20, 18, 0.08);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 800;
}

.motion-panel li:first-child {
  border-top: 0;
}

.motion-panel-plan {
  top: 4%;
  right: 3%;
  width: 148px;
  animation: panelFloatA 7.5s ease-in-out infinite;
}

.motion-panel-build {
  top: 26%;
  right: 36%;
  width: 154px;
  animation: panelFloatB 8.8s ease-in-out infinite;
}

.motion-panel-preview {
  top: 42%;
  right: 6%;
  width: 176px;
  animation: panelFloatC 9.2s ease-in-out infinite;
}

.motion-panel-check {
  bottom: 5%;
  right: 31%;
  width: 150px;
  animation: panelFloatA 8.4s ease-in-out 0.3s infinite;
}

.motion-mini-icon,
.motion-check-dot {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(229, 244, 238, 0.9);
  color: var(--accent-strong);
}

.motion-mini-icon::before,
.motion-mini-icon::after,
.motion-check-dot::before {
  content: "";
  position: absolute;
  border-color: currentColor;
}

.motion-mini-doc::before {
  left: 5px;
  top: 4px;
  width: 6px;
  height: 8px;
  border: 2px solid currentColor;
}

.motion-mini-scope::before {
  left: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.motion-mini-scope::after {
  left: 7px;
  top: 7px;
  width: 2px;
  height: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.motion-mini-grid::before {
  left: 4px;
  top: 4px;
  width: 3px;
  height: 3px;
  box-shadow:
    6px 0 0 currentColor,
    0 6px 0 currentColor,
    6px 6px 0 currentColor;
  background: currentColor;
}

.motion-code-card {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 6px 8px;
  min-height: 88px;
}

.motion-code-card span:not(.motion-code-icon) {
  height: 4px;
  align-self: center;
  border-radius: 999px;
  background: rgba(17, 20, 18, 0.18);
}

.motion-code-card span:nth-child(3),
.motion-code-card span:nth-child(5) {
  width: 62%;
  background: rgba(15, 143, 104, 0.54);
}

.motion-code-icon {
  grid-row: 1 / span 5;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.56rem;
  font-weight: 900;
}

.motion-preview-grid {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: 24px 52px;
  gap: 6px;
}

.motion-preview-grid span {
  border-radius: 4px;
  background: rgba(15, 143, 104, 0.12);
}

.motion-preview-grid span:nth-child(1) {
  grid-row: 1 / span 2;
}

.motion-preview-grid span:nth-child(2) {
  height: 16px;
}

.motion-preview-grid span:nth-child(3) {
  position: relative;
  overflow: hidden;
}

.motion-preview-grid span:nth-child(3)::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 25px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: skewY(-24deg);
  opacity: 0.78;
}

.motion-check-dot {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
  border-radius: 50%;
  background: var(--accent);
}

.motion-check-dot::before {
  left: 4px;
  top: 2px;
  width: 4px;
  height: 7px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
}

.motion-link {
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(15, 143, 104, 0.78), transparent);
  transform-origin: center;
  opacity: 0.84;
}

.motion-link::after {
  content: "";
  position: absolute;
  top: -3px;
  right: 18%;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(15, 143, 104, 0.38);
}

.motion-link-a {
  top: 31%;
  right: 18%;
  width: 55%;
  transform: rotate(13deg);
  animation: linkPulse 3.8s ease-in-out infinite;
}

.motion-link-b {
  top: 65%;
  right: 24%;
  width: 48%;
  transform: rotate(-18deg);
  animation: linkPulse 4.6s ease-in-out 0.5s infinite;
}

.motion-scan {
  top: 0;
  bottom: 0;
  left: 16%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(15, 143, 104, 0.7), transparent);
  animation: verticalScan 4.4s ease-in-out infinite;
}

.example-feature-preview,
.gallery-preview {
  position: relative;
  overflow: hidden;
}

.example-feature-preview::after,
.gallery-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gallery-preview::after {
  background: linear-gradient(var(--sheen-angle, 115deg), transparent 0 48%, rgba(255, 255, 255, 0.24) 50%, transparent 52% 100%);
  transform: translate3d(var(--sheen-start-x, -120%), var(--sheen-start-y, 0), 0);
  animation: previewSheen var(--sheen-duration, 18s) ease-in-out var(--sheen-delay, 0s) infinite;
}

.example-feature-preview::after {
  z-index: 2;
  background: linear-gradient(var(--sheen-angle, 115deg), transparent 0 48%, rgba(255, 255, 255, 0.28) 50%, transparent 52% 100%);
  transform: translate3d(var(--sheen-start-x, -120%), var(--sheen-start-y, 0), 0);
  animation: previewSheen var(--sheen-duration, 17s) ease-in-out var(--sheen-delay, 0s) infinite;
}

.example-carousel.is-next .example-feature-card {
  animation: exampleCardNext 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.example-carousel.is-prev .example-feature-card {
  animation: exampleCardPrev 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.gallery-card {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.gallery-card:hover {
  border-color: rgba(15, 143, 104, 0.34);
  box-shadow: 0 18px 45px rgba(17, 20, 18, 0.09);
  transform: translateY(-3px);
}

.gallery-card:hover .gallery-preview iframe {
  transform: scale(0.255);
}

@keyframes motionGrid {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 54px 0, 0 54px;
  }
}

@keyframes motionSweep {
  0%,
  100% {
    opacity: 0.34;
    transform: translateX(-1.4%) skewX(-3deg);
  }
  50% {
    opacity: 0.7;
    transform: translateX(2%) skewX(-3deg);
  }
}

@keyframes panelFloatA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-1deg);
  }
  50% {
    transform: translate3d(-12px, 14px, 0) rotate(1.2deg);
  }
}

@keyframes panelFloatB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(1deg);
  }
  50% {
    transform: translate3d(10px, -12px, 0) rotate(-1deg);
  }
}

@keyframes panelFloatC {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-0.5deg);
  }
  50% {
    transform: translate3d(-8px, -10px, 0) rotate(1deg);
  }
}

@keyframes linkPulse {
  0%,
  100% {
    opacity: 0.35;
    filter: saturate(0.8);
  }
  50% {
    opacity: 0.95;
    filter: saturate(1.25);
  }
}

@keyframes verticalScan {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0;
  }
  18%,
  72% {
    opacity: 0.82;
  }
  50% {
    transform: translateX(330px);
  }
}

@keyframes previewSheen {
  0%,
  64% {
    transform: translate3d(var(--sheen-start-x, -120%), var(--sheen-start-y, 0), 0);
  }
  80%,
  100% {
    transform: translate3d(var(--sheen-end-x, 120%), var(--sheen-end-y, 0), 0);
  }
}

@keyframes exampleCardNext {
  from {
    opacity: 0;
    transform: translate3d(80px, 16px, 0) rotate(calc(var(--feature-tilt) + 4deg)) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(var(--feature-tilt)) scale(1);
  }
}

@keyframes exampleCardPrev {
  from {
    opacity: 0;
    transform: translate3d(-80px, 16px, 0) rotate(calc(var(--feature-tilt) - 4deg)) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(var(--feature-tilt)) scale(1);
  }
}

:root[data-theme="dark"] .motion-panel {
  border-color: rgba(116, 228, 182, 0.2);
  background:
    linear-gradient(180deg, rgba(21, 25, 24, 0.82), rgba(21, 25, 24, 0.42)),
    repeating-linear-gradient(180deg, transparent 0 15px, rgba(247, 248, 242, 0.1) 16px, transparent 18px);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .motion-panel::before {
  background: rgba(247, 248, 242, 0.16);
}

:root[data-theme="dark"] .motion-panel::after {
  background: rgba(116, 228, 182, 0.28);
}

:root[data-theme="crazy"] .hero-motion::before {
  background:
    linear-gradient(90deg, rgba(13, 255, 242, 0.32) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 0, 214, 0.22) 1px, transparent 1px);
  filter: drop-shadow(0 0 8px rgba(13, 255, 242, 0.28));
}

:root[data-theme="crazy"] .motion-panel {
  border-color: rgba(13, 255, 242, 0.42);
  background:
    linear-gradient(145deg, rgba(255, 0, 214, 0.26), transparent 54%),
    linear-gradient(315deg, rgba(13, 255, 242, 0.22), transparent 58%),
    rgba(18, 0, 32, 0.78);
  box-shadow: 0 0 20px rgba(255, 0, 214, 0.34), 0 0 42px rgba(13, 255, 242, 0.2);
}

:root[data-theme="crazy"] .motion-card-head span,
:root[data-theme="crazy"] .motion-code-icon {
  background: linear-gradient(135deg, #ff00d6, #f7ff00 52%, #0dfff2);
  color: #08000f;
  box-shadow: 0 0 12px rgba(247, 255, 0, 0.58);
}

:root[data-theme="crazy"] .motion-mini-icon,
:root[data-theme="crazy"] .motion-check-dot {
  background: rgba(247, 255, 0, 0.13);
  color: #f7ff00;
  box-shadow: inset 0 0 10px rgba(247, 255, 0, 0.18);
}

:root[data-theme="crazy"] .motion-code-card span:not(.motion-code-icon) {
  background: rgba(255, 249, 255, 0.26);
}

:root[data-theme="crazy"] .motion-code-card span:nth-child(3),
:root[data-theme="crazy"] .motion-code-card span:nth-child(5) {
  background: rgba(13, 255, 242, 0.74);
  box-shadow: 0 0 10px rgba(13, 255, 242, 0.42);
}

@media (max-width: 940px) {
  .hero-motion {
    top: 16%;
    right: -18%;
    width: 76vw;
    height: 48vh;
    opacity: 0.46;
  }

  .motion-panel-a {
    right: 18%;
  }

  .motion-panel-b {
    right: 8%;
  }

  .motion-panel-c {
    right: 28%;
  }
}

@media (max-width: 640px) {
  .hero-motion {
    top: 6%;
    right: 0;
    left: 0;
    width: 100%;
    height: 44vh;
    opacity: 0.28;
  }

  .motion-panel-a {
    right: 5%;
    width: 40%;
  }

  .motion-panel-b {
    right: 16%;
    width: 48%;
  }

  .motion-panel-c {
    right: 8%;
    width: 38%;
  }

  .motion-link,
  .motion-scan {
    display: none;
  }

  .gallery-card:hover {
    transform: none;
  }

  .example-feature-card {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-motion::before,
  .hero-motion::after,
  .motion-panel,
  .motion-link,
  .motion-scan,
  .example-feature-preview::after,
  .gallery-preview::after {
    animation: none !important;
  }

  .example-carousel.is-next .example-feature-card,
  .example-carousel.is-prev .example-feature-card {
    animation: none !important;
  }

  .gallery-card,
  .gallery-card:hover .gallery-preview iframe {
    transition: none !important;
  }
}
