/* SIGE.chat landing page motion, after anilan.ai's techniques (assets/js/site.js there):
   scroll progress, a motion switch, a canvas field, pointer-lit sections, reveal on scroll,
   self-drawing strokes, a scroll-pinned chapter and a looping illustrative demo.
   Everything here is decorative. Nothing is hidden unless motion.js has switched motion on
   (html.mo), and body.motion-off or prefers-reduced-motion puts every element at rest. */

:root {
  --mo-orange: 194, 65, 12;
  --mo-purple: 42, 0, 78;
  --mo-ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Scroll progress ---------- */
.mo-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 1100;
  background: linear-gradient(90deg, rgb(var(--mo-orange)), rgb(var(--mo-purple)));
  pointer-events: none;
}

/* ---------- Motion switch ---------- */
.mo-toggle {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  font: 700 0.72rem/1 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--mo-purple));
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(var(--mo-purple), 0.18);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(var(--mo-purple), 0.12);
}
.mo-toggle:focus-visible {
  outline: 3px solid rgba(var(--mo-orange), 0.55);
  outline-offset: 2px;
}

/* ---------- Hero: field, pointer light, depth ---------- */
.hero.mo-hero {
  overflow: hidden;
  isolation: isolate;
}
.mo-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.mo-light {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(520px circle at calc(50% + var(--pointer-offset-x, 0px)) var(--pointer-y, 30%),
      rgba(var(--mo-orange), 0.11), transparent 62%);
  transition: opacity .4s;
}
body.motion-off .mo-light { opacity: 0; }

html.mo .hero .header-container { will-change: transform; }

/* ---------- Section-local pointer light ---------- */
.mo-glow-zone { position: relative; isolation: isolate; }
.mo-glow-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s;
  background: radial-gradient(420px circle at calc(50% + var(--pointer-offset-x, 0px)) var(--pointer-y, 50%),
      rgba(var(--mo-orange), 0.09), transparent 65%);
}
.mo-glow-zone.is-pointer-lit::before { opacity: 1; }
.mo-glow-zone .problem-card,
.mo-glow-zone .feature-card { position: relative; }

/* ---------- Reveal on scroll ---------- */
html.mo .mo-reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition: opacity .7s var(--mo-ease), transform .7s var(--mo-ease);
}
html.mo .mo-reveal.mo-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Self-drawing strokes ---------- */
.mo-underline {
  display: block;
  width: min(220px, 50%);
  height: 14px;
  margin: 6px auto 0;
  overflow: visible;
}
.mo-underline path {
  fill: none;
  stroke: rgb(var(--mo-orange));
  stroke-width: 3;
  stroke-linecap: round;
}
html.mo .mo-draw path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.1s var(--mo-ease) .15s;
}
html.mo .mo-draw.mo-drawn path { stroke-dashoffset: 0; }

/* ---------- Illustrative chat demo (the hero's console) ---------- */
.mo-demo-wrap {
  position: relative;
  z-index: 2;
  width: min(440px, 100%);
  margin: 40px auto 0;
}
html.mo .mo-demo-wrap { animation: mo-rise 1.1s var(--mo-ease) .25s both; }
@keyframes mo-rise {
  from { opacity: 0; transform: translate3d(0, 48px, 0) scale(.94); }
  to { opacity: 1; transform: none; }
}
.mo-demo {
  text-align: left;
  background: #fff;
  border: 1px solid rgba(var(--mo-purple), 0.12);
  border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(var(--mo-purple), 0.35), 0 8px 20px rgba(var(--mo-purple), 0.08);
  overflow: hidden;
  transform-origin: 50% 0;
  will-change: transform;
}
.mo-demo-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgb(var(--mo-purple));
  color: #fff;
}
.mo-demo-bar img { width: 26px; height: 26px; border-radius: 50%; background: #fff; }
.mo-demo-bar strong { font-family: var(--font-headline); font-size: 1rem; line-height: 1.1; }
.mo-demo-bar small { display: block; font-size: .72rem; opacity: .8; }
.mo-demo-time {
  margin-left: auto;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  opacity: .85;
}
.mo-demo-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 16px;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(var(--mo-purple), .6);
  background: var(--light-lavender);
}
.mo-demo-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  min-height: 300px;
}
.mo-msg {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: .92rem;
  line-height: 1.45;
}
.mo-msg.from-customer {
  align-self: flex-end;
  background: rgb(var(--mo-orange));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mo-msg.from-assistant {
  align-self: flex-start;
  background: var(--light-lavender);
  color: var(--neutral-dark);
  border-bottom-left-radius: 4px;
}
.mo-card {
  align-self: flex-start;
  width: 82%;
  border: 1px solid rgba(var(--mo-purple), .15);
  border-radius: 14px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  font-size: .88rem;
}
.mo-card b { font-family: var(--font-headline); color: rgb(var(--mo-purple)); font-size: 1rem; }
.mo-card .mo-confirm {
  justify-self: start;
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(var(--mo-orange));
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
  transition: background .3s;
}
.mo-card.is-confirmed .mo-confirm { background: #15803d; }
.mo-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--light-lavender);
}
.mo-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(var(--mo-purple), .45);
  animation: mo-dot 1s infinite;
}
.mo-typing span:nth-child(2) { animation-delay: .15s; }
.mo-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes mo-dot {
  0%, 60%, 100% { transform: none; opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
html.mo .mo-enter { animation: mo-pop .45s var(--mo-ease) both; }
@keyframes mo-pop {
  from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.97); }
  to { opacity: 1; transform: none; }
}

/* ---------- How it works: a pinned chapter ---------- */
.mo-rail {
  display: none;
}
@media (min-width: 1025px) {
  html.mo .how-it-works-section.mo-pinned {
    height: 240vh;
    padding: 0;
    overflow-x: clip; /* steps fly in from the sides; clip keeps sticky working, unlike hidden */
  }
  html.mo .how-it-works-section.mo-pinned > .container {
    position: sticky;
    top: 80px;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  html.mo .how-it-works-section.mo-pinned .how-it-works-steps { position: relative; }
  html.mo .how-it-works-section.mo-pinned .mo-rail {
    display: block;
    position: absolute;
    left: 16.6%;
    right: 16.6%;
    top: 35px;
    height: 4px;
    border-radius: 2px;
    background: rgba(var(--mo-purple), .1);
    z-index: 0;
  }
  html.mo .how-it-works-section.mo-pinned .mo-rail::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgb(var(--mo-orange)), rgb(var(--mo-purple)));
    transform-origin: 0 50%;
    transform: scaleX(var(--rail, 0));
  }
  html.mo .how-it-works-section.mo-pinned .step {
    position: relative;
    z-index: 1;
    will-change: translate, opacity;
  }
  html.mo .how-it-works-section.mo-pinned .step .step-number {
    transition: transform .4s var(--mo-ease), box-shadow .4s;
  }
  html.mo .how-it-works-section.mo-pinned .step.is-active .step-number {
    transform: scale(1.12);
    box-shadow: 0 0 0 8px rgba(var(--mo-orange), .14), 0 4px 10px rgba(var(--mo-orange), .3);
  }
}

/* ---------- At rest ---------- */
@media (prefers-reduced-motion: reduce) {
  .mo-progress, .mo-light { display: none; }
}
body.motion-off .mo-demo-wrap,
body.motion-off .mo-enter { animation: none; }
body.motion-off .mo-typing span { animation: none; }
