/* Motion v2 — styles for the interaction motion system (app/motion.js, app/effects.js, dnd.js, swipe.js, sheet.js).
   Only transform / opacity / filter / clip-path are ever animated or transitioned here. */

/* ---------- containers that host absolutely positioned motion layers ---------- */
.outline { position: relative; }
.rows { position: relative; }

/* ---------- shared selection highlight (slides between rows; selection itself is instant) ---------- */
.sel-hl { position: absolute; top: 0; left: 0; height: 0; border-radius: 9px; background: var(--sel); pointer-events: none; opacity: 0; }
.sel-hl.on { opacity: 1; }
body.is-dragging .sel-hl { opacity: 0; }
.outline.hl-on .row.sel.cursor { background: transparent; }
.outline.hl-on .row.sel.cursor:hover { background: color-mix(in srgb, var(--text) 2.5%, transparent); }

/* ---------- hover / press ---------- */
.row .check:hover { transform: scale(1.08); }
.row .check:active { transform: scale(.9); }
.row .disc { transition: transform 280ms var(--ease-spring); }

/* ---------- completion: elastic circle, fill spreads, tick wipes in, title struck left → right ---------- */
.row .check { position: relative; }
.row .check::before {
  content: ''; position: absolute; inset: -1.5px; border-radius: inherit; background: var(--ok);
  clip-path: circle(0% at 50% 50%); transition: clip-path 260ms var(--ease-out); pointer-events: none;
}
.row.kind-folder .check::before { display: none; }
.row.checking .check, .row.st-completed .check { background: transparent; border-color: var(--ok); color: #fff; animation: none; }
.row.checking .check::before, .row.st-completed .check::before { clip-path: circle(75% at 50% 50%); }
.row .check .tick { position: relative; z-index: 1; clip-path: inset(0 100% 0 0); transition: clip-path 220ms var(--ease-out) 90ms; }
.row .check .tick path { stroke-dashoffset: 0; }
.row.checking .check .tick, .row.st-completed .check .tick { clip-path: inset(0 0 0 0); }
.row.unchecking .check::before { clip-path: circle(0% at 50% 50%) !important; transition-duration: 200ms; }
.row.unchecking .check .tick { clip-path: inset(0 0 0 100%) !important; transition-delay: 0s; }
.row.unchecking .check { color: var(--text); }

.row .title .tt { position: relative; }
.row .title .tt::after {
  content: ''; position: absolute; left: -1px; right: -1px; top: 52%; height: 1.5px; border-radius: 1px; background: var(--muted);
  transform: scaleX(0); transform-origin: left center; transition: transform 300ms var(--ease-out) 110ms; pointer-events: none;
}
.row.checking .title { text-decoration: none; color: var(--text); }
.row.checking .title .tt { opacity: .55; transition: opacity 240ms var(--ease) 140ms; }
.row.checking .title .tt::after { transform: scaleX(1); }
.row.unchecking .title { text-decoration: none; }
.row.unchecking .title .tt::after { transform: scaleX(1); transform-origin: right center; animation: strike-out 220ms var(--ease-in) both; }
@keyframes strike-out { to { transform: scaleX(0); } }

/* "Done · Undo" chip shown during the grace period */
.undo-chip {
  position: absolute; right: 8px; top: 50%; z-index: 2; display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ok); font-weight: 560;
  background: var(--surface); padding: 2px 3px 2px 11px; border-radius: var(--r-pill); box-shadow: var(--e-2); transform: translateY(-50%);
  animation: chip-in var(--dur) var(--ease-out) both;
}
.undo-chip .sep { color: var(--muted); font-weight: 400; }
.undo-chip button { color: var(--accent-ink); font-weight: 650; padding: 3px 10px; border-radius: var(--r-pill); background: var(--accent-soft); }
@keyframes chip-in { from { opacity: 0; transform: translateY(-50%) translateX(10px) scale(.96); } to { opacity: 1; transform: translateY(-50%); } }
@media (max-width: 767px) { .undo-chip button { padding: 8px 12px; } }

/* ---------- effects layer: particles, fly-in chip, theme veil ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 140; overflow: hidden; }
.fx-dot { position: absolute; width: 6px; height: 6px; border-radius: 50%; will-change: transform, opacity; }
.fly-chip {
  position: absolute; transform-origin: left center; transform: translateY(-50%); max-width: 280px; padding: 6px 13px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-text); font-size: 13px; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent), var(--e-2); will-change: transform, opacity;
}
.fx-veil { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
html.vt-theme::view-transition-old(root), html.vt-theme::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.vt-theme::view-transition-new(root) { z-index: 1; }

/* chip changed → one soft background pulse (opacity of an overlay) */
.fx-pulse { position: relative; }
.fx-pulse::after { content: ''; position: absolute; inset: -2px -5px; border-radius: 6px; background: var(--accent-soft); opacity: 0; pointer-events: none; }

/* project completed → one highlight sweep */
.row.fx-celebrate { overflow: hidden; }
.row.fx-celebrate::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent 15%, color-mix(in srgb, var(--ok) 26%, transparent) 50%, transparent 85%);
}

/* ---------- odometer counters ---------- */
.odo { display: inline-flex; }
.odo-col { display: inline-block; height: 1.25em; line-height: 1.25em; overflow: hidden; vertical-align: top; }
.odo-stack { display: flex; flex-direction: column; }
.odo-stack > span, .odo-static { display: block; height: 1.25em; line-height: 1.25em; }
.badge, .title-count { font-variant-numeric: tabular-nums; }

