/* TAJERX robot (robot.js). Self-contained so any TAJERX site or portal can use it:
   load robot.css and robot.js. Colours fall back to the brand values when the page has no theme variables. */
.robot { position: fixed; left: 0; top: 0; width: 68px; height: 90px; z-index: 50; pointer-events: none; will-change: transform; }
.robot svg { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 100%; display: block; }
.rb-shadow { fill: var(--robot-shadow, rgba(10, 10, 10, 0.13)); }
.rb-leg, .rb-arm, .rb-head, .rb-eyes-open, .rb-body { transform-box: fill-box; }
.rb-leg, .rb-arm { transform-origin: 50% 12%; }
.rb-head { transform-origin: 50% 100%; animation: rb-breathe 2.6s ease-in-out infinite; }
.rb-eyes { transition: transform 0.18s ease-out; }
.rb-eyes-open { transform-origin: 50% 50%; animation: rb-blink 4.6s infinite; }
.rb-eyes-happy, .rb-eyes-closed { opacity: 0; }
.robot.is-shy .rb-eyes-open { opacity: 0; }
.robot.is-shy .rb-eyes-closed { opacity: 1; }

.robot.is-running .rb-body { animation: rb-bob 0.17s ease-in-out infinite alternate; }
.robot.is-running .rb-leg-f { animation: rb-swing 0.34s ease-in-out infinite alternate; }
.robot.is-running .rb-leg-b { animation: rb-swing 0.34s ease-in-out infinite alternate-reverse; }
.robot.is-running .rb-arm-f { animation: rb-swing-arm 0.34s ease-in-out infinite alternate-reverse; }
.robot.is-running .rb-arm-b { animation: rb-swing-arm 0.34s ease-in-out infinite alternate; }

.robot.is-waving .rb-arm-b { transform-origin: 50% 12%; animation: rb-wave 0.5s ease-in-out 4 alternate; }

.robot.is-happy .rb-eyes-open { opacity: 0; }
.robot.is-happy .rb-eyes-happy { opacity: 1; }
.robot.is-happy .rb-eyes-closed { opacity: 0; }
.robot.is-happy .rb-body { transform-origin: 50% 100%; animation: rb-jump 0.6s cubic-bezier(.3,.7,.4,1) 3; }
.robot.is-happy .rb-arm-f { animation: rb-arms-up-f 0.6s ease-in-out 3; }
.robot.is-happy .rb-arm-b { animation: rb-arms-up-b 0.6s ease-in-out 3; }

@keyframes rb-swing { from { transform: rotate(34deg); } to { transform: rotate(-34deg); } }
@keyframes rb-swing-arm { from { transform: rotate(40deg); } to { transform: rotate(-40deg); } }
@keyframes rb-bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes rb-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(0.8px); } }
@keyframes rb-blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes rb-wave { from { transform: rotate(-150deg); } to { transform: rotate(-115deg); } }
@keyframes rb-jump { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-16px); } }
@keyframes rb-arms-up-f { 0%, 100% { transform: rotate(0); } 45% { transform: rotate(140deg); } }
@keyframes rb-arms-up-b { 0%, 100% { transform: rotate(0); } 45% { transform: rotate(-140deg); } }

