/* <pg-timelapse> (tool.js). Tokens mirror widgets.css and the before-and-after maker. */
pg-timelapse{
  --tl-ink:#1d1d1f;--tl-muted:#6e6e73;--tl-panel:#f2f1ee;--tl-card:#fff;--tl-line:rgba(0,0,0,.1);--tl-fill:rgba(0,0,0,.055);
  --tl-orange:#ff8a1f;--tl-accent:#c25e00;--tl-cyan:#7fe9ff;--tl-stage:#1c1c1e;--tl-bad:#d70015;--tl-good:#248a3d;
  --tl-ease:cubic-bezier(.22,1,.36,1);
  display:block;margin:40px 0;color:var(--tl-ink);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",InterLocal,system-ui,sans-serif;
  -webkit-tap-highlight-color:transparent
}
@media (prefers-color-scheme:dark){
  pg-timelapse{--tl-ink:#f5f5f7;--tl-muted:#98989d;--tl-panel:#141416;--tl-card:#1f1f22;--tl-line:rgba(255,255,255,.12);--tl-fill:rgba(255,255,255,.08);
    --tl-accent:#ff9f3f;--tl-stage:#0b0b0c;--tl-bad:#ff6961;--tl-good:#30d158}
}
pg-timelapse[data-upgraded]>:not(.tl-ui){display:none}
.tl-ui{position:relative;background:var(--tl-panel);border-radius:28px;padding:clamp(16px,3.6vw,30px);container-type:inline-size;font-size:16px;line-height:1.5}
.tl-ui :focus-visible{outline:2px solid var(--tl-orange);outline-offset:3px}
.tl-ui button{font:inherit;color:inherit;border:0;background:none;padding:0;cursor:pointer}
.tl-ui button:disabled{cursor:default;opacity:.4}
.tl-ui p{margin:0}
.tl-ui [hidden]{display:none!important}
.tl-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.tl-offscreen{position:fixed;left:-20000px;top:0;width:2px;height:2px;pointer-events:none}

.tl-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;margin-bottom:22px}
.tl-eyebrow{font-size:13px;font-weight:650;letter-spacing:.01em;color:var(--tl-accent)}
.tl-private{display:inline-flex;align-items:center;gap:8px;padding:7px 14px 7px 11px;border-radius:999px;background:color-mix(in srgb,var(--tl-good) 12%,var(--tl-card));color:var(--tl-ink);font-size:14px;line-height:1.3}
.tl-private svg{width:16px;height:16px;flex:none;color:var(--tl-good)}

