/* Signature cut: one motion contract for the standalone Experience document
   and the application. Imported into the app build; linked in the gateway
   head. Opt in only for deliberate page/workspace changes, never typing,
   filters, menus or streamed output. Native navigation starts immediately. */
@view-transition { navigation: auto; }

:root {
  --public-duration-route: 220ms;
  --public-duration-route-compact: 160ms;
  --public-duration-reduced: 120ms;
  --public-route-shift: 0px;
  --public-route-enter-shift: 0px;
  --public-ease-route: cubic-bezier(.32, .72, 0, 1);
}

html:has(body.gateway-page) { color-scheme: dark; }
html:has(body.gateway-page) { background-color: var(--gateway-ground, Canvas); }

html:is([data-signature-motion], [data-route-vt])::view-transition-group(root) {
  /* Do not interpolate root geometry when the two pages have different heights. */
  animation-name: none;
  animation-duration: var(--public-duration-route);
  animation-timing-function: var(--public-ease-route);
  overflow: clip;
}
html:is([data-signature-motion], [data-route-vt])::view-transition-old(root) {
  animation: signature-cut-out var(--public-duration-route) var(--public-ease-route) both;
  mix-blend-mode: normal;
  z-index: 1;
}
html:is([data-signature-motion], [data-route-vt])::view-transition-new(root) {
  animation: signature-cut-in var(--public-duration-route) var(--public-ease-route) both;
  mix-blend-mode: normal;
  z-index: 2;
}
/* Returning reverses the reveal edge, not the position of the text or chrome. */
html[data-signature-motion="back"]::view-transition-old(root) { animation-name: signature-cut-out-back; }
html[data-signature-motion="back"]::view-transition-new(root) { animation-name: signature-cut-in-back; }

/* A client route may mount after pagereveal. Retain the outgoing frame while
   the browser keeps the incoming snapshot live, then release one clean cut.
   The head bootstrap bounds this pause and cancels it on input or navigation. */
html[data-signature-wait]::view-transition-old(root),
html[data-signature-wait]::view-transition-new(root) { animation-play-state: paused; }
html[data-signature-wait]::view-transition-new(root) { visibility: hidden; }

/* One incoming edge owns forward motion; the old page stays still below it.
   Cross-document chrome travels with its page, never as a separate logo morph. */
html[data-signature-document] :is(.gateway-brand-wordmark, .gateway-agent-symbol, [style*="view-transition-name"]) {
  view-transition-name: none !important;
}

/* Agent lockups have different geometry. During a full workspace cut they
   belong to the stationary page snapshot, not an independent logo morph.
   Compact page changes and generation's shared result surfaces stay intact. */
html[data-signature-motion]:not([data-signature-compact]) :is(.site-header-wordmark, .gateway-brand-wordmark, .gateway-agent-symbol, [data-glyph][style*="view-transition-name"]) {
  view-transition-name: none !important;
}

/* A cold document has no outgoing snapshot. Reveal only on its first real
   route commit, with a short opacity settle. Never clip/translate body: that
   moves fixed navigation and reveals the empty canvas behind the page. */
html[data-signature-entry] body {
  animation: signature-fade-in var(--public-duration-reduced) linear both;
}

html:is([data-signature-motion], [data-route-vt])::view-transition-group(prompeteer-wordmark),
html:is([data-signature-motion], [data-route-vt])::view-transition-group(gateway-path-skilling),
html:is([data-signature-motion], [data-route-vt])::view-transition-group(gateway-path-discovery) {
  animation-duration: var(--public-duration-route);
  animation-timing-function: var(--public-ease-route);
}

/* More frequent movement inside a workspace uses the same gesture, sooner. */
html[data-signature-compact]::view-transition-group(*),
html[data-signature-compact]::view-transition-old(root),
html[data-signature-compact]::view-transition-new(root) {
  animation-duration: var(--public-duration-route-compact);
}

