/* Agent overlay: Medal 4's LOOK (Mon Nov 30, 02:0x), ADOPTED as Sr Dev 2's site/shared/overlay.css —
   now byte-identical to overlay-look.css again (the .cpo-pause addition was removed in rev 4).
   Class names use a cpo- prefix; tokens are the page kit's own (--cpk-*), so it matches every demo.
   Assumed markup (inserted as the FIRST child of figure.cpk-demo, which is already position:relative):
   <div class="cpo" role="group" aria-label="Project engineer, step by step">
     <div class="cpo-head"><img class="cpo-art" src="/art/project-office.svg" alt=""><b class="cpo-role">Project engineer</b><span class="cpo-state" aria-hidden="true"></span></div>
     <ol class="cpo-lines"><li class="cpo-line">…</li>…</ol>
     <span class="cpo-dots" aria-hidden="true"><i></i><i></i><i></i></span>
     <button type="button" class="cpo-replay">Replay</button>
   </div>
   States on .cpo: is-working | is-done.  Lines: .is-cur (newest), .is-prev (the one before), others hidden while playing. */

/* 1. The window: small, white, floating over the mock-up's top-right corner (covers only the window-head pill area,
      never the rows the lines talk about) */
.cpk-demo > .cpo{overflow-anchor:none;position:absolute;z-index:4;top:-14px;right:-12px;width:280px;max-width:calc(100% - 24px);
  box-sizing:border-box;padding:12px 14px 10px;background:#fff;color:var(--cpk-ink);
  border:1px solid #e4e4f0;border-radius:14px;box-shadow:0 14px 36px -8px #17173c40,0 2px 6px #17173c14;
  font-family:var(--cpk-font);font-size:14px;line-height:1.35;text-align:left;
  opacity:0;transform:translateY(6px);transition:opacity .35s ease,transform .45s ease}
.cpk-demo > .cpo.is-in{opacity:1;transform:none}
/* oasis-scrub fix (Medal 4, Nov 30): Chrome's scroll anchoring may pick a line inside this window as the anchor;
   when the lines re-flow it scrolls the visitor's page 2-3 px. overflow-anchor:none keeps the window out of anchor choice. */
@media (max-width:1199.98px){.cpk-demo > .cpo{right:10px}}          /* never past the viewport edge */

