/* Contract: contracts/sort/rules.md
 * Smart sort's dialog: web/smart-sort.js and web/smart-sort-view.js.
 *
 * Wider and taller than an ordinary .dlg because it is a preview of a whole
 * folder, and the cards scroll inside it so the place to argue and the button
 * that executes are always on screen together.
 */

.finder-sort { color: var(--accent); }

.dlg.ssort-dlg {
  width: min(760px, 94vw); max-height: min(86vh, 900px); padding: 0;
  display: none; flex-direction: column; overflow: hidden;
}
.dlg.ssort-dlg[open] { display: flex; }

.ssort-top {
  display: flex; align-items: baseline; gap: 10px; padding: 18px 22px 6px;
}
.dlg .ssort-h { margin: 0; font-size: 16px; }
.ssort-where { color: var(--ink-dim); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssort-close {
  border: 0; background: none; color: var(--ink-dim); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.ssort-close:hover { color: var(--ink); }

.ssort-summary { margin: 4px 22px 8px; font-size: 13.5px; line-height: 1.5; }
.ssort-summary:empty { display: none; }
.ssort-reply {
  margin: 0 22px 10px; padding: 8px 12px; font-size: 13px; line-height: 1.45;
  background: color-mix(in oklab, var(--accent) 10%, var(--panel)); border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.ssort-body {
  flex: 1; min-height: 160px; overflow: auto; padding: 6px 22px 14px;
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.ssort-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow-sm);
  animation: ssort-in var(--t-med) var(--ease) both;
}
.ssort-card.new { border-color: color-mix(in oklab, var(--accent) 45%, var(--line)); }
@keyframes ssort-in { from { opacity: 0; transform: translateY(4px); } }

.ssort-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.ssort-icon { color: var(--folder, var(--accent)); width: 14px; text-align: center; }
.ssort-card.new .ssort-icon { color: var(--accent); }
.ssort-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg input.ssort-foldername {
  width: auto; flex: 0 1 260px; margin: 0; padding: 3px 8px; font-weight: 600; font-size: 13.5px;
}
.ssort-badge {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 99px; background: var(--panel-2); color: var(--ink-dim);
}
.ssort-badge.new { background: var(--accent); color: var(--on-accent); }
.ssort-count { margin-left: auto; color: var(--ink-dim); font-weight: 400; font-size: 12px; }
.ssort-reason { margin: 4px 0 2px 22px; font-size: 12.5px; color: var(--ink-dim); }

.ssort-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 10px; margin-top: 6px; }
.dlg label.ssort-file {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 3px 4px;
  font-size: 12.5px; color: var(--ink); border-radius: var(--radius-sm); cursor: pointer; min-width: 0;
}
.dlg label.ssort-file:hover { background: var(--panel-hover); }
.dlg .ssort-file input { width: 15px; height: 15px; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.dlg label.ssort-file.renamed { grid-column: 1 / -1; }
.ssort-file.off { opacity: .45; }
/* A Desktop guess: unticked until somebody agrees, and says what it is based on. */
.dlg label.ssort-file.guess { grid-column: 1 / -1; }
.ssort-file.guess.off { opacity: .7; }
.ssort-file.guess.off .ssort-name { text-decoration: none; }
.ssort-guess {
  margin-left: auto; padding-left: 8px; font-size: 11.5px; color: var(--warn);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ssort-file.off .ssort-name { text-decoration: line-through; }
.ssort-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; background: var(--panel-2); flex: none; }
.ssort-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssort-old { color: var(--ink-dim); }
.ssort-arrow { margin: 0 4px; color: var(--ink-dim); }
.ssort-new { color: var(--ok); font-weight: 500; }

/* On the Desktop: the folder inside the project a group of files goes to. */
.ssort-sub {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 6px;
  margin: 6px 0 0; font-size: 12px; font-weight: 600; color: var(--ink-dim);
}
.ssort-subicon { color: var(--folder, var(--accent)); }
.ssort-subnew {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 99px; background: color-mix(in oklab, var(--accent) 16%, var(--panel)); color: var(--accent);
}

.ssort-note, .ssort-tidy { margin: 4px 2px; font-size: 12.5px; color: var(--ink-dim); }
.ssort-tidy { font-size: 13.5px; padding: 24px 0; text-align: center; }
.ssort-error { color: var(--danger); font-size: 13px; }

.ssort-loading { font-size: 13px; color: var(--ink-dim); padding: 4px 2px; }
.ssort-ghost {
  height: 74px; animation: ssort-shimmer 1.4s ease-in-out infinite;
  background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%);
  background-size: 200% 100%;
}
@keyframes ssort-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.ssort-foot { padding: 12px 22px 16px; display: flex; flex-direction: column; gap: 10px; }
.ssort-talk { display: flex; gap: 8px; align-items: flex-end; }
.dlg textarea.ssort-say { flex: 1; margin: 0; min-height: 44px; }
.ssort-acts { display: flex; justify-content: flex-end; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  .ssort-card, .ssort-ghost { animation: none; }
}