/* Rail navigation moves the working pane, keeping the header and rail fixed.
   Beacon has its own rail inside .workspace-content, so name only its main
   scroller. Naming the outer wrapper as well would animate nested snapshots. */
html[data-signature-compact]:not([data-signature-document]) .workspace-layout[data-workspace="prompeteer"] .workspace-content,
html[data-signature-compact]:not([data-signature-document]) .workspace-layout[data-workspace="beacon"] .beacon-main-wrap {
  view-transition-name: workspace-page;
}
/* Beacon's working pane is transparent in normal layout (the shell paints its
   own grounds), so its captured snapshot has see-through regions and the old
   page shows through the incoming one during the slide. Give the named pane a
   solid ground only while the cut is active, so the incoming snapshot is opaque
   and cleanly covers the outgoing page, matching Prompeteer's opaque .workspace-content
   (owner: "new page overlaps the old for a hot sec", 7 Nov 2026). Normal
   rendering is untouched; the attribute is set only during the transition. */
html[data-signature-compact]:not([data-signature-document]) .workspace-layout[data-workspace="beacon"] .beacon-main-wrap {
  background: var(--public-ground);
}
html[data-signature-compact]::view-transition-group(workspace-page) {
  animation: none;
  overflow: clip;
  isolation: isolate;
}
html[data-signature-compact]::view-transition-old(root),
html[data-signature-compact]::view-transition-new(root) {
  animation: none;
}
/* The root is the only snapshot containing unnamed chrome such as the rail.
   Keep it underneath the incoming root while an async route commit is pending
   or being skipped; the separately named workspace pane owns all movement. */
html[data-signature-compact]::view-transition-old(root) { opacity: 1; }
html[data-signature-compact]::view-transition-old(workspace-page) {
  animation: none;
  mix-blend-mode: normal;
  z-index: 1;
}
html[data-signature-compact]::view-transition-new(workspace-page) {
  animation: signature-cut-in var(--public-duration-route-compact) var(--public-ease-route) both;
  mix-blend-mode: normal;
  z-index: 2;
}

@keyframes signature-cut-in {
  from { clip-path: polygon(120% 0, 120% 0, 100% 100%, 100% 100%); }
  to { clip-path: polygon(0 0, 120% 0, 100% 100%, -20% 100%); }
}
@keyframes signature-cut-out {
  from { opacity: 1; }
  to { opacity: 1; }
}
@keyframes signature-cut-in-back {
  from { clip-path: polygon(0 0, 0 0, -20% 100%, -20% 100%); }
  to { clip-path: polygon(0 0, 100% 0, 120% 100%, 0 100%); }
}
@keyframes signature-cut-out-back {
  from { opacity: 1; }
  to { opacity: 1; }
}
@keyframes signature-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes signature-fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html[data-signature-entry] body {
    /* Explicit opacity-only exception to legacy universal animation resets. */
    animation: signature-fade-in var(--public-duration-reduced) linear both !important;
  }
  html:is([data-signature-motion], [data-route-vt])::view-transition-group(*) { animation: none; }
  html:is([data-signature-motion], [data-route-vt])::view-transition-old(*),
  html:is([data-signature-motion], [data-route-vt])::view-transition-new(*) { animation-duration: var(--public-duration-reduced); }
  html:is([data-signature-motion], [data-route-vt])::view-transition-old(root) {
    animation: signature-fade-out var(--public-duration-reduced) linear both;
  }
  html:is([data-signature-motion], [data-route-vt])::view-transition-new(root) {
    animation: signature-fade-in var(--public-duration-reduced) linear both;
  }
  html[data-signature-compact]::view-transition-old(workspace-page) {
    animation: signature-fade-out var(--public-duration-reduced) linear both;
  }
  html[data-signature-compact]::view-transition-new(workspace-page) {
    animation: signature-fade-in var(--public-duration-reduced) linear both;
  }
}
