/* The platform's Ontol cube: the hero's mint glass shell with a tesseract turning inside (tesseract.js).
   Each layer tints the whole cube, shell and lines together, toward its accent. */
@property --cube-accent { syntax: '<color>'; inherits: true; initial-value: #1aa9bb; }
.platform-graphic { justify-content: flex-start; background: none; --cube-accent: var(--layer-0); --cube-tint: hue-rotate(14deg) saturate(1.1); transition: --cube-accent .6s ease; }
.platform-graphic[data-layer="1"] { --cube-accent: var(--layer-1); --cube-tint: hue-rotate(178deg) saturate(1.2) brightness(1.04); }
.platform-graphic[data-layer="2"] { --cube-accent: var(--layer-2); --cube-tint: hue-rotate(124deg) saturate(1.3) brightness(1.1); }
.tesseract-stage { position: relative; width: 100%; height: 420px; flex: 0 0 420px; isolation: isolate; }
.tesseract-core { position: absolute; top: 35px; left: 50%; width: 350px; height: 350px; margin-left: -175px; z-index: 2; }
.tesseract-core .ontol-cube { display: block; width: 100%; height: 100%; filter: var(--cube-tint); transition: filter .6s ease; }
.tesseract-halo { position: absolute; width: 340px; height: 290px; top: 50px; left: calc(50% - 170px); background: radial-gradient(ellipse closest-side, color-mix(in srgb, var(--cube-accent) 12%, transparent), transparent); }
.tesseract-shadow { position: absolute; width: 190px; height: 22px; left: calc(50% - 95px); top: 318px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--cube-accent) 22%, #10182818), transparent); filter: blur(6px); }
/* Connect: source systems line up in two columns and feed the cube through wires drawn by connect-scene.js. */
.cn-links { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; overflow: visible; pointer-events: none; }
.cn-wire { fill: none; stroke: #d3e2e7; stroke-width: 1; }
.cn-pulse { fill: none; stroke: var(--cyan); stroke-width: 1.75; stroke-linecap: round; stroke-dashoffset: var(--cn-from); filter: drop-shadow(0 0 3px #39bfd0aa); animation: cn-flow 6s cubic-bezier(.45, 0, .25, 1) var(--cn-delay) infinite both; }
.cn-port { fill: #fff; stroke: #a8d8e0; stroke-width: 1; animation: cn-port 6s ease-out var(--cn-delay) infinite both; }
.tesseract-stage .orbit-label { z-index: 3; display: flex; align-items: center; gap: 7px; width: max-content; max-width: 150px; padding: 6px 11px 6px 9px; border: 1px solid #e4e7ec; border-radius: 6px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 500; line-height: 1.35; letter-spacing: -.01em; box-shadow: 0 1px 2px #1018280a, 0 6px 18px #10182808; }
.tesseract-stage .orbit-label i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: cn-emit 6s ease-out var(--cn-delay) infinite both; }
.tesseract-stage :is(.orbit-a, .orbit-e, .orbit-f, .orbit-h) { left: 0; right: auto; }
.tesseract-stage :is(.orbit-b, .orbit-c, .orbit-g, .orbit-i) { left: auto; right: 0; }
.tesseract-stage :is(.orbit-a, .orbit-b, .orbit-d) { top: 14px; }
.tesseract-stage :is(.orbit-c, .orbit-e) { top: 132px; }
.tesseract-stage :is(.orbit-f, .orbit-g) { top: 250px; }
.tesseract-stage :is(.orbit-h, .orbit-i) { top: auto; bottom: 14px; }
.tesseract-stage .orbit-d { left: 50%; transform: translateX(-50%); }
/* A pulse leaves its chip, travels the wire, and lights the port as it reaches the cube. */
@keyframes cn-flow { 0% { stroke-dashoffset: var(--cn-from); } 28%, 100% { stroke-dashoffset: var(--cn-to); } }
@keyframes cn-port { 0%, 22% { fill: #fff; stroke: #a8d8e0; } 28% { fill: var(--cyan); stroke: var(--cyan); } 48%, 100% { fill: #fff; stroke: #a8d8e0; } }
@keyframes cn-emit { 0% { box-shadow: 0 0 0 0 #39bfd066; } 5% { box-shadow: 0 0 0 4px #39bfd02e; } 16%, 100% { box-shadow: 0 0 0 6px #39bfd000; } }
.motion-paused .cn-pulse { visibility: hidden; }
.platform-graphic .layer-panel { position: relative; width: 100%; padding-top: 10px; padding-bottom: 20px; }
/* Explanatory scenes for Understand and Coordinate; Connect keeps its wired sources. */
.tesseract-stage :is(.cn-links, .orbit-label) { transition: opacity .35s, visibility .35s; }
.platform-graphic:is([data-layer="1"], [data-layer="2"]) .tesseract-stage :is(.cn-links, .orbit-label) { opacity: 0; visibility: hidden; }
.layer-scene { display: none; position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.platform-graphic[data-layer="1"] .scene-understand,
.platform-graphic[data-layer="2"] .scene-coordinate { display: block; }
/* Understand: records drift behind the glass, then return as one ordered patient timeline.
   It plays once on its own each time the layer opens and holds its last frame. */
.scene-understand { --accent: #e04d70; }
.ud-frag { position: absolute; inset: 0; z-index: 1; animation: ud-absorb 2.5s cubic-bezier(.5, 0, .4, 1) calc(var(--i) * .15s - var(--ud-t, 0s)) both; }
.ud-frag span { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%) rotate(var(--r)); display: flex; width: max-content; align-items: center; gap: 6px; padding: 5px 9px; border: 1px dashed #dfb0bc; border-radius: 4px; background: #fffffff2; color: #6e5a61; font-size: 11px; line-height: 1.4; white-space: nowrap; animation: ud-shrink 2.5s cubic-bezier(.5, 0, .4, 1) calc(var(--i) * .15s - var(--ud-t, 0s)) both; }
.ud-frag span::before { content: ''; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); opacity: .7; flex: none; }
.ud-stem { position: absolute; left: 50%; top: 78%; bottom: calc(3% + 44px); width: 1px; margin-left: -.5px; z-index: 1; background: linear-gradient(#e04d7000, var(--accent)); transform-origin: top; animation: ud-stem .5s ease-out calc(2.5s - var(--ud-t, 0s)) both; }
.ud-timeline { position: absolute; left: 4%; right: 4%; bottom: 3%; height: 50px; z-index: 3; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ud-line { position: absolute; top: 6px; left: 12.5%; right: 12.5%; height: 1px; background: var(--accent); opacity: .55; animation: ud-line 1.1s cubic-bezier(.4, 0, .2, 1) calc(2.8s - var(--ud-t, 0s)) both; }
.ud-step { position: relative; display: flex; flex-direction: column; align-items: center; padding: 17px 2px 0; text-align: center; animation: ud-step .35s ease-out calc(3.15s + var(--i) * .45s - var(--ud-t, 0s)) both; }
.ud-step b { position: absolute; top: 2px; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px #e04d701c; }
.ud-step strong { font-size: 11.5px; font-weight: 550; line-height: 1.3; color: var(--ink); }
.ud-step small { margin-top: 2px; font-size: 10px; line-height: 1.35; color: #8b737a; }
@keyframes ud-absorb {
  0% { opacity: 0; translate: 0 0; }
  14%, 67% { opacity: 1; translate: 0 0; }
  89% { opacity: .85; translate: calc(var(--dx) * .78) calc(var(--dy) * .78); }
  100% { opacity: 0; translate: var(--dx) var(--dy); }
}
@keyframes ud-shrink { 0%, 67% { scale: 1; } 100% { scale: .35; } }
@keyframes ud-stem { from { scale: 1 0; } to { scale: 1 1; } }
@keyframes ud-line { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes ud-step { from { opacity: 0; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }
/* Coordinate: one clock walks a screening visit clockwise around the cube.
   Each step lights when the clock passes its --at second; all reset together before the loop. */
@property --co-clock { syntax: '<number>'; inherits: true; initial-value: 10; }
.scene-coordinate { --accent: #b84ad1; animation: co-clock 12s linear infinite; }
.co-path { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; animation: co-fade .6s ease-out both; }
.co-path rect { fill: none; stroke: var(--accent); stroke-width: 1; stroke-opacity: .38; stroke-dasharray: 3 5; animation: co-dash 1.2s linear infinite; }
.co-token { position: absolute; inset: 0; z-index: 2; opacity: 0; animation: co-token 12s ease-in-out infinite both; }
.co-token::before { content: ''; position: absolute; left: 50%; top: 9%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #b84ad126, 0 0 12px #b84ad1; }
.co-step {
  --on: calc(clamp(0, (var(--co-clock) - var(--at)) * 4, 1) * clamp(0, (11.2 - var(--co-clock)) * 2, 1));
  --pulse: calc(var(--on) * clamp(0, 1 - (var(--co-clock) - var(--at)) / 1.2, 1));
  position: absolute; top: var(--y); z-index: 3; display: flex; align-items: center; gap: 7px; width: max-content; max-width: 170px; padding: 6px 11px 6px 7px;
  border: 1px solid color-mix(in srgb, #dcb3e7 calc(var(--on) * 100%), #e4e7ec); border-radius: 6px; background: #fff;
  box-shadow: 0 0 0 calc(var(--pulse) * 5px) #b84ad11f, 0 6px 18px #10182808;
}
.co-l { left: 1%; translate: 0 -50%; }
.co-c { left: 50%; translate: -50% -50%; }
.co-r { right: 1%; translate: 0 -50%; }
/* Side steps sit level with the cube, so they wrap before reaching it. */
.co-mid { max-width: 22%; }
.co-step b { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid color-mix(in srgb, var(--accent) calc(var(--on) * 100%), #d0d5dd); border-radius: 50%; background: color-mix(in srgb, var(--accent) calc(var(--on) * 100%), #fff); color: color-mix(in srgb, #fff calc(var(--on) * 100%), #98a2b3); font-size: 9.5px; font-weight: 600; line-height: 1; }
.co-step span { font-size: 12px; line-height: 1.35; color: var(--ink); opacity: calc(.5 + .5 * var(--on)); }
@keyframes co-clock { from { --co-clock: 0; } to { --co-clock: 12; } }
@keyframes co-fade { from { opacity: 0; } }
@keyframes co-dash { to { stroke-dashoffset: -8; } }
/* Waypoints are offsets from step 1 (top centre); the token rests under each card as it lights. */
@keyframes co-token {
  0% { opacity: 0; translate: 0 0; }
  3%, 5.8% { opacity: 1; translate: 0 0; }
  12.5%, 15% { translate: 36% 0; }
  21.7%, 24.2% { translate: 36% 39%; }
  30.8%, 33.3% { translate: 36% 79%; }
  40%, 42.5% { translate: 0 79%; }
  49.2%, 51.7% { translate: -36% 79%; }
  58.3%, 60.8% { translate: -36% 39%; }
  67.5% { opacity: 1; translate: -36% 0; }
  70%, 100% { opacity: 0; translate: -36% 0; }
}
@media (max-width: 650px) {
.tesseract-stage { height: 355px; flex-basis: 355px; }
  .tesseract-core { width: 224px; height: 224px; margin-left: -112px; top: 63px; }
  .tesseract-shadow { top: 255px; width: 140px; left: calc(50% - 70px); }
  .tesseract-stage .orbit-label { gap: 5px; max-width: 84px; padding: 5px 7px 5px 6px; font-size: 10.5px; }
  .tesseract-stage .orbit-label i { width: 5px; height: 5px; }
  .tesseract-stage :is(.orbit-c, .orbit-e) { top: 114px; }
  .tesseract-stage :is(.orbit-f, .orbit-g) { top: 214px; }
  .platform-graphic .layer-panel { padding-top: 12px; }
  .ud-frag span { gap: 4px; padding: 4px 6px; font-size: 10px; white-space: normal; max-width: 84px; }
  .ud-timeline { left: 0; right: 0; }
  .ud-step strong { font-size: 10.5px; }
  .ud-step small { font-size: 9px; }
  .co-step { gap: 5px; max-width: 104px; padding: 5px 7px 5px 5px; }
  .co-mid { max-width: 88px; }
  .co-step b { width: 15px; height: 15px; font-size: 8.5px; }
  .co-step span { font-size: 10px; }
}