/* Touch screens: sitting at the bottom or on a field, with small idle routines. */
.robot.is-sitting .rb-body { transform: translateY(16px); }
.robot.is-sitting .rb-leg { transform: scaleY(0.46); }
.robot.is-dancing svg { animation: rb-dance 0.65s ease-in-out 4 alternate; }
.robot.is-dancing .rb-arm-f { animation: rb-arms-up-f 0.65s ease-in-out 4 alternate; }
.robot.is-dancing .rb-arm-b { animation: rb-arms-up-b 0.65s ease-in-out 4 alternate-reverse; }
.robot.is-hopping svg { animation: rb-hop 0.5s cubic-bezier(.3,.7,.4,1) 4; }
.robot.is-looking .rb-eyes { animation: rb-look 2.6s ease-in-out 1; }
.robot.is-pinned { position: absolute; }
.robot.is-draggable { pointer-events: auto; touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.robot.is-dragged { cursor: grabbing; }
.robot.is-going-to-bed { transition: transform 0.4s ease-in, opacity 0.4s ease-in; opacity: 0; }
.robot.is-going-to-bed svg { transform: scale(0.2) !important; transition: transform 0.4s ease-in; }
.robot.is-going-to-bed .rb-eyes-open { opacity: 0; }
.robot.is-going-to-bed .rb-eyes-closed { opacity: 1; }
.robot.is-asleep { display: none; }

/* The bed the robot can be dropped into on touch screens (robot.js). */
.rb-dock {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 49;
  width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card, #FAFAFA); border: 1px dashed var(--gold, #C49A3C); color: var(--gold-text, #8A6A1F);
  box-shadow: var(--shadow, 0 12px 32px rgba(10, 10, 10, 0.08)); pointer-events: none; opacity: 0; transform: translateY(16px) scale(0.9);
  transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}
.rb-dock svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rb-dock.is-visible { opacity: 1; transform: none; }
.rb-dock.is-over { background: var(--gold-soft, rgba(196, 154, 60, 0.18)); border-style: solid; transform: scale(1.15); }
.robot-wake {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line, rgba(10, 10, 10, 0.12)); border-radius: 999px; background: transparent; color: var(--gold-text, #8A6A1F); cursor: pointer;
}
.robot-wake[hidden] { display: none; }
.robot-wake svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.robot-wake:focus-visible { outline: 2px solid var(--gold, #C49A3C); outline-offset: 2px; }
.robot.is-dragged .rb-leg-f { animation: rb-swing 0.5s ease-in-out infinite alternate; }
.robot.is-dragged .rb-leg-b { animation: rb-swing 0.5s ease-in-out infinite alternate-reverse; }
.robot.is-dragged .rb-arm-f { animation: rb-arms-up-f 0.5s ease-in-out infinite alternate; }
.robot.is-dragged .rb-arm-b { animation: rb-arms-up-b 0.5s ease-in-out infinite alternate; }
@keyframes rb-dance { from { transform: rotate(-9deg) translateY(0); } to { transform: rotate(9deg) translateY(-4px); } }
@keyframes rb-hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-12px); } }
@keyframes rb-look { 0%, 100% { transform: translate(0, 0); } 20%, 40% { transform: translate(-4px, 1px); } 60%, 80% { transform: translate(4px, 1px); } }

