/* 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. */

[data-soceo-scene-playback="interaction"] .ws-feature .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 .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 .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 .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: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: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: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 .ws-stage-frame:hover::before {
    opacity: .75;
    animation-play-state: running;
  }
  [data-soceo-scene-playback="interaction"] .ws-feature .ws-stage-frame:hover::after {
    opacity: 1;
    transform: scale(1);
  }
  [data-soceo-scene-playback="interaction"] .ws-feature .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 .ws-stage-frame::before { animation: none; transition: none; }
  [data-soceo-scene-playback="interaction"] .ws-feature .ws-stage-frame::after { transition: none; transform: none; }
  [data-soceo-scene-playback="interaction"] .ws-feature .ws-stage { transition: none; }
}

/* 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;
}
