/* High-density technical scenes layered over the original APOTEC tone. */

.hero-optics {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: clamp(10px, 4vw, 76px);
  width: min(39vw, 590px);
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate3d(var(--optic-x, 0px), calc(-50% + var(--optic-y, 0px)), 0);
  opacity: 0.8;
  mix-blend-mode: screen;
  mask-image: radial-gradient(circle, #000 38%, rgba(0, 0, 0, 0.9) 60%, transparent 74%);
}

.optic-reticle {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: rgba(230, 238, 241, 0.28);
  stroke-width: 1;
}

.optic-ring {
  transform-origin: 260px 260px;
}

.optic-ring-a {
  stroke: rgba(184, 255, 61, 0.34);
  stroke-dasharray: 7 18 42 12;
  animation: optic-spin 26s linear infinite;
}

.optic-ring-b {
  stroke-dasharray: 2 10;
  animation: optic-spin 15s linear infinite reverse;
}

.optic-ring-c {
  stroke: rgba(184, 255, 61, 0.65);
  stroke-dasharray: 34 8 3 12;
  animation: optic-spin 9s linear infinite;
}

.optic-axis {
  stroke: rgba(245, 248, 249, 0.24);
  stroke-dasharray: 2 5;
}

.optic-bracket {
  stroke: var(--signal);
  stroke-width: 1.5;
  stroke-dasharray: 85 20;
  filter: drop-shadow(0 0 7px rgba(184, 255, 61, 0.45));
  animation: bracket-breathe 2.8s ease-in-out infinite;
}

.optic-core {
  fill: var(--signal);
  stroke: var(--signal);
  filter: drop-shadow(0 0 10px var(--signal));
}

.optic-readout {
  position: absolute;
  top: 18%;
  right: 2%;
  display: grid;
  gap: 7px;
  min-width: 158px;
  padding: 12px 13px;
  border-top: 1px solid rgba(184, 255, 61, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 7, 8, 0.54);
  color: #879196;
  font: 8px var(--font-geist-mono), monospace;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

.optic-readout span {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.optic-readout b {
  color: var(--signal);
  font-weight: 650;
}

.optic-coordinate {
  position: absolute;
  color: #8d979b;
  font: 8px var(--font-geist-mono), monospace;
  letter-spacing: 0.12em;
}

.coordinate-x {
  right: 7%;
  bottom: 26%;
}

.coordinate-y {
  top: 31%;
  left: 8%;
  transform: rotate(-90deg);
}

/* Scroll-controlled machine inspection scene */
.product-stage {
  min-height: 190vh;
  overflow: visible;
  border: 0;
  background: var(--ink);
}

.product-stage::before {
  display: none;
}

.product-stage-sticky {
  position: sticky;
  top: 0;
  isolation: isolate;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  border-block: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(5, 7, 8, 0.99) 0 35%, rgba(5, 7, 8, 0.36) 67%),
    radial-gradient(circle at 72% 48%, #273235 0, #0b1012 33%, #050708 68%);
}

.product-stage-sticky::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.18;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 90px 90px;
  mask-image: linear-gradient(90deg, transparent 8%, #000 48%, #000 100%);
}

.product-stage-sticky::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 62%;
  width: 1px;
  background: linear-gradient(transparent 8%, rgba(184, 255, 61, 0.65), transparent 92%);
  box-shadow: 0 0 18px rgba(184, 255, 61, 0.32);
  opacity: 0.45;
}

.product-stage-word,
.product-stage-copy,
.product-machine,
.product-stage-rail {
  position: absolute;
}

.product-machine {
  top: 51%;
  right: clamp(-70px, 1vw, 20px);
  width: min(58vw, 790px);
  height: 88%;
  transform: translateY(-50%);
  transition: none;
}

.product-machine img {
  animation: none;
  will-change: transform, opacity, filter;
}

.product-machine .machine-base,
.product-machine .machine-module {
  position: absolute;
  right: 0;
  bottom: 0;
  width: auto;
  height: 100%;
  max-width: none;
  filter: drop-shadow(0 38px 55px rgba(0, 0, 0, 0.74));
}

.product-machine .machine-base {
  z-index: 2;
  opacity: 0.9;
  transform-origin: right bottom;
}

.product-machine .machine-module {
  z-index: 3;
  opacity: 0.98;
  transform-origin: right bottom;
  filter:
    drop-shadow(0 0 1px rgba(245, 248, 249, 0.6))
    drop-shadow(0 18px 25px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 16px rgba(184, 255, 61, 0.08));
}

.module-feed {
  clip-path: inset(7% 9% 64% 4%);
}

.module-process {
  clip-path: inset(29% 12% 27% 7%);
}

.module-control {
  clip-path: inset(24% 0 27% 79%);
}

.module-output {
  clip-path: inset(68% 18% 8% 9%);
}

.machine-halo {
  animation: halo-scan 8s linear infinite;
}

.machine-scan-grid {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  height: 100%;
  aspect-ratio: 2 / 3;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(184, 255, 61, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 255, 61, 0.16) 1px, transparent 1px);
  background-size: 12.5% 8.333%;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 88%, transparent);
  pointer-events: none;
}

