/* Catch: a file drop zone with an upload arc. */

.catch {
  position: relative;
  box-sizing: border-box;
  width: min(600px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: var(--ct-surface);
  border-radius: var(--ct-radius);
  box-shadow: var(--ct-shadow);
  font-family: var(--ct-font);
  font-size: 14px;
  color: var(--ct-ink);
}

.catch__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.catch__title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

.catch__limit { font-size: 13px; color: var(--ct-muted); }

/* The drop zone. */
.catch__zone {
  min-height: 190px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 2px dashed var(--ct-line);
  border-radius: var(--ct-zone-radius);
  text-align: center;
  transition: border-color var(--ct-fade) linear, background-color var(--ct-fade) linear;
}

.catch__zone svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--ct-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--ct-fade) linear, transform var(--ct-duration) var(--ct-ease);
}

.catch__prompt { margin: 0; font-weight: 600; transition: color var(--ct-fade) linear; }

.catch__or { margin: 0; font-size: 13px; color: var(--ct-muted); }

/* Dragging files over it. */
.catch__zone[data-over] { border-color: var(--ct-accent); background: var(--ct-accent-soft); }
.catch__zone[data-over] svg { stroke: var(--ct-accent-text); transform: translateY(-4px); }
.catch__zone[data-over] .catch__prompt { color: var(--ct-accent-text); }

/* "browse your files": a label around a real file input, which is hidden but focusable. */
.catch__browse {
  position: relative;
  color: var(--ct-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
}

.catch__browse:hover { color: var(--ct-accent-text); }

.catch__browse:has(.catch__input:focus-visible) { outline: 2px solid var(--ct-focus); outline-offset: 3px; }

.catch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}

.catch__error { margin: -6px 0 0; font-size: 13px; color: var(--ct-danger); }
.catch__error[hidden] { display: none; }

/* The file list. */
.catch__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.catch__list:empty { display: none; }

.catch__file {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--ct-line-soft);
  border-radius: var(--ct-item-radius);
  animation: catch-in var(--ct-duration) var(--ct-ease) both;
}

.catch__file[data-leaving] { animation: catch-out var(--ct-fade) linear both; }

@keyframes catch-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes catch-out { to { opacity: 0; } }

/* The arc: a track and a stroke that fills as the upload runs. */
.catch__progress {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
}

.catch__ring { position: absolute; inset: 0; width: 36px; height: 36px; transform: rotate(-90deg); }

.catch__track { fill: none; stroke: var(--ct-line-soft); stroke-width: 3; }

.catch__arc {
  fill: none;
  stroke: var(--ct-accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--ct-sweep) linear, opacity var(--ct-fade) linear;
}

.catch__file[data-status="waiting"] .catch__arc { opacity: 0; }

.catch__percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ct-mono);
  font-size: 10px;
  color: var(--ct-ink);
}

.catch__done {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ct-success-soft);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--ct-duration) var(--ct-ease), transform var(--ct-duration) var(--ct-ease);
}

.catch__done svg { width: 16px; height: 16px; fill: none; stroke: var(--ct-success); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Done: the arc first glides the rest of the way to a full circle (--ct-sweep),
   then the ring and the number fade out while the check grows in. */
.catch__file[data-status="done"] .catch__done {
  opacity: 1;
  transform: none;
  transition-delay: var(--ct-sweep);
}
.catch__file[data-status="done"] .catch__ring,
.catch__file[data-status="done"] .catch__percent {
  opacity: 0;
  transition: opacity var(--ct-duration) var(--ct-ease) var(--ct-sweep);
}

.catch__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.catch__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.catch__meta { font-size: 12px; color: var(--ct-muted); }

.catch__file[data-status="error"] .catch__meta { color: var(--ct-danger); }

.catch__action {
  flex: none;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ct-line);
  border-radius: 8px;
  background: var(--ct-surface);
  color: var(--ct-ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.catch__action[hidden] { display: none; }

.catch__remove {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ct-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.catch__remove svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.catch__remove:hover { color: var(--ct-ink); background: var(--ct-bg); }

.catch__action:focus-visible,
.catch__remove:focus-visible { outline: 2px solid var(--ct-focus); outline-offset: 2px; }

.catch__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Reduced motion: no arc sweep and nothing moves. The number shows progress; states cross-fade. */
@media (prefers-reduced-motion: reduce) {
  .catch__arc { display: none; }
  .catch__zone svg { transition: stroke var(--ct-fade) linear; }
  .catch__zone[data-over] svg { transform: none; }
  .catch__file { animation: catch-fade var(--ct-fade) linear both; }
  .catch__done { transform: none; transition: opacity var(--ct-fade) linear; }
  /* No arc to wait for: the number and the check cross-fade at once. */
  .catch__file[data-status="done"] .catch__done,
  .catch__file[data-status="done"] .catch__ring,
  .catch__file[data-status="done"] .catch__percent { transition: opacity var(--ct-fade) linear; }
}

@keyframes catch-fade { from { opacity: 0; } }
