/* Hero story. story.js moves #story through:
   is-chaos (+ is-stress) -> is-merge -> is-logo -> is-calm, then loops. */
.story { container-type: inline-size; }

/* Captions above the stage */
.captions { position: relative; height: 5.4cqw; margin-bottom: 2.4cqw; }
.cap {
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: .55em;
  padding: .45em 1em; border-radius: 999px; background: var(--paper); border: 1px solid var(--line);
  font-size: max(12px, 1.9cqw); font-weight: 800; white-space: nowrap;
  opacity: 0; transform: translateY(6px); transition: opacity .45s ease, transform .45s ease;
}
.cap i { width: .6em; height: .6em; border-radius: 50%; }
.cap-chaos { color: #b4382d; }
.cap-chaos i { background: #e5533f; }
.cap-calm { color: var(--green); }
.cap-calm i { background: var(--green-2); }
.is-chaos .cap-chaos, .is-calm .cap-calm { opacity: 1; transform: none; }

/* The laptop only appears after the logo */
.stage-laptop { opacity: 0; transform: scale(.94); transition: opacity .7s ease, transform .9s cubic-bezier(.2,.8,.2,1); }
.is-calm .stage-laptop { opacity: 1; transform: none; }

/* Inbox content fills in once the laptop is up */
.story .chips, .story .row, .story .chat-head, .story .msgs p { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.is-calm .chips, .is-calm .row, .is-calm .chat-head, .is-calm .msgs p { opacity: 1; transform: none; }
.is-calm .chips { transition-delay: .45s; }
.is-calm .row:nth-of-type(2) { transition-delay: .55s; }
.is-calm .row:nth-of-type(3) { transition-delay: .65s; }
.is-calm .row:nth-of-type(4) { transition-delay: .75s; }
.is-calm .row:nth-of-type(5) { transition-delay: .85s; }
.is-calm .row:nth-of-type(6) { transition-delay: .95s; }
.is-calm .chat-head { transition-delay: .8s; }
.is-calm .msgs p:nth-child(1) { transition-delay: 1.1s; }
.is-calm .msgs p:nth-child(2) { transition-delay: 1.5s; }
.is-calm .msgs p:nth-child(3) { transition-delay: 1.9s; }
.is-calm .msgs p:nth-child(4) { transition-delay: 2.4s; }
.story .ai-suggest { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.is-calm .ai-suggest { opacity: 1; transform: none; transition-delay: 2.9s; }

/* Chaos layer */
.chaos { position: absolute; inset: 7.8cqw 0 0 0; z-index: 3; pointer-events: none; }
.ci {
  position: absolute; opacity: 0;
  transform: translate(0, 0) scale(.6) rotate(var(--r));
  transition: opacity .35s ease, transform .5s cubic-bezier(.3,1.5,.5,1);
}
.is-chaos .ci { opacity: 1; transform: scale(1) rotate(var(--r)); transition-delay: var(--d); }
.is-merge .ci, .is-logo .ci, .is-calm .ci {
  opacity: 0; transform: translate(var(--tx, 0), var(--ty, 0)) scale(.1) rotate(0deg);
  transition: transform .75s cubic-bezier(.6,0,.3,1), opacity .4s ease .35s;
  transition-delay: var(--md, 0s);
}
.no-anim .ci, .no-anim .stage-laptop, .no-anim .burst, .no-anim .story * { transition: none !important; }

.float { animation: jitter 1.6s ease-in-out infinite; animation-delay: var(--d); }
.is-stress .float { animation-duration: .45s; animation-name: jitter-hard; }
@keyframes jitter {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(.25cqw, -.35cqw); }
  50% { transform: translate(-.2cqw, .2cqw); }
  75% { transform: translate(.3cqw, .25cqw); }
}
@keyframes jitter-hard {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(.6cqw, -.5cqw) rotate(.6deg); }
  50% { transform: translate(-.5cqw, .4cqw) rotate(-.6deg); }
  75% { transform: translate(.5cqw, .5cqw) rotate(.3deg); }
}

/* App windows */
.win {
  width: 35cqw; font-size: 1.7cqw; line-height: 1.35;
}
.win .float {
  background: var(--paper); border: 1px solid var(--line); border-radius: 1.6cqw; overflow: hidden;
  box-shadow: 0 1.5cqw 3cqw -1.6cqw #1d2e2633;
  transition: opacity .25s ease, box-shadow .25s ease;
}
.is-chaos .win:not(.focus) .float { opacity: .72; }
.win.focus .float { opacity: 1; box-shadow: 0 0 0 .45cqw var(--green-2), 0 1.5cqw 3cqw -1.6cqw #1d2e2633; }
.win.focus::after {
  content: "Membalas\2026"; position: absolute; right: 1.2cqw; bottom: -1.6cqw;
  padding: .2em .7em; border-radius: 99px; background: var(--green); color: #fff;
  font-size: 1.5cqw; font-weight: 800;
}
.win-head { display: flex; align-items: center; gap: .55em; padding: .6em .8em; font-weight: 800; color: #fff; }
.win.wa .win-head { background: #1f9e50; }
.win.tg .win-head { background: #2389c9; }
.win.em .win-head { background: #5b6964; }
.win.grp, .win.chn { width: 29cqw; }
.win-head { white-space: nowrap; }
.win-head > :not(.ch):not(.count) { overflow: hidden; text-overflow: ellipsis; }
.win.grp .win-head { background: #127a3c; }
.win.chn .win-head { background: #1a6fa6; }
.win .at { color: #1a77b8; font-weight: 800; margin-right: .25em; }
.win-head .ch { width: 1.6em; height: 1.6em; background: #ffffff33; }
.count { margin-left: auto; min-width: 2.2em; padding: .05em .55em; border-radius: 99px; background: #e5533f; color: #fff; text-align: center; font-size: .9em; }
.win p { margin: 0; padding: .5em .85em; border-top: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win p strong { display: block; font-size: .9em; color: var(--ink); }

/* The overwhelmed agent */
.agent .float { display: grid; justify-items: center; gap: .6cqw; width: 19cqw; }
.face {
  display: grid; place-items: center; width: 10cqw; height: 10cqw; border-radius: 50%;
  background: var(--mint); color: var(--green); font-size: 3.2cqw; font-weight: 800;
  border: .5cqw solid var(--paper); box-shadow: 0 1cqw 2.4cqw -1.2cqw #1d2e2655;
  transition: background .4s ease, color .4s ease;
}
.is-stress .face { background: #fde3df; color: #b4382d; }
.agent-label { padding: .2em .8em; border-radius: 99px; background: var(--ink); color: #fff; font-size: 1.6cqw; font-weight: 800; white-space: nowrap; }
.marks { position: absolute; top: -3.4cqw; left: 50%; width: 14cqw; transform: translateX(-50%); display: flex; justify-content: space-between; pointer-events: none; }
.marks i { font-style: normal; font-weight: 800; font-size: 3cqw; color: #e5533f; opacity: 0; transform: translateY(1cqw) scale(.6); }
.is-stress .marks i { animation: mark 1.1s ease-in-out infinite; }
.is-stress .marks i:nth-child(2) { animation-delay: .25s; }
.is-stress .marks i:nth-child(3) { animation-delay: .5s; }
@keyframes mark {
  0% { opacity: 0; transform: translateY(1cqw) scale(.6); }
  30%, 70% { opacity: 1; transform: translateY(-.6cqw) scale(1); }
  100% { opacity: 0; transform: translateY(-1.6cqw) scale(.9); }
}

/* Wait timer */
.timer .float {
  display: grid; padding: .7cqw 1.4cqw; border-radius: 1.2cqw; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 1cqw 2cqw -1.2cqw #1d2e2640;
}
.timer small { font-size: 1.4cqw; font-weight: 700; color: var(--muted); }
.timer .clock { font-size: 2.8cqw; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); transition: color .3s ease; }
.is-stress .timer .clock { color: #d23c2b; }

/* Problem tags */
.tag .float {
  padding: .45em .9em; border-radius: .7em; background: #fff1ef; border: 1px solid #f3c2bb;
  color: #b4382d; font-size: 1.75cqw; font-weight: 800; white-space: nowrap;
  box-shadow: 0 1cqw 2cqw -1.2cqw #b4382d55;
}
.tag .float::before { content: "\26A0  "; }

/* Loose bubbles */
.bub .float {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .55em .9em .55em .55em; border-radius: 99px; background: var(--paper); border: 1px solid var(--line);
  font-size: 1.8cqw; font-weight: 700; white-space: nowrap; color: var(--ink);
  box-shadow: 0 1cqw 2cqw -1.2cqw #1d2e2640;
}
.bub .ch { width: 1.8em; height: 1.8em; }

/* Logo moment between the chaos and the dashboard */
.burst {
  position: absolute; z-index: 4; left: 50%; top: 56%;
  display: grid; justify-items: center; gap: 1.6cqw;
  opacity: 0; transform: translate(-50%, -50%) scale(.35);
  transition: opacity .3s ease, transform .3s ease; pointer-events: none;
}
.burst-word { width: 54cqw; height: auto; }
.burst-line { font-size: 2.4cqw; font-weight: 800; color: var(--muted); white-space: nowrap; opacity: 0; transform: translateY(6px); transition: opacity .4s ease .35s, transform .4s ease .35s; }
.is-logo .burst-line { opacity: 1; transform: none; }
.is-logo .burst { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: opacity .35s ease, transform .7s cubic-bezier(.3,1.6,.5,1); }
.is-logo .burst-word { animation: beat 1.2s ease-in-out .5s; }
@keyframes beat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.08); } }
.is-calm .burst { opacity: 0; transform: translate(-50%, -50%) scale(1.25); transition: opacity .45s ease, transform .6s ease; }

@media (prefers-reduced-motion: reduce) {
  .chaos, .burst, .cap-chaos { display: none; }
  .cap-calm { opacity: 1; transform: none; }
  .stage-laptop, .story .chips, .story .row, .story .chat-head, .story .msgs p, .story .ai-suggest { opacity: 1; transform: none; transition: none; }
}
@media (max-width: 980px) {
  .captions { display: flex; justify-content: center; }
  .cap { left: 50%; transform: translate(-50%, 6px); }
  .is-chaos .cap-chaos, .is-calm .cap-calm { transform: translateX(-50%); }
}

/* Hero copy: the key-feature word rolls through like r1's, with a
   hand-drawn underline that sketches itself under each new word. */
.roll { position: relative; display: inline-block; white-space: nowrap; vertical-align: bottom; color: var(--green); font-weight: 800; transition: width .4s cubic-bezier(.16,1,.3,1); }
.roll-sizer { visibility: hidden; }
.roll-clip { position: absolute; inset: 0 -40% 0 0; overflow: hidden; }
.roll-word { position: absolute; left: 0; top: 0; white-space: nowrap; transform: translateY(0); transition: transform .4s cubic-bezier(.16,1,.3,1); }
.roll-word.up { transform: translateY(-110%); }
.roll-word.below { transform: translateY(110%); transition: none; }
.roll-line { position: absolute; left: 0; right: 0; bottom: -.16em; width: 100%; height: .42em; overflow: visible; }
.roll-line path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset .4s cubic-bezier(.16,1,.3,1) .4s, opacity .15s ease .4s; }
.roll-line.reset path { stroke-dashoffset: 1; opacity: 0; transition: none; }
