/* Scene playback on interaction (V2 home).
   Scenes rest on their complete static frame. A mouse over the scene, keyboard
   focus on its play control or a tap on play wakes it up: the frame lifts, a
   tinted dot texture fades in and drifts, registration marks close in on the
   corners, and the demo plays. Nothing here downloads an asset: the texture is
   drawn with gradients and only animates while the scene is active. */

/* The horizontal platform is presented on its finished frame. */
[data-soceo-scene-playback="interaction"] .ws-feature--platform .ws-window-footer { display: none !important; }

[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame {
  --fx-dot: color-mix(in oklab, var(--q-demo-ground, #ebe6fb) 30%, #6728d4);
  --fx-mark: color-mix(in oklab, var(--q-demo-ground, #ebe6fb) 20%, #16033a);
  isolation: isolate;
}

/* Tinted dot field, masked into soft blotches like a noise texture. */
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame::before {
  content: "";
  position: absolute;
  inset: -34px -40px;
  z-index: -1;
  border-radius: 28px;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--fx-dot) 0 1.1px, transparent 1.6px);
  background-size: 8px 8px;
  -webkit-mask-image:
    radial-gradient(40% 48% at 10% 18%, #000 0 34%, transparent 74%),
    radial-gradient(36% 44% at 92% 80%, #000 0 30%, transparent 72%),
    radial-gradient(30% 36% at 70% 6%, #000 0 24%, transparent 70%),
    radial-gradient(26% 30% at 24% 96%, #000 0 20%, transparent 68%);
  mask-image:
    radial-gradient(40% 48% at 10% 18%, #000 0 34%, transparent 74%),
    radial-gradient(36% 44% at 92% 80%, #000 0 30%, transparent 72%),
    radial-gradient(30% 36% at 70% 6%, #000 0 24%, transparent 70%),
    radial-gradient(26% 30% at 24% 96%, #000 0 20%, transparent 68%);
  -webkit-mask-size: 160% 160%;
  mask-size: 160% 160%;
  opacity: 0;
  transition: opacity .45s ease;
  animation: ws-fx-drift 9s linear infinite paused;
}

/* Registration marks on the four corners, closing in when the scene wakes. */
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame::after {
  content: "";
  position: absolute;
  inset: -9px;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle, transparent 0 3.2px, var(--fx-mark) 3.4px 4.4px, transparent 4.6px) left top / 12px 12px no-repeat,
    radial-gradient(circle, transparent 0 3.2px, var(--fx-mark) 3.4px 4.4px, transparent 4.6px) right top / 12px 12px no-repeat,
    radial-gradient(circle, transparent 0 3.2px, var(--fx-mark) 3.4px 4.4px, transparent 4.6px) left bottom / 12px 12px no-repeat,
    radial-gradient(circle, transparent 0 3.2px, var(--fx-mark) 3.4px 4.4px, transparent 4.6px) right bottom / 12px 12px no-repeat;
  opacity: 0;
  transform: scale(1.025);
  transition: opacity .3s ease, transform .5s cubic-bezier(.2, .8, .2, 1);
}

[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage {
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s ease;
}

/* Active: mouse over the scene, keyboard focus on play, or playing (tap). */
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform)[data-ws-playing] .ws-stage-frame::before,
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform):has(.ws-play:focus-visible) .ws-stage-frame::before {
  opacity: .75;
  animation-play-state: running;
}
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform)[data-ws-playing] .ws-stage-frame::after,
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform):has(.ws-play:focus-visible) .ws-stage-frame::after {
  opacity: 1;
  transform: scale(1);
}
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform)[data-ws-playing] .ws-stage,
[data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform):has(.ws-play:focus-visible) .ws-stage {
  transform: translateY(-4px);
  box-shadow: 0 28px 70px #301a4924;
}
@media (hover: hover) and (pointer: fine) {
  [data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame:hover::before {
    opacity: .75;
    animation-play-state: running;
  }
  [data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame:hover::after {
    opacity: 1;
    transform: scale(1);
  }
  [data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame:hover .ws-stage {
    transform: translateY(-4px);
    box-shadow: 0 28px 70px #301a4924;
  }
}

@keyframes ws-fx-drift {
  from { background-position: 0 0; -webkit-mask-position: 0% 0%; mask-position: 0% 0%; }
  to { background-position: 54px 27px; -webkit-mask-position: 100% 60%; mask-position: 100% 60%; }
}

/* Reduced motion: the texture and marks still answer the interaction, still. */
@media (prefers-reduced-motion: reduce) {
  [data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame::before { animation: none; transition: none; }
  [data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage-frame::after { transition: none; transform: none; }
  [data-soceo-scene-playback="interaction"] .ws-feature:not(.ws-feature--platform) .ws-stage { transition: none; }
}

/* A small patch of ink appears on the exposed editorial paper. The dots stay
   registered to the page as the pointer reveals them. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .ed-paper-layer[data-reactive-paper] { overflow: hidden; }
  .ed-paper-layer[data-reactive-paper]::after {
    content: ""; position: absolute; left: 0; top: 0; width: 240px; height: 184px;
    pointer-events: none;
    background: radial-gradient(circle, #79658b .65px, transparent 1.15px) 0 0 / 10px 10px;
    background-position: calc(0px - var(--paper-x, 0px)) calc(0px - var(--paper-y, 0px));
    mask-image: radial-gradient(ellipse closest-side, #000 0%, #0009 45%, transparent 100%);
    transform: translate(var(--paper-x, 0px), var(--paper-y, 0px)) translate(-50%, -50%);
    opacity: 0; transition: opacity 200ms ease-out;
  }
  .ed-paper-layer.is-under-pointer::after { opacity: .32; }
}

/* Background grids: until a mouse first enters the section, the canvas box
   carries a static SVG of the same grid and ambient cells (set by
   audience-grid.js), so the surface's own fallback lines step aside. */
[data-soceo-scene-playback="interaction"] .mix-audience-background:is([data-grid-static], [data-grid-ready]) { background-image: none; }

/* Cursor badge: a short bar that fills beside the cursor before a scene plays
   or an inner area takes the wheel (hover-intent.js). */
.soceo-intent {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2147483000;
  display: flex;
  align-items: stretch;
  gap: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease-out;
  will-change: transform;
}
.soceo-intent.is-on { opacity: 1; }
.soceo-intent.is-done { opacity: 0; transition-duration: .2s; }
.soceo-intent__track {
  position: relative;
  width: 6px;
  height: 26px;
  overflow: hidden;
  background: #6728d424;
}
.soceo-intent__bar {
  position: absolute;
  inset: 0;
  background: #6728d4;
  transform: scaleY(0);
  transform-origin: bottom;
}
.soceo-intent.is-filling .soceo-intent__bar { transform: scaleY(1); transition: transform var(--intent-ms, 650ms) linear; }
.soceo-intent__label {
  display: grid;
  align-content: center;
  padding: 0 6px;
  background: #fdfdfbee;
  box-shadow: 0 0 0 1px #6728d433;
  color: #2a1260;
  font: 600 11px/1.05 "DM Mono", ui-monospace, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
/* Inner areas stay out of the wheel's way until the bar fills. */
[data-scroll-gate="locked"] { overflow: hidden !important; }

/* Keyboard focus on the demo regions that are reachable by Tab. */
[data-soceo-scene-playback="interaction"] :is(.og-v2-branch-scene, .mcp-interface, .tc-window)[tabindex]:focus-visible {
  outline: 2px solid #7839ee;
  outline-offset: 3px;
}

/* Perspectives prompts type themselves (hex-scenes.js). The invisible final
   text holds the pill's width while the typed text and caret grow over it. */
.hx-prompt .hx-prompt-text { display: inline-grid; min-width: 0; }
.hx-prompt .hx-prompt-text > span { grid-area: 1 / 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-prompt .hx-prompt-ghost { visibility: hidden; }
.hx-artifact.is-typing .hx-prompt-typed::after {
  content: ""; display: inline-block; width: 1px; height: 1em; margin-left: 1px;
  vertical-align: -.15em; background: currentColor;
}

/* The platform arrives finished and stays still: no entrance, no moving dashes.
   Antes/Depois/Repetir remain available to whoever presses them. */
[data-soceo-scene-playback="interaction"] .ws-feature--platform .mix-cowork-flow-path { animation: none !important; }
