/* Mako Autopilot on /new: the app's Autopilot moments (#1705, makoAgent.css), told with motion
   rather than words: a goal typed in, the week's plan as dots, the switch with its rainbow edge
   light, shockwave and sparks, two new ads developing in the live card, and a spark pop when
   Mako is done. The demo plays itself (autopilot.js sets data-step on #ap-demo); with reduced
   motion it shows the finished state, still. The panel never changes height, so nothing on
   the page moves and the edge light always runs around the whole panel. */

@property --ap-spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.ap{max-width:480px;margin:0 auto}
.ap-stage{position:relative}

/* Story-style progress: one segment per moment, filling while the demo is on it. */
.ap-track{list-style:none;margin:0 0 14px;padding:0 10px;display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.ap-track li{height:4px;border-radius:2px;background:rgba(159,220,255,.18);overflow:hidden}
.ap-track li::before{content:"";display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#3d8bff,#8a5cff,#ff4fd8);transform:scaleX(0);transform-origin:left}
.ap-track li.full::before{transform:none}
.ap-track li.run::before{animation:ap-fill var(--d,2s) linear forwards}

/* The panel: Mako's panel from the app, white on the deep water. */
.ap-panel{position:relative;z-index:1;padding:16px;border-radius:28px;background:#fff;color:#1d1d1f;text-align:left;
  box-shadow:0 40px 90px -30px rgba(0,8,30,.75),0 12px 30px -12px rgba(0,8,30,.5);font-size:15px;line-height:1.4}
.ap-head{display:flex;align-items:center;gap:12px;padding:2px 2px 4px}
.ap-face{position:relative;flex:none;width:46px;height:46px;border-radius:14px;overflow:hidden;background:#0b2a4a;box-shadow:0 0 0 2px #fff,0 0 0 3.5px rgba(10,132,255,.35);transition:box-shadow .4s ease}
.ap-face video,.ap-face img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:opacity .35s ease}
.ap-face .ap-celebrate{opacity:0}
#ap-demo[data-step="done"] .ap-face .ap-celebrate{opacity:1}
.ap-on .ap-face{box-shadow:0 0 0 2px #fff,0 0 0 3.5px #8a5cff}
.ap-who b{display:block;font-size:17px;font-weight:700;letter-spacing:-.01em}
.ap-status{display:block;min-height:1.4em;font-size:14px;color:#6e6e73}
.ap-status i{font-style:normal;display:none}
#ap-demo:not([data-step]) .ap-status .s-goal,#ap-demo[data-step="goal"] .ap-status .s-goal,#ap-demo[data-step="plan"] .ap-status .s-plan,
#ap-demo[data-step="switch"] .ap-status .s-on,#ap-demo[data-step="work"] .ap-status .s-work,#ap-demo[data-step="done"] .ap-status .s-done{display:inline}
#ap-demo[data-step="switch"] .ap-status .s-on,#ap-demo[data-step="work"] .ap-status .s-work{
  background:linear-gradient(90deg,#3d6bff,#8a4cff,#e0359e,#f0662a,#8a4cff,#3d6bff) 0 0/250% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;font-weight:600;
  animation:ap-flow 2.2s linear infinite}

/* Goal, week and switch: one calm row each. */
.ap-row{display:flex;align-items:center;gap:12px;min-height:52px;margin-top:10px;padding:0 14px;border-radius:16px;background:#f5f7fa}
.ap-label{flex:none;width:76px;font-size:12px;font-weight:650;letter-spacing:.02em;text-transform:uppercase;color:#86868b}
.ap-goal-text{flex:1;min-width:0;margin:0;font-weight:600;white-space:nowrap;overflow:hidden}
.ap-goal-text .ap-caret{display:inline-block;width:2px;height:1.05em;margin-left:1px;vertical-align:-.15em;background:#0a84ff;animation:ap-caret 1s steps(1) infinite}
.ap-check{position:relative;flex:none;width:22px;height:22px;border-radius:50%;background:#34c759;transform:scale(0);transition:transform .45s cubic-bezier(.3,1.6,.5,1)}
.ap-check::after,.ap-tile b::after{content:"";position:absolute;left:8px;top:4.5px;width:5px;height:10px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}
.ap-got .ap-check{transform:none}

/* The week: Monday, Wednesday and Friday get a dot as Mako plans them. */
.ap-week{flex:1;display:grid;grid-template-columns:repeat(7,1fr);text-align:center}
.ap-week>span{display:grid;justify-items:center;gap:5px;font-size:12px;font-weight:600;line-height:1;color:#aeaeb2;transition:color .3s ease}
.ap-week i{position:relative;width:10px;height:10px;border-radius:50%;box-shadow:inset 0 0 0 1.5px #d8d8de}
.ap-week i::after{content:"";position:absolute;inset:-1px;border-radius:50%;background:linear-gradient(135deg,#3d8bff,#8a5cff 55%,#ff4fd8);transform:scale(0);
  transition:transform .5s cubic-bezier(.3,1.7,.5,1)}
.ap-week .on{color:#1d1d1f}
.ap-week .on i::after{transform:none}

/* The switch: a press (the thumb stretches, as on iPhone), then a slow flowing rainbow once it's on. */
.ap-auto b{flex:1;font-size:16px;font-weight:650}
.ap-switch{position:relative;flex:none;width:51px;height:31px;border-radius:999px;background:#e3e3e8;transition:background-color .25s ease}
.ap-switch::before{content:"";position:absolute;left:-2px;top:-7px;width:44px;height:44px;border-radius:50%;background:rgba(60,60,67,.16);opacity:0;transform:scale(1.4);
  transition:opacity .3s ease,transform .3s ease;pointer-events:none}
.ap-switch::after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:999px;background:#fff;box-shadow:0 3px 8px rgba(0,0,0,.18),0 1px 1px rgba(0,0,0,.08);
  transition:transform .4s cubic-bezier(.3,1.3,.5,1),width .25s ease}
.ap-press .ap-switch::before{opacity:1;transform:none;transition-duration:.12s}
.ap-press .ap-switch::after{width:33px}
.ap-on .ap-switch{background:linear-gradient(90deg,#3d8bff,#8a5cff,#ff4fd8,#ff7a45,#ffc53d,#8a5cff,#3d8bff) 0 0/300% 100%;
  box-shadow:0 0 14px -2px rgba(138,92,255,.6),0 0 20px -6px rgba(255,79,216,.55);animation:ap-flow 5s linear infinite}
.ap-on .ap-switch::after{transform:translateX(20px)}
.ap-on .ap-auto b{background:linear-gradient(90deg,#3d6bff,#8a4cff,#e0359e);-webkit-background-clip:text;background-clip:text;color:transparent;font-weight:700}

/* The live card: grey and still while Autopilot is off; then the bar runs and two ads develop. */
.ap-live{position:relative;margin-top:10px;padding:14px;border-radius:20px;background:#f5f7fa;transition:background-color .4s ease,box-shadow .4s ease}
.ap-live::before{content:"";position:absolute;inset:0;border-radius:inherit;padding:1.5px;background:linear-gradient(120deg,#3d8bff,#8a5cff,#ff4fd8);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask-composite:exclude;
  opacity:0;transition:opacity .4s ease;pointer-events:none}
.ap-live-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px;opacity:0;transition:opacity .3s ease}
.ap-live-top b{font-size:16px;font-weight:650}
.ap-timer{font-size:13px;font-variant-numeric:tabular-nums;color:#6e6e73;transition:color .3s ease}
.ap-bar{height:4px;margin-top:10px;border-radius:2px;background:#e6e8ee;overflow:hidden}
.ap-bar i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#3d8bff,#8a5cff,#ff4fd8,#8a5cff,#3d8bff) 0 0/200% 100%;transform:scaleX(0);transform-origin:left;
  transition:background-color .3s ease}
.ap-tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}
.ap-tile{position:relative;aspect-ratio:1}
.ap-img{position:absolute;inset:0;border-radius:14px;overflow:hidden;background:#e9ecf2}
.ap-img::before{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.75) 50%,transparent 70%) 0 0/250% 100%;opacity:0}
.ap-tile img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;filter:blur(14px) saturate(.6);transform:scale(1.08);
  transition:opacity .3s ease,filter .3s ease,transform .3s ease}
.ap-tile b{position:absolute;right:-7px;top:-7px;z-index:1;width:24px;height:24px;border-radius:50%;background:#34c759;box-shadow:0 0 0 2.5px #fff,0 3px 8px rgba(0,0,0,.2);transform:scale(0);
  transition:transform .45s cubic-bezier(.3,1.6,.5,1)}
.ap-tile b::after{left:9px;top:5px}
.ap-tile.in img{opacity:1;filter:none;transform:none;transition:opacity .45s ease,filter .8s cubic-bezier(.2,.8,.2,1),transform .8s cubic-bezier(.2,.8,.2,1)}
.ap-tile.in b{transform:none;transition-delay:.35s}
.ap-ask{margin-top:12px;opacity:0;transform:translateY(6px);transition:opacity .35s ease,transform .45s cubic-bezier(.2,.8,.2,1)}
.ap-ask p{margin:0;font-size:14px;color:#424245}
.ap-btns{display:flex;gap:8px;margin-top:8px}
.ap-btns span{flex:1;padding:9px 12px;border-radius:999px;text-align:center;font-size:14px;font-weight:600}
.ap-no{background:#f2f2f7;color:#1d1d1f}
.ap-yes{position:relative;overflow:hidden;background:#0a84ff;color:#fff}
.ap-yes::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,.5) 50%,transparent 70%);transform:translateX(-120%)}

#ap-demo:is([data-step="work"],[data-step="done"]) .ap-live{background:#fff;box-shadow:0 10px 26px -14px rgba(138,92,255,.6)}
#ap-demo:is([data-step="work"],[data-step="done"]) .ap-live::before,#ap-demo:is([data-step="work"],[data-step="done"]) .ap-live-top{opacity:1}
#ap-demo[data-step="work"] .ap-bar i{animation:ap-fill 2.9s cubic-bezier(.4,0,.2,1) forwards,ap-flow 1.6s linear infinite}
#ap-demo[data-step="work"] .ap-tile:not(.in) .ap-img::before{opacity:1;animation:ap-flow 1.4s linear infinite}
#ap-demo[data-step="done"] .ap-bar i{transform:none;background:#34c759}
#ap-demo[data-step="done"] .ap-timer{color:#34c759}
#ap-demo[data-step="done"] .ap-ask{opacity:1;transform:none}
#ap-demo[data-step="done"] .ap-yes::after{animation:ap-sheen 1.1s .7s ease forwards}

/* The burst: edge light around the panel (a crisp line and a wide glow), a shockwave and sparks. */
.ap-fx{position:absolute;inset:0;z-index:2;pointer-events:none}
.ap-edge{position:absolute;inset:-3px;padding:3px;border-radius:31px;
  background:conic-gradient(from var(--ap-spin),#3d8bff,#8a5cff,#ff4fd8,#ff7a45,#ffc53d,#3dd6a6,#3d8bff);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);mask-composite:exclude;opacity:0}
.ap-glow{position:absolute;inset:0;filter:blur(18px)}
.ap-edge--wide{inset:-14px;padding:16px;border-radius:42px}
.ap-burst .ap-edge{animation:ap-spin 2.2s cubic-bezier(.3,.1,.3,1) forwards,ap-edge 2.2s ease forwards}
.ap-origin{position:absolute;width:0;height:0}
.ap-wave{position:absolute;left:-24px;top:-24px;width:48px;height:48px;border-radius:50%;
  background:conic-gradient(#3d8bff,#8a5cff,#ff4fd8,#ff7a45,#ffc53d,#3dd6a6,#3d8bff);
  -webkit-mask:radial-gradient(circle,transparent 60%,#000 63%,#000 69%,transparent 72%);mask:radial-gradient(circle,transparent 60%,#000 63%,#000 69%,transparent 72%);
  opacity:0;animation:ap-wave 760ms cubic-bezier(.2,.8,.2,1) forwards}
.ap-wave--late{animation-delay:140ms}
.ap-wave--small{left:-18px;top:-18px;width:36px;height:36px}
.ap-spark{position:absolute;left:0;top:0;width:var(--s);height:var(--s);margin:calc(var(--s)/-2) 0 0 calc(var(--s)/-2);border-radius:50%;background:var(--c);
  box-shadow:0 0 10px 2px var(--c);opacity:0;animation-name:ap-spark;animation-timing-function:cubic-bezier(.15,.7,.3,1);animation-fill-mode:forwards}

@keyframes ap-fill{to{transform:none}}
@keyframes ap-flow{to{background-position:300% 0}}
@keyframes ap-spin{to{--ap-spin:320deg}}
@keyframes ap-edge{0%{opacity:0}12%{opacity:1}62%{opacity:.9}100%{opacity:0}}
@keyframes ap-wave{from{opacity:1;transform:scale(.4)}to{opacity:0;transform:scale(4.6)}}
@keyframes ap-spark{0%{opacity:1;transform:translate(0,0) scale(1)}70%{opacity:.9}100%{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.3)}}
@keyframes ap-sheen{to{transform:translateX(120%)}}
@keyframes ap-caret{50%{opacity:0}}

.ap-note{margin:22px 0 0;text-align:center}
@media (max-width:480px){
  .ap-panel{padding:14px;border-radius:24px}.ap-edge{border-radius:27px}
  .ap-row{padding:0 12px;gap:10px}.ap-label{width:68px;font-size:11px}
  .ap-live{padding:12px}.ap-tiles{gap:8px}
}

/* Reduced motion: the finished state, still; no burst, no flow, no shimmer. */
@media (prefers-reduced-motion:reduce){
  .ap-on .ap-switch,#ap-demo .ap-status i,.ap-goal-text .ap-caret,#ap-demo .ap-bar i,#ap-demo .ap-img::before,#ap-demo .ap-yes::after,.ap-track li::before{animation:none}
  .ap-panel *,.ap-panel *::before,.ap-panel *::after{transition:none!important}
  .ap-fx{display:none}
}
