/* JCG Studio: feedback, the component library's second slice (2026-10-05).
   How the interface says what is happening: status, progress, loading, notices, toasts and empty states. It speaks
   the queue's language (base.css .q-mark): a status is a dot, a hollow ring while it waits, an orange orb while it is
   being worked on, solid chrome when it's done. Orange is for what is alive; problems are loud in ink, like a field
   error (the forms rule JC approved on 2026-10-05); nothing moves by itself unless something is actually happening.
   Needs tokens.css and base.css (.btn, .lamp, .ticks, and the orb, shimmer and snap-text keyframes). Toasts, the mark
   loader and dismissing a notice need assets/js/feedback.js. Shown live on the brand page's Feedback tab.

   Decisions for JC (on the tab, to confirm):
   - Status marks are the queue's dots, plus Needs you (half filled: the work is with you) and Paused (a ring with a
     bar). Failed is an inverse tag, like a field error.
   - Progress is a 1 px line, orange while it runs and chrome when it's done, with a padded mono readout. Steps run
     down the screen on a phone and across from 600 px.
   - Toasts drop in under the top HUD row, centred, where the Work page's reduced-motion note already sits. The newest
     is on top, three at most. They leave after 4 s (6 s with an action) and a fuse shows the time left; hovering or
     focusing one pauses it; errors stay until dismissed.
   - Waiting: nothing for the first 150 ms (the nav loader's rule); a skeleton where content is coming; a blinking lamp
     on a busy button; the budding mark when there is nothing to show yet. aria-busy also buds the nav mark.
   - An empty state shows one block, the first frame of the mark's budding; a queue that is all clear shows the
     whole mark. */

/* ── Status: a dot and a word ────────────────────────────────────── */
.status {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 var(--t-hud)/1 var(--font-hud);
  letter-spacing: var(--track-hud);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--chrome-3);
}
.status::before {                                                       /* queued: a hollow ring */
  content: "";
  flex: none;
  width: 8px; height: 8px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--chrome-3);
}
.status[data-state="active"] { color: var(--signal); }
.status[data-state="active"]::before {                                  /* in progress: the queue's orb */
  width: 9px; height: 9px;
  box-shadow: none;
  background: radial-gradient(circle at 34% 30%, #FFD0C2 0 14%, var(--signal) 48%, #8F2A10 100%);
}
.status[data-state="active"].is-running::after {                        /* the sheen turns only while work runs on screen */
  content: "";
  position: absolute; left: 0; top: 50%;
  width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 58%, rgba(255,255,255,.6) 74%, transparent 90%);
  animation: orb 1.2s linear infinite;
}
.status[data-state="review"] { color: var(--chrome); }
.status[data-state="review"]::before {                                  /* needs you: half filled, the work is with you */
  background: linear-gradient(90deg, var(--chrome) 50%, transparent 50%);
  box-shadow: inset 0 0 0 1px var(--chrome);
}
.status[data-state="done"] { color: var(--chrome); }
.status[data-state="done"]::before { background: var(--chrome); box-shadow: none; }
.status[data-state="paused"]::before {                                  /* paused: a ring with a bar through it */
  background: linear-gradient(var(--chrome-3), var(--chrome-3)) center / 4px 1px no-repeat;
}
.status[data-state="error"] {                                           /* failed: loud in ink, like a field error */
  padding: 3px 6px 2px;
  border-radius: var(--r-chip);
  background: var(--chrome);
  color: var(--void);
}
.status[data-state="error"]::before { display: none; }
.status[data-state="note"]::before { display: none; }                  /* a plain mono label, no dot */

/* ── Progress: a 1 px line, orange while it runs ──────────────────── */
.progress-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 10px;
  font: 400 var(--t-hud)/1.3 var(--font-hud);
  letter-spacing: var(--track-hud);
  text-transform: uppercase;
  color: var(--chrome-2);
}
.progress-head > :last-child { color: var(--chrome-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress {
  --p: 0;
  position: relative;
  height: 1px;
  background: var(--line-strong);
  overflow: hidden;
}
.progress::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--signal);
  transform-origin: left;
  transform: scaleX(var(--p));
  transition: transform var(--dur-2) var(--ease-out), background-color var(--dur-2) linear;
}
.progress[data-state="done"]::before { background: var(--chrome); }
.progress--sweep::before { width: 28%; transform: none; animation: fb-sweep 1400ms var(--ease-in-out) infinite; }
@keyframes fb-sweep { from { translate: -100% 0; } to { translate: 360% 0; } }

