/* ============================================================
   MB-CU · "State-of-the-art computer use" MacBook demo
   Compressed rebuild of act.css for the MacBook screen.
   Consumes tokens.css + base.css. Every selector prefixed .cu-.
   Green --act = action/detect · cyan --see = scan.
   Geometry: a fixed design stage (720×450 desktop, 520×325 under
   980px viewports), scaled to the real .mac-screen width by
   js/mb-cu.js via --cu-s. All px inside are design px. Detection
   frames are anchored INSIDE their target elements so they can
   never drift at any width.
   ============================================================ */

.cu-app {
  position: absolute; inset: 0;
  overflow: hidden;
  background: var(--bg-1);
  font-family: var(--font-body);
  user-select: none;
}

.cu-stage {
  position: absolute; left: 0; top: 0;
  /* design stage; page scales it to the screen (720 desktop, 520 stacked) */
  width: 720px; height: 450px;
  transform: scale(var(--cu-s, 1));
  transform-origin: 0 0;
  display: flex; flex-direction: column;
}

/* ---------- titlebar (app chrome; nothing in the notch center) ---------- */
.cu-titlebar {
  flex: none; height: 26px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line);
}
.cu-dots { display: inline-flex; gap: 5px; flex: none; }
.cu-dot { width: 7px; height: 7px; border-radius: 50%; display: block; opacity: 0.9; }
.cu-dot--r { background: var(--danger); }
.cu-dot--y { background: var(--warm); }
.cu-dot--g { background: var(--act); }
.cu-title {
  flex: 1 1 auto; min-width: 0;
  font-size: 10px; letter-spacing: 0.02em;
  color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cu-capture {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  font-size: 8px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--see);
}
.cu-capture-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--see);
  animation: cu-capture-pulse 2.2s var(--ease-out) infinite;
}
@keyframes cu-capture-pulse {
  0%   { box-shadow: 0 0 0 0 var(--see-glow); }
  70%  { box-shadow: 0 0 0 4px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- viewport (the captured screen surface) ---------- */
.cu-viewport {
  position: relative; flex: 1 1 auto; min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% 0%, var(--act-soft), transparent 55%),
    radial-gradient(120% 120% at 100% 100%, var(--see-soft), transparent 55%),
    var(--bg-1);
}

/* ---------- scenes ---------- */
.cu-scene {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transform: translateX(14px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), visibility 0s linear 0.45s;
}
.cu-scene--a { transform: translateX(-14px); }
.cu-scene.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s, 0s, 0s; }

/* ---------- inline icons ---------- */
.cu-ic { display: block; }
.cu-ic path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
   SCENE A · analytics dashboard   (viewport 720×402 desktop)
   ============================================================ */
.cu-a-head { position: absolute; left: 24px; top: 20px; display: flex; align-items: baseline; gap: 9px; }
.cu-a-title {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em;
  font-size: 16px; line-height: 1; color: var(--fg);
}
.cu-a-sub { font-size: 8px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-dim); }

.cu-a-export {
  position: absolute; right: 24px; top: 16px;
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 600; font-size: 10px; letter-spacing: 0.04em;
  color: var(--act-ink); background: var(--act);
  padding: 6px 12px; border-radius: var(--r-sm);
  box-shadow: 0 3px 10px var(--act-glow);
}
.cu-a-export .cu-ic { width: 11px; height: 11px; }

.cu-a-kpi { position: absolute; left: 24px; top: 84px; }
.cu-a-kpi-label { font-size: 8px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 5px; }
.cu-a-kpi-num { font-size: 30px; line-height: 0.95; font-weight: 500; letter-spacing: -0.02em; color: var(--fg); }
.cu-a-kpi-delta { margin-top: 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; color: var(--act); }

.cu-a-mini { position: absolute; right: 24px; top: 88px; text-align: right; }
.cu-a-mini-label { font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 4px; }
.cu-a-mini-num { font-size: 15px; font-weight: 500; color: var(--fg-muted); }