/* ---------- drag & drop ---------- */
.drag-lift {
  position: fixed; z-index: 100; pointer-events: none; margin: 0; background: var(--surface); border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .2), 0 3px 8px rgba(0, 0, 0, .08); transform-origin: 50% 50%; will-change: transform; content-visibility: visible;
}
.drag-lift .actions, .drag-lift .undo-chip { display: none; }
.lift-count {
  position: absolute; top: -9px; right: -9px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 650; box-shadow: var(--e-2);
}
.row.drag-src { outline: 1.5px dashed var(--line-strong); outline-offset: -3px; background: color-mix(in srgb, var(--text) 2.5%, transparent) !important; }
.row.drag-src > * { opacity: 0; }
.row.drop-inside { transform: scale(1.012); transition: transform var(--dur-fast) var(--ease); }
.side-item.drop-inside { transform: scale(1.04); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }

/* ---------- phone row swipe ---------- */
.row.swiping, .row.swipe-open { content-visibility: visible; }
.row.swiping > :not(.swipe-bg), .row.swipe-open > :not(.swipe-bg) { position: relative; z-index: 1; }
.swipe-bg { position: absolute; inset: 0; z-index: 0; border-radius: 9px; display: flex; align-items: center; pointer-events: none; overflow: hidden; }
.swipe-bg[data-side="right"] { background: color-mix(in srgb, var(--ok) 78%, var(--bg)); color: #fff; }
.row.armed .swipe-bg[data-side="right"] { background: var(--ok); }
.swipe-bg[data-side="left"] { background: var(--surface-3); }
.swipe-bg .sw-done { padding-left: 20px; line-height: 0; opacity: var(--p, 0); transform: scale(calc(.6 + .4 * var(--p, 0))); transition: transform 160ms var(--ease-spring); }
.row.armed .swipe-bg .sw-done { transform: scale(1.18); }
.swipe-bg[data-side="left"] .sw-done, .swipe-bg[data-side="right"] .sw-actions { visibility: hidden; }
.swipe-bg .sw-actions { display: flex; height: 100%; margin-left: auto; }
.sw-actions button { width: 72px; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; pointer-events: auto; }
.sw-actions .sw-flag { background: var(--flag); }
.sw-actions .sw-del { background: var(--danger); }

/* ---------- phone bottom sheet ---------- */
@media (max-width: 767px) {
  .inspector { transition: none; }
  .inspector[data-snap="half"] { overflow: hidden; touch-action: none; }
  .app.inspector-open .scrim { transition: opacity 120ms linear; }
}

/* ---------- toasts ---------- */
.toast { position: relative; overflow: hidden; touch-action: pan-y; user-select: none; }
.toast-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: color-mix(in srgb, var(--bg) 55%, transparent); transform-origin: left center; }

/* ---------- quick open / pickers: sliding result highlight ---------- */
.picker-list { position: relative; }
.picker-hl { position: absolute; left: 6px; right: 6px; top: 0; height: 0; border-radius: var(--r-md); background: var(--sel); pointer-events: none; opacity: 0; }
.picker-item { position: relative; }
.picker-item.on { background: transparent; }

/* ---------- empty states: illustration wipes in and floats; inbox-zero cheer ---------- */
.empty .illus { animation: illus-in 720ms var(--ease-out) both, illus-float 5.5s ease-in-out 900ms infinite; }
@keyframes illus-in { from { opacity: 0; clip-path: inset(0 100% 0 0); transform: translateY(6px); } to { opacity: 1; clip-path: inset(0 0 0 0); transform: none; } }
@keyframes illus-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.empty-cheer { margin: 12px 0 0; color: var(--ok); font-weight: 560; font-size: var(--fs-base); animation: float-in 420ms var(--ease-out) 360ms both; }
html[data-motion="simple"] .empty .illus { animation: illus-in 400ms var(--ease-out) both; }

/* ---------- buttons: loading state ---------- */
.btn.loading { position: relative; pointer-events: none; }
.btn.loading > *, .btn.loading { color: transparent !important; }
.btn.loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid var(--accent-text); border-right-color: transparent; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- first-load skeleton ---------- */
.skeleton { display: grid; grid-template-columns: var(--sidebar-w, 260px) minmax(0, 1fr); height: 100vh; height: 100dvh; background: var(--bg); }
.skel-side { background: var(--sidebar-bg); border-right: 1px solid var(--line); padding: 26px 18px; display: flex; flex-direction: column; gap: 15px; }
.skel-main { padding: 28px 30px; display: flex; flex-direction: column; gap: 20px; }
.skel-title { height: 40px; display: flex; align-items: center; }
.skel-row { display: flex; gap: 12px; align-items: flex-start; animation: skel-in var(--dur-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
.skel-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel-bar { display: block; height: 12px; border-radius: 6px; background: var(--surface-3); position: relative; overflow: hidden; }
.skel-bar.lg { height: 18px; } .skel-bar.xl { height: 26px; } .skel-bar.sm { height: 9px; }
.skel-bar::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%); animation: shimmer 1.5s var(--ease) infinite;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 75%, transparent), transparent);
}
.skel-gap { height: 14px; }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes skel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 1023px) { .skeleton { grid-template-columns: minmax(0, 1fr); } .skel-side { display: none; } .skel-main { padding: 20px 16px; } }
.proc-done .illus { animation: illus-in 720ms var(--ease-out) both, illus-float 5.5s ease-in-out 900ms infinite; }
