/* Homepage Oriant easter egg. Decorative overlay only.
   Loaded from index.html. Other pages do not include it.
   Sticky call bar stays at z-index 50 in styles.css; this layer is
   underneath it and never receives pointer events. */

.orient-egg {
  --orient-h: min(34vh, 210px);
  --orient-foot: calc(4.85rem + env(safe-area-inset-bottom, 0px));
  --orient-idle-ratio: 0.5325;
  --orient-spray-ratio: 1.0279;
  position: fixed;
  inset: 0;
  z-index: 45;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

@media (min-width: 760px) {
  .orient-egg {
    --orient-h: min(64vh, 520px);
    --orient-foot: 0px;
  }
}

.orient-ant {
  position: absolute;
  top: 100%;
  width: 22px;
  pointer-events: none;
}

.orient-ant img {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
  /* Red ant sprites rendered as solid black pests */
  filter: brightness(0);
  animation: orient-ant-scurry 0.55s ease-in-out infinite;
}

/* Six thin walking legs under the body sprite */
.orient-ant-leg {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 2px;
  height: 38%;
  margin-left: -1px;
  background: #000;
  border-radius: 1px;
  transform-origin: 50% 0%;
  z-index: 0;
  opacity: 0.95;
}

.orient-ant-leg--1 { transform: rotate(-52deg); animation: orient-leg-a 0.34s linear infinite; }
.orient-ant-leg--2 { transform: rotate(-18deg); animation: orient-leg-b 0.34s linear infinite; }
.orient-ant-leg--3 { transform: rotate(18deg); animation: orient-leg-a 0.34s linear infinite 0.11s; }
.orient-ant-leg--4 { transform: rotate(52deg); animation: orient-leg-b 0.34s linear infinite 0.11s; }
.orient-ant-leg--5 { left: 32%; transform: rotate(-70deg); height: 32%; animation: orient-leg-a 0.34s linear infinite 0.05s; }
.orient-ant-leg--6 { left: 68%; transform: rotate(70deg); height: 32%; animation: orient-leg-b 0.34s linear infinite 0.05s; }

@keyframes orient-leg-a {
  0%, 100% { transform: rotate(var(--leg-from, -52deg)) translateY(0); }
  50% { transform: rotate(calc(var(--leg-from, -52deg) + 28deg)) translateY(1px); }
}

@keyframes orient-leg-b {
  0%, 100% { transform: rotate(var(--leg-from, 18deg)) translateY(0); }
  50% { transform: rotate(calc(var(--leg-from, 18deg) - 28deg)) translateY(1px); }
}

/* Explicit keyframes per side so browsers without var() in keyframes still animate */
.orient-ant-leg--1 { animation-name: orient-leg-l1; }
.orient-ant-leg--2 { animation-name: orient-leg-l2; }
.orient-ant-leg--3 { animation-name: orient-leg-l3; }
.orient-ant-leg--4 { animation-name: orient-leg-l4; }
.orient-ant-leg--5 { animation-name: orient-leg-l5; }
.orient-ant-leg--6 { animation-name: orient-leg-l6; }

@keyframes orient-leg-l1 {
  0%, 100% { transform: rotate(-52deg); }
  50% { transform: rotate(-24deg); }
}
@keyframes orient-leg-l2 {
  0%, 100% { transform: rotate(-18deg); }
  50% { transform: rotate(-42deg); }
}
@keyframes orient-leg-l3 {
  0%, 100% { transform: rotate(18deg); }
  50% { transform: rotate(42deg); }
}
@keyframes orient-leg-l4 {
  0%, 100% { transform: rotate(52deg); }
  50% { transform: rotate(24deg); }
}
@keyframes orient-leg-l5 {
  0%, 100% { transform: rotate(-70deg); }
  50% { transform: rotate(-48deg); }
}
@keyframes orient-leg-l6 {
  0%, 100% { transform: rotate(70deg); }
  50% { transform: rotate(48deg); }
}

@keyframes orient-ant-scurry {
  0%, 100% { transform: rotate(-5deg) translateX(0); }
  50% { transform: rotate(6deg) translateX(1px) translateY(-1px); }
}

.orient-egg-oriont {
  position: absolute;
  right: 0;
  bottom: var(--orient-foot);
  height: var(--orient-h);
  width: calc(var(--orient-h) * var(--orient-idle-ratio));
  transform: translate3d(118%, 0, 0);
  transition:
    transform 0.58s cubic-bezier(0.16, 0.82, 0.24, 1),
    width 0.2s ease;
}

.orient-egg-oriont.is-in {
  transform: translate3d(5%, 0, 0);
}

.orient-egg-oriont.is-in.is-spray {
  width: calc(var(--orient-h) * var(--orient-spray-ratio));
  transform: translate3d(-8%, 0, 0);
}

/* Brief look beat: slight lean toward the left (ants) — no fake eyelid */
.orient-egg-oriont.is-in.is-look {
  transform: translate3d(2%, 0, 0) rotate(-3deg);
  transform-origin: 70% 100%;
}

.orient-egg-oriont.is-out {
  transform: translate3d(122%, 0, 0);
}

.orient-egg-sprite {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: right bottom;
}

@media (min-width: 760px) {
  .orient-ant { width: 30px; }
  .orient-ant-leg { width: 2.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .orient-egg { display: none !important; }
}