/* explicit width: an abs-positioned table shrink-to-fits and ignores right */
.cu-a-table { position: absolute; left: 24px; top: 176px; width: 672px; border-collapse: collapse; }
.cu-a-table th, .cu-a-table td { text-align: left; line-height: 1.25; border-bottom: 1px solid var(--line); }
.cu-a-table th:last-child, .cu-a-table td:last-child { text-align: right; }
.cu-a-table th {
  padding: 8px 10px;
  font-weight: 500; font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-dim); border-bottom-color: var(--line-2);
}
.cu-a-table th:first-child { width: 150px; }
.cu-a-table th:nth-child(2) { width: 260px; }
.cu-a-table td { padding: 9px 10px; font-size: 11px; color: var(--fg-muted); }
.cu-a-table td:first-child, .cu-a-table td:nth-child(2) { color: var(--fg); }
.cu-a-table tbody tr:nth-child(3) td { border-bottom-color: var(--line-2); }
.cu-a-table tr:last-child td { border-bottom: none; }
.cu-a-total td { color: var(--fg); }
.cu-pos { color: var(--act); }

.cu-a-foot { position: absolute; left: 24px; bottom: 14px; font-size: 8px; color: var(--fg-dim); letter-spacing: 0.04em; }

/* ============================================================
   SCENE B · Slack #finance   (viewport 720×402 desktop)
   ============================================================ */
.cu-b-head {
  position: absolute; left: 24px; right: 24px; top: 12px; height: 30px;
  display: flex; align-items: center; gap: 7px;
  border-bottom: 1px solid var(--line);
}
.cu-b-logo { width: 14px; height: 14px; flex: none; }
.cu-b-hash { color: var(--fg-dim); font-size: 13px; font-weight: 500; margin-left: 3px; }
.cu-b-chan { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; font-size: 14px; color: var(--fg); }
.cu-b-meta { margin-left: auto; font-size: 8px; color: var(--fg-dim); letter-spacing: 0.06em; }

