/* Adapted from motion-self 725be9f: s-track, staggered-reveal, bar-chart-stagger, check-draw. */
:root {
  --spring: cubic-bezier(.22, 1.35, .35, 1);
  --motion-expo: cubic-bezier(.16, 1, .3, 1);
  --demo-time: 4s;
}
.editor-board { container-type: inline-size; margin-top: 14px; }
.editor-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 19px; font-size: 9px; color: #7b8da6; }
.add-control { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); background: #e6f0ff; border: 1px solid #d9e8ff; border-radius: 6px; padding: 3px 7px; }
.add-control svg { width: 12px; height: 12px; }
.size-control { display: flex; gap: 5px; align-items: center; }
.size-control b { font-size: 8px; font-weight: 500; padding: 2px 6px; border-radius: 4px; }
.size-control b:nth-of-type(2) { background: white; color: var(--blue); box-shadow: 0 1px 4px #263b6210; }
.save-state { min-width: 76px; }
.demo-actions { display: flex; align-items: center; gap: 2px; }
.demo-top .replay { width: 44px; height: 44px; padding: 0; font-size: 18px; display: grid; place-items: center; border-radius: 50%; }
.demo-top .replay[hidden] { display: none; }
.demo-top .replay:hover { background: #e7f1ff; }
.save-done { display: inline-flex; align-items: center; justify-content: center; gap: 3px; color: #13845e; background: #e9f8f1; border-radius: 6px; padding: 3px 6px; }
.save-done svg { width: 12px; height: 12px; color: #13845e; }
.save-editing { display: block; position: absolute; inset: 0; opacity: 0; padding-top: 3px; color: #7d8ba1; }
.demo-card { transform-origin: 50% 45%; overflow: hidden; }
.card-download .line-chart { overflow: hidden; height: 39px; margin-top: 4px; }
.drop-zone { position: absolute; inset: 142px 0 0; border: 1px dashed #6daaff; background: #e2efff60; border-radius: 15px; opacity: 0; pointer-events: none; }
.touch-ring { position: absolute; top: 46px; left: calc(25% - 17px); width: 34px; height: 34px; border: 2px solid #479eff; border-radius: 50%; opacity: 0; pointer-events: none; z-index: 7; }
.resize-grip { position: absolute; right: 0; top: 260px; width: 24px; height: 24px; border-radius: 7px; background: var(--blue); color: white; box-shadow: 0 3px 8px #087bfa35; display: grid; place-items: center; font-size: 17px; opacity: 0; z-index: 5; }
.demo-cursor { left: 0; top: 0; z-index: 8; filter: drop-shadow(0 2px 3px #fff) drop-shadow(0 2px 3px #173c6430); }
.demo-progress { height: 3px; margin-top: 20px; border-radius: 4px; background: #e1e9f6; overflow: hidden; }
.demo-progress > span { display: block; height: 100%; background: var(--blue); transform-origin: left; }
.demo-steps { padding-top: 12px; border: 0; font-size: 9px; }
.demo-steps span { padding: 3px 4px; border-radius: 5px; }
.demo-steps span:last-child { background: #e8f2ff; }
.chart-endpoint { fill: currentColor; stroke: white; stroke-width: 1.3; transform-box: fill-box; transform-origin: center; }
.connection-line::after { content: ''; position: absolute; top: -3px; right: 0; width: 7px; height: 7px; border-radius: 50%; background: #4d9cff; box-shadow: 0 0 0 4px #dcecff; opacity: 0; }
.journey-card:nth-child(1) .app-list > div:nth-child(2) { border-color: #b7d6ff; background: #f5f9ff; }
.final-panel { position: relative; isolation: isolate; overflow: hidden; }
.final-panel::before { content: ''; pointer-events: none; z-index: -1; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 10%, #b9d6ff70, transparent 65%); opacity: 1; }

/* atlas.spring(k=170,c=18,m=1), 0–650ms, 41 CSS stops; final stop settles to 1. */
@supports (animation-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, 0.02033, 0.0735, 0.14911, 0.23853, 0.33481, 0.43246, 0.52736, 0.61651, 0.69793, 0.77041, 0.83341, 0.8869, 0.9312, 0.96694, 0.9949, 1.01596, 1.03106, 1.04113, 1.04705, 1.04965, 1.04966, 1.04774, 1.04446, 1.04029, 1.03561, 1.03074, 1.02591, 1.0213, 1.01703, 1.01319, 1.00981, 1.00691, 1.00447, 1.00248, 1.0009, 0.99968, 0.99879, 0.99817, 0.99777, 1); }
}

@media (prefers-reduced-motion: no-preference) {
  .button { position: relative; overflow: hidden; isolation: isolate; transition: transform 220ms var(--spring), box-shadow 220ms, background 180ms; }
  .button::before { content: ''; pointer-events: none; position: absolute; inset: -50% -80%; background: linear-gradient(110deg, transparent 40%, #ffffff28 50%, transparent 60%); transform: translateX(-65%); }
  .button:hover { transform: translateY(-3px); box-shadow: 0 10px 25px #087bfa30; }
  .button:hover::before { animation: button-sheen 650ms var(--ease); }
  .button:hover svg { transform: translateX(5px); }
  .button:active { transform: translateY(1px) scale(.965); box-shadow: 0 2px 5px #087bfa20; transition-duration: 70ms; }
  .replay { transition: transform 180ms var(--spring); }
  .replay:active { transform: scale(.94); }
  .replay:hover span { display: inline-block; transform: rotate(-35deg); transition: transform 240ms var(--spring); }

  /* Each visual observes its own viewport entry, including stacked mobile cards. */
  [data-motion="hero"].is-playing .phone { animation: phone-arrive 650ms var(--spring) backwards; }
  [data-motion="hero"].is-playing .phone-cards > .metric-card { animation: card-cascade 500ms var(--spring) backwards; }
  [data-motion="hero"].is-playing .phone-cards > .metric-card:nth-child(2) { animation-delay: 75ms; }
  [data-motion="hero"].is-playing .phone-cards > .metric-card:nth-child(3) { animation-delay: 150ms; }
  [data-motion="hero"].is-playing .phone-cards > .metric-card:nth-child(4) { animation-delay: 225ms; }
  [data-motion="hero"].is-playing .floating-note { animation: note-arrive 550ms var(--spring) 200ms backwards; }
  [data-motion="hero"].is-playing .note-bottom { animation-delay: 350ms; }
  [data-motion="hero"].is-playing .hero-halo { animation: halo-arrive 900ms var(--ease) backwards; }
  [data-motion="hero"].is-playing .bars i,
  [data-motion="asc"].is-playing .bars i { animation: bar-grow 600ms var(--motion-expo) backwards; animation-delay: calc(var(--i) * 35ms); }
  [data-motion="hero"].is-playing .draw-line,
  [data-motion="ga4"].is-playing .draw-line { animation: line-draw 800ms var(--motion-expo) 120ms backwards; }
  .is-playing .chart-endpoint { animation: endpoint-arrive 350ms var(--spring) 700ms backwards; }
  [data-motion="asc"].is-playing .source-preview,
  [data-motion="ga4"].is-playing .source-preview { animation: preview-arrive 550ms var(--spring) backwards; }
  [data-motion="asc"].is-playing .source-preview strong,
  [data-motion="ga4"].is-playing .source-preview strong { animation: metric-arrive 500ms var(--spring) 90ms backwards; }

  .edit-visual.is-playing .card-download { animation: download-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .card-revenue { animation: revenue-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .card-page { animation: page-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .card-download .line-chart { animation: resize-chart var(--demo-time) linear backwards; }
  .edit-visual.is-playing .demo-cursor { animation: cursor-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .touch-ring { animation: touch-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .drop-zone { animation: drop-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .resize-grip { animation: resize-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .add-control { animation: add-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .size-control b:nth-of-type(2) { animation: size-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .save-done { animation: saved-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .save-done path { animation: check-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .save-editing { animation: editing-label var(--demo-time) step-end backwards; }
  .edit-visual.is-playing .editor-board { animation: restore-edit var(--demo-time) linear backwards; }
  .edit-visual.is-playing .demo-progress > span { animation: demo-progress var(--demo-time) linear backwards; }
  .edit-visual.is-playing .demo-steps span:nth-child(1) { animation: step-one var(--demo-time) step-end backwards; }
  .edit-visual.is-playing .demo-steps span:nth-child(2) { animation: step-two var(--demo-time) step-end backwards; }
  .edit-visual.is-playing .demo-steps span:nth-child(3) { animation: step-three var(--demo-time) step-end backwards; }
  .edit-visual.is-playing .demo-steps span:nth-child(4) { animation: step-four var(--demo-time) step-end backwards; }

  .journey-card.is-playing { animation: journey-arrive 600ms var(--spring) backwards; }
  [data-motion="journey-1"].is-playing .app-list > div { animation: list-arrive 450ms var(--spring) backwards; }
  [data-motion="journey-1"].is-playing .app-list > div:nth-child(2) { animation-delay: 100ms; }
  [data-motion="journey-1"].is-playing .app-list > div:nth-child(3) { animation-delay: 200ms; }
  [data-motion="journey-1"].is-playing .app-list > div:nth-child(2) .app-tile { animation: select-app 550ms var(--spring) 650ms backwards; }
  [data-motion="journey-2"].is-playing .app-tile { animation: note-arrive 600ms var(--spring) 180ms backwards; }
  [data-motion="journey-2"].is-playing .individual-metric { animation: metric-arrive 450ms var(--spring) 300ms backwards; }
  [data-motion="journey-2"].is-playing .tiny-stats { animation: list-arrive 450ms var(--spring) 430ms backwards; }
  [data-motion="journey-3"].is-playing .line-chart path { stroke-dasharray: 1; animation: line-draw 650ms var(--motion-expo) 100ms backwards; }
  [data-motion="journey-3"].is-playing .country-bar i { transform-origin: left; animation: bar-horizontal 600ms var(--motion-expo) 280ms backwards; }
  [data-motion="journey-3"].is-playing .country-bar:nth-of-type(3) i { animation-delay: 360ms; }
  [data-motion="journey-3"].is-playing .review-preview { animation: list-arrive 450ms var(--spring) 600ms backwards; }
  .version-visual.is-playing .old-line { animation: old-draw 500ms var(--motion-expo) backwards; }
  .version-visual.is-playing .new-line { animation: line-draw 700ms var(--motion-expo) 250ms backwards; }
  .version-visual.is-playing .baseline,
  .version-visual.is-playing .baseline-label { animation: marker-arrive 300ms var(--ease) 850ms backwards; }
  .version-visual.is-playing .version-result { animation: result-arrive 500ms var(--spring) 950ms backwards; }
  .security-visual.is-playing .security-device { animation: device-arrive 600ms var(--spring) backwards; }
  .security-visual.is-playing .security-services > div { animation: list-arrive 450ms var(--spring) 180ms backwards; }
  .security-visual.is-playing .security-services > div:nth-child(2) { animation-delay: 280ms; }
  .security-visual.is-playing .connection-line { animation: connect 550ms var(--ease) 200ms backwards; }
  .security-visual.is-playing .line-google { animation-delay: 400ms; }
  .security-visual.is-playing .connection-line::after { animation: connection-packet 550ms var(--ease) 200ms backwards; }
  .security-visual.is-playing .line-google::after { animation-delay: 400ms; }
  .plan.is-playing { animation: plan-arrive 550ms var(--spring) backwards; }
  .plan.is-playing .plan-list svg { animation: check-arrive 400ms var(--spring) 120ms backwards; }
  .plan.is-playing .plan-list li:nth-child(2) svg { animation-delay: 180ms; }
  .plan.is-playing .plan-list li:nth-child(3) svg { animation-delay: 240ms; }
  .plan.is-playing .plan-list li:nth-child(4) svg { animation-delay: 300ms; }
  .plan.is-playing .plan-list li:nth-child(5) svg { animation-delay: 360ms; }
  .plan.is-playing .plan-list li:nth-child(6) svg { animation-delay: 420ms; }
  .final-panel.is-playing .final-mark { animation: mark-arrive 650ms var(--spring) backwards; }
  .final-panel.is-playing::before { animation: final-light 900ms var(--ease) backwards; }

  @keyframes phone-arrive { from { transform: perspective(900px) translateY(28px) rotateY(-7deg) rotateZ(2deg) scale(.97); } to { transform: none; } }
  @keyframes card-cascade { from { transform: translateY(17px) scale(.96); opacity: .5; } to { transform: none; opacity: 1; } }
  @keyframes note-arrive { from { transform: translateY(15px) scale(.82); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes halo-arrive { from { transform: scale(.86); opacity: .35; } to { transform: scale(1); opacity: 1; } }
  @keyframes bar-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
  @keyframes bar-horizontal { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes line-draw { from { stroke-dasharray: 1; stroke-dashoffset: 1; } to { stroke-dasharray: 1; stroke-dashoffset: 0; } }
  @keyframes endpoint-arrive { from { opacity: 0; transform: scale(.1); } to { opacity: 1; transform: scale(1); } }
  @keyframes preview-arrive { from { transform: translateY(18px) scale(.975); box-shadow: 0 15px 28px #1f66c218; } to { transform: none; box-shadow: none; } }
  @keyframes metric-arrive { from { transform: translateY(8px); opacity: .3; } to { transform: none; opacity: 1; } }
  @keyframes list-arrive { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
  @keyframes journey-arrive { from { transform: translateY(20px); border-color: #79b6ff; box-shadow: 0 16px 28px #087bfa10; } to { transform: none; } }
  @keyframes select-app { 0% { transform: scale(.9); } 38% { transform: scale(1.1) rotate(-5deg); box-shadow: 0 0 0 5px #dceaff; } 100% { transform: none; box-shadow: none; } }
  @keyframes old-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
  @keyframes marker-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
  @keyframes result-arrive { from { transform: translateY(10px) scale(.94); background: #deecff; } to { transform: none; } }
  @keyframes device-arrive { from { opacity: .4; transform: translateY(14px) rotate(-3deg) scale(.95); } to { opacity: 1; transform: none; } }
  @keyframes connect { from { clip-path: inset(-10px 100% -10px -10px); } to { clip-path: inset(-10px); } }
  @keyframes connection-packet { 0% { opacity: 0; right: 100%; } 20%, 80% { opacity: 1; } 100% { opacity: 0; right: 0; } }
  @keyframes plan-arrive { from { transform: translateY(18px) scale(.98); border-color: #8dbfff; box-shadow: 0 12px 32px #087bfa15; } to { transform: none; } }
  @keyframes check-arrive { from { transform: scale(.4) rotate(-25deg); opacity: .3; } to { transform: none; opacity: 1; } }
  @keyframes mark-arrive { from { transform: translateY(16px) scale(.65) rotate(-8deg); opacity: .4; } to { transform: none; opacity: 1; } }
  @keyframes final-light { from { opacity: 0; transform: scale(.65); } to { opacity: 1; transform: scale(1); } }
  @keyframes button-sheen { to { transform: translateX(65%); } }

  /* Anticipation, lift, spring settle, resize, confirmation, then restore once. */
  @keyframes download-edit {
    0%, 23% { width: calc(50% - 6px); height: 130px; transform: none; box-shadow: none; animation-timing-function: var(--ease); }
    28% { width: calc(50% - 6px); height: 130px; transform: scale(.98); border-color: #8bbdff; animation-timing-function: var(--spring); }
    34% { width: calc(50% - 6px); height: 130px; transform: translateY(-9px) rotate(-2deg) scale(1.055); box-shadow: 0 18px 28px #163e7840; border-color: #62a6ff; animation-timing-function: var(--ease); }
    46% { width: calc(50% - 6px); height: 130px; transform: translateY(142px) rotate(1.5deg) scale(1.035); box-shadow: 0 16px 25px #163e7828; animation-timing-function: var(--spring); }
    53%, 57% { width: calc(50% - 6px); height: 130px; transform: translateY(142px); box-shadow: none; border-color: #dce8f8; animation-timing-function: var(--spring); }
    72% { width: 100%; height: 168px; transform: translateY(142px); border-color: #75b2ff; }
    79%, 100% { width: 100%; height: 168px; transform: translateY(142px); border-color: #e8edf6; box-shadow: none; }
  }
  @keyframes revenue-edit {
    0%, 36% { transform: translateX(calc(100% + 12px)); animation-timing-function: var(--spring); }
    53%, 100% { transform: none; }
  }
  @keyframes page-edit {
    0%, 4% { opacity: 0; transform: translateY(142px) scale(.7); animation-timing-function: var(--spring); }
    19%, 36% { opacity: 1; transform: translateY(142px); animation-timing-function: var(--spring); }
    53%, 100% { opacity: 1; transform: translateX(calc(100% + 12px)); }
  }
  @keyframes cursor-edit {
    0% { opacity: 0; transform: translate(22px, -19px) scale(1); }
    4%, 12% { opacity: 1; transform: translate(22px, -19px) scale(.9); }
    19% { opacity: 1; transform: translate(25cqw, 48px); animation-timing-function: var(--ease); }
    28% { opacity: 1; transform: translate(25cqw, 48px) scale(.86); animation-timing-function: var(--spring); }
    34% { opacity: 1; transform: translate(25cqw, 39px); animation-timing-function: var(--ease); }
    46%, 51% { opacity: 1; transform: translate(25cqw, 190px); animation-timing-function: var(--ease); }
    57% { opacity: 1; transform: translate(calc(50cqw - 16px), 258px); animation-timing-function: var(--spring); }
    72% { opacity: 1; transform: translate(calc(100cqw - 17px), 290px); }
    78%, 100% { opacity: 0; transform: translate(calc(100cqw - 17px), 290px); }
  }
  @keyframes touch-edit {
    0%, 23% { opacity: 0; transform: scale(.3); }
    28% { opacity: .9; transform: scale(1); }
    34% { opacity: 0; transform: scale(1.65); }
    100% { opacity: 0; }
  }
  @keyframes drop-edit { 0%, 34% { opacity: 0; } 40%, 46% { opacity: 1; } 54%, 100% { opacity: 0; } }
  @keyframes resize-edit { 0%, 54% { opacity: 0; transform: translateX(calc(-50cqw + 6px)); } 58% { opacity: 1; transform: translateX(calc(-50cqw + 6px)); animation-timing-function: var(--spring); } 72% { opacity: 1; transform: translateY(28px); } 78%, 100% { opacity: 0; transform: translateY(28px); } }
  @keyframes resize-chart { 0%, 57% { opacity: 0; transform: scaleY(.4); } 73%, 100% { opacity: 1; transform: scaleY(1); } }
  @keyframes add-edit { 0%, 4% { transform: scale(1); } 8% { transform: scale(.9); background: #cce3ff; } 17%, 100% { transform: none; } }
  @keyframes size-edit { 0%, 57% { background: transparent; color: #7b8da6; } 63% { transform: scale(1.15); background: #dcecff; color: var(--blue); } 73%, 100% { transform: none; background: white; color: var(--blue); } }
  @keyframes saved-edit { 0%, 75% { opacity: 0; transform: scale(.7); animation-timing-function: var(--spring); } 87%, 100% { opacity: 1; transform: scale(1); } }
  @keyframes check-edit { 0%, 79% { stroke-dasharray: 1; stroke-dashoffset: 1; } 88%, 100% { stroke-dasharray: 1; stroke-dashoffset: 0; } }
  @keyframes editing-label { 0% { opacity: 1; } 76%, 100% { opacity: 0; } }
  @keyframes restore-edit { 0%, 88% { opacity: 1; transform: none; } 91% { opacity: .2; transform: translateY(4px) scale(.985); } 97%, 100% { opacity: 1; transform: none; } }
  @keyframes demo-progress { 0% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
  @keyframes step-one { 0% { color: var(--blue); background: #e8f2ff; } 23%, 100% { color: #7a89a1; background: transparent; } }
  @keyframes step-two { 0% { color: #7a89a1; background: transparent; } 23% { color: var(--blue); background: #e8f2ff; } 55%, 100% { color: #7a89a1; background: transparent; } }
  @keyframes step-three { 0% { color: #7a89a1; background: transparent; } 55% { color: var(--blue); background: #e8f2ff; } 76%, 100% { color: #7a89a1; background: transparent; } }
  @keyframes step-four { 0% { color: #7a89a1; background: transparent; } 76%, 100% { color: var(--blue); background: #e8f2ff; } }
}
@media (max-width: 760px) {
  .editor-controls { font-size: 8px; }
  .size-control b { font-size: 7px; padding-inline: 4px; }
  .demo-steps { font-size: 8px; }
}
@media (max-width: 370px) {
  .demo-steps { font-size: 7px; }
  .size-control { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .motion-stage *, .motion-stage::before, .motion-stage::after, .button::before { animation: none !important; transition: none !important; }
  .button:hover, .button:active { transform: none; }
}
@media (max-width: 370px) {
  .site-header nav { display: none; }
  .site-header .button.small { margin-left: auto; flex-shrink: 0; white-space: nowrap; min-height: 44px; }
}