.tl-step+.tl-step{margin-top:30px;padding-top:28px;border-top:1px solid var(--tl-line)}
.tl-ui .tl-step-title{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:0 0 8px;font-size:clamp(18px,2.4vw,21px);font-weight:700;letter-spacing:-.015em;line-height:1.3}
.tl-num{flex:none;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--tl-ink);color:var(--tl-panel);font-size:14px;font-weight:700}
.tl-optional{padding:2px 9px;border-radius:999px;background:var(--tl-fill);color:var(--tl-muted);font-size:12.5px;font-weight:600;letter-spacing:0}
.tl-step-help{max-width:46em;margin-bottom:18px!important;color:var(--tl-muted);font-size:15.5px}
.tl-dot{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;font-size:12px;font-weight:700;vertical-align:1px;color:#1a0d00}
.tl-dot-1{background:var(--tl-orange)}.tl-dot-2{background:var(--tl-cyan);color:#00262e}

/* Step 1: photos */
.tl-file{display:none}
.tl-photos{border-radius:22px;transition:box-shadow .2s}
.tl-photos.tl-over{box-shadow:0 0 0 2px var(--tl-orange),0 0 0 6px rgba(255,138,31,.18)}
.tl-drop-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;width:100%;min-height:200px;padding:24px;border-radius:20px;background:var(--tl-card);
  box-shadow:inset 0 0 0 1.5px var(--tl-line);text-align:center;transition:box-shadow .2s,transform .25s var(--tl-ease)}
.tl-ui .tl-drop-btn:hover{box-shadow:inset 0 0 0 1.5px var(--tl-orange)}
.tl-ui .tl-drop-btn:active{transform:scale(.99)}
.tl-plus{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:var(--tl-orange);color:#1a0d00;margin-bottom:6px;box-shadow:0 8px 20px -8px rgba(255,138,31,.7)}
.tl-plus svg{width:22px;height:22px}
.tl-drop-title{font-size:17px;font-weight:650}
.tl-drop-sub{max-width:30em;font-size:14px;color:var(--tl-muted)}

.tl-ui .tl-grid{list-style:none;margin:0;padding:4px;display:grid;grid-template-columns:repeat(auto-fill,minmax(74px,1fr));gap:10px;max-height:min(420px,60svh);overflow:auto;overscroll-behavior:contain}
.tl-ui .tl-grid li{position:relative;min-width:0;margin:0;padding:0;list-style:none}
.tl-ui .tl-grid li::before{content:none}
.tl-ui .tl-grid li::marker{content:none}
.tl-grid li.tl-drop-before::before,.tl-grid li.tl-drop-after::after{content:"";position:absolute;top:0;bottom:0;width:3px;border-radius:2px;background:var(--tl-orange);z-index:2}
.tl-grid li.tl-drop-before::before{left:-6.5px}.tl-grid li.tl-drop-after::after{right:-6.5px}
.tl-ui .tl-thumb{position:relative;display:block;width:100%;aspect-ratio:3/4;border-radius:12px;overflow:hidden;background:var(--tl-stage);cursor:grab;
  box-shadow:0 0 0 1px var(--tl-line);transition:box-shadow .2s,transform .25s var(--tl-ease),opacity .2s}
.tl-thumb canvas{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
.tl-ui .tl-thumb[aria-pressed=true]{box-shadow:0 0 0 2.5px var(--tl-orange),0 6px 16px -6px rgba(255,138,31,.6)}
.tl-ui .tl-thumb.tl-playing{box-shadow:0 0 0 2px var(--tl-ink)}
.tl-ui .tl-thumb[aria-pressed=true].tl-playing{box-shadow:0 0 0 2.5px var(--tl-orange),0 0 0 5px var(--tl-ink)}
.tl-thumb.tl-lifted{opacity:.4}
.tl-ui .tl-thumb:focus-visible{outline-offset:2px}
.tl-badge{position:absolute;left:5px;top:5px;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:rgba(20,20,20,.62);color:#fff;font-size:11.5px;font-weight:650;line-height:20px;text-align:center;
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.tl-check{position:absolute;right:5px;top:5px;width:18px;height:18px;border-radius:50%;background:var(--tl-good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat}
.tl-add-tile button{display:grid;place-items:center;width:100%;aspect-ratio:3/4;border-radius:12px;background:var(--tl-card);box-shadow:inset 0 0 0 1.5px var(--tl-line);color:var(--tl-accent);transition:box-shadow .2s}
.tl-ui .tl-add-tile button:hover{box-shadow:inset 0 0 0 1.5px var(--tl-orange)}
.tl-add-tile svg{width:24px;height:24px}

.tl-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;margin-top:16px}
.tl-order{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--tl-muted)}
.tl-order select{height:36px;padding:0 30px 0 12px;border:0;border-radius:999px;background:var(--tl-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") right 9px center/16px no-repeat;
  -webkit-appearance:none;appearance:none;color:var(--tl-ink);font:inherit;font-size:14.5px;font-weight:550;box-shadow:inset 0 0 0 1px var(--tl-line);cursor:pointer}
.tl-sel-tools{display:flex;align-items:center;gap:8px;margin-left:auto;font-size:14px}
.tl-sel-name{color:var(--tl-muted);font-variant-numeric:tabular-nums;margin-right:4px}
.tl-ui .tl-icon-btn{display:grid;place-items:center;width:36px;height:36px;border-radius:50%;background:var(--tl-card);box-shadow:inset 0 0 0 1px var(--tl-line);transition:box-shadow .2s,transform .2s var(--tl-ease)}
.tl-ui .tl-icon-btn:hover:not(:disabled){box-shadow:inset 0 0 0 1px var(--tl-orange)}
.tl-ui .tl-icon-btn:active:not(:disabled){transform:scale(.94)}
.tl-icon-btn svg{width:18px;height:18px}
.tl-ui .tl-link{color:var(--tl-accent);font-weight:600;font-size:14px;padding:6px 2px;text-decoration:none;text-align:left}
.tl-ui .tl-link:hover:not(:disabled){text-decoration:underline}
.tl-ui .tl-secondary{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;padding:0 18px;border-radius:999px;background:var(--tl-card);font-size:15px;font-weight:600;
  box-shadow:inset 0 0 0 1px var(--tl-line),0 1px 2px rgba(0,0,0,.05);transition:transform .25s var(--tl-ease),box-shadow .2s;text-decoration:none;color:var(--tl-ink)}
.tl-ui .tl-secondary:hover:not(:disabled){box-shadow:inset 0 0 0 1px var(--tl-orange)}
.tl-ui .tl-secondary:active:not(:disabled){transform:scale(.97)}
.tl-secondary svg,.tl-primary svg{width:18px;height:18px}
.tl-note{font-size:12.5px;color:var(--tl-muted);margin-left:auto!important}
.tl-status{min-height:1.5em;margin-top:12px!important;font-size:14px;color:var(--tl-muted);font-variant-numeric:tabular-nums}
.tl-status.tl-error{color:var(--tl-bad);font-weight:550}

/* Step 2: alignment editor */
.tl-align-row{margin-top:0}
.tl-align-body{margin-top:18px}
.tl-editor{display:grid;gap:18px;align-items:start}
@container (min-width:700px){.tl-editor{grid-template-columns:minmax(0,1fr) 270px;gap:28px}}
.tl-ed-photo-wrap{min-width:0;display:flex;justify-content:center}
.tl-photo{position:relative;border-radius:16px;background:var(--tl-stage);touch-action:pan-y;user-select:none;-webkit-user-select:none;max-width:100%}
.tl-frame{position:absolute;inset:0;border-radius:inherit;overflow:hidden}
.tl-frame canvas{display:block;width:100%;height:100%}
.tl-line{position:absolute;height:0;border-top:2px dashed rgba(255,255,255,.85);transform-origin:0 0;pointer-events:none;filter:drop-shadow(0 0 2px rgba(0,0,0,.6))}
.tl-ui .tl-handle{position:absolute;z-index:2;width:30px;height:30px;margin:-15px 0 0 -15px;border-radius:50%;display:grid;place-items:center;font-size:13px;font-weight:750;color:#1a0d00;
  background:var(--tl-orange);box-shadow:0 0 0 2.5px #fff,0 4px 14px rgba(0,0,0,.45);touch-action:none;cursor:grab;transition:transform .2s var(--tl-ease)}
.tl-ui .tl-handle::before{content:"";position:absolute;inset:-9px;border-radius:50%}
.tl-ui .tl-handle-2{background:var(--tl-cyan);color:#00262e}
.tl-ui .tl-handle:active{cursor:grabbing;transform:scale(1.12)}
.tl-ui .tl-handle:focus-visible{outline:3px solid #fff;outline-offset:3px}
.tl-loupe{position:absolute;z-index:3;width:110px;height:110px;margin:-55px 0 0 -55px;border-radius:50%;box-shadow:0 0 0 3px #fff,0 10px 30px rgba(0,0,0,.45);pointer-events:none;opacity:0;transform:scale(.8);transition:opacity .15s,transform .2s var(--tl-ease)}
.tl-dragging .tl-loupe{opacity:1;transform:none}
.tl-ed-side{display:grid;gap:14px;align-content:start}
.tl-ed-nav{display:flex;align-items:center;gap:10px}
.tl-ed-count{flex:1;white-space:nowrap;font-weight:650;font-variant-numeric:tabular-nums}
.tl-ui .tl-next{min-height:40px;padding:0 12px 0 16px;font-size:14.5px;white-space:nowrap}
.tl-ed-status{font-size:13.5px;color:var(--tl-muted);font-variant-numeric:tabular-nums}
.tl-ed-status:empty{display:none}
.tl-meter{position:relative;height:6px;border-radius:999px;background:var(--tl-fill);overflow:hidden}
.tl-meter span{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--tl-good);transition:width .3s var(--tl-ease)}
.tl-ed-side .tl-meter{margin-top:22px;overflow:visible}
.tl-ed-side .tl-meter::before{content:attr(data-text);position:absolute;bottom:12px;left:0;font-size:13px;color:var(--tl-muted);white-space:nowrap}

/* Step 3: studio */
.tl-studio{display:grid;gap:22px;align-items:start}
@container (min-width:760px){.tl-studio{grid-template-columns:minmax(0,1fr) 290px;gap:28px}}
.tl-stage-wrap{position:relative;min-width:0;display:flex;flex-direction:column;align-items:center;gap:12px}
.tl-stage{position:relative;width:100%;aspect-ratio:4/5;border-radius:18px;overflow:hidden;background:var(--tl-stage);touch-action:pan-y;user-select:none;-webkit-user-select:none;cursor:grab;
  box-shadow:0 0 0 1px rgba(255,255,255,.06),0 30px 60px -30px rgba(0,0,0,.5);isolation:isolate}
pg-timelapse:not([data-tl-ready]) .tl-stage{max-width:420px;cursor:default}
.tl-stage.tl-grabbing{cursor:grabbing}
.tl-stage canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.tl-stage:focus-visible{outline:2px solid var(--tl-orange);outline-offset:4px}
.tl-empty{position:absolute;inset:0;display:grid;place-content:center;gap:6px;padding:24px;text-align:center;color:#a1a1a6;font-size:14.5px;
  background:radial-gradient(120% 80% at 50% 0%,rgba(255,138,31,.16),transparent 60%)}
.tl-ui .tl-empty-title{color:#f5f5f7;font-size:17px;font-weight:650}
.tl-ui .tl-big-play{position:absolute;left:50%;top:50%;z-index:2;display:grid;place-items:center;width:68px;height:68px;margin:-34px 0 0 -34px;border-radius:50%;color:#fff;
  background:rgba(40,40,40,.45);box-shadow:0 0 0 1px rgba(255,255,255,.25) inset,0 8px 24px rgba(0,0,0,.3);-webkit-backdrop-filter:blur(16px) saturate(1.6);backdrop-filter:blur(16px) saturate(1.6);transition:transform .25s var(--tl-ease)}
.tl-ui .tl-big-play:hover{transform:scale(1.06)}
.tl-big-play svg{width:28px;height:28px;margin-left:3px}
.tl-player{display:flex;align-items:center;gap:12px;width:100%;max-width:100%}
.tl-ui .tl-play{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:var(--tl-ink);color:var(--tl-panel)}
.tl-play svg{width:18px;height:18px}
.tl-counter{min-width:56px;text-align:right;font-size:14px;color:var(--tl-muted);font-variant-numeric:tabular-nums}
.tl-ui input[type=range]{flex:1;min-width:0;height:28px;margin:0;accent-color:var(--tl-orange);cursor:pointer}

.tl-controls{min-width:0;margin:0;padding:0;border:0;display:grid;gap:22px}
.tl-controls:disabled{opacity:.5}
.tl-group{display:grid;gap:12px}
.tl-label{font-size:13px;font-weight:650;letter-spacing:.01em;color:var(--tl-muted)}
.tl-sub{font-size:13.5px;color:var(--tl-muted);font-variant-numeric:tabular-nums;margin-top:-6px!important}
.tl-hint{font-size:13px;color:var(--tl-muted);line-height:1.4}
.tl-seg{display:flex;padding:3px;border-radius:999px;background:var(--tl-fill)}
.tl-ui .tl-seg button{flex:1 1 auto;min-width:0;height:34px;padding:0 10px;border-radius:999px;font-size:14px;font-weight:550;color:var(--tl-muted);white-space:nowrap;transition:color .2s,background .25s,box-shadow .25s}
.tl-ui .tl-seg button[aria-pressed=true]{color:var(--tl-ink);background:var(--tl-card);box-shadow:0 1px 2px rgba(0,0,0,.08),0 3px 10px -2px rgba(0,0,0,.12)}
.tl-ui .tl-seg button:focus-visible{outline-offset:-2px}
@media (prefers-color-scheme:dark){.tl-ui .tl-seg button[aria-pressed=true]{background:rgba(255,255,255,.16);box-shadow:none}}
.tl-range-row{display:flex;align-items:center;gap:12px;font-size:14px}
.tl-range-row label{min-width:40px;color:var(--tl-muted)}
.tl-range-row output{min-width:44px;text-align:right;font-variant-numeric:tabular-nums;color:var(--tl-ink);font-weight:550;white-space:nowrap}
.tl-toggles{display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px}
.tl-switch{display:inline-flex;align-items:center;gap:9px;font-size:15px;cursor:pointer}
.tl-switch input{appearance:none;-webkit-appearance:none;position:relative;flex:none;width:42px;height:26px;margin:0;border-radius:999px;background:var(--tl-fill);box-shadow:inset 0 0 0 1px var(--tl-line);cursor:pointer;transition:background .25s}
.tl-switch input::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:transform .3s var(--tl-ease)}
.tl-switch input:checked{background:var(--tl-orange)}
.tl-switch input:checked::after{transform:translateX(16px)}
.tl-switch input:disabled{opacity:.4;cursor:default}
.tl-switch input:focus-visible{outline:2px solid var(--tl-orange);outline-offset:3px}
.tl-align-row .tl-switch{font-weight:600}
.tl-prefix{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--tl-muted)}
.tl-prefix input{flex:1;min-width:0;height:38px;padding:0 12px;border:0;border-radius:12px;background:var(--tl-card);color:var(--tl-ink);font:inherit;font-size:16px;box-shadow:inset 0 0 0 1px var(--tl-line)}
.tl-prefix input:focus{outline:2px solid var(--tl-orange);outline-offset:0}

.tl-size{font-size:13.5px;color:var(--tl-muted);line-height:1.45}
.tl-actions{display:flex;gap:10px}
.tl-ui .tl-primary{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:50px;padding:0 22px;border-radius:999px;background:var(--tl-orange);color:#1a0d00;font-size:16px;font-weight:650;text-decoration:none;
  box-shadow:0 1px 0 rgba(255,255,255,.35) inset,0 8px 24px -8px rgba(255,138,31,.6);transition:transform .25s var(--tl-ease)}
.tl-ui .tl-primary:active:not(:disabled){transform:scale(.97)}
.tl-actions .tl-secondary{min-height:50px}
.tl-progress span{background:var(--tl-orange);transition:width .2s linear}
.tl-result{display:grid;gap:10px;padding:14px;border-radius:18px;background:color-mix(in srgb,var(--tl-good) 10%,var(--tl-card))}
.tl-result-name{font-size:13.5px;font-weight:550;overflow-wrap:anywhere}

@container (max-width:520px){
  .tl-ui .tl-step-title{font-size:18px}
  .tl-ui .tl-grid{grid-template-columns:repeat(auto-fill,minmax(60px,1fr));gap:8px}
  .tl-sel-tools{margin-left:0;width:100%}
  .tl-sel-name{margin-right:auto}
  .tl-row>.tl-secondary{flex:1 1 auto}
  .tl-note{margin-left:0!important;width:100%}
}
@media (prefers-reduced-motion:reduce){pg-timelapse *{transition:none!important}}

/* No-JS fallback */
pg-timelapse:not([data-upgraded]) figure{margin:0}
pg-timelapse:not([data-upgraded]) .tl-fallback{padding:20px 22px;border-radius:22px;background:var(--tl-panel);margin-top:16px}
