/* Luma owns this file. Batch 5 motion (Nov 18 2026): confirm checkmark morph (item 6) and the bell panel (items 2-5).
   Built on Bolt's batch 5 hooks only:
     confirm: [data-confirm] buttons carry .btn-label / .btn-check / .btn-done; [data-confirmed] is set for 1400ms after
              the second click (approve, deny, save; chat Send has no confirm), then removed and the action runs.
     bell:    #bell-panel (.bell-panel) toggles [data-open] and [hidden]; it stays shown for --bell-panel-out-ms after
              close. Items are .bell-item in #bell-list, each with .bell-x. Count is #bell-count.
   batch5-motion.js adds .b5-cm / --b5-cx / --b5-cr on a confirming button, the bell transform-origin, and the
   delete / count morphs. Transform, opacity and clip-path only: nothing here changes layout. Link after motion.css.
   Nov 18 (v31 bugs): A01 the morph starts the same when Bolt saves first and sets data-confirmed after; A03 a new note
   rings the glyph + pops the count with a soft halo, no panel; A22 the first open always slides (.b5-from start
   frame, set by JS, so it doesn't depend on @starting-style); decided approve/deny rows collapse on [data-leaving]
   (WAAPI in batch5-motion.js: the one height animation here, so the rows below glide up instead of jumping). */

html {
  --b5-spring: linear(0, 0.084 4.5%, 0.267 9.1%, 0.477 13.6%, 0.670 18.2%, 0.824 22.7%, 0.933 27.3%, 1.002 31.8%, 1.039 36.4%, 1.053 40.9%, 1.053 45.5%, 1.044 50.0%, 1.033 54.5%, 1.022 59.1%, 1.013 63.6%, 1.006 68.2%, 1.001 72.7%, 0.999 77.3%, 0.997 81.8%, 0.997 86.4%, 0.997 90.9%, 0.998 95.5%, 1);
  --b5-pop: linear(0, 0.093 4.5%, 0.300 9.1%, 0.536 13.6%, 0.748 18.2%, 0.910 22.7%, 1.017 27.3%, 1.075 31.8%, 1.094 36.4%, 1.089 40.9%, 1.071 45.5%, 1.049 50.0%, 1.028 54.5%, 1.012 59.1%, 1.000 63.6%, 0.994 68.2%, 0.991 72.7%, 0.991 77.3%, 0.993 81.8%, 0.995 86.4%, 0.997 90.9%, 0.999 95.5%, 1);
  --b5-out: cubic-bezier(0.32, 0.72, 0, 1);
  --b5-in: cubic-bezier(0.5, 0, 0.75, 0);
  --b5-fade: cubic-bezier(0.33, 0, 0.2, 1);
  /* confirm green: the mock's own .pill.grn greens. Light #2F6B45 + white check 6.34:1; dark #8FCB9B + #1F2A2E check 7.83:1 */
  --b5-ok: #2F6B45;
  --b5-ok-ink: #FFFFFF;
  --b5-morph: 480ms;
  /* Bolt's closeBell() keeps the panel shown this long so the close can play */
  --bell-panel-out-ms: 240;
}
html[data-theme="dark"] {
  --b5-ok: #8FCB9B;
  --b5-ok-ink: #1F2A2E;
}

/* ================= 6. confirm: the button morphs into a green checkmark ================= */
/* .b5-cm is on the button from the first confirmed frame until the morph back has settled. */
.b5-cm {
  position: relative;
  clip-path: inset(0 0 round var(--b5-cr0, 8px));
  transition:
    clip-path var(--b5-morph) var(--b5-spring),
    background-color 130ms var(--b5-fade),
    border-color 130ms var(--b5-fade),
    color 120ms var(--b5-fade),
    transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1); /* Bolt's .btn press spring, kept */
}
/* Nov 18: app.css .btn:active:not(:disabled) sets transition-duration .08s; when the 2nd tap lands on the button
   itself (team pages, avatar editor) :active is still on while the morph starts. Same list, higher specificity. */
.btn.b5-cm:active:not(:disabled),
.b5-cm:active {
  transition:
    clip-path var(--b5-morph) var(--b5-spring),
    background-color 130ms var(--b5-fade),
    border-color 130ms var(--b5-fade),
    color 120ms var(--b5-fade),
    transform 80ms ease-out; /* Bolt's press-in */
}
/* keep the label in layout (no width change, no layout shift); it just fades */
.b5-cm .btn-label {
  display: inline !important;
  transition: opacity 120ms var(--b5-fade) 60ms;
}
.b5-cm .btn-done { display: none !important; }
.b5-cm .btn-check {
  display: block !important;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  color: var(--b5-ok-ink);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: opacity 90ms var(--b5-fade), transform 160ms var(--b5-fade);
}
.b5-cm .btn-check::before { content: none !important; }
.b5-cm .btn-check svg { display: block; width: 100%; height: 100%; overflow: visible; }
.b5-cm .btn-check path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 120ms var(--b5-fade);
}