/* Steps: a request's way through the queue, as statuses joined by a line. Down the screen on a phone, across when
   there is room (600 px). */
.progress-steps { container-type: inline-size; }
.progress-steps > ol { display: grid; }
.progress-steps li { position: relative; display: flex; padding: 10px 0; }   /* flex: the row is the status line, 31 px a step */
.progress-steps li:not(:last-child)::after {
  content: "";
  position: absolute; left: 3.5px; top: 24px;                         /* from 4 px under one dot to 4 px above the next */
  width: 1px; height: 15px;
  background: var(--line-strong);
}
.progress-steps li:has(> [data-state="done"])::after { background: var(--chrome-3); }
@container (min-width: 600px) {
  .progress-steps > ol { display: flex; align-items: center; }
  .progress-steps li { display: flex; flex: 1 1 auto; align-items: center; gap: 12px; padding: 0; }
  .progress-steps li:last-child { flex: none; }
  .progress-steps li:not(:last-child)::after { position: static; flex: 1 1 auto; width: auto; min-width: 16px; height: 1px; margin-right: 12px; }
}

/* ── Loading ───────────────────────────────────────────────────────── */
/* Skeleton: grey shapes where content is coming, with the frames' load shimmer (base.css). */
.skel {
  display: block;
  background:
    linear-gradient(100deg, transparent 20%, rgba(230,233,237,.06) 42%, rgba(230,233,237,.12) 50%, rgba(230,233,237,.06) 58%, transparent 80%) 0 0 / 250% 100% no-repeat,
    var(--ph-1);
  animation: shimmer 1.1s linear infinite;
}
.skel-line { height: 12px; margin: 7px 0; }
.skel-line.is-short { width: 42%; }
.skel-line.is-mid { width: 72%; }
.skel-dot { width: 8px; height: 8px; border-radius: 50%; }
.skel-frame { aspect-ratio: 16 / 10; }

/* A busy button: its lamp lights and blinks; aria-busy also buds the nav mark. */
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .lamp { background: var(--signal); opacity: 1; animation: fb-busy 900ms steps(1, end) infinite; }
@keyframes fb-busy { 50% { opacity: .2; } }

/* The mark as a loader: one block budding into the logo and back (feedback.js draws it; still with reduced motion). */
.mark-loader {
  --cell: 8px;
  display: inline-block;
  width: calc(var(--cell) * 7.5); height: calc(var(--cell) * 3);
  color: var(--chrome);
  line-height: 0;
}
.mark-loader svg { display: block; width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.loading { display: grid; justify-items: center; align-content: center; gap: 18px; min-height: 200px; padding: 24px; text-align: center; }
.loading-label { font: 400 var(--t-hud)/1.3 var(--font-hud); letter-spacing: var(--track-hud); text-transform: uppercase; color: var(--chrome-3); }

/* ── Notice: a message that stays in the page ──────────────────────── */
.notice {
  position: relative;
  display: grid; gap: 8px; justify-items: start;
  padding: 16px 52px 16px 18px;
  background: var(--void-2);
  border: 1px solid var(--line);
}
.notice:not(:has(> .notice-close)) { padding-right: 18px; }
.notice[data-tone="error"] { border-color: var(--chrome); }
.notice-text { margin: 0; max-width: 64ch; font-size: 15px; line-height: 1.5; color: var(--chrome-2); }
.notice-text b { color: var(--chrome); font-weight: 560; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 0 24px; margin: -6px 0 -12px; }
.notice-action, .toast-action {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 44px; min-height: 44px;                                   /* a one-word action is still a 44 px target */
  padding: 0;
  font: 400 var(--t-hud)/1 var(--font-hud);
  letter-spacing: var(--track-hud);
  text-transform: uppercase;
  color: var(--chrome);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 5px;
  cursor: pointer;
}
@media (hover: hover) { .notice-action:hover, .toast-action:hover { text-decoration-color: var(--chrome); } }
.notice.is-leaving { opacity: 0; transition: opacity 160ms linear; }

/* The close ×: hairlines, a 44 px target. */
.notice-close, .toast-close {
  position: absolute; top: 4px; right: 4px;
  width: 44px; height: 44px;
  border: 0; background: transparent;
  color: var(--chrome-3);
  cursor: pointer;
}
.notice-close::before, .notice-close::after, .toast-close::before, .toast-close::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 12px; height: 1px;
  margin: -.5px 0 0 -6px;
  background: currentColor;
  transform: rotate(45deg);
}
.notice-close::after, .toast-close::after { transform: rotate(-45deg); }
@media (hover: hover) { .notice-close:hover, .toast-close:hover { color: var(--chrome); } }
.notice-close:focus-visible, .toast-close:focus-visible { outline: 1px solid var(--chrome); outline-offset: -8px; }