.machine-scan-line {
  position: absolute;
  z-index: 5;
  right: 0;
  top: 12%;
  width: 66%;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, var(--signal) 18%, var(--signal) 82%, transparent);
  box-shadow: 0 0 16px rgba(184, 255, 61, 0.75), 0 0 42px rgba(184, 255, 61, 0.18);
  will-change: top, opacity;
  pointer-events: none;
}

.machine-scan-line i {
  position: absolute;
  right: 9%;
  bottom: 0;
  width: 1px;
  height: 52px;
  background: linear-gradient(transparent, rgba(184, 255, 61, 0.68));
}

.machine-target {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  min-height: 28px;
  padding: 7px 9px 7px 31px;
  border: 1px solid rgba(184, 255, 61, 0.38);
  color: #dfe7e9;
  background: rgba(5, 7, 8, 0.78);
  box-shadow: inset 0 0 22px rgba(184, 255, 61, 0.04);
  opacity: 0;
  font: 8px/1 var(--font-geist-mono), monospace;
  letter-spacing: 0.1em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  will-change: opacity, transform;
}

.machine-target::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: clamp(18px, 3vw, 52px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184, 255, 61, 0.78));
}

.machine-target i {
  position: absolute;
  left: 9px;
  width: 11px;
  height: 11px;
  border: 1px solid var(--signal);
  box-shadow: 0 0 12px rgba(184, 255, 61, 0.38);
}

.machine-target b {
  margin-right: 7px;
  color: var(--signal);
  font-weight: 600;
}

.target-feed {
  top: 16%;
  right: 9%;
}

.target-dose {
  top: 39%;
  right: 22%;
}

.target-control {
  top: 56%;
  right: 0;
}

.target-output {
  right: 18%;
  bottom: 13%;
}

.assembly-monitor {
  position: absolute;
  z-index: 6;
  top: 14%;
  right: clamp(330px, 40vw, 590px);
  width: 174px;
  padding: 15px;
  border: 1px solid rgba(184, 255, 61, 0.32);
  background: rgba(5, 7, 8, 0.7);
  transform: none;
  backdrop-filter: blur(10px);
}

.assembly-monitor > span,
.assembly-monitor p {
  display: block;
  margin: 0;
  color: #818c91;
  font: 8px var(--font-geist-mono), monospace;
  letter-spacing: 0.13em;
}

.assembly-monitor strong {
  display: block;
  margin: 14px 0;
  color: var(--signal);
  font: 38px/1 var(--font-geist-mono), monospace;
  letter-spacing: -0.06em;
  text-shadow: 0 0 24px rgba(184, 255, 61, 0.25);
}

.assembly-monitor > div {
  height: 2px;
  margin-bottom: 13px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
}

.assembly-monitor i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--signal);
  box-shadow: 0 0 10px var(--signal);
}

.product-stage-rail b {
  color: var(--signal);
  font-weight: 500;
}

/* Live inspection overlay over the real packaging image */
.line-inspection {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(5, 7, 8, 0.36);
}

.line-inspection::before,
.line-inspection::after {
  content: "";
  position: absolute;
  background: rgba(184, 255, 61, 0.28);
}

.line-inspection::before {
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
}

.line-inspection::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.inspect-box {
  position: absolute;
  width: 17%;
  height: 25%;
  border: 1px solid rgba(184, 255, 61, 0.85);
  color: var(--signal);
  font: 8px var(--font-geist-mono), monospace;
  box-shadow: 0 0 18px rgba(184, 255, 61, 0.08);
  animation: inspect-lock 3.1s ease-in-out infinite;
}

.inspect-box::before,
.inspect-box::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
}

.inspect-box::before {
  top: -2px;
  left: -2px;
  border-top: 2px solid var(--signal);
  border-left: 2px solid var(--signal);
}

.inspect-box::after {
  right: -2px;
  bottom: -2px;
  border-right: 2px solid var(--signal);
  border-bottom: 2px solid var(--signal);
}

.inspect-box b,
.inspect-box i {
  position: absolute;
  padding: 4px 5px;
  background: rgba(5, 7, 8, 0.78);
  font-style: normal;
  font-weight: 500;
  white-space: nowrap;
}

.inspect-box b {
  top: -21px;
  left: -1px;
}

.inspect-box i {
  right: -1px;
  bottom: -20px;
}

