/* ==========================================================================
   CHECKLIST (.verser-checklist > .verser-checklist-item): rows of things to tick (a task's steps). CSS only.

   Each row (an <li>), its children in this order:
     input.verser-check          the tick (the kit's field check, field.css)
     .verser-checklist-title     the words; a <button aria-haspopup="menu"> when a tap opens the kit menu (menu.js:
                                 Rename, Remove), a <span> or <label> when it only ticks
     .verser-checklist-meta      a mono line under the words (when it was done, who unticked it); optional
     .verser-checklist-figure    a quiet mono figure at the end (the weight, "35%"); optional
     .verser-icon-btn            a remove × at the very end (data-size="sm", aria-label "Remove"); optional

     data-state  done     ticked: the words struck through and quieter
                 draft    a suggested step not saved yet: the tick shown disabled (give the input disabled too), the
                          title button renames it, the × removes it, the figure stays read only
                 pending  a tick on its way to the server: the kit's loading light runs along the row's foot

   Hooks: --verser-checklist-gap, -row-height, -divider, -title-size, -figure-text.
   ========================================================================== */

.verser-checklist{display:grid;min-inline-size:0;margin:0;padding:0;list-style:none}
.verser-checklist-item{
  position:relative;box-sizing:border-box;display:grid;
  grid-template-columns:auto minmax(0,1fr) auto auto;
  grid-template-areas:"check title figure end" "check meta figure end";
  align-items:center;column-gap:var(--verser-checklist-gap,var(--space-3));row-gap:1px;
  min-block-size:var(--verser-checklist-row-height,max(var(--tap-min),calc(52px * var(--density))));
  margin:0;padding-block:var(--space-2);padding-inline:var(--space-2);
  border-block-start:1px solid var(--verser-checklist-divider,var(--hairline))
}
.verser-checklist-item:first-child{border-block-start-color:transparent}
.verser-checklist-item>.verser-check{grid-area:check}
.verser-checklist-title{
  grid-area:title;align-self:end;justify-self:start;min-inline-size:0;max-inline-size:100%;margin:0;padding:0;
  border:0;border-radius:var(--radius-4xs);background:none;
  font-family:var(--font-ui);font-size:var(--verser-checklist-title-size,14.5px);font-weight:500;line-height:1.35;
  color:var(--text);text-align:start;overflow-wrap:anywhere
}
.verser-checklist-item:not(:has(.verser-checklist-meta)) .verser-checklist-title{grid-row:1 / span 2;align-self:center}
button.verser-checklist-title{cursor:pointer;-webkit-tap-highlight-color:transparent}
button.verser-checklist-title:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring);outline-offset:var(--focus-ring-offset)}
@media (hover:hover) and (pointer:fine){
  button.verser-checklist-title:hover{text-decoration:underline;text-decoration-color:var(--border-selected);text-underline-offset:3px}
}
.verser-checklist-meta{
  grid-area:meta;align-self:start;display:inline-flex;align-items:center;gap:6px;min-inline-size:0;
  font-family:var(--font-mono);font-size:var(--font-size-caption);line-height:1.4;color:var(--text-muted);font-variant-numeric:tabular-nums
}
.verser-checklist-figure{
  grid-area:figure;min-inline-size:4ch;text-align:end;
  font-family:var(--font-mono);font-size:var(--font-size-caption);font-weight:500;line-height:1.4;
  color:var(--verser-checklist-figure-text,var(--text-muted));font-variant-numeric:tabular-nums
}
:is(.verser-checklist-meta,.verser-checklist-figure):is(:lang(ar),:dir(rtl)){font-family:var(--font-mono-rtl);letter-spacing:0}
:is(.verser-checklist-meta,.verser-checklist-figure) :is(bdi,[data-num]){unicode-bidi:isolate}
/* The remove ×: quiet, pulled into the row's end padding so it lines up with the edge. */
.verser-checklist-item>.verser-icon-btn{grid-area:end;margin-inline-end:calc(var(--space-2) * -1);color:var(--text-muted)}

/* Done */
.verser-checklist-item[data-state="done"] .verser-checklist-title{
  color:var(--text-secondary);text-decoration:line-through;text-decoration-thickness:1px;
  text-decoration-color:color-mix(in srgb,var(--text-secondary) 60%,transparent)
}
/* Draft */
.verser-checklist-item[data-state="draft"]>.verser-check{opacity:.35}
/* Pending: the kit's loading light (loading.css), moved by transform. It starts past the row's start edge and
   leaves past its end; the row clips it sideways only, so a menu or focus ring above or below is never cut. */
.verser-checklist-item[data-state="pending"]{
  --_verser-sweep-dir:1;--_verser-sweep-light:linear-gradient(90deg,transparent,var(--brand-from),var(--brand-to),transparent);
  overflow-x:clip
}
.verser-checklist-item[data-state="pending"]:dir(rtl){
  --_verser-sweep-dir:-1;--_verser-sweep-light:linear-gradient(270deg,transparent,var(--brand-from),var(--brand-to),transparent)
}
.verser-checklist-item[data-state="pending"] :is(.verser-checklist-meta,.verser-checklist-figure){opacity:.6}
.verser-checklist-item[data-state="pending"]::after{
  content:"";position:absolute;inset-inline-start:0;inset-block-end:-1px;inline-size:45%;block-size:2px;
  border-radius:var(--radius-pill);background:var(--_verser-sweep-light);pointer-events:none;
  animation:verser-checklist-sweep var(--verser-loading-duration,1.2s) cubic-bezier(.4,0,.2,1) infinite
}
@keyframes verser-checklist-sweep{
  from{transform:translateX(calc(-100% * var(--_verser-sweep-dir)))}
  to{transform:translateX(calc(225% * var(--_verser-sweep-dir)))}
}
@media (prefers-reduced-motion:reduce){
  .verser-checklist-item[data-state="pending"]::after{
    inset-inline:var(--space-2);inline-size:auto;transform:none;animation:verser-loading-fade 1.6s ease-in-out infinite
  }
}
