/* tsukumogami motion layer. Built by tsukumogami-motion.js; see the comment there. */

:root {
  --tg-gold: #f4d06f;
  --tg-teal: #77e6d2;
  --tg-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --tg-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Title ---------- */

/* Split glyphs lose kerning and run wider than the plain word, so the size comes down a notch. */
.hero h1.is-kinetic {
  font-size: clamp(44px, 7.6vw, 92px);
  white-space: nowrap;
  perspective: 800px;
}

.tg-char {
  display: inline-block;
  animation: tgCharIn 1.1s var(--tg-ease) var(--d) both;
}

@keyframes tgCharIn {
  0% {
    opacity: 0;
    color: var(--tg-gold);
    filter: blur(12px);
    transform: translateY(0.5em) rotateY(-80deg);
    text-shadow: 0 0 40px rgba(244, 208, 111, 0.9);
  }
  55% {
    opacity: 1;
    color: #fff6d6;
    text-shadow: 0 0 28px rgba(244, 208, 111, 0.8);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: none;
    text-shadow: none;
  }
}

/* ---------- Stage ---------- */

.hero.has-stage::after {
  display: none;
}

.tg-stage {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 4;
  min-height: 580px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 38%, rgba(119, 230, 210, 0.1), transparent 46%),
    radial-gradient(circle at 50% 100%, rgba(244, 208, 111, 0.12), transparent 50%),
    linear-gradient(180deg, rgba(14, 16, 24, 0.94), rgba(6, 7, 10, 0.98));
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(244, 208, 111, 0.05);
  isolation: isolate;
}

.tg-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at 50% 38%, #000, transparent 72%);
  pointer-events: none;
}

.tg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Core: the agent bridge. */
.tg-core {
  position: absolute;
  z-index: 2;
  top: 38%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  translate: -50% -50%;
}

.tg-core-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, var(--tg-teal) 60%);
  box-shadow: 0 0 22px var(--tg-teal), 0 0 60px rgba(119, 230, 210, 0.5);
  animation: tgPulse 2.4s ease-in-out infinite;
}

.tg-core-ring {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(119, 230, 210, 0.4);
  border-radius: 50%;
  animation: tgSpin 14s linear infinite;
}

.tg-core-ring + .tg-core-ring {
  inset: 16px;
  border-style: solid;
  border-color: rgba(119, 230, 210, 0.18) rgba(119, 230, 210, 0.6) rgba(119, 230, 210, 0.18) rgba(119, 230, 210, 0.18);
  animation-duration: 3.6s;
  animation-direction: reverse;
}

.tg-core em {
  position: absolute;
  top: calc(100% + 4px);
  font-family: var(--tg-mono);
  font-size: 8.5px;
  font-style: normal;
  line-height: 1.35;
  letter-spacing: 0.18em;
  text-align: center;
  color: rgba(119, 230, 210, 0.75);
  white-space: nowrap;
}

@keyframes tgSpin {
  to {
    rotate: 360deg;
  }
}

@keyframes tgPulse {
  0%,
  100% {
    scale: 1;
  }
  50% {
    scale: 1.35;
  }
}

/* Objects. */
.tg-obj {
  position: absolute;
  z-index: 3;
  top: var(--y);
  left: var(--x);
  display: grid;
  gap: 3px;
  width: 124px;
  padding: 9px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(18, 20, 28, 0.9);
  color: rgba(248, 250, 252, 0.4);
  translate: -50% -50%;
  filter: grayscale(1);
  transition:
    border-color 0.6s ease,
    background-color 0.6s ease,
    color 0.6s ease,
    filter 0.8s ease,
    box-shadow 0.6s ease;
}

.tg-obj.is-awake {
  border-color: rgba(244, 208, 111, 0.4);
  color: var(--text, #f8fafc);
  filter: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(244, 208, 111, 0.08);
  animation:
    tgWake 0.9s var(--tg-ease) both,
    tgBob 4.2s ease-in-out var(--bob) infinite;
}

.tg-obj.is-called {
  border-color: var(--tg-teal);
  box-shadow: 0 0 0 1px rgba(119, 230, 210, 0.4), 0 0 34px rgba(119, 230, 210, 0.35);
}

.tg-obj.is-speaking {
  border-color: var(--tg-gold);
  box-shadow: 0 0 0 1px rgba(244, 208, 111, 0.5), 0 0 34px rgba(244, 208, 111, 0.3);
}

@keyframes tgWake {
  0% {
    scale: 0.86;
    box-shadow: 0 0 0 0 rgba(244, 208, 111, 0.9);
  }
  40% {
    scale: 1.08;
    box-shadow: 0 0 0 10px rgba(244, 208, 111, 0);
  }
  100% {
    scale: 1;
  }
}

@keyframes tgBob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(-0.8deg);
  }
}