.inspect-a {
  top: 25%;
  left: 18%;
}

.inspect-b {
  top: 35%;
  left: 46%;
  animation-delay: -0.9s;
}

.inspect-c {
  top: 17%;
  right: 10%;
  animation-delay: -1.7s;
}

.inspection-readout {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: grid;
  min-width: 155px;
  padding: 12px;
  border-top: 1px solid var(--signal);
  background: rgba(5, 7, 8, 0.72);
  backdrop-filter: blur(8px);
}

.inspection-readout span,
.inspection-readout small {
  color: #8f9a9f;
  font: 8px var(--font-geist-mono), monospace;
  letter-spacing: 0.12em;
}

.inspection-readout strong {
  margin: 7px 0 4px;
  color: var(--signal);
  font: 25px/1 var(--font-geist-mono), monospace;
}

/* Machine-vision demo uses a real process image beneath the HUD. */
.vision-frame {
  background: #080c0d;
}

.vision-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.78) contrast(1.24) brightness(0.42);
  transform: scale(1.08);
  animation: vision-feed-drift 9s ease-in-out infinite alternate;
}

.vision-frame::before,
.vision-frame::after {
  z-index: 2;
}

.vision-crosshair {
  position: absolute;
  z-index: 4;
  top: 47%;
  left: 53%;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(184, 255, 61, 0.6);
  transform: translate(-50%, -50%);
  animation: target-track 5.4s ease-in-out infinite;
}

.vision-crosshair::before,
.vision-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(184, 255, 61, 0.55);
}

.vision-crosshair::before {
  top: 50%;
  right: -18px;
  left: -18px;
  height: 1px;
}

.vision-crosshair::after {
  top: -18px;
  bottom: -18px;
  left: 50%;
  width: 1px;
}

.vision-crosshair i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 14px var(--signal);
}

.vision-data b {
  color: var(--signal);
  font-weight: 500;
}

@keyframes optic-spin {
  to { transform: rotate(360deg); }
}

@keyframes bracket-breathe {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 1; }
}

@keyframes halo-scan {
  to { transform: rotate(360deg); }
}

@keyframes inspect-lock {
  0%, 100% { opacity: 0.58; transform: scale(0.985); }
  45%, 65% { opacity: 1; transform: scale(1); }
}

@keyframes vision-feed-drift {
  to { transform: scale(1.13) translate3d(-1.5%, 1%, 0); }
}

@keyframes target-track {
  0%, 100% { transform: translate(-50%, -50%); }
  35% { transform: translate(-39%, -58%); }
  68% { transform: translate(-57%, -43%); }
}

@media (max-width: 980px) {
  .hero-optics {
    right: -8vw;
    width: 58vw;
    opacity: 0.52;
  }

  .assembly-monitor {
    right: 18px;
    width: 158px;
  }
}

@media (max-width: 760px) {
  .hero-optics {
    top: 36%;
    right: -34vw;
    width: 105vw;
    opacity: 0.35;
  }

  .optic-readout {
    display: none;
  }

  .product-stage {
    min-height: 175vh;
  }

  .product-stage-sticky {
    min-height: 100svh;
    background: radial-gradient(circle at 58% 69%, #20292c 0, #090d0e 35%, #050708 70%);
  }

  .product-stage-sticky::after {
    display: none;
  }

  .product-machine {
    top: auto;
    right: 0;
    bottom: 52px;
    width: 100%;
    height: 47%;
    transform: none;
  }

  .assembly-monitor {
    top: auto;
    right: 16px;
    bottom: 68px;
    width: 130px;
    transform: none;
  }

  .assembly-monitor strong {
    font-size: 28px;
  }

  .machine-scan-line {
    width: 67%;
  }

  .machine-target {
    max-width: 116px;
    min-height: 24px;
    padding: 5px 6px 5px 25px;
    font-size: 7px;
    line-height: 1.25;
    letter-spacing: 0.06em;
    white-space: normal;
  }

  .machine-target i {
    left: 7px;
    width: 9px;
    height: 9px;
  }

  .target-feed {
    right: 2%;
  }

  .target-dose {
    right: 13%;
  }

  .target-control {
    right: 0;
  }

  .target-output {
    right: 44%;
  }

  .target-output::before {
    right: auto;
    left: 100%;
    background: linear-gradient(90deg, rgba(184, 255, 61, 0.78), transparent);
  }

  .inspect-box {
    width: 21%;
    height: 29%;
  }

  .inspection-readout {
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .optic-ring,
  .optic-bracket,
  .machine-halo,
  .inspect-box,
  .vision-feed,
  .vision-crosshair {
    animation: none !important;
  }

  .product-stage {
    min-height: 100vh;
  }
}