/* More random moves (robot.js picks one now and then while the robot rests). */
.robot.is-spin svg { animation: rb-spin 1.1s cubic-bezier(.5,0,.3,1) 2; }
.robot.is-flip svg { transform-origin: 50% 60%; animation: rb-flip 1.2s cubic-bezier(.4,0,.3,1) 1; }
.robot.is-flip .rb-eyes-open { opacity: 0; }
.robot.is-flip .rb-eyes-happy { opacity: 1; }
.robot.is-sleepy .rb-eyes-open { opacity: 0; }
.robot.is-sleepy .rb-eyes-closed { opacity: 1; }
.robot.is-sleepy .rb-head { animation: rb-doze 2.6s ease-in-out 1; }
.robot.is-sleepy .rb-arm-b { animation: rb-yawn 2.6s ease-in-out 1; }
.robot.is-shake .rb-head { animation: rb-shake 0.32s ease-in-out 6 alternate; }
.robot.is-nod .rb-head { animation: rb-nod 0.4s ease-in-out 5 alternate; }
.robot.is-nod .rb-eyes-open { opacity: 0; }
.robot.is-nod .rb-eyes-happy { opacity: 1; }
.robot.is-jacks svg { animation: rb-hop 0.44s ease-in-out 5; }
.robot.is-jacks .rb-arm-f { animation: rb-arms-up-f 0.44s ease-in-out 5; }
.robot.is-jacks .rb-arm-b { animation: rb-arms-up-b 0.44s ease-in-out 5; }
.robot.is-jacks .rb-leg-f { animation: rb-leg-out-f 0.44s ease-in-out 5; }
.robot.is-jacks .rb-leg-b { animation: rb-leg-out-b 0.44s ease-in-out 5; }
.robot.is-robot .rb-arm-f { animation: rb-robot-arm 0.6s steps(2, jump-none) 4; }
.robot.is-robot .rb-arm-b { animation: rb-robot-arm 0.6s steps(2, jump-none) 4 reverse; }
.robot.is-robot .rb-head { animation: rb-robot-head 0.6s steps(2, jump-none) 4; }
.robot.is-robot svg { animation: rb-robot-step 0.6s steps(2, jump-none) 4; }
.robot.is-wiggle svg { transform-origin: 50% 100%; animation: rb-squash 0.36s ease-in-out 6 alternate; }
.robot.is-peek svg { transform-origin: 50% 100%; animation: rb-peek 2.4s ease-in-out 1; }
.robot.is-peek .rb-eyes-open { animation: rb-peek-eyes 2.4s steps(1) 1; }
.robot.is-peek .rb-eyes-happy { animation: rb-peek-happy 2.4s steps(1) 1; }
.robot.is-salute .rb-arm-b { animation: rb-salute 2.4s ease-in-out 1; }
.robot.is-salute .rb-head { animation: rb-salute-head 2.4s ease-in-out 1; }
.robot.is-giggle svg { animation: rb-giggle 0.12s linear 14 alternate; }
.robot.is-giggle .rb-eyes-open { opacity: 0; }
.robot.is-giggle .rb-eyes-happy { opacity: 1; }
.robot.is-stretch svg { transform-origin: 50% 100%; animation: rb-stretch 2.4s ease-in-out 1; }
.robot.is-stretch .rb-arm-f { animation: rb-stretch-arm-f 2.4s ease-in-out 1; }
.robot.is-stretch .rb-arm-b { animation: rb-stretch-arm-b 2.4s ease-in-out 1; }
@keyframes rb-spin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
@keyframes rb-flip { 0% { transform: translateY(0) rotate(0); } 20% { transform: translateY(4px) rotate(0) scaleY(0.9); } 55% { transform: translateY(-34px) rotate(-200deg); } 85% { transform: translateY(0) rotate(-360deg); } 92% { transform: translateY(2px) rotate(-360deg) scaleY(0.92); } 100% { transform: translateY(0) rotate(-360deg); } }
@keyframes rb-doze { 0%, 100% { transform: rotate(0); } 30%, 45% { transform: rotate(-12deg) translateY(2px); } 55% { transform: rotate(3deg); } 70%, 85% { transform: rotate(-14deg) translateY(2px); } }
@keyframes rb-yawn { 0%, 100% { transform: rotate(0); } 15%, 35% { transform: rotate(-160deg); } }
@keyframes rb-shake { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }
@keyframes rb-nod { from { transform: translateY(0) rotate(0); } to { transform: translateY(3px) rotate(4deg); } }
@keyframes rb-leg-out-f { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(24deg); } }
@keyframes rb-leg-out-b { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-24deg); } }
@keyframes rb-robot-arm { from { transform: rotate(-90deg); } to { transform: rotate(0); } }
@keyframes rb-robot-head { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@keyframes rb-robot-step { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@keyframes rb-squash { from { transform: scale(1.12, 0.88); } to { transform: scale(0.9, 1.1); } }
@keyframes rb-peek { 0%, 100% { transform: scaleY(1); } 15%, 55% { transform: scaleY(0.35) translateY(6px); } 65% { transform: scaleY(1.12) translateY(-6px); } 75% { transform: scaleY(1); } }
@keyframes rb-peek-eyes { 0%, 60% { opacity: 1; } 61%, 95% { opacity: 0; } 96%, 100% { opacity: 1; } }
@keyframes rb-peek-happy { 0%, 60% { opacity: 0; } 61%, 95% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes rb-salute { 0%, 100% { transform: rotate(0); } 18%, 78% { transform: rotate(-150deg); } }
@keyframes rb-salute-head { 0%, 100% { transform: rotate(0); } 18%, 78% { transform: rotate(-4deg); } }
@keyframes rb-giggle { from { transform: translateX(-1.5px) rotate(-2deg); } to { transform: translateX(1.5px) rotate(2deg); } }
@keyframes rb-stretch { 0%, 100% { transform: scaleY(1); } 30%, 60% { transform: scale(0.94, 1.12); } 75% { transform: scale(1.06, 0.94); } }
@keyframes rb-stretch-arm-f { 0%, 100% { transform: rotate(0); } 30%, 60% { transform: rotate(170deg); } }
@keyframes rb-stretch-arm-b { 0%, 100% { transform: rotate(0); } 30%, 60% { transform: rotate(-170deg); } }

/* Curtain: a TAJERX blind rolls down over the robot while the visitor types (or while a password
   field has focus), so it cannot peek. The robot tries to push it aside: the cloth bulges and swings,
   a hand slips out at the edge and gets pulled back, and the feet kick underneath. It never gets out. */
.rb-curtain { position: absolute; left: -9%; right: -9%; top: -3%; height: 80%; pointer-events: none; }
.rb-roller {
  position: absolute; left: -3%; right: -3%; top: 0; height: 8%; min-height: 4px; border-radius: 99px; z-index: 3;
  background: linear-gradient(180deg, #EAD7A8, #C9A55A 55%, #A88541); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transform: scaleX(0); transition: transform 0.2s ease-out 0.25s;
}
.rb-cloth {
  position: absolute; left: 0; right: 0; top: 4%; bottom: 0; z-index: 2; overflow: hidden;
  background: linear-gradient(180deg, #17171A, #0D0D0F 70%); border-radius: 0 0 6px 6px;
  border-bottom: 3px solid #C49A3C; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.22);
  display: grid; place-items: center; transform-origin: 50% 0; transform: scaleY(0);
  transition: transform 0.25s ease-in;
}
.rb-cloth::before { /* soft vertical folds */
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 22%);
}
.rb-cloth svg { position: relative; width: 78%; height: auto; overflow: visible; }
.rb-bump { /* where the robot pushes from behind */
  position: absolute; width: 46%; aspect-ratio: 1; border-radius: 50%; left: 27%; top: 40%; opacity: 0;
  background: radial-gradient(circle at 40% 35%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.04) 55%, transparent 70%);
}
.rb-hand {
  position: absolute; z-index: 1; top: 52%; left: 4%; width: 15%; height: 30%; border-radius: 99px;
  background: linear-gradient(135deg, #FBF7EF, #E6DDCC); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); opacity: 0;
}
.robot.is-curtained .rb-roller { transform: scaleX(1); transition-delay: 0s; }
.robot.is-curtained .rb-cloth {
  transform: scaleY(1); transition: transform 0.42s cubic-bezier(.3, 1.45, .55, 1) 0.12s;
  animation: rb-push 3.2s ease-in-out 0.7s infinite;
}
.robot.is-curtained .rb-bump { animation: rb-bump 3.2s ease-in-out 0.7s infinite; }
.robot.is-curtained .rb-hand { animation: rb-hand 3.2s ease-in-out 0.7s infinite; }
.robot.is-curtained .rb-leg-f { animation: rb-kick 0.4s ease-in-out infinite alternate; }
.robot.is-curtained .rb-leg-b { animation: rb-kick 0.4s ease-in-out infinite alternate-reverse; }
.robot.is-curtained .rb-eyes-open { opacity: 0; }
.robot.is-curtained .rb-eyes-closed { opacity: 1; }
@keyframes rb-push {
  0%, 8%, 100% { transform: scaleY(1); }
  12% { transform: scale(1.07, 0.97) translateY(-1px); }       /* head-butt from the middle */
  17% { transform: scaleY(1); }
  30% { transform: scaleY(1) skewX(-7deg) translateX(-4%); }    /* shoves the left side */
  36% { transform: scaleY(1) skewX(3deg); }
  41% { transform: scaleY(1); }
  52%, 58% { transform: scaleY(1) skewX(9deg) translateX(7%) rotate(2deg); } /* big push to the right */
  63% { transform: scaleY(1) skewX(-4deg) translateX(-2%); }    /* curtain swings back */
  69% { transform: scaleY(1) skewX(1.5deg); }
  74% { transform: scaleY(1); }
  80% { transform: scale(1.04, 0.98); } 83% { transform: scaleY(1); }   /* two tiny tries */
  87% { transform: scale(1.04, 0.98); } 90% { transform: scaleY(1); }
}
@keyframes rb-bump {
  0%, 8%, 17%, 24%, 41%, 46%, 63%, 77%, 92%, 100% { opacity: 0; }
  12% { opacity: 1; left: 27%; top: 30%; }
  30% { opacity: 1; left: 2%; top: 44%; }
  52%, 58% { opacity: 1; left: 52%; top: 40%; }
  80%, 87% { opacity: 0.8; left: 27%; top: 50%; }
}
@keyframes rb-hand {
  0%, 30%, 100% { opacity: 0; transform: translateX(0); }
  33% { opacity: 1; transform: translateX(0); }
  38%, 41% { opacity: 1; transform: translateX(-85%) rotate(-12deg); } /* sneaks out at the edge */
  44% { opacity: 1; transform: translateX(-30%); }                      /* gets pulled back in */
  46% { opacity: 0; transform: translateX(0); }
}
@keyframes rb-kick { from { transform: rotate(16deg); } to { transform: rotate(-16deg); } }

@media (prefers-reduced-motion: reduce) {
  .robot *, .robot.is-running *, .robot.is-happy * { animation: none !important; }
  .rb-cloth, .rb-roller { transition: none !important; }
}
@media (max-width: 560px) {
  .robot { width: 46px; height: 61px; }
}
@media print { .robot { display: none; } }

/* Avatar: the robot sits inside a page element (for example the circle above a sign-in form)
   instead of walking around the screen. <div data-tajerx-robot></div> turns this on. */
[data-tajerx-robot] { position: relative; }
.robot.is-avatar { position: absolute; left: 50%; bottom: 0; top: auto; width: 62%; height: auto; aspect-ratio: 68 / 90; margin-left: -31%; z-index: 1; }
.robot.is-avatar .rb-shadow { display: none; }