.cu-b-thread { position: absolute; left: 24px; right: 24px; top: 58px; }
.cu-b-msg { display: flex; gap: 11px; align-items: flex-start; margin-bottom: 16px; }
.cu-b-avatar {
  flex: none; width: 24px; height: 24px; border-radius: 5px;
  background: var(--bg-3); color: var(--fg-muted);
  display: grid; place-items: center;
  font-weight: 700; font-size: 10px;
}
.cu-b-avatar--al { background: var(--act-soft); color: var(--act); border: 1px solid var(--act-soft); font-size: 9px; }
.cu-b-body { min-width: 0; }
.cu-b-name { display: flex; align-items: baseline; gap: 6px; color: var(--fg); font-weight: 600; font-size: 11px; line-height: 1.1; }
.cu-b-time { color: var(--fg-dim); font-weight: 400; font-size: 8px; }
.cu-b-badge {
  font-size: 7px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-dim); background: var(--bg-3);
  border: 1px solid var(--line); border-radius: 2px; padding: 1px 4px;
}
.cu-b-text { color: var(--fg-muted); font-size: 11px; line-height: 1.35; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the agent's message posts into the thread on send */
.cu-b-post { display: none; }
.cu-b-post.is-in { display: flex; animation: cu-post-in 0.4s var(--ease-out); }
@keyframes cu-post-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* attachment chip (in the posted message and in compose) */
.cu-chipfile {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  font-size: 9px; color: var(--fg-muted);
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 4px 8px; white-space: nowrap;
}
.cu-chipfile .cu-ic { width: 10px; height: 10px; color: var(--act); }
.cu-chipfile-sz { color: var(--fg-dim); }

/* compose */
.cu-b-compose {
  position: absolute; left: 24px; right: 24px; top: 316px; height: 68px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.cu-b-ph { position: absolute; left: 14px; top: 12px; font-size: 11px; color: var(--fg-dim); transition: opacity var(--dur-2) var(--ease); }
.cu-b-compose.is-typing .cu-b-ph, .cu-b-compose.is-filled .cu-b-ph { opacity: 0; }
.cu-b-input {
  position: absolute; left: 14px; top: 12px; right: 100px;
  display: flex; align-items: baseline;
  white-space: nowrap; overflow: hidden;
}
.cu-type { color: var(--fg); font-size: 11px; line-height: 1.3; }
.cu-caret {
  display: inline-block; flex: none; width: 2px; height: 13px;
  background: var(--act); margin-left: 1px; align-self: center; opacity: 0;
}
.cu-b-compose.is-typing .cu-caret { animation: cu-caret-blink 1s steps(1) infinite; }
@keyframes cu-caret-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.cu-b-attach {
  position: absolute; left: 12px; bottom: 10px; margin-top: 0;
  opacity: 0; transform: translateY(4px) scale(0.97);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.cu-b-attach.is-on { opacity: 1; transform: none; }

.cu-b-send {
  position: absolute; right: 10px; bottom: 10px; height: 24px;
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 600; font-size: 9px; letter-spacing: 0.04em;
  color: var(--act-ink); background: var(--act);
  padding: 0 11px; border-radius: var(--r-sm);
  box-shadow: 0 2px 8px var(--act-glow);
}
.cu-b-send .cu-ic { width: 10px; height: 10px; }
.cu-b-send.is-flash { animation: cu-btn-flash 0.45s var(--ease-out); }
@keyframes cu-btn-flash {
  0%   { box-shadow: 0 2px 8px var(--act-glow); }
  40%  { box-shadow: 0 0 0 5px var(--act-soft), 0 2px 8px var(--act-glow); }
  100% { box-shadow: 0 2px 8px var(--act-glow); }
}

/* green confirmation pill */
.cu-done {
  position: absolute; left: 50%; top: 240px;
  transform: translate(-50%, -50%) scale(0.92);
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 600; font-size: 10px;
  color: var(--act); background: var(--act-soft);
  border: 1px solid var(--act); border-radius: var(--r-pill);
  padding: 6px 13px;
  box-shadow: 0 4px 14px var(--act-glow);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), visibility 0s linear var(--dur-2);
}
.cu-done .cu-ic { width: 11px; height: 11px; }
.cu-done .cu-ic path { stroke-width: 2.6; }
.cu-done.is-on { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); transition-delay: 0s; }

/* ============================================================
   DETECTION FRAMES · anchored inside their targets
   (corner brackets via shared .detect-frame + tiny mono label)
   ============================================================ */
.cu-detect {
  position: absolute; inset: -6px;
  --c: var(--act); --len: 10px; --thick: 2px; --inset: 0px;
  border: 1px solid var(--act-soft);
  background: var(--act-soft);
  border-radius: 3px;
  opacity: 0; transform: scale(1.07);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
  pointer-events: none; z-index: 4;
}
.cu-detect--wide { inset: -8px -12px; }
.cu-detect.is-on { opacity: 1; transform: none; }
.cu-detect.is-flash { animation: cu-box-flash 0.5s var(--ease-out); }
@keyframes cu-box-flash {
  0%   { box-shadow: 0 0 0 0 var(--act-glow); background: var(--act-soft); border-color: var(--act-soft); }
  35%  { box-shadow: 0 0 0 5px transparent;   background: var(--act-glow); border-color: var(--act); }
  100% { box-shadow: 0 0 0 0 transparent;     background: var(--act-soft); border-color: var(--act-soft); }
}

.cu-detect-label {
  position: absolute; left: -1px; bottom: 100%; margin-bottom: 4px;
  font-size: 9px; font-weight: 600; line-height: 1; letter-spacing: 0.02em;
  padding: 3px 6px;
  background: var(--act); color: var(--act-ink);
  border-radius: 3px; border-bottom-left-radius: 0;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--act-glow);
}
.cu-detect-label--below { bottom: auto; top: 100%; margin-bottom: 0; margin-top: 4px; border-radius: 3px; border-top-left-radius: 0; }
.cu-detect-label--right { left: auto; right: -1px; border-radius: 3px; border-bottom-right-radius: 0; }
.cu-detect-label--below.cu-detect-label--right { border-radius: 3px; border-top-right-radius: 0; }

