/*!
 * USM LCC app layer on top of Spry (spry.css loads BEFORE this file).
 *
 * Spry provides the reset, typography, cards, buttons, badges, forms and
 * tables; this file carries ONLY what it does not:
 *   - the LCC teal accent, applied the supported way (--spry-* tokens)
 *   - a few app glyphs: .kv fact grids, .snippet log blocks, the
 *     .status-running pulse and the stm-busy-class="loading" spinner.
 *
 * Spry's palette blocks are wrapped in :where() (specificity 0,0,0), so
 * these blocks mirror that exact structure — light, forced dark, and the
 * prefers-color-scheme auto-dark duplicate — and win by source order.
 * Derived tokens (--spry-accent-soft, --spry-focus-ring, links) follow
 * automatically via color-mix / var() substitution.
 */

/* Light: LCC's teal, white-on-teal accent text. */
:where(:root) {
  --spry-accent: #0f6f5c;
  --spry-accent-hover: #0b5646;
}

/* Dark (forced + switcher hook): a brighter teal reads on dark surfaces;
   Spry pairs dark accents with a dark --spry-accent-fg. */
:where(:root[data-mode="dark"], html:has(#spry-mode-dark:checked)) {
  --spry-accent: #35a08a;
  --spry-accent-hover: #56b79f;
}

/* Dark (auto, follows the OS) — same values, same selectors as spry.css. */
@media (prefers-color-scheme: dark) {
  :where(:root:not([data-mode="light"]):not(:has(#spry-mode-light:checked)),
    html:has(#spry-mode-auto:checked):not([data-mode="light"])) {
    --spry-accent: #35a08a;
    --spry-accent-hover: #56b79f;
  }
}

/* Definition-list fact grids (repo facts, run summaries). Spry has no
   dl layout utility; dt reads as a small uppercase muted key. */
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
}
.kv dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--spry-fg-muted);
  align-self: center;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Captured command output: inset log block. Long runs scroll instead of
   stretching the page; wrapped lines keep their place in long commands. */
.snippet {
  background: var(--spry-bg-inset);
  color: var(--spry-fg);
  border: var(--spry-border-width) solid var(--spry-border);
  border-radius: var(--spry-radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}
pre.snippet {
  max-height: 22rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.snippet code {
  color: inherit;
}

/* A run in flight: gentle pulse on its status badge. Spry's global
   reduced-motion clamp degrades this to a steady badge. */
.status-running {
  animation: lcc-pulse 1.6s ease-in-out infinite;
}
@keyframes lcc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* stm-busy-class="loading" on a form: the transport disables the controls
   and adds .loading to the FORM; show a spinner in the submit button with
   zero extra page markup. Only submit-flavoured buttons light up. */
form.loading button:not([type])::after,
form.loading button[type="submit"]::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.5em;
  border-radius: 50%;
  border: 0.18em solid var(--spry-border);
  border-top-color: var(--spry-accent);
  animation: lcc-spin 0.9s linear infinite;
}
@keyframes lcc-spin {
  to { transform: rotate(1turn); }
}
