/*
 * The brain sticker (register J254, 30 Sep 2026; js/v21_brain.js, contract/BRAIN_STAMP.md).
 * At the very top of the open job: a small pill with a digital brain mark in a round badge, "Fred's brain: full run at
 * 4:31pm, checked 23 things", and a chevron. Pressed, a small panel lists each step with its time. On the board card: a
 * small brain mark beside the title. Without a stamp for the version shown: a plain grey line, no mark.
 * The desk's own tokens, so it follows every theme, light and dark and High contrast. The badge has a slow sheen that
 * stops under reduced motion, Calm, the quiet states and a day that matters. No inline styles anywhere.
 */
.brn-top { max-width: 1160px; margin: 0 auto 12px; }

/* ---------- the sticker ---------- */
.brn-wrap { display: grid; justify-items: start; gap: 8px; }
.brn-stick {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; min-height: 40px; padding: 4px 12px 4px 4px;
  border: 1px solid color-mix(in srgb, var(--brand-text) 28%, transparent); border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .8125rem; line-height: 1.25rem; font-weight: 600; text-align: left; color: var(--ink);
  background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand-text) 6%, var(--solid)));
  box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 10%, transparent);
  transition: box-shadow var(--t-small) var(--ease-out), border-color var(--t-small) var(--ease-out);
}
.brn-stick:hover { border-color: color-mix(in srgb, var(--brand-text) 55%, transparent); box-shadow: 0 2px 8px color-mix(in srgb, var(--brand-text) 18%, transparent); }
.brn-stick:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.brn-stick > .ico { flex: none; color: var(--brand-text); transition: transform var(--t-small) var(--ease-out); }
.brn-wrap.is-open .brn-stick > .ico { transform: rotate(180deg); }
.brn-badge {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; color: var(--solid); background: var(--brand-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--solid) 25%, transparent), 0 0 0 3px color-mix(in srgb, var(--brand-text) 14%, transparent);
}
.brn-badge::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-130%);
  background: linear-gradient(115deg, transparent 32%, color-mix(in srgb, var(--solid) 60%, transparent) 50%, transparent 68%);
  animation: brn-sheen 6s ease-in-out 1.5s infinite;
}
@keyframes brn-sheen { 0%, 72% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
.brn-mark .brn-node { fill: currentColor; }
.brn-words { min-width: 0; overflow-wrap: anywhere; }
.brn-main { color: var(--ink); }
.brn-amber { color: var(--warn); font-weight: 700; }

/* ---------- the steps panel ---------- */
.brn-panel {
  width: min(460px, 100%); padding: 12px 14px; border-radius: 12px; background: var(--solid);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-text) 22%, transparent), 0 6px 18px color-mix(in srgb, var(--ink) 10%, transparent);
}
.brn-panel[hidden] { display: none; }
.brn-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .875rem; line-height: 1.35rem; }
.brn-step { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; }
.brn-tick { display: inline-flex; align-self: center; color: var(--ok); }
.brn-step-l { color: var(--ink); overflow-wrap: anywhere; }
.brn-step-t { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.brn-foot { margin: 10px 0 0; font-size: .8125rem; line-height: 1.25rem; color: var(--ink-3); }
.brn-foot-not { color: var(--warn); font-weight: 600; }

/* ---------- no stamp for this version: the plain grey line ---------- */
.brn-not { margin: 0; color: var(--ink-3); font-size: .8125rem; line-height: 1.25rem; }
.brn-not-job { padding: 2px 4px; }
.brn-not-card { margin-top: 6px; font-size: .75rem; line-height: 1.125rem; }

/* ---------- the board card's mark ---------- */
.brn-cmark {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px; vertical-align: -4px; border-radius: 50%;
  color: var(--solid); background: var(--brand-text);
}
.brn-cmark-not .brn-node { fill: var(--warn); stroke: var(--warn); }

/* ---------- stillness ---------- */
@media (prefers-reduced-motion: reduce) {
  .brn-badge::after { animation: none; display: none; }
  .brn-stick, .brn-stick > .ico { transition: none; }
}
:root[data-calm="on"] .brn-badge::after, :root[data-quiet="on"] .brn-badge::after, :root[data-day-matters] .brn-badge::after { animation: none; display: none; }
:root[data-calm="on"] .brn-stick, :root[data-calm="on"] .brn-stick > .ico { transition: none; }

/* ---------- High contrast, forced colours, the phone, print ---------- */
:root[data-theme="high_contrast"] .brn-stick { border: 2px solid #000; background: #fff; color: #000; box-shadow: none; }
:root[data-theme="high_contrast"] .brn-badge, :root[data-theme="high_contrast"] .brn-cmark { background: #000; color: #fff; box-shadow: none; }
:root[data-theme="high_contrast"] .brn-badge::after { display: none; }
:root[data-theme="high_contrast"] .brn-panel { box-shadow: none; border: 2px solid #000; background: #fff; }
:root[data-theme="high_contrast"] .brn-not, :root[data-theme="high_contrast"] .brn-step-t, :root[data-theme="high_contrast"] .brn-foot { color: #000; }
@media (forced-colors: active) {
  .brn-stick { border: 1px solid ButtonText; background: ButtonFace; color: ButtonText; }
  .brn-badge, .brn-cmark { forced-color-adjust: none; background: Canvas; color: CanvasText; border: 1px solid CanvasText; }
  .brn-badge::after { display: none; }
  .brn-panel { border: 1px solid CanvasText; }
  .brn-amber, .brn-foot-not { text-decoration: underline; }
}
@media (max-width: 599px) {
  .brn-top { margin-bottom: 10px; }
  .brn-stick { width: 100%; border-radius: 16px; }
  .brn-stick > .ico { margin-left: auto; }
  .brn-panel { width: 100%; }
}
@media print {
  .brn-badge::after { display: none; }
  .brn-stick > .ico { display: none; }
}