/* ============================================================
   OVERLAY · cyan scan sweep + agent pointer
   ============================================================ */
.cu-overlay { position: absolute; inset: 0; z-index: 12; pointer-events: none; }

.cu-scan {
  position: absolute; left: 0; right: 0; top: 0; height: 30%;
  transform: translateY(-120%); opacity: 0;
  background: linear-gradient(to bottom, transparent 0%, var(--see-soft) 78%, var(--see-glow) 100%);
  border-bottom: 1px solid var(--see);
  box-shadow: 0 1px 10px var(--see-glow);
}
.cu-scan.is-run { animation: cu-scan-sweep 1.5s var(--ease) forwards; }
@keyframes cu-scan-sweep {
  0%   { transform: translateY(-120%); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(360%); opacity: 0; }
}

.cu-pointer {
  position: absolute; left: 690px; top: 428px;
  width: 17px; height: 17px;
  transform: translate(-20%, -13%);
  transition: left 0.8s var(--ease), top 0.8s var(--ease);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.55)); /* matches act.css pointer shadow */
  will-change: left, top;
}
.cu-pointer-cursor { width: 100%; height: 100%; overflow: visible; }
.cu-pointer-cursor path { fill: var(--act); stroke: var(--bg); stroke-width: 1.4; stroke-linejoin: round; }
.cu-pointer.is-click .cu-pointer-cursor { animation: cu-press 0.42s var(--ease-out); }

.cu-pointer-ripple {
  position: absolute; left: 3px; top: 3px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--act);
  transform: translate(-50%, -50%) scale(0.2); opacity: 0;
}
.cu-pointer.is-click .cu-pointer-ripple { animation: cu-ripple 0.5s var(--ease-out); }

@keyframes cu-press { 0% { transform: scale(1); } 45% { transform: scale(0.8); } 100% { transform: scale(1); } }
@keyframes cu-ripple {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.85; }
  100% { transform: translate(-50%, -50%) scale(1.9); opacity: 0; }
}

/* ============================================================
   STATUS STRIP · one-line mono agent log
   ============================================================ */