.cpo-head{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.cpo-art{width:32px;height:32px;border-radius:50%;background:#f3f3fb;border:1px solid #e4e4f0;object-fit:cover;flex:none}
.cpo-role{font-weight:600;font-size:14px;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cpo-state{width:8px;height:8px;border-radius:50%;flex:none;background:var(--cpk-signal);box-shadow:0 0 0 0 #4440ff55}
.cpo.is-working .cpo-state{animation:cpo-pulse 1.4s ease-out infinite}
.cpo.is-done .cpo-state{width:16px;height:16px;background:var(--cpk-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat;animation:none}
@keyframes cpo-pulse{0%{box-shadow:0 0 0 0 #4440ff55}100%{box-shadow:0 0 0 8px #4440ff00}}

/* 2. Lines: one at a time. The newest is ink and full size, the one before sits above it, faded; older ones are gone */
.cpo-lines{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;justify-content:flex-end;min-height:3.9em}
.cpo-line{display:none;margin:0}
.cpo-line.is-prev{display:block;color:var(--cpk-meta);font-size:13px;margin-bottom:3px}
.cpo-line.is-cur{display:block;font-weight:500;animation:cpo-line .3s ease}
@keyframes cpo-line{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.cpo.is-done .cpo-line.is-cur{color:var(--cpk-ink);font-weight:600}

/* typing dots before each line */
.cpo-dots{display:none;gap:4px;padding:4px 0 2px}
.cpo.is-typing .cpo-dots{display:inline-flex}
.cpo-dots i{width:5px;height:5px;border-radius:50%;background:#b9b9d0;animation:cpo-dot 1s infinite}
.cpo-dots i:nth-child(2){animation-delay:.15s}.cpo-dots i:nth-child(3){animation-delay:.3s}
@keyframes cpo-dot{0%,60%,100%{opacity:.35;transform:none}30%{opacity:1;transform:translateY(-2px)}}

/* Replay: quiet text button, shown once the run is done (the overlay's ONLY control:
   no Pause of its own — Minor 3 — and the page's Pause is never driven, it throws on
   9 pages). */
.cpo-replay{all:unset;display:none;margin-top:6px;font-size:13px;font-weight:500;color:var(--cpk-signal);cursor:pointer;min-height:32px;align-items:center}
.cpo.is-done .cpo-replay{display:inline-flex}
.cpo-replay:focus-visible{outline:2px solid var(--cpk-signal);outline-offset:2px;border-radius:6px}
@media (pointer:coarse){.cpo-replay{min-height:44px}}

/* 3. Actions on the mock-up (classes added by the overlay; nothing in the page is removed or retexted) */
.cpo-hl{outline:2px solid var(--cpk-signal)!important;outline-offset:-2px;background:var(--cpk-tint)!important;transition:background-color .25s,outline-color .25s}
.cpk-row.cpo-hl{box-shadow:inset 3px 0 0 var(--cpk-signal)}
.cpo-fill{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:6px;background:var(--cpk-tint);color:var(--cpk-signal);font-weight:600;white-space:nowrap}
.cpo-fill.is-typing::after{content:"";display:inline-block;width:1px;height:1em;margin-left:1px;vertical-align:-2px;background:currentColor;animation:cpo-caret .8s steps(1) infinite}
@keyframes cpo-caret{50%{opacity:0}}
/* FIX B: the badge sits AFTER the text (inline), never on a letter; rows keep it on their left edge */
.cpo-tick::after{content:"";display:inline-block;vertical-align:middle;width:18px;height:18px;margin:-3px 0 0 6px;border-radius:50%;
  background:var(--cpk-ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
  box-shadow:0 0 0 2px #fff;animation:cpo-pop .3s ease}
.cpk-row.cpo-tick{position:relative}
.cpk-row.cpo-tick::after{position:absolute;left:-9px;top:50%;margin:-9px 0 0}
@keyframes cpo-pop{from{transform:scale(.4);opacity:0}to{transform:none;opacity:1}}
.cpo-open{box-shadow:0 0 0 3px #4440ff40,0 18px 40px -12px #17173c55!important;transform:translateY(-2px);transition:box-shadow .3s,transform .3s}

/* 4. HOLD: while the overlay plays, the page's own quiet loop keeps running (we never touch its script or Pause),
      but its look is held on the finished screen, so the rows the lines talk about never fade, rewind or hide
      mid-run. Toggle .cpo-hold on the figure at the first step; drop it at the loop's next .is-reset after the run. */
.cpo-hold.cpk-live [data-in]:not(.is-on){opacity:1;transform:none}
.cpo-hold.cpk-live .cpk-ai[data-in]:not(.is-on){transform:none}
.cpo-hold.cpk-live .cpk-bar[data-in]:not(.is-on) i,.cpo-hold.cpk-live .cpk-cols[data-in]:not(.is-on) i{transform:none}
.cpo-hold.cpk-live [data-out]:not(.is-off){opacity:0;visibility:hidden}
.cpo-hold.cpk-live .cpk-row.is-flagged[data-flag]:not(.is-flag-on){box-shadow:inset 3px 0 0 var(--cpk-over);background:#fff6f5}
.cpo-hold.cpk-live .cpk-row.is-now:not(.cpo-hl){background:transparent}
.cpo-hold.cpk-live.is-reset .cpk-main,.cpo-hold.cpk-live.is-reset .cpk-page,.cpo-hold.cpk-live.is-reset .cpk-ai{opacity:1}

/* 5. Phone (<600px): a strip in the flow at the mock-up's TOP edge, not floating, so it can never cover a row.
      It is on screen when the run starts (the run starts as the mock-up's top comes into view); a bottom dock would be
      below the fold on the tall phone mock-ups, and a sticky one covers rows as you scroll. */
@media (max-width:599.98px){
  .cpk-demo > .cpo{position:relative;top:auto;right:auto;width:auto;max-width:none;grid-column:1/-1;grid-row:1;
    margin:0 6px -10px;padding:10px 12px 8px;border-radius:12px}
  .cpk-demo > .cpo ~ .cpk-win,.cpk-demo:has(> .cpo) > .cpk-win{grid-row:2}
  .cpo-lines{min-height:2.7em}
  .cpo-line.is-prev{display:none}
  /* FIX C: the strip keeps ONE height all run (it is in the flow: any change moves the whole mock-up).
     Typing dots and Replay live in the head row, so they add no height. */
  .cpk-demo > .cpo .cpo-dots{position:absolute;top:24px;right:36px;padding:0}
  .cpk-demo > .cpo .cpo-replay{position:absolute;top:10px;right:34px;margin:0;min-height:32px}
  .cpo.is-done .cpo-role{padding-right:64px}
  /* v3 (Medal 4 ruling): the strip travels with the visitor through the mock-up (sticky under the 53 px page bar),
     so the words stay on screen while they scroll down to the rows being marked. The engine still never scrolls. */
  .cpk-demo > .cpo{position:sticky;top:60px}
  .cpk-split:has(.cpo){overflow:clip}   /* healthcare hub only: overflow:hidden stops sticky; clip cuts the same way */
}

/* 6. Reduced motion: no motion, every line shown, actions in their end state */
@media (prefers-reduced-motion:reduce){
  .cpk-demo > .cpo{opacity:1;transform:none;transition:none}
  .cpo-line{display:block!important;animation:none!important;color:var(--cpk-ink)!important;font-size:13px!important;margin:0 0 3px!important}
  .cpo-dots,.cpo-replay{display:none!important}
  .cpo-state,.cpo-tick::after,.cpo-fill.is-typing::after{animation:none!important}
}