.tg-obj-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tg-obj-kind {
  font-family: var(--tg-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: rgba(244, 208, 111, 0.55);
}

.tg-obj.is-awake .tg-obj-kind {
  color: var(--tg-gold);
}

.tg-obj strong {
  font-size: 15px;
  line-height: 1.2;
}

.tg-obj-state {
  min-height: 1.3em;
  font-family: var(--tg-mono);
  font-size: 9.5px;
  color: var(--tg-teal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tg-obj-anx {
  display: block;
  max-height: 0;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.4;
  color: #ffd9a8;
  opacity: 0;
  transition:
    max-height 0.5s var(--tg-ease),
    opacity 0.4s ease;
}

.tg-obj.is-speaking .tg-obj-anx,
.tg-obj:hover .tg-obj-anx,
.tg-stage.is-static .tg-obj-anx {
  max-height: 3em;
  opacity: 1;
}

.tg-obj-anx::before {
  content: '⚠ ';
  color: var(--tg-gold);
}

.tg-call {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: 3px 7px;
  border: 1px solid rgba(119, 230, 210, 0.5);
  border-radius: 999px;
  background: rgba(6, 7, 10, 0.92);
  font-family: var(--tg-mono);
  font-size: 9px;
  color: var(--tg-teal);
  white-space: nowrap;
  translate: -50% 0;
  animation: tgCall 1.9s var(--tg-ease) both;
  pointer-events: none;
}

@keyframes tgCall {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  15%,
  75% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Faces: a pair of eyes that follow the pointer and blink. Closed while dormant. */
.tg-face {
  display: inline-flex;
  gap: 5px;
  padding: 3px 5px;
  border-radius: 999px;
}

.tg-eye {
  position: relative;
  display: block;
  width: 9px;
  height: 9px;
  overflow: hidden;
  border-radius: 50%;
  background: #fff8e1;
  scale: 1 0.12;
  transition: scale 0.18s ease;
}

.tg-eye b {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: #06070a;
  transform: translate(var(--look-x, 0), var(--look-y, 0));
}

.tg-obj.is-awake .tg-eye,
.tg-face-chip .tg-eye {
  scale: 1 1;
  box-shadow: 0 0 8px rgba(244, 208, 111, 0.6);
}

.tg-face.is-blink .tg-eye {
  scale: 1 0.1;
}

/* Human Gate. */
.tg-gate {
  position: absolute;
  z-index: 3;
  bottom: 12%;
  left: 50%;
  display: grid;
  grid-template-columns: 4px 58px 4px;
  grid-template-rows: 34px auto;
  column-gap: 0;
  align-items: start;
  translate: -50% 0;
}

.tg-gate-pillar {
  grid-row: 1;
  height: 34px;
  border-radius: 2px;
  background: rgba(244, 208, 111, 0.6);
}

.tg-gate-bar {
  grid-row: 1;
  grid-column: 2;
  align-self: center;
  height: 3px;
  margin: 0 -2px;
  border-radius: 2px;
  background: var(--tg-gold);
  box-shadow: 0 0 10px rgba(244, 208, 111, 0.6);
  transform-origin: left center;
  transition:
    rotate 0.5s var(--tg-ease),
    background-color 0.3s ease;
}

.tg-gate.is-waiting .tg-gate-bar {
  animation: tgGateHold 0.9s ease-in-out infinite;
}

.tg-gate.is-open .tg-gate-bar {
  rotate: -70deg;
  background: var(--tg-teal);
  box-shadow: 0 0 12px rgba(119, 230, 210, 0.7);
}

@keyframes tgGateHold {
  50% {
    box-shadow: 0 0 22px rgba(244, 208, 111, 1);
  }
}

.tg-gate-label {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  margin-top: 6px;
  font-family: var(--tg-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: rgba(244, 208, 111, 0.85);
  white-space: nowrap;
}

.tg-gate-label em {
  min-height: 1.4em;
  margin-top: 2px;
  font-family: inherit;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.04em;
  color: #fff3c9;
}

.tg-gate.is-sent .tg-gate-label em {
  color: var(--tg-teal);
}

.tg-gate-approve {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  padding: 5px 12px;
  border: 1px solid rgba(244, 208, 111, 0.6);
  border-radius: 999px;
  background: rgba(244, 208, 111, 0.12);
  color: #fff3c9;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  translate: -50% 6px;
  transition:
    opacity 0.3s ease,
    translate 0.4s var(--tg-ease),
    background-color 0.15s ease,
    scale 0.15s ease;
}

.tg-gate.is-waiting .tg-gate-approve {
  opacity: 1;
  translate: -50% 0;
}

.tg-gate-approve.is-pressed {
  background: var(--tg-gold);
  color: #0c0b05;
  scale: 0.92;
}

.tg-hand {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  opacity: 0;
  transform: translate(calc(var(--hx, 0px) + 120px), calc(var(--hy, 0px) + 90px));
  transition:
    transform 0.9s var(--tg-ease),
    opacity 0.4s ease;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.tg-hand.is-in {
  opacity: 1;
  transform: translate(var(--hx, 0px), var(--hy, 0px));
}

.tg-hand.is-click svg {
  scale: 0.82;
  transition: scale 0.12s ease;
}

.tg-outside {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 4%;
  font-family: var(--tg-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(248, 250, 252, 0.3);
}

/* ---------- Product cards ---------- */

.product-card {
  position: relative;
}

.tg-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  aspect-ratio: 16 / 9;
  pointer-events: none;
}

.tg-face-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(6, 7, 10, 0.86);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(244, 208, 111, 0.35);
}

.tg-hud-status {
  position: absolute;
  bottom: 10px;
  left: 10px;
  max-width: calc(100% - 20px);
  min-height: 1.6em;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(6, 7, 10, 0.86);
  font-family: var(--tg-mono);
  font-size: 11px;
  color: var(--tg-teal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.tg-hud-status:empty {
  opacity: 0;
}

.tg-hud-status::after {
  content: '▍';
  margin-left: 1px;
  color: var(--tg-gold);
  animation: tgCaret 1s steps(1) infinite;
}

@keyframes tgCaret {
  50% {
    opacity: 0;
  }
}

.tg-motion .product-card {
  opacity: 0;
  translate: 0 36px;
  transition:
    opacity 0.8s ease var(--reveal-delay, 0ms),
    translate 0.9s var(--tg-ease) var(--reveal-delay, 0ms),
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 0.3s ease;
}

.tg-motion .product-card.is-in-view {
  opacity: 1;
  translate: 0 0;
}

.tg-motion .product-card:hover {
  box-shadow: 0 0 0 1px rgba(244, 208, 111, 0.3), 0 24px 60px rgba(0, 0, 0, 0.35);
}

.tg-motion .product-card:hover .tg-face-chip {
  animation: tgHop 0.5s var(--tg-ease);
}

@keyframes tgHop {
  40% {
    transform: translateY(-5px) rotate(-6deg);
  }
}

/* ---------- Mechanism: a signal walks the four steps and stops at the gate ---------- */

.tg-motion .mechanism > div {
  animation: tgStep 6s ease-in-out infinite;
}

.tg-motion .mechanism > div:nth-child(2) {
  animation-delay: 1.2s;
}

.tg-motion .mechanism > div:nth-child(3) {
  animation-delay: 2.4s;
}

.tg-motion .mechanism > div:nth-child(4) {
  animation-name: tgStepGate;
  animation-delay: 3.6s;
}

@keyframes tgStep {
  0%,
  30%,
  100% {
    border-color: var(--line, rgba(255, 255, 255, 0.18));
    box-shadow: none;
  }
  8% {
    border-color: var(--tg-teal);
    box-shadow: 0 0 0 1px rgba(119, 230, 210, 0.3), 0 0 36px rgba(119, 230, 210, 0.18);
  }
}

@keyframes tgStepGate {
  0%,
  34%,
  100% {
    border-color: var(--line, rgba(255, 255, 255, 0.18));
    box-shadow: none;
  }
  8%,
  24% {
    border-color: var(--tg-gold);
    box-shadow: 0 0 0 1px rgba(244, 208, 111, 0.4), 0 0 40px rgba(244, 208, 111, 0.22);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .tg-stage {
    grid-column: 1;
    grid-row: auto;
    min-height: 540px;
  }
}

@media (max-width: 560px) {
  .tg-stage {
    min-height: 520px;
    border-radius: 24px;
  }

  .tg-obj {
    width: 100px;
    padding: 7px 8px 8px;
  }

  .tg-obj strong {
    font-size: 13px;
  }

  .tg-obj-state {
    font-size: 8.5px;
  }

  .tg-core {
    width: 72px;
    height: 72px;
  }

  .tg-outside {
    display: none;
  }
}