.cu-status {
  flex: none; height: 22px;
  display: flex; align-items: center; gap: 7px;
  padding: 0 12px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  font-size: 10px; letter-spacing: 0.02em;
}
.cu-status-dot {
  flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--act);
  box-shadow: 0 0 6px var(--act-glow);
  animation: cu-status-pulse 2.4s var(--ease-out) infinite;
}
@keyframes cu-status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.cu-status-line { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
.cu-status-line.is-tick { animation: cu-tick 0.3s var(--ease-out); }
@keyframes cu-tick { from { opacity: 0.15; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.cu-status-verb { font-weight: 700; flex: none; }
.cu-v-see  { color: var(--see); }
.cu-v-plan { color: var(--fg-muted); }
.cu-v-act  { color: var(--act); }
.cu-status-sep { color: var(--fg-dim); flex: none; }
.cu-status-text { color: var(--fg-muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   NARROW STAGE · 520×325 (stacked layouts under 980px viewports)
   Same scenes, compressed verticals, slightly smaller type.
   ============================================================ */
@media (max-width: 980px) {
  .cu-stage { width: 520px; height: 325px; }

  /* chrome */
  .cu-titlebar { height: 22px; gap: 8px; padding: 0 10px; }
  .cu-dot { width: 6px; height: 6px; }
  .cu-title { font-size: 9px; }
  .cu-capture { font-size: 7px; gap: 4px; }
  .cu-capture-dot { width: 5px; height: 5px; }
  .cu-status { height: 18px; gap: 6px; padding: 0 10px; font-size: 9px; }
  .cu-status-dot { width: 5px; height: 5px; }

  /* scene A (viewport 520×285) */
  .cu-a-head { left: 18px; top: 12px; gap: 8px; }
  .cu-a-title { font-size: 14px; }
  .cu-a-sub { font-size: 7px; }
  .cu-a-export { right: 18px; top: 10px; font-size: 9px; padding: 5px 10px; }
  .cu-a-export .cu-ic { width: 10px; height: 10px; }
  .cu-a-kpi { left: 18px; top: 58px; }
  .cu-a-kpi-label { font-size: 7px; margin-bottom: 4px; }
  .cu-a-kpi-num { font-size: 26px; }
  .cu-a-kpi-delta { font-size: 9px; margin-top: 5px; }
  .cu-a-mini { right: 18px; top: 62px; }
  .cu-a-mini-label { font-size: 7px; margin-bottom: 3px; }
  .cu-a-mini-num { font-size: 13px; }
  .cu-a-table { left: 18px; top: 128px; width: 484px; }
  .cu-a-table th { padding: 6px 8px; font-size: 7px; }
  .cu-a-table th:first-child { width: 110px; }
  .cu-a-table th:nth-child(2) { width: 190px; }
  .cu-a-table td { padding: 6px 8px; font-size: 10px; }
  .cu-a-foot { left: 18px; bottom: 10px; font-size: 7.5px; }

  /* scene B (viewport 520×285) */
  .cu-b-head { left: 18px; right: 18px; top: 8px; height: 26px; gap: 6px; }
  .cu-b-logo { width: 12px; height: 12px; }
  .cu-b-hash { font-size: 12px; }
  .cu-b-chan { font-size: 12.5px; }
  .cu-b-meta { font-size: 7px; }
  .cu-b-thread { left: 18px; right: 18px; top: 44px; }
  .cu-b-msg { gap: 9px; margin-bottom: 12px; }
  .cu-b-avatar { width: 20px; height: 20px; font-size: 9px; border-radius: 4px; }
  .cu-b-avatar--al { font-size: 8px; }
  .cu-b-name { font-size: 10px; gap: 5px; }
  .cu-b-time { font-size: 7px; }
  .cu-b-badge { font-size: 6px; padding: 1px 3px; }
  .cu-b-text { font-size: 10px; margin-top: 2px; }
  .cu-chipfile { font-size: 8px; padding: 3px 6px; gap: 4px; margin-top: 5px; }
  .cu-chipfile .cu-ic { width: 9px; height: 9px; }
  .cu-b-compose { left: 18px; right: 18px; top: 215px; height: 56px; }
  .cu-b-ph { left: 12px; top: 10px; font-size: 10px; }
  .cu-b-input { left: 12px; top: 10px; right: 84px; }
  .cu-type { font-size: 10px; }
  .cu-caret { height: 11px; width: 1.5px; }
  .cu-b-attach { left: 10px; bottom: 8px; }
  .cu-b-send { right: 8px; bottom: 8px; height: 21px; font-size: 8px; padding: 0 9px; }
  .cu-b-send .cu-ic { width: 9px; height: 9px; }
  .cu-done { top: 176px; font-size: 9px; padding: 5px 11px; }
  .cu-done .cu-ic { width: 10px; height: 10px; }

  /* detection + pointer */
  .cu-detect { inset: -5px; --len: 8px; --thick: 1.5px; }
  .cu-detect--wide { inset: -6px -9px; }
  .cu-detect-label { font-size: 8px; padding: 2.5px 5px; margin-bottom: 3px; }
  .cu-detect-label--below { margin-top: 3px; }
  .cu-pointer { width: 15px; height: 15px; }
  .cu-pointer-ripple { width: 28px; height: 28px; left: 2.5px; top: 2.5px; }
}

/* ============================================================
   REDUCED MOTION · static end state (set by js/mb-cu.js)
   base.css zeroes durations; also stop ambient loops here.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .cu-capture-dot, .cu-status-dot { animation: none; }
  .cu-scan { display: none; }
  .cu-caret { display: none; }
  .cu-pointer { transition: none; }
}