.b5-cm[data-confirmed]:not(.b5-pre) {
  clip-path: inset(0 var(--b5-cx, 0px) round var(--b5-cr, 999px));
  background-color: var(--b5-ok) !important;
  border-color: var(--b5-ok) !important;
  color: var(--b5-ok-ink) !important;
}
.b5-cm[data-confirmed]:not(.b5-pre) .btn-label { opacity: 0; transition-delay: 0ms; transition-duration: 100ms; }
.b5-cm[data-confirmed]:not(.b5-pre) .btn-check {
  opacity: 1;
  transform: scale(1);
  transition: opacity 120ms var(--b5-fade) 150ms, transform 420ms var(--b5-pop) 150ms;
}
.b5-cm[data-confirmed]:not(.b5-pre) .btn-check path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 280ms cubic-bezier(0.65, 0, 0.35, 1) 190ms;
}
/* Bolt's fixed-markup fallback still shows "✓ Done" if batch5-motion.js is missing: nothing above applies without .b5-cm */

/* ================= 2-5. bell panel ================= */
#bell-panel {
  transform-origin: var(--b5-ox, calc(100% - 20px)) var(--b5-oy, -24px);
  box-shadow: 0 6px 20px rgba(31, 42, 46, 0.10), 0 1px 3px rgba(31, 42, 46, 0.06);
  will-change: transform, opacity;
  opacity: 0;
  transform: translateY(-6px) scale(0.88);
  pointer-events: none;
  transition:
    transform 200ms var(--b5-in),
    opacity 160ms var(--b5-fade) 40ms;
}
html[data-theme="dark"] #bell-panel { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.2); }
#bell-panel[data-open] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition:
    transform 420ms var(--b5-spring),
    opacity 140ms var(--b5-fade);
}
@starting-style {
  #bell-panel[data-open] { opacity: 0; transform: translateY(-6px) scale(0.88); }
}
/* A22: batch5-motion.js puts the panel on this start frame for one style pass when it opens from hidden, so the
   open transition always has a "from" (WebKit sometimes skipped @starting-style on the first open and snapped). */
#bell-panel.b5-from {
  opacity: 0 !important;
  transform: translateY(-6px) scale(0.88) !important;
  transition: none !important;
}
#bell-list { position: relative; }

/* A03: a new note. The glyph swings (motion.css), the count springs in or rolls to the new number (JS), and one
   soft halo of the badge colour spreads and fades behind it. Transform + opacity only; the badge box never moves. */
/* the halo sits on .bell at the badge's spot (the badge itself clips its overflow); the badge is lifted above it */
.bell::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #9A3328; /* = Bolt's badge colour */
  opacity: 0;
  pointer-events: none;
}
.bell .bell-count { z-index: 1; }
.bell.b5-halo::after { animation: b5-halo 760ms cubic-bezier(0.22, 0.61, 0.36, 1) 60ms both; }
@keyframes b5-halo {
  0% { opacity: 0.42; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.3); }
}
/* delete: the ghost of the removed row slides out right and fades; rows below glide up (FLIP in JS) */
.b5-ghost {
  position: absolute !important;
  margin: 0 !important;
  pointer-events: none !important;
  z-index: 1;
}
.bell-count.b5-ghost { z-index: 2; }

/* ================= reduced motion: crossfades only ================= */
@media (prefers-reduced-motion: reduce) {
  html { --bell-panel-out-ms: 100; --b5-morph: 160ms; }
  .b5-cm,
  .b5-cm[data-confirmed]:not(.b5-pre) {
    clip-path: none !important;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease !important;
  }
  .b5-cm .btn-label,
  .b5-cm[data-confirmed]:not(.b5-pre) .btn-label { transition: opacity 160ms ease !important; }
  .b5-cm .btn-check,
  .b5-cm[data-confirmed]:not(.b5-pre) .btn-check {
    transform: none !important;
    transition: opacity 160ms ease !important;
  }
  .b5-cm .btn-check path { stroke-dashoffset: 0 !important; transition: none !important; }
  /* "✓ Done" (Bolt's fallback wording) when it fits inside the button, else the check alone */
  .b5-cm[data-b5-fit] .btn-check { left: calc(50% - var(--b5-dw, 0px) / 2); margin-left: 0; width: 16px; height: 16px; margin-top: -8px; }
  .b5-cm[data-b5-fit] .btn-done {
    display: block !important;
    position: absolute;
    top: 50%;
    left: calc(50% - var(--b5-dw, 0px) / 2 + 21px);
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 160ms ease;
    white-space: nowrap;
  }
  .b5-cm[data-b5-fit][data-confirmed]:not(.b5-pre) .btn-done { opacity: 1; }
  #bell-panel,
  #bell-panel[data-open] {
    transform: none !important;
    transition: opacity 100ms ease !important;
  }
  #bell-panel.b5-from { transform: none !important; transition: none !important; }
  .bell.b5-halo::after { animation: none; }
  @starting-style {
    #bell-panel[data-open] { opacity: 0; transform: none; }
  }
}