/* ── Toast: a message that drops in and leaves on its own ──────────── */
.toasts {
  position: fixed; z-index: 70;
  top: calc(var(--edge) + var(--hud-row) + 10px);
  left: 50%; translate: -50% 0;
  width: min(460px, calc(100vw - 2 * var(--edge)));
  display: grid; gap: 16px;
  pointer-events: none;
}
.toast {
  position: relative;
  display: grid; gap: 8px; justify-items: start;
  padding: 14px 52px 15px 16px;
  background: var(--void-2);
  border: 1px solid var(--line-strong);
  pointer-events: auto;
  animation: fb-drop 240ms var(--ease-out) both;
}
.toast[data-tone="error"] { border-color: var(--chrome); }
.toast.ticks::before { --t: 6px; --c: var(--chrome-2); inset: -14px; opacity: 0; }   /* brackets snap in as it arrives */
.toast.ticks.is-in::before {
  inset: -5px;
  opacity: 1;
  transition: inset 520ms var(--ease-snap);
  animation: snap-text 360ms steps(3, end) both;
}
.toast-text { margin: 0; font-size: 15px; line-height: 1.45; color: var(--chrome-2); }
.toast-text b { color: var(--chrome); font-weight: 560; }
.toast-actions { display: flex; gap: 0 24px; margin: -6px 0 -12px; }
.toast-fuse {                                                           /* the time left; it is the timer */
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--chrome-3);
  transform-origin: left;
  animation: fb-fuse var(--life, 4000ms) linear forwards;
}
.toast:hover .toast-fuse, .toast:focus-within .toast-fuse { animation-play-state: paused; }
.toast.is-leaving { opacity: 0; translate: 0 -6px; transition: opacity 160ms linear, translate 160ms var(--ease-out); }
/* Dismissed by hand (play layer, feedback.js): the toast breaks into grid cells that fold back toward one block, the
   seed the mark grows from, which goes last. */
.toast.is-breaking { background: transparent; border-color: transparent; animation: none; }
.toast.is-breaking::before { opacity: 0; transition: opacity 120ms linear; }
.toast.is-breaking > :not(.toast-cells) { visibility: hidden; }
.toast-cells { position: absolute; inset: -1px; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(3, 1fr); pointer-events: none; }
.toast-cells i { background: var(--void-2); outline: 1px solid var(--line); animation: fb-cell 280ms var(--ease-in-out) calc(var(--d, 0) * 1ms) both; }
.toast-cells i.is-seed { background: var(--chrome); outline: 0; animation: fb-seed 520ms var(--ease-in-out) both; }
@keyframes fb-cell { to { scale: 0; opacity: 0; } }
@keyframes fb-seed { 0%, 55% { scale: .5; } 100% { scale: 0; opacity: 0; } }
@keyframes fb-drop { from { opacity: 0; translate: 0 -8px; } }
@keyframes fb-fuse { to { transform: scaleX(0); } }

/* ── Empty state: one block on the grid, waiting ───────────────────── */
.empty {
  display: grid; justify-items: center; align-content: center; gap: 12px;
  min-height: 280px;
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--line-control);
  background: radial-gradient(circle, rgba(230,233,237,.11) 1px, transparent 1.3px) 0 0 / 24px 24px;   /* the floor's faint dots */
}
.empty-art { display: block; height: 40px; margin-bottom: 8px; color: var(--chrome); line-height: 0; }
.empty-art svg { display: block; height: 100%; width: auto; fill: currentColor; overflow: visible; }
.empty-label { font: 400 var(--t-hud)/1.3 var(--font-hud); letter-spacing: var(--track-hud); text-transform: uppercase; color: var(--chrome-3); }
.empty-title { margin: 0; max-width: 28ch; text-wrap: balance; }
.empty-text { margin: 0; max-width: 44ch; font-size: 15px; line-height: 1.55; color: var(--chrome-2); }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .status.is-running::after { display: none; }
  .progress--sweep::before { animation: none; width: 100%; opacity: .5; }
  .btn[aria-busy="true"] .lamp { animation: none; }
  .toast-fuse { display: none; }
}
